G4Root Version 6.6
Loading...
Searching...
No Matches
G4Root interface

This package is an interface allowing running native GEANT4 with a ROOT geometry. In fact it is just the G4 navigation that uses directly the TGeo geometry. The package contains:

  1. A manager class: TG4RootNavMgr. This is a TObject-based class allowing the connection of a TGeo geometry to a G4RunManager object.
  2. A special G4 user detector construction: TG4RootDetectorConstruction The class takes a TGeo geometry and builds a GEANT4 logical hierarchy based on it. The class provides methods to acess GEANT4 created objects corresponding to TGeo ones.
  3. A user class TVirtualUserPostDetConstruction. Users should derive from this and implement the method Initialize() to connect G4 objects to the geometry (such as: sensitive detectors, user limits, magnetic field, ...)
  4. The navigation interface: TG4RootNavigator. This class derives from the base class G4Navigator and implements the navigation based on TGeo.
  5. TG4RootSolid - an interface class for using TGeo shapes as ROOT solids.

To use the interface, one has to use the following calling sequence:

  1. Get the geometry in memory:
      TGeoManager  *geom = TGeoManager::Import("mygeom.root");
      TG4RootNavMgr *mgr = TG4RootNavMgr::GetInstance(geom);
    
  2. Create G4 run manager
      G4RunManager* runManager = new G4RunManager;
    
  3. Instantiate user class
      MyUserPostDetConstruction *pdc = new MyUserPostDetConstruction();
    
  4. Connect interface to run manager
      mgr->Initialize(pdc);
      mgr->ConnectToG4();