k4SimGeant4
Loading...
Searching...
No Matches
SimG4Svc Class Reference

Main Geant simulation service. More...

#include <SimG4Components/src/SimG4Svc.h>

Inheritance diagram for SimG4Svc:
Collaboration diagram for SimG4Svc:

Public Member Functions

 SimG4Svc (const std::string &aName, ISvcLocator *aSL)
 Standard constructor.
 
virtual ~SimG4Svc ()
 Standard destructor.
 
virtual StatusCode initialize () final
 Initialize the Geant simulation service.
 
virtual StatusCode finalize () final
 Finalize the Geant simulation service.
 
StatusCode processEvent (G4Event &aEvent)
 Simulate the event with Geant.
 
StatusCode retrieveEvent (G4Event *&aEvent)
 Retrieve the processed event.
 
StatusCode terminateEvent ()
 Terminate the event simulation.
 

Private Attributes

SmartIF< IToolSvc > m_toolSvc
 Pointer to the tool service.
 
SmartIF< IRndmGenSvc > m_randSvc
 Pointer to the random numbers service.
 
ToolHandle< ISimG4DetectorConstructionm_detectorTool {"SimG4DD4hepDetector", this, true}
 Handle for the detector construction tool.
 
ToolHandle< ISimG4PhysicsListm_physicsListTool {"SimG4FtfpBert", this, true}
 Handle for the Geant physics list tool.
 
ToolHandle< ISimG4ActionToolm_actionsTool {"SimG4FullSimActions", this, true}
 Handle for the user action initialization.
 
ToolHandle< ISimG4MagneticFieldToolm_magneticFieldTool {"SimG4ConstantMagneticFieldTool", this, true}
 Handle for the magnetic field initialization.
 
Gaudi::Property< std::vector< std::string > > m_g4PreInitCommands
 Geant4 commands to be executed before user initialization.
 
Gaudi::Property< std::vector< std::string > > m_g4PostInitCommands
 Geant4 commands to be executed after user initialization.
 
std::vector< ISimG4RegionTool * > m_regionTools
 Handles to the tools creating regions and fast simulation models to be replaced with the ToolHandleArray<ISimG4RegionTool> m_regionTools.
 
Gaudi::Property< std::vector< std::string > > m_regionToolNames
 Names of the tools that create regions and fast simulation models to be deleted once the ToolHandleArray<ISimG4RegionTool> m_regionTools is in place.
 
Gaudi::Property< bool > m_rndmFromGaudi {this, "randomNumbersFromGaudi", true, "Whether random numbers should be taken from Gaudi"}
 Flag whether random numbers seeds should be taken from Gaudi (default: true)
 
Gaudi::Property< long > m_seedValue {this, "seedValue", 1234567, "Seed to be used in RndmGenSvc engine (randomNumbersFromGaudi must be set to false)"}
 
Gaudi::Property< bool > m_interactiveMode {this, "InteractiveMode", false, "Enter the interactive mode"}
 
sim::RunManager m_runManager
 Run Manager.
 
std::unique_ptr< G4VisManager > m_visManager {nullptr}
 
std::unique_ptr< G4UIsession > m_session {nullptr}
 

Detailed Description

Main Geant simulation service.

It handles Geant initialization (via tools) and communication with the G4RunManager. For more information please see.

Author
Anna Zaborowska

Constructor & Destructor Documentation

◆ SimG4Svc()

SimG4Svc::SimG4Svc ( const std::string & aName,
ISvcLocator * aSL )
explicit

Standard constructor.

◆ ~SimG4Svc()

SimG4Svc::~SimG4Svc ( )
virtual

Standard destructor.

Member Function Documentation

◆ finalize()

StatusCode SimG4Svc::finalize ( )
finalvirtual

Finalize the Geant simulation service.

Returns
status code

◆ initialize()

StatusCode SimG4Svc::initialize ( )
finalvirtual

Initialize the Geant simulation service.

Tools set in the configuration file need to specify the detector construction, physics list and user action initialization to initialize G4RunManager.

Returns
status code

◆ processEvent()

StatusCode SimG4Svc::processEvent ( G4Event & aEvent)

Simulate the event with Geant.

Parameters
[in]aEventAn event to be processed.
Returns
status code

◆ retrieveEvent()

StatusCode SimG4Svc::retrieveEvent ( G4Event *& aEvent)

Retrieve the processed event.

Parameters
[out]aEventThe processed event.
Returns
status code

◆ terminateEvent()

StatusCode SimG4Svc::terminateEvent ( )

Terminate the event simulation.

Returns
status code

Member Data Documentation

◆ m_actionsTool

ToolHandle<ISimG4ActionTool> SimG4Svc::m_actionsTool {"SimG4FullSimActions", this, true}
private

Handle for the user action initialization.

◆ m_detectorTool

ToolHandle<ISimG4DetectorConstruction> SimG4Svc::m_detectorTool {"SimG4DD4hepDetector", this, true}
private

Handle for the detector construction tool.

◆ m_g4PostInitCommands

Gaudi::Property<std::vector<std::string> > SimG4Svc::m_g4PostInitCommands
private
Initial value:
{
this, "g4PostInitCommands", {}, "Geant4 commands to be executed after user initialization"}

Geant4 commands to be executed after user initialization.

◆ m_g4PreInitCommands

Gaudi::Property<std::vector<std::string> > SimG4Svc::m_g4PreInitCommands
private
Initial value:
{
this, "g4PreInitCommands", {}, "Geant4 commands to be executed before user initialization"}

Geant4 commands to be executed before user initialization.

◆ m_interactiveMode

Gaudi::Property<bool> SimG4Svc::m_interactiveMode {this, "InteractiveMode", false, "Enter the interactive mode"}
private

◆ m_magneticFieldTool

ToolHandle<ISimG4MagneticFieldTool> SimG4Svc::m_magneticFieldTool {"SimG4ConstantMagneticFieldTool", this, true}
private

Handle for the magnetic field initialization.

◆ m_physicsListTool

ToolHandle<ISimG4PhysicsList> SimG4Svc::m_physicsListTool {"SimG4FtfpBert", this, true}
private

Handle for the Geant physics list tool.

◆ m_randSvc

SmartIF<IRndmGenSvc> SimG4Svc::m_randSvc
private

Pointer to the random numbers service.

◆ m_regionToolNames

Gaudi::Property<std::vector<std::string> > SimG4Svc::m_regionToolNames
private
Initial value:
{
this, "regions", {}, "Names of the tools that create regions and fast simulation models"}

Names of the tools that create regions and fast simulation models to be deleted once the ToolHandleArray<ISimG4RegionTool> m_regionTools is in place.

◆ m_regionTools

std::vector<ISimG4RegionTool*> SimG4Svc::m_regionTools
private

Handles to the tools creating regions and fast simulation models to be replaced with the ToolHandleArray<ISimG4RegionTool> m_regionTools.

◆ m_rndmFromGaudi

Gaudi::Property<bool> SimG4Svc::m_rndmFromGaudi {this, "randomNumbersFromGaudi", true, "Whether random numbers should be taken from Gaudi"}
private

Flag whether random numbers seeds should be taken from Gaudi (default: true)

◆ m_runManager

sim::RunManager SimG4Svc::m_runManager
private

Run Manager.

◆ m_seedValue

Gaudi::Property<long> SimG4Svc::m_seedValue {this, "seedValue", 1234567, "Seed to be used in RndmGenSvc engine (randomNumbersFromGaudi must be set to false)"}
private

◆ m_session

std::unique_ptr<G4UIsession> SimG4Svc::m_session {nullptr}
private

◆ m_toolSvc

SmartIF<IToolSvc> SimG4Svc::m_toolSvc
private

Pointer to the tool service.

◆ m_visManager

std::unique_ptr<G4VisManager> SimG4Svc::m_visManager {nullptr}
private

The documentation for this class was generated from the following files: