![]() |
ATLAS Offline Software
|
Front-end service for initializing and interacting with the Geant4 run. More...
#include <G4RunTool.h>
Classes | |
| struct | EventQueueSynchronization |
| struct | StateSynchronization |
Public Member Functions | |
| virtual StatusCode | initialize () override final |
| Initialize and start the Geant4 main thread, then wait until Geant4 is ready to start the run. | |
| virtual StatusCode | finalize () override final |
| virtual void | NotifyBeginRun () override |
| Notify Athena that Geant4 is ready to start a run. | |
| virtual void | WaitBeginRun () override |
| virtual size_t | Size () const override |
| virtual void | PushEvent (UPEvent ev) override |
| virtual UPEvent | GetEvent () override |
| Get an event from the queue (called from Geant4 threads) | |
Private Member Functions | |
| void | Geant4main () |
| Geant4 main thread function, this is executed in a separate thread and blocks on BeamOn. | |
| void | commandLog (int returnCode, const std::string &commandString) const |
| This command prints a message about a G4Command depending on its returnCode. | |
Private Attributes | |
| ServiceHandle< IPhysicsListSvc > | m_physicsListSvc {this, "PhysicsListSvc", "PhysicsListSvc"} |
| ServiceHandle< IUserLimitsSvc > | m_userLimitsSvc {this, "UserLimitsSvc", "UserLimitsSvc"} |
| ServiceHandle< G4UA::IUserActionSvc > | m_userActionSvc {this, "UserActionSvc", "G4UA::UserActionSvc"} |
| ToolHandle< IDetectorConstructionTool > | m_detConstruction {this, "DetectorConstruction", "", "Tool handle of the DetectorConstruction"} |
| ToolHandleArray< G4UA::IUserActionTool > | m_actionTools {this, "UserActionTools", {}, "User action tools to be added to the G4 Action service."} |
| PublicToolHandleArray< IPhysicsInitializationTool > | m_physicsInitializationTools {this, "PhysicsInitializationTools", {}, "Physics initialization happening after Geant4 initialization"} |
| Gaudi::Property< bool > | m_activateParallelGeometries {this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"} |
| Gaudi::Property< std::string > | m_libList {this, "Dll", "", ""} |
| Gaudi::Property< std::string > | m_physList {this, "Physics", "", ""} |
| Gaudi::Property< std::string > | m_fieldMap {this, "FieldMap", "", ""} |
| Gaudi::Property< std::vector< std::string > > | m_g4commands {this, "G4Commands", {}, "Commands to be sent to Geant4 UI at initialization"} |
| Gaudi::Property< int > | m_nG4threads {this, "NG4threads", 1, "Number of parallel G4 worker threads to launch"} |
| Gaudi::Property< int > | m_nG4eventsPerRun {this, "NG4eventsPerRun", 100000, "Number of G4 events foreseen for each Run"} |
| std::unique_ptr< std::thread > | m_thread |
| StateSynchronization | m_statusSync |
| EventQueueSynchronization | m_eventQueueSync |
Front-end service for initializing and interacting with the Geant4 run.
This public tool will initialize Geant4 in a separate thread which will block until the end of the job. All the services constructing Geant4 objects (detector construction, physics list, etc.) are retrieved from the Geant4 main thread during initialize().
This tool's initialize() will spawn the Geant4 main thread, but doesn't wait for Geant4 to be initialized before returning. The reason is that the Geant4 main thread needs to initialize tools, and Gaudi tool initialization is protected by a recursive mutex, which would lead to a deadlock. Algorithms using this tool should call WaitBeginRun() in their initialize function to ensure Geant4 is ready.
Athena can push events to Geant4 using the PushEvent method, and Geant4 will retrieve them using GetEvent in the generator action.
Definition at line 48 of file G4RunTool.h.
|
private |
This command prints a message about a G4Command depending on its returnCode.
Definition at line 235 of file G4RunTool.cxx.
|
finaloverridevirtual |
Definition at line 41 of file G4RunTool.cxx.
|
private |
Geant4 main thread function, this is executed in a separate thread and blocks on BeamOn.
Definition at line 124 of file G4RunTool.cxx.
|
overridevirtual |
Get an event from the queue (called from Geant4 threads)
Definition at line 110 of file G4RunTool.cxx.
|
finaloverridevirtual |
Initialize and start the Geant4 main thread, then wait until Geant4 is ready to start the run.
Definition at line 24 of file G4RunTool.cxx.
|
overridevirtual |
Notify Athena that Geant4 is ready to start a run.
Definition at line 68 of file G4RunTool.cxx.
|
overridevirtual |
Definition at line 101 of file G4RunTool.cxx.
|
overridevirtual |
Definition at line 95 of file G4RunTool.cxx.
|
overridevirtual |
Definition at line 73 of file G4RunTool.cxx.
|
private |
Definition at line 79 of file G4RunTool.h.
|
private |
Definition at line 82 of file G4RunTool.h.
|
private |
Definition at line 78 of file G4RunTool.h.
|
private |
Definition at line 121 of file G4RunTool.h.
|
private |
Definition at line 86 of file G4RunTool.h.
|
private |
Definition at line 87 of file G4RunTool.h.
|
private |
Definition at line 84 of file G4RunTool.h.
|
private |
Definition at line 90 of file G4RunTool.h.
|
private |
Definition at line 89 of file G4RunTool.h.
|
private |
Definition at line 80 of file G4RunTool.h.
|
private |
Definition at line 74 of file G4RunTool.h.
|
private |
Definition at line 85 of file G4RunTool.h.
|
private |
Definition at line 118 of file G4RunTool.h.
|
private |
Definition at line 115 of file G4RunTool.h.
|
private |
Definition at line 76 of file G4RunTool.h.
|
private |
Definition at line 75 of file G4RunTool.h.