Presentation is loading. Please wait.

Presentation is loading. Please wait.

Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management.

Similar presentations


Presentation on theme: "Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management."— Presentation transcript:

1 Makoto Asai (SLAC) Geant4 Users Workshop @ CERN Nov. 15 th, 2002 Customizing Run Management

2 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 2 G4RunManager Basic flow of Geant4 kernel Structure of G4RunManager Contents

3 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 3 G4RunManager G4RunManager is the only manager class in Geant4 kernel from which the user is allowed / expected to inherit and create his / her own customized manager. For large HEP experiments, it is rather mandatory to make their own customized managers. For connecting to their specific frameworks For their persistency solutions Etc. G4RunManager is well structured and almost all of its methods are virtual. Thus the user can easily overwrite some of its methods for customization while keep utilizing other methods given in the base class.

4 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 4 How Geant4 runs w.r.t. run management Instantiation Instantiation / initialization of manager classes Initialization Construction of material and geometry Construction of particles, physics processes Calculation of cross-section tables “ Beam-On ” = “ Run ” Close geometry --> Optimize geometry Event Loop Termination Deletion of manager classes

5 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 5 Initialization

6 6 Beam on (event loop) loop

7 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 7 User classes Initialization classes - Invoked at the initialization G4VUserDetectorConstruction G4VUserPhysicsList Action classes - Invoked during the event loop G4VUserPrimaryGeneratorAction G4UserRunAction G4UserEventAction G4UserStackingAction G4UserTrackingAction G4UserSteppingAction Classes with yellow underlines are “ mandatory ” user classes. Classes written in red are used exclusively by G4RunManager.

8 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 8 G4ApplicationState Geant4 is a state machine. It has seven states, PreInit, Init, Idle, GeomClosed, EventProc, Quit and Abort. All state changes except Abort are triggered by G4RunManager. Abort state is triggered by G4Exception. Note that the state of Geant4 is always EventProc while an event is processing. Other five states ( PreInit, Init, Idle, GeomClosed and Quit ) are for the sake of proper handling of run management.

9 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 9 Constructor / destructor of G4RunManager G4RunManager::G4RunManager() Instantiation and initialization of kernel manager classes virtual G4RunManager::~G4RunManager() Deletion of kernel manager classes Orders of instantiation and deletion of kernel manager classes are important to avoid conflicts. By deriving G4RunManager, these constructor and destructor are used to ensure the correct ordering.

10 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 10 Methods in G4RunManager for initialization virtual void Initialize(); This method invokes all the necessary initialization procedures. This method invokes three granular methods, InitializeGeometry(), InitializePhysics() and InitializeCutOff(). After some event loops, the user can invoke this method once again. It is rather mandatory if the user changes geometry, physics process, and/or cut off value(s). If the user forget the second invocation, G4RunManager will automatically invoke this method at the moment of next BeamOn.

11 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 11 Methods in G4RunManager for initialization virtual void InitializeGeometry(); This method invokes user’s concrete G4VUserDetectorConstruction::Construct(). Then the world volume is set to G4Navigator through G4RunManager::DefineWorldVolume() method. Note that all materials must be constructed before start calculating cross-section tables.

12 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 12 Methods in G4RunManager for initialization virtual void InitializePhysics(); This method invokes user’s G4VUserPhysicsList::Construct(). Note that all particles must be defined and all processes must be properly assigned to them before start calculating cross-section tables. virtual void InitializeCutOff(); This method invokes user’s G4VUserPhysicsList::SetCut() to calculate cross-section tables.

13 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 13 Methods in G4RunManager for event loop virtual void BeamOn(); This method starts an event loop. The condition of Geant4 is examined before starting the event loop. This method invokes four granular methods, ConfirmBeamOnCondition(), RunInitialization(), DoEventLoop() and RunTermination(). According to the second and third arguments of BeamOn method, a macro file will be read at the end of each event.

14 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 14 Methods in G4RunManager for event loop virtual G4bool ConfirmBeamOnCondition(); Confirms initialization, re-initialization if needed virtual void RunInitialization(); Closes geometry virtual void DoEventLoop(); Manages an event loop Invokes two granular methods, GenerateEvent() and AnalyzeEvent() for each event virtual void RunTermination(); Opens geometry

15 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 15 Methods in G4RunManager for one event virtual G4Event* GenerateEvent(); Instantiates G4Event object Invokes user’s G4VUserPrimaryGeneratorAction virtual void AnalyzeEvent(); Basically does nothing as default Invokes G4VPersistencyManager if the user defines a concrete class Allows access to more than one events for, for example, event pile-up.

16 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 16 Future plans We believe G4RunManager is well modularized for most of the cases. So that the user can easily derive his/her own concrete (customized) RunManager by just overwriting some of its virtual methods. G4RunManager contains both some mandatory procedures to use Geant4 kernel and also some utility functionalities to make the user easy to use Geant4. We understand there exists a requirement from CMS to split mandatory procedures from utilities.

17 Customizing Run Management - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/15/2002) 17 Future plans To meet this requirement from CMS, we are studying to split G4RunManager into three classes. G4RunManager Keeps all methods in its header file so that ordinary users do not need to change anything Is to be re-implemented to use following two classes G4RunManagerCore Has all mandatory procedures to use Geant4 kernel G4RunManagerUtilities Has most of utility functionalities which the current G4RunManager has, and which are still useful to experienced users


Download ppt "Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management."

Similar presentations


Ads by Google