k4SimGeant4
Loading...
Searching...
No Matches
SimG4Svc.h
Go to the documentation of this file.
1#ifndef SIMG4COMPONENTS_G4SIMSVC_H
2#define SIMG4COMPONENTS_G4SIMSVC_H
3
4// FCCSW
12
13// Gaudi
14#include "GaudiKernel/IRndmGenSvc.h"
15#include "GaudiKernel/Service.h"
16#include "GaudiKernel/ToolHandle.h"
17
18#include "G4UIsession.hh"
19#include "G4UIterminal.hh"
20#include "G4VisExecutive.hh"
21#include "G4VisManager.hh"
22
32class SimG4Svc : public extends1<Service, ISimG4Svc> {
33public:
35 explicit SimG4Svc(const std::string& aName, ISvcLocator* aSL);
37 virtual ~SimG4Svc();
43 virtual StatusCode initialize() final;
47 virtual StatusCode finalize() final;
52 StatusCode processEvent(G4Event& aEvent);
57 StatusCode retrieveEvent(G4Event*& aEvent);
61 StatusCode terminateEvent();
62
63private:
65 SmartIF<IToolSvc> m_toolSvc;
67 SmartIF<IRndmGenSvc> m_randSvc;
69 ToolHandle<ISimG4DetectorConstruction> m_detectorTool{"SimG4DD4hepDetector", this, true};
71 ToolHandle<ISimG4PhysicsList> m_physicsListTool{"SimG4FtfpBert", this, true};
73 ToolHandle<ISimG4ActionTool> m_actionsTool{"SimG4FullSimActions", this, true};
75 ToolHandle<ISimG4MagneticFieldTool> m_magneticFieldTool{"SimG4ConstantMagneticFieldTool", this, true};
77 Gaudi::Property<std::vector<std::string>> m_g4PreInitCommands{
78 this, "g4PreInitCommands", {}, "Geant4 commands to be executed before user initialization"};
80 Gaudi::Property<std::vector<std::string>> m_g4PostInitCommands{
81 this, "g4PostInitCommands", {}, "Geant4 commands to be executed after user initialization"};
84 std::vector<ISimG4RegionTool*> m_regionTools;
87 Gaudi::Property<std::vector<std::string>> m_regionToolNames{
88 this, "regions", {}, "Names of the tools that create regions and fast simulation models"};
90 Gaudi::Property<bool> m_rndmFromGaudi{this, "randomNumbersFromGaudi", true, "Whether random numbers should be taken from Gaudi"};
91 Gaudi::Property<long> m_seedValue{this, "seedValue", 1234567, "Seed to be used in RndmGenSvc engine (randomNumbersFromGaudi must be set to false)"};
92
93 Gaudi::Property<bool> m_interactiveMode{this, "InteractiveMode", false, "Enter the interactive mode"};
94
97
98 std::unique_ptr<G4VisManager> m_visManager{nullptr};
99 // Define UI terminal for interactive mode
100 std::unique_ptr<G4UIsession> m_session{nullptr};
101};
102
103#endif /* SIMG4COMPONENTS_G4SIMSVC_H */
Main Geant simulation service.
Definition SimG4Svc.h:32
StatusCode terminateEvent()
Terminate the event simulation.
Definition SimG4Svc.cpp:142
Gaudi::Property< long > m_seedValue
Definition SimG4Svc.h:91
sim::RunManager m_runManager
Run Manager.
Definition SimG4Svc.h:96
StatusCode processEvent(G4Event &aEvent)
Simulate the event with Geant.
Definition SimG4Svc.cpp:131
Gaudi::Property< std::vector< std::string > > m_g4PostInitCommands
Geant4 commands to be executed after user initialization.
Definition SimG4Svc.h:80
std::unique_ptr< G4VisManager > m_visManager
Definition SimG4Svc.h:98
StatusCode retrieveEvent(G4Event *&aEvent)
Retrieve the processed event.
Definition SimG4Svc.cpp:140
Gaudi::Property< bool > m_interactiveMode
Definition SimG4Svc.h:93
Gaudi::Property< std::vector< std::string > > m_regionToolNames
Names of the tools that create regions and fast simulation models to be deleted once the ToolHandleAr...
Definition SimG4Svc.h:87
Gaudi::Property< std::vector< std::string > > m_g4PreInitCommands
Geant4 commands to be executed before user initialization.
Definition SimG4Svc.h:77
ToolHandle< ISimG4DetectorConstruction > m_detectorTool
Handle for the detector construction tool.
Definition SimG4Svc.h:69
ToolHandle< ISimG4ActionTool > m_actionsTool
Handle for the user action initialization.
Definition SimG4Svc.h:73
SmartIF< IToolSvc > m_toolSvc
Pointer to the tool service.
Definition SimG4Svc.h:65
virtual StatusCode finalize() final
Finalize the Geant simulation service.
Definition SimG4Svc.cpp:147
std::unique_ptr< G4UIsession > m_session
Definition SimG4Svc.h:100
ToolHandle< ISimG4MagneticFieldTool > m_magneticFieldTool
Handle for the magnetic field initialization.
Definition SimG4Svc.h:75
std::vector< ISimG4RegionTool * > m_regionTools
Handles to the tools creating regions and fast simulation models to be replaced with the ToolHandleAr...
Definition SimG4Svc.h:84
ToolHandle< ISimG4PhysicsList > m_physicsListTool
Handle for the Geant physics list tool.
Definition SimG4Svc.h:71
SimG4Svc(const std::string &aName, ISvcLocator *aSL)
Standard constructor.
Definition SimG4Svc.cpp:19
Gaudi::Property< bool > m_rndmFromGaudi
Flag whether random numbers seeds should be taken from Gaudi (default: true)
Definition SimG4Svc.h:90
virtual StatusCode initialize() final
Initialize the Geant simulation service.
Definition SimG4Svc.cpp:28
virtual ~SimG4Svc()
Standard destructor.
Definition SimG4Svc.cpp:26
SmartIF< IRndmGenSvc > m_randSvc
Pointer to the random numbers service.
Definition SimG4Svc.h:67
Definition RunManager.h:22