ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
iGeant4::Geant4SimSvc Class Reference

#include <Geant4SimSvc.h>

Inheritance diagram for iGeant4::Geant4SimSvc:
Collaboration diagram for iGeant4::Geant4SimSvc:

Public Member Functions

 Geant4SimSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor. More...
 
virtual ~Geant4SimSvc ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Athena algorithm's interface methods. More...
 
virtual StatusCode finalize () override
 framework methods More...
 
virtual StatusCode simulate (ISF::ISFParticle &isp, McEventCollection *mcEventCollection) override
 Simulation Call
More...
 
virtual StatusCode simulateVector (const ISF::ISFParticleVector &particles, McEventCollection *mcEventCollection, McEventCollection *shadowTruth=nullptr) override
 Simulation Call for vector of ISF particles. More...
 
virtual StatusCode setupEvent () override
 Setup Event chain - in case of a begin-of event action is needed. More...
 
virtual StatusCode releaseEvent () override
 Release Event chain - in case of an end-of event action is needed. More...
 
virtual StatusCode sysInitialize () override
 Gaudi sysInitialize() methods. More...
 
const std::string & simSvcDescriptor () override
 Return the simulation service descriptor. More...
 
virtual StatusCode setParticleBroker (IParticleBroker *broker) override
 Inform the SimulationSvc about the ParticleBroker svc. More...
 
const ChronoEntity * chronoStart (const IChronoSvc::ChronoTag &tag)
 wrapper call to start chrono with given tag More...
 
const ChronoEntity * chronoStop (const IChronoSvc::ChronoTag &tag)
 wrapper call to stop chrono with given tag More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
ServiceHandle< StoreGateSvc > & detStore ()
 
template<class T >
StatusCode retrieveTool (ToolHandle< T > &thandle)
 templated Tool retrieval - gives unique handling & look and feel More...
 
template<class T >
StatusCode retrieveTools (ToolHandleArray< T > &thandleArray)
 templated Tool retrieval - gives unique handling & look and feel More...
 
template<class T >
StatusCode recordCollection (T *&coll, const std::string &collName) const
 templated record collection method, will create a new one if not existing More...
 
template<class T >
StatusCode retrieveCollection (T *&coll, const std::string &collName, bool forceBreak=true) const
 templated retrieve collection method, boolean steers that force break More...
 

Protected Attributes

Gaudi::Property< std::string > m_simDescr
 The simulator service descriptor. More...
 
Gaudi::Property< std::string > m_screenOutputPrefix
 Screen output refinement. More...
 
ServiceHandle< IChronoStatSvc > m_chrono {this, "ChronoStatService", "ChronoStatSvc"}
 The timing service for general usage. More...
 
IParticleBroker * m_particleBroker {}
 The particle service used to push particles into the simulation. More...
 

Private Member Functions

 Geant4SimSvc ()
 Default constructor. More...
 

Private Attributes

PublicToolHandle< ISF::ISimulatorToolm_simulatorTool {this, "SimulatorTool", "", ""}
 
ServiceHandle< StoreGateSvcm_evtStore
 Handle to StoreGate (event store by default) More...
 
ServiceHandle< StoreGateSvcm_detStore
 Handle to StoreGate (detector store by default) More...
 

Detailed Description

Definition at line 27 of file Geant4SimSvc.h.

Constructor & Destructor Documentation

◆ Geant4SimSvc() [1/2]

iGeant4::Geant4SimSvc::Geant4SimSvc ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Constructor.

Definition at line 9 of file Geant4SimSvc.cxx.

9  :
11 {
12 }

◆ ~Geant4SimSvc()

iGeant4::Geant4SimSvc::~Geant4SimSvc ( )
virtual

Destructor.

Definition at line 14 of file Geant4SimSvc.cxx.

15 {}

◆ Geant4SimSvc() [2/2]

iGeant4::Geant4SimSvc::Geant4SimSvc ( )
private

Default constructor.

Member Function Documentation

◆ chronoStart()

const ChronoEntity* ISF::BaseSimulationSvc::chronoStart ( const IChronoSvc::ChronoTag &  tag)
inlineinherited

wrapper call to start chrono with given tag

Definition at line 104 of file BaseSimulationSvc.h.

104  {
105  if (m_chrono) return m_chrono->chronoStart( tag);
106  return nullptr;
107  }

◆ chronoStop()

const ChronoEntity* ISF::BaseSimulationSvc::chronoStop ( const IChronoSvc::ChronoTag &  tag)
inlineinherited

wrapper call to stop chrono with given tag

Definition at line 110 of file BaseSimulationSvc.h.

110  {
111  if (m_chrono) return m_chrono->chronoStop( tag);
112  return nullptr;
113  }

◆ detStore() [1/2]

ServiceHandle<StoreGateSvc>& ISF::BaseSimulationSvc::detStore ( )
inlineinherited

Definition at line 125 of file BaseSimulationSvc.h.

125 {return m_detStore;};

◆ detStore() [2/2]

const ServiceHandle<StoreGateSvc>& ISF::BaseSimulationSvc::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 124 of file BaseSimulationSvc.h.

124 {return m_detStore;};

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& ISF::BaseSimulationSvc::evtStore ( )
inlineinherited

Definition at line 119 of file BaseSimulationSvc.h.

119 {return m_evtStore;};

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& ISF::BaseSimulationSvc::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 118 of file BaseSimulationSvc.h.

118 {return m_evtStore;};

◆ finalize()

StatusCode iGeant4::Geant4SimSvc::finalize ( )
overridevirtual

framework methods

Definition at line 25 of file Geant4SimSvc.cxx.

26 {
27  return StatusCode::SUCCESS;
28 }

◆ initialize()

StatusCode iGeant4::Geant4SimSvc::initialize ( )
overridevirtual

Athena algorithm's interface methods.

framework methods

Definition at line 18 of file Geant4SimSvc.cxx.

19 {
20  ATH_CHECK (m_simulatorTool.retrieve());
21  return StatusCode::SUCCESS;
22 }

◆ recordCollection()

template<class T >
StatusCode ISF::BaseSimulationSvc::recordCollection ( T *&  coll,
const std::string &  collName 
) const
inlineinherited

templated record collection method, will create a new one if not existing

Definition at line 150 of file BaseSimulationSvc.h.

150  {
151  // create if necessary
152  coll = coll ? coll : new T;
153  // record
154  if (evtStore()->record( coll, collName).isFailure()){
155  ATH_MSG_FATAL( m_screenOutputPrefix << "Cannot record collection " << collName << ". Abort." );
156  return StatusCode::FAILURE;
157  } else
158  ATH_MSG_DEBUG(m_screenOutputPrefix << "Successfully recorded collection " << collName);
159  return StatusCode::SUCCESS;
160  }

◆ releaseEvent()

StatusCode iGeant4::Geant4SimSvc::releaseEvent ( )
overridevirtual

Release Event chain - in case of an end-of event action is needed.

Reimplemented from ISF::BaseSimulationSvc.

Definition at line 35 of file Geant4SimSvc.cxx.

36 {
37  return m_simulatorTool->releaseEventST();
38 }

◆ retrieveCollection()

template<class T >
StatusCode ISF::BaseSimulationSvc::retrieveCollection ( T *&  coll,
const std::string &  collName,
bool  forceBreak = true 
) const
inlineinherited

templated retrieve collection method, boolean steers that force break

Definition at line 164 of file BaseSimulationSvc.h.

164  {
165  // check for existence in the soft case
166  if (!forceBreak && !evtStore()->contains<T>(collName)) {
167  coll = 0;
168  ATH_MSG_DEBUG(m_screenOutputPrefix << "Collection does not exists (not required). Ignore.");
169  return StatusCode::SUCCESS;
170  }
171  if ( evtStore()->retrieve(coll, collName).isFailure()){
172  ATH_MSG_FATAL( m_screenOutputPrefix << "Cannot retireve collection " << collName << ". Abort." );
173  return StatusCode::FAILURE;
174  } else
175  ATH_MSG_DEBUG(m_screenOutputPrefix << "Successfully retrieved collection " << collName);
176  return StatusCode::SUCCESS;
177  }

◆ retrieveTool()

template<class T >
StatusCode ISF::BaseSimulationSvc::retrieveTool ( ToolHandle< T > &  thandle)
inlineinherited

templated Tool retrieval - gives unique handling & look and feel

Definition at line 128 of file BaseSimulationSvc.h.

128  {
129  if (!thandle.empty() && thandle.retrieve().isFailure()){
130  ATH_MSG_FATAL( m_screenOutputPrefix << "Cannot retrieve " << thandle << ". Abort.");
131  return StatusCode::FAILURE;
132  } else
133  ATH_MSG_DEBUG(m_screenOutputPrefix << "Successfully retrieved " << thandle);
134  return StatusCode::SUCCESS;
135  }

◆ retrieveTools()

template<class T >
StatusCode ISF::BaseSimulationSvc::retrieveTools ( ToolHandleArray< T > &  thandleArray)
inlineinherited

templated Tool retrieval - gives unique handling & look and feel

Definition at line 139 of file BaseSimulationSvc.h.

139  {
140  if (!thandleArray.empty() && thandleArray.retrieve().isFailure()){
141  ATH_MSG_FATAL( m_screenOutputPrefix << "Cannot retrieve " << thandleArray << ". Abort.");
142  return StatusCode::FAILURE;
143  } else
144  ATH_MSG_DEBUG(m_screenOutputPrefix << "Successfully retrieved " << thandleArray);
145  return StatusCode::SUCCESS;
146  }

◆ setParticleBroker()

virtual StatusCode ISF::BaseSimulationSvc::setParticleBroker ( IParticleBroker broker)
inlineoverridevirtualinherited

Inform the SimulationSvc about the ParticleBroker svc.

Definition at line 77 of file BaseSimulationSvc.h.

77  {
78  m_particleBroker = broker;
79  return StatusCode::SUCCESS;
80  }

◆ setupEvent()

StatusCode iGeant4::Geant4SimSvc::setupEvent ( )
overridevirtual

Setup Event chain - in case of a begin-of event action is needed.

Reimplemented from ISF::BaseSimulationSvc.

Definition at line 30 of file Geant4SimSvc.cxx.

31 {
32  return m_simulatorTool->setupEventST();
33 }

◆ simSvcDescriptor()

const std::string& ISF::BaseSimulationSvc::simSvcDescriptor ( )
inlineoverrideinherited

Return the simulation service descriptor.

Definition at line 66 of file BaseSimulationSvc.h.

66 { return m_simDescr.value(); }

◆ simulate()

StatusCode iGeant4::Geant4SimSvc::simulate ( ISF::ISFParticle isp,
McEventCollection mcEventCollection 
)
overridevirtual

Simulation Call

Simulation Call.

Reimplemented from ISF::BaseSimulationSvc.

Definition at line 41 of file Geant4SimSvc.cxx.

42 {
43  const EventContext& ctx = Gaudi::Hive::currentContext();
44  ISF::ISFParticleContainer secondaries; // filled, but not used
45  ATH_CHECK(m_simulatorTool->simulate(ctx, isp, secondaries, mcEventCollection));
46  return StatusCode::SUCCESS;
47 }

◆ simulateVector()

StatusCode iGeant4::Geant4SimSvc::simulateVector ( const ISF::ISFParticleVector particles,
McEventCollection mcEventCollection,
McEventCollection shadowTruth = nullptr 
)
overridevirtual

Simulation Call for vector of ISF particles.

Simulation Call.

Reimplemented from ISF::BaseSimulationSvc.

Definition at line 50 of file Geant4SimSvc.cxx.

51 {
52  const EventContext& ctx = Gaudi::Hive::currentContext();
53  ISF::ISFParticleContainer secondaries; // filled, but not used
54  ATH_CHECK (m_simulatorTool->simulateVector(ctx, particles,secondaries, mcEventCollection, shadowTruth));
55  return StatusCode::SUCCESS;
56 }

◆ sysInitialize()

virtual StatusCode ISF::BaseSimulationSvc::sysInitialize ( )
inlineoverridevirtualinherited

Gaudi sysInitialize() methods.

Definition at line 51 of file BaseSimulationSvc.h.

52  {
53  if ( AthService::sysInitialize().isFailure() ) {
54  ATH_MSG_FATAL( m_screenOutputPrefix << " Cannot initialize AthService! Abort.");
55  return StatusCode::FAILURE;
56  }
57  if ( m_chrono.retrieve().isFailure()){
58  ATH_MSG_FATAL( m_screenOutputPrefix << " Cannot retrieve ChronoStatSvc! Abort.");
59  return StatusCode::FAILURE;
60  }
61 
62  return StatusCode::SUCCESS;
63  }

Member Data Documentation

◆ m_chrono

ServiceHandle<IChronoStatSvc> ISF::BaseSimulationSvc::m_chrono {this, "ChronoStatService", "ChronoStatSvc"}
protectedinherited

The timing service for general usage.

Definition at line 202 of file BaseSimulationSvc.h.

◆ m_detStore

ServiceHandle<StoreGateSvc> ISF::BaseSimulationSvc::m_detStore
privateinherited
Initial value:
{this, "DetStore", "StoreGateSvc/DetectorStore",
"Handle to a StoreGateSvc/DetectorStore instance: it will be used to retrieve data during the course of the job"}

Handle to StoreGate (detector store by default)

Definition at line 188 of file BaseSimulationSvc.h.

◆ m_evtStore

ServiceHandle<StoreGateSvc> ISF::BaseSimulationSvc::m_evtStore
privateinherited
Initial value:
{this, "EvtStore", "StoreGateSvc/StoreGateSvc",
"Handle to a StoreGateSvc instance: it will be used to retrieve data during the course of the job"}

Handle to StoreGate (event store by default)

Definition at line 184 of file BaseSimulationSvc.h.

◆ m_particleBroker

IParticleBroker* ISF::BaseSimulationSvc::m_particleBroker {}
protectedinherited

The particle service used to push particles into the simulation.

Definition at line 205 of file BaseSimulationSvc.h.

◆ m_screenOutputPrefix

Gaudi::Property<std::string> ISF::BaseSimulationSvc::m_screenOutputPrefix
protectedinherited
Initial value:
{this, "ScreenOutputPrefix", "isf >> ",
"Prefix for log output"}

Screen output refinement.

Definition at line 198 of file BaseSimulationSvc.h.

◆ m_simDescr

Gaudi::Property<std::string> ISF::BaseSimulationSvc::m_simDescr
protectedinherited
Initial value:
{this, "Identifier", {},
"A unique string to identify the simulator."}

The simulator service descriptor.

Definition at line 194 of file BaseSimulationSvc.h.

◆ m_simulatorTool

PublicToolHandle<ISF::ISimulatorTool> iGeant4::Geant4SimSvc::m_simulatorTool {this, "SimulatorTool", "", ""}
private

Definition at line 56 of file Geant4SimSvc.h.


The documentation for this class was generated from the following files:
ISF::ISFParticleContainer
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
Definition: ISFParticleContainer.h:23
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ISF::BaseSimulationSvc::m_simDescr
Gaudi::Property< std::string > m_simDescr
The simulator service descriptor.
Definition: BaseSimulationSvc.h:194
ISF::BaseSimulationSvc::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
The timing service for general usage.
Definition: BaseSimulationSvc.h:202
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ISF::BaseSimulationSvc::BaseSimulationSvc
BaseSimulationSvc()
Default constructor.
iGeant4::Geant4SimSvc::m_simulatorTool
PublicToolHandle< ISF::ISimulatorTool > m_simulatorTool
Definition: Geant4SimSvc.h:56
ISF::BaseSimulationSvc::evtStore
const ServiceHandle< StoreGateSvc > & evtStore() const
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: BaseSimulationSvc.h:118
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ISF::BaseSimulationSvc::m_screenOutputPrefix
Gaudi::Property< std::string > m_screenOutputPrefix
Screen output refinement.
Definition: BaseSimulationSvc.h:198
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
ISF::BaseSimulationSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Handle to StoreGate (detector store by default)
Definition: BaseSimulationSvc.h:188
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ISF::BaseSimulationSvc::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Handle to StoreGate (event store by default)
Definition: BaseSimulationSvc.h:184
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
ISF::BaseSimulationSvc::m_particleBroker
IParticleBroker * m_particleBroker
The particle service used to push particles into the simulation.
Definition: BaseSimulationSvc.h:205
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35