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

#include <TransportTool.h>

Inheritance diagram for iGeant4::G4TransportTool:
Collaboration diagram for iGeant4::G4TransportTool:

Public Member Functions

 G4TransportTool (const std::string &, const std::string &, const IInterface *)
 Constructor. More...
 
virtual ~G4TransportTool ()=default
 Destructor. More...
 
virtual StatusCode initialize () override final
 AlgTool initialize method. More...
 
void initializeOnce ATLAS_NOT_THREAD_SAFE ()
 G4 initialization called only by the first tool instance. More...
 
virtual StatusCode finalize () override final
 AlgTool finalize method. More...
 
void finalizeOnce ()
 G4 finalization called only by the first tool instance. More...
 
virtual StatusCode simulate (const EventContext &ctx, ISF::ISFParticle &isp, ISF::ISFParticleContainer &secondaries, McEventCollection *mcEventCollection) override
 
virtual StatusCode simulateVector (const EventContext &ctx, const ISF::ISFParticleVector &particles, ISF::ISFParticleContainer &secondaries, McEventCollection *mcEventCollection, McEventCollection *shadowTruth=nullptr) override
 Simulation call for vectors of particles. More...
 
virtual StatusCode setupEvent (const EventContext &) override
 Setup Event chain - in case of a begin-of event action is needed. More...
 
virtual StatusCode releaseEvent (const EventContext &) override
 Release Event chain - in case of an end-of event action is needed. More...
 
virtual ISF::SimulationFlavor simFlavor () const override
 
virtual StatusCode sysInitialize () override
 Gaudi sysInitialize() methods. More...
 
virtual StatusCode setupEventST () override
 Setup Event chain - in case of a begin-of event action is needed (called by ISimulationSvc) More...
 
virtual StatusCode releaseEventST () override
 Release Event chain - in case of an end-of event action is needed (called by ISimulationSvc) 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...
 

Protected Attributes

ServiceHandle< IChronoStatSvc > m_chrono {this, "ChronoStatService", "ChronoStatSvc"}
 The timing service for general usage. More...
 

Private Member Functions

void commandLog (int returnCode, const std::string &commandString) const
 This command prints a message about a G4Command depending on its returnCode. More...
 
HepMC::GenEvent * genEvent (McEventCollection *mcEventCollection) const
 

Configurable Properties

using passbackAction_t = G4UA::iGeant4::TrackProcessorUserActionBase
 
using passbackActionMap_t = tbb::concurrent_unordered_map< std::thread::id, std::vector< passbackAction_t * >, std::hash< std::thread::id > >
 
Gaudi::Property< bool > m_doTiming {this, "PrintTimingInfo", true, ""}
 
float m_accumulatedEventTime {0.}
 
float m_accumulatedEventTimeSq {0.}
 
unsigned int m_nrOfEntries {0}
 
G4Timer * m_runTimer {nullptr}
 
G4Timer * m_eventTimer {nullptr}
 
passbackActionMap_t m_secondaryActions ATLAS_THREAD_SAFE
 
Gaudi::Property< std::string > m_mcEventCollectionName {this, "McEventCollection", "TruthEvent", ""}
 
Gaudi::Property< std::string > m_libList {this, "Dll", "", ""}
 Helper Tool to provide G4RunManager. More...
 
Gaudi::Property< std::string > m_physList {this, "Physics", "", ""}
 
Gaudi::Property< std::string > m_fieldMap {this, "FieldMap", "", ""}
 
Gaudi::Property< bool > m_releaseGeoModel {this, "ReleaseGeoModel", true, ""}
 
Gaudi::Property< bool > m_recordFlux {this, "RecordFlux", false, ""}
 
Gaudi::Property< bool > m_quietMode {this, "QuietMode", false, ""}
 
Gaudi::Property< std::vector< std::string > > m_g4commands {this, "G4Commands", {}, "Commands to send to the G4UI"}
 Commands to send to the G4 UI. More...
 
Gaudi::Property< bool > m_useMT {this,"MultiThreading", false, "Multi-threading specific settings"}
 Activate multi-threading configuration. More...
 
Gaudi::Property< bool > m_activateParallelGeometries {this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"}
 
ServiceHandle< IAthRNGSvcm_rndmGenSvc {this, "RandomNumberService", "AthRNGSvc", ""}
 
Gaudi::Property< std::string > m_randomStreamName {this, "RandomStreamName", "Geant4", ""}
 Random Stream Name. More...
 
ServiceHandle< IUserLimitsSvcm_userLimitsSvc {this, "UserLimitsSvc", "UserLimitsSvc", ""}
 
ServiceHandle< G4UA::IUserActionSvcm_userActionSvc {this, "UserActionSvc", "", ""}
 user action service More...
 
ServiceHandle< IDetectorGeometrySvcm_detGeoSvc {this, "DetGeoSvc", "DetectorGeometrySvc", ""}
 Detector Geometry Service (builds G4 Geometry) More...
 
ServiceHandle< ISF::IInputConverterm_inputConverter {this, "InputConverter", "ISF_InputConverter", ""}
 Service to convert ISF_Particles into a G4Event. More...
 
ServiceHandle< IPhysicsListSvcm_physListSvc {this, "PhysicsListSvc", "PhysicsListSvc", ""}
 Physics List Service. More...
 
PublicToolHandle< ISensitiveDetectorMasterToolm_senDetTool {this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""}
 Sensitive Detector Master Tool. More...
 
PublicToolHandle< IFastSimulationMasterToolm_fastSimTool {this, "FastSimMasterTool", "FastSimulationMasterTool", ""}
 Fast Simulation Master Tool. More...
 

Detailed Description

Geant4 AlgTool to create a ISFParticle at a volume entry/exit

Author
Robert Harrington

Definition at line 66 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

Member Typedef Documentation

◆ passbackAction_t

◆ passbackActionMap_t

using iGeant4::G4TransportTool::passbackActionMap_t = tbb::concurrent_unordered_map< std::thread::id, std::vector< passbackAction_t* >, std::hash<std::thread::id> >
private

Constructor & Destructor Documentation

◆ G4TransportTool()

iGeant4::G4TransportTool::G4TransportTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Constructor.

Definition at line 58 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

62 {
63  //declareProperty("KillAllNeutrinos", m_KillAllNeutrinos=true);
64  //declareProperty("KillLowEPhotons", m_KillLowEPhotons=-1.);
65 }

◆ ~G4TransportTool()

virtual iGeant4::G4TransportTool::~G4TransportTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

void initializeOnce iGeant4::G4TransportTool::ATLAS_NOT_THREAD_SAFE ( )

G4 initialization called only by the first tool instance.

This is done (for now) because we get multiple tool instances in hive.

◆ chronoStart()

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

wrapper call to start chrono with given tag

Definition at line 98 of file BaseSimulatorTool.h.

98  {
99  if (m_chrono) return m_chrono->chronoStart( tag);
100  return nullptr;
101  }

◆ chronoStop()

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

wrapper call to stop chrono with given tag

Definition at line 104 of file BaseSimulatorTool.h.

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

◆ commandLog()

void iGeant4::G4TransportTool::commandLog ( int  returnCode,
const std::string &  commandString 
) const
private

This command prints a message about a G4Command depending on its returnCode.

Definition at line 474 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

475 {
476  switch(returnCode) {
477  case 0: { ATH_MSG_DEBUG("G4 Command: " << commandString << " - Command Succeeded"); } break;
478  case 100: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Command Not Found!"); } break;
479  case 200: {
480  auto* stateManager = G4StateManager::GetStateManager();
481  ATH_MSG_DEBUG("G4 Command: " << commandString << " - Illegal Application State (" <<
482  stateManager->GetStateString(stateManager->GetCurrentState()) << ")!");
483  } break;
484  case 300: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Out of Range!"); } break;
485  case 400: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Unreadable!"); } break;
486  case 500: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Out of Candidates!"); } break;
487  case 600: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Alias Not Found!"); } break;
488  default: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Unknown Status!"); } break;
489  }
490 
491 }

◆ finalize()

StatusCode iGeant4::G4TransportTool::finalize ( )
finaloverridevirtual

AlgTool finalize method.

Definition at line 218 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

219 {
220  ATH_MSG_VERBOSE("++++++++++++ ISF G4 G4TransportTool finalized ++++++++++++");
221 
222  // One time finalization
223  try {
224  std::call_once(finalizeOnceFlag, &iGeant4::G4TransportTool::finalizeOnce, this);
225  }
226  catch(const std::exception& e) {
227  ATH_MSG_ERROR("Failure in iGeant4::G4TransportTool::finalizeOnce: " << e.what());
228  return StatusCode::FAILURE;
229  }
230 
231  if (m_doTiming) {
232  m_runTimer->Stop();
233  const float numEntriesFloat(m_nrOfEntries);
234  const float runTime=m_runTimer->GetUserElapsed()+m_runTimer->GetSystemElapsed();
235  const float avgTimePerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTime/(numEntriesFloat-1.f) : runTime;
236  const float avgTimeSqPerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTimeSq/(numEntriesFloat-1.f) : runTime*runTime;
237  const float sigma=(m_nrOfEntries>2) ? std::sqrt(std::abs(avgTimeSqPerEvent - avgTimePerEvent*avgTimePerEvent)/(numEntriesFloat-2.f)) : 0;
238  ATH_MSG_INFO("*****************************************"<<endmsg<<
239  "** **"<<endmsg<<
240  " End of run - time spent is "<<std::setprecision(4) <<
241  runTime<<endmsg<<
242  " Average time per event was "<<std::setprecision(4) <<
243  avgTimePerEvent <<" +- "<< std::setprecision(4) << sigma<<endmsg<<
244  "** **"<<endmsg<<
245  "*****************************************");
246  }
247 
248  return StatusCode::SUCCESS;
249 }

◆ finalizeOnce()

void iGeant4::G4TransportTool::finalizeOnce ( )

G4 finalization called only by the first tool instance.

This is done (for now) because we get multiple tool instances in hive.

Definition at line 252 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

253 {
254  ATH_MSG_DEBUG("\t terminating the current G4 run");
255  auto runMgr = G4RunManager::GetRunManager();
256  runMgr->RunTermination();
257  return;
258 }

◆ genEvent()

HepMC::GenEvent * iGeant4::G4TransportTool::genEvent ( McEventCollection mcEventCollection) const
private

Definition at line 452 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

453 {
454 
455  if(!mcEventCollection) {
456  // retrieve McEventCollection from storegate
457  if (evtStore()->contains<McEventCollection>(m_mcEventCollectionName)) {
458  if (evtStore()->retrieve( mcEventCollection, m_mcEventCollectionName).isFailure()) {
459  ATH_MSG_ERROR( "Unable to retrieve McEventCollection with name=" << m_mcEventCollectionName
460  << ".");
461  return nullptr;
462  }
463  else {
464  ATH_MSG_WARNING( "Fallback. Sucessfully retrieved McEventCollection with name=" << m_mcEventCollectionName);
465  }
466  }
467  else { return nullptr; }
468  }
469  // collect last GenEvent from McEventCollection
470  return mcEventCollection->back();
471 }

◆ initialize()

StatusCode iGeant4::G4TransportTool::initialize ( )
finaloverridevirtual

AlgTool initialize method.

Reimplemented from ISF::BaseSimulatorTool.

Definition at line 68 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

69 {
70  ATH_MSG_VERBOSE("initialize");
71 
73 
74  // create G4Timers if enabled
75  if (m_doTiming) {
76  m_runTimer = new G4Timer();
77  m_eventTimer = new G4Timer();
78  m_runTimer->Start();
79  }
80 
81  // Create the scoring manager if requested
82  if (m_recordFlux) G4ScoringManager::GetScoringManager();
83 
84  // One-time initialization
85  try {
86  std::call_once(initializeOnceFlag, &iGeant4::G4TransportTool::initializeOnce, this);
87  }
88  catch(const std::exception& e) {
89  ATH_MSG_ERROR("Failure in iGeant4::G4TransportTool::initializeOnce: " << e.what());
90  return StatusCode::FAILURE;
91  }
92 
93  ATH_CHECK( m_rndmGenSvc.retrieve() );
94  ATH_CHECK( m_userActionSvc.retrieve() );
95 
96  ATH_CHECK(m_senDetTool.retrieve());
97  ATH_CHECK(m_fastSimTool.retrieve());
98 
99  ATH_CHECK(m_inputConverter.retrieve());
100 
101  return StatusCode::SUCCESS;
102 }

◆ releaseEvent()

StatusCode iGeant4::G4TransportTool::releaseEvent ( const EventContext &  )
overridevirtual

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

Todo:
: strip hits of the tracks ...

Reimplemented from ISF::BaseSimulatorTool.

Definition at line 406 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

407 {
408  ATH_MSG_DEBUG ( "release Event" );
411  /* todo: ELLI: the following is copied in from the PyG4AtlasAlg:
412  -> this somehow needs to be moved into C++
413  and put into releaseEvent() ( or setupEvent() ?)
414 
415  from ISF_Geant4Example import AtlasG4Eng
416  from ISF_Geant4Example.ISF_SimFlags import simFlags
417  if self.doFirstEventG4SeedsCheck :
418  if simFlags.SeedsG4.statusOn:
419  rnd = AtlasG4Eng.G4Eng.menu_G4RandomNrMenu()
420  rnd.set_Seed(simFlags.SeedsG4.get_Value())
421  self.doFirstEventG4SeedsCheck = False
422  if self.RndG4Menu.SaveStatus:
423  self.RndG4Menu.Menu.saveStatus('G4Seeds.txt')
424  */
425 
426  // print per-event timing info if enabled
427  if (m_doTiming) {
428  m_eventTimer->Stop();
429 
430  const double eventTime=m_eventTimer->GetUserElapsed()+m_eventTimer->GetSystemElapsed();
431  if (m_nrOfEntries>1) {
432  m_accumulatedEventTime +=eventTime;
433  m_accumulatedEventTimeSq+=eventTime*eventTime;
434  }
435 
436  const float numEntriesFloat(m_nrOfEntries);
437  const float avgTimePerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTime/(numEntriesFloat-1.f) : eventTime;
438  const float avgTimeSqPerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTimeSq/(numEntriesFloat-1.f) : eventTime*eventTime;
439  const float sigma=(m_nrOfEntries>2) ? std::sqrt(std::abs(avgTimeSqPerEvent - avgTimePerEvent*avgTimePerEvent)/(numEntriesFloat-2.f)) : 0;
440  ATH_MSG_INFO("\t Run:Event "<<ctx.eventID().run_number()<<":"<<ctx.eventID().event_number() << "\t ("<<m_nrOfEntries<<"th event for this worker) took " << std::setprecision(4) <<
441  eventTime << " s. New average " << std::setprecision(4) <<
442  avgTimePerEvent<<" +- "<<std::setprecision(4) << sigma);
443  }
444 
445  ATH_CHECK(m_senDetTool->EndOfAthenaEvent());
446  ATH_CHECK(m_fastSimTool->EndOfAthenaEvent());
447 
448  return StatusCode::SUCCESS;
449 }

◆ releaseEventST()

virtual StatusCode ISF::BaseSimulatorTool::releaseEventST ( )
inlineoverridevirtualinherited

Release Event chain - in case of an end-of event action is needed (called by ISimulationSvc)

Reimplemented in ISF::FastCaloSimV2Tool.

Definition at line 94 of file BaseSimulatorTool.h.

95  { return releaseEvent(Gaudi::Hive::currentContext()); }

◆ setupEvent()

StatusCode iGeant4::G4TransportTool::setupEvent ( const EventContext &  )
overridevirtual

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

Reimplemented from ISF::BaseSimulatorTool.

Definition at line 370 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

371 {
372  ATH_MSG_DEBUG ( "setup Event" );
373 
374 #ifdef G4MULTITHREADED
375  // In some rare cases, TBB may create more physical worker threads than
376  // were requested via the pool size. This can happen at any time.
377  // In that case, those extra threads will not have had the thread-local
378  // initialization done, leading to a crash. Try to detect that and do
379  // the initialization now if needed.
380  if (m_useMT && G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume() == nullptr)
381  {
382  ToolHandle<IThreadInitTool> ti ("G4ThreadInitTool", nullptr);
383  ATH_CHECK( ti.retrieve() );
384  ti->initThread();
385  }
386 #endif
387 
388  // Set the RNG to use for this event. We need to reset it for MT jobs
389  // because of the mismatch between Gaudi slot-local and G4 thread-local RNG.
390  ATHRNG::RNGWrapper* rngWrapper = m_rndmGenSvc->getEngine(this, m_randomStreamName);
391  rngWrapper->setSeed( m_randomStreamName, ctx );
392  G4Random::setTheEngine(rngWrapper->getEngine(ctx));
393 
394  ATH_CHECK(m_senDetTool->BeginOfAthenaEvent());
395 
396  m_nrOfEntries++;
397  if (m_doTiming) m_eventTimer->Start();
398 
399  // make sure SD collections are properly initialized in every Athena event
400  G4SDManager::GetSDMpointer()->PrepareNewEvent();
401 
402  return StatusCode::SUCCESS;
403 }

◆ setupEventST()

virtual StatusCode ISF::BaseSimulatorTool::setupEventST ( )
inlineoverridevirtualinherited

Setup Event chain - in case of a begin-of event action is needed (called by ISimulationSvc)

Reimplemented in ISF::FastCaloSimV2Tool.

Definition at line 67 of file BaseSimulatorTool.h.

68  { return setupEvent(Gaudi::Hive::currentContext()); }

◆ simFlavor()

virtual ISF::SimulationFlavor iGeant4::G4TransportTool::simFlavor ( ) const
inlineoverridevirtual

Definition at line 97 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

97 { return ISF::Geant4; };

◆ simulate()

StatusCode iGeant4::G4TransportTool::simulate ( const EventContext &  ctx,
ISF::ISFParticle isp,
ISF::ISFParticleContainer secondaries,
McEventCollection mcEventCollection 
)
overridevirtual

Process ParticleState from particle stack

Reimplemented from ISF::BaseSimulatorTool.

Definition at line 261 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

262  {
263 
264  // give a screen output that you entered Geant4SimSvc
265  ATH_MSG_VERBOSE( "Particle " << isp << " received for simulation." );
266 
268  // wrap the given ISFParticle into a STL vector of ISFParticles with length 1
269  // (minimizing code duplication)
270  const ISF::ISFParticleVector ispVector(1, &isp);
271  StatusCode success = this->simulateVector(ctx, ispVector, secondaries, mcEventCollection);
272  ATH_MSG_VERBOSE( "Simulation done" );
273 
274  // Geant4 call done
275  return success;
276 }

◆ simulateVector()

StatusCode iGeant4::G4TransportTool::simulateVector ( const EventContext &  ctx,
const ISF::ISFParticleVector particles,
ISF::ISFParticleContainer secondaries,
McEventCollection mcEventCollection,
McEventCollection = nullptr 
)
overridevirtual

Simulation call for vectors of particles.

Process ParticleState from particle stack

Reimplemented from ISF::BaseSimulatorTool.

Definition at line 279 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx.

279  {
280 
281  ATH_MSG_DEBUG (name() << ".simulateVector(...) : Received a vector of " << particles.size() << " particles for simulation.");
283  G4Event* inputEvent{};
284  if (shadowTruth && !shadowTruth->empty()) {
285  inputEvent = m_inputConverter->ISF_to_G4Event(ctx, particles, genEvent(mcEventCollection), shadowTruth->back());
286  }
287  else{
288  inputEvent = m_inputConverter->ISF_to_G4Event(ctx, particles, genEvent(mcEventCollection));
289  }
290  if (!inputEvent) {
291  ATH_MSG_ERROR("ISF Event conversion failed ");
292  return StatusCode::FAILURE;
293  }
294 
295  ATH_MSG_DEBUG("Calling ISF_Geant4 ProcessEvent");
296  bool abort = false;
297  // Worker run manager
298  // Custom class has custom method call: ProcessEvent.
299  // So, grab custom singleton class directly, rather than base.
300  // Maybe that should be changed! Then we can use a base pointer.
301  if(m_useMT) {
302 #ifdef G4MULTITHREADED
303  auto* workerRM = G4AtlasWorkerRunManager::GetG4AtlasWorkerRunManager();
304  abort = workerRM->ProcessEvent(inputEvent);
305 #else
306  ATH_MSG_ERROR("Trying to use multi-threading in non-MT build!");
307  return StatusCode::FAILURE;
308 #endif
309  }
310  else {
311  auto* workerRM ATLAS_THREAD_SAFE = G4AtlasRunManager::GetG4AtlasRunManager(); // non-MT case
312  abort = workerRM->ProcessEvent(inputEvent);
313  }
314  if (abort) {
315  ATH_MSG_WARNING("Event was aborted !! ");
316  //ATH_MSG_WARNING("Simulation will now go on to the next event ");
317  //ATH_MSG_WARNING("setFilterPassed is now False");
318  //setFilterPassed(false);
319  return StatusCode::FAILURE;
320  }
321 
322  // Get user actions that return secondaries
323  auto actionsFound = m_secondaryActions.find( std::this_thread::get_id() );
324  if ( actionsFound == m_secondaryActions.end() ) {
325  // Get all UAs
326  std::vector< G4UserSteppingAction* > allActions;
327  StatusCode sc = m_userActionSvc->getSecondaryActions( allActions );
328  if ( !sc.isSuccess() ) {
329  ATH_MSG_ERROR( "Failed to retrieve secondaries from UASvc" );
330  return sc;
331  }
332 
333  // Find the UAs that can return secondaries
334  for ( G4UserSteppingAction* action : allActions ) {
335  passbackAction_t* castAction = dynamic_cast< passbackAction_t* >( action );
336  if ( castAction ) {
337  m_secondaryActions[ std::this_thread::get_id() ].push_back( castAction );
338  }
339  }
340 
341  actionsFound = m_secondaryActions.find( std::this_thread::get_id() );
342  }
343 
344  // Retrieve secondaries from user actions
345  for ( auto* action : actionsFound->second ) {
346  for ( auto& parent : particles ) {
347 
348  ISF::ISFParticleContainer someSecondaries = action->ReturnSecondaries( parent );
349 
350  secondaries.splice( begin(secondaries), std::move(someSecondaries) );
351  }
352  }
353 
354  // const DataHandle <TrackRecordCollection> tracks;
355 
356  // StatusCode sc = evtStore()->retrieve(tracks,m_trackCollName);
357 
358  // if (sc.isFailure()) {
359  // ATH_MSG_WARNING(" Cannot retrieve TrackRecordCollection " << m_trackCollName);
360  // }
361 
362  // not implemented yet... need to get particle stack from Geant4 and convert to ISFParticle
363  ATH_MSG_VERBOSE( "Simulation done" );
364 
365  // Geant4 call done
366  return StatusCode::SUCCESS;
367 }

◆ sysInitialize()

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

Gaudi sysInitialize() methods.

Definition at line 49 of file BaseSimulatorTool.h.

50  {
52  ATH_CHECK( m_chrono.retrieve() );
53  return StatusCode::SUCCESS;
54  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

passbackActionMap_t m_secondaryActions iGeant4::G4TransportTool::ATLAS_THREAD_SAFE
mutableprivate

◆ m_accumulatedEventTime

float iGeant4::G4TransportTool::m_accumulatedEventTime {0.}
private

◆ m_accumulatedEventTimeSq

float iGeant4::G4TransportTool::m_accumulatedEventTimeSq {0.}
private

◆ m_activateParallelGeometries

Gaudi::Property<bool> iGeant4::G4TransportTool::m_activateParallelGeometries {this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"}
private

◆ m_chrono

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

The timing service for general usage.

Definition at line 115 of file BaseSimulatorTool.h.

◆ m_detGeoSvc

ServiceHandle<IDetectorGeometrySvc> iGeant4::G4TransportTool::m_detGeoSvc {this, "DetGeoSvc", "DetectorGeometrySvc", ""}
private

Detector Geometry Service (builds G4 Geometry)

Definition at line 150 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_doTiming

Gaudi::Property<bool> iGeant4::G4TransportTool::m_doTiming {this, "PrintTimingInfo", true, ""}
private

◆ m_eventTimer

G4Timer* iGeant4::G4TransportTool::m_eventTimer {nullptr}
private

◆ m_fastSimTool

PublicToolHandle<IFastSimulationMasterTool> iGeant4::G4TransportTool::m_fastSimTool {this, "FastSimMasterTool", "FastSimulationMasterTool", ""}
private

Fast Simulation Master Tool.

Definition at line 158 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_fieldMap

Gaudi::Property<std::string> iGeant4::G4TransportTool::m_fieldMap {this, "FieldMap", "", ""}
private

◆ m_g4commands

Gaudi::Property<std::vector<std::string> > iGeant4::G4TransportTool::m_g4commands {this, "G4Commands", {}, "Commands to send to the G4UI"}
private

Commands to send to the G4 UI.

Definition at line 137 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_inputConverter

ServiceHandle<ISF::IInputConverter> iGeant4::G4TransportTool::m_inputConverter {this, "InputConverter", "ISF_InputConverter", ""}
private

Service to convert ISF_Particles into a G4Event.

Definition at line 152 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_libList

Gaudi::Property<std::string> iGeant4::G4TransportTool::m_libList {this, "Dll", "", ""}
private

Helper Tool to provide G4RunManager.

Definition at line 130 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_mcEventCollectionName

Gaudi::Property<std::string> iGeant4::G4TransportTool::m_mcEventCollectionName {this, "McEventCollection", "TruthEvent", ""}
private

◆ m_nrOfEntries

unsigned int iGeant4::G4TransportTool::m_nrOfEntries {0}
private

◆ m_physList

Gaudi::Property<std::string> iGeant4::G4TransportTool::m_physList {this, "Physics", "", ""}
private

◆ m_physListSvc

ServiceHandle<IPhysicsListSvc> iGeant4::G4TransportTool::m_physListSvc {this, "PhysicsListSvc", "PhysicsListSvc", ""}
private

Physics List Service.

Definition at line 154 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_quietMode

Gaudi::Property<bool> iGeant4::G4TransportTool::m_quietMode {this, "QuietMode", false, ""}
private

◆ m_randomStreamName

Gaudi::Property<std::string> iGeant4::G4TransportTool::m_randomStreamName {this, "RandomStreamName", "Geant4", ""}
private

Random Stream Name.

Definition at line 144 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_recordFlux

Gaudi::Property<bool> iGeant4::G4TransportTool::m_recordFlux {this, "RecordFlux", false, ""}
private

◆ m_releaseGeoModel

Gaudi::Property<bool> iGeant4::G4TransportTool::m_releaseGeoModel {this, "ReleaseGeoModel", true, ""}
private

◆ m_rndmGenSvc

ServiceHandle<IAthRNGSvc> iGeant4::G4TransportTool::m_rndmGenSvc {this, "RandomNumberService", "AthRNGSvc", ""}
private

◆ m_runTimer

G4Timer* iGeant4::G4TransportTool::m_runTimer {nullptr}
private

◆ m_senDetTool

PublicToolHandle<ISensitiveDetectorMasterTool> iGeant4::G4TransportTool::m_senDetTool {this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""}
private

Sensitive Detector Master Tool.

Definition at line 156 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_useMT

Gaudi::Property<bool> iGeant4::G4TransportTool::m_useMT {this,"MultiThreading", false, "Multi-threading specific settings"}
private

Activate multi-threading configuration.

Definition at line 139 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_userActionSvc

ServiceHandle<G4UA::IUserActionSvc> iGeant4::G4TransportTool::m_userActionSvc {this, "UserActionSvc", "", ""}
private

user action service

Definition at line 148 of file ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h.

◆ m_userLimitsSvc

ServiceHandle<IUserLimitsSvc> iGeant4::G4TransportTool::m_userLimitsSvc {this, "UserLimitsSvc", "UserLimitsSvc", ""}
private

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
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
iGeant4::G4TransportTool::m_nrOfEntries
unsigned int m_nrOfEntries
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:114
ISF::BaseSimulatorTool::releaseEvent
virtual StatusCode releaseEvent(const EventContext &) override
Release Event chain - in case of an end-of event action is needed.
Definition: BaseSimulatorTool.h:90
iGeant4::G4TransportTool::m_accumulatedEventTimeSq
float m_accumulatedEventTimeSq
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:113
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
iGeant4::G4TransportTool::m_senDetTool
PublicToolHandle< ISensitiveDetectorMasterTool > m_senDetTool
Sensitive Detector Master Tool.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:156
iGeant4::G4TransportTool::m_mcEventCollectionName
Gaudi::Property< std::string > m_mcEventCollectionName
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:125
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
iGeant4::G4TransportTool::m_runTimer
G4Timer * m_runTimer
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:116
iGeant4::G4TransportTool::genEvent
HepMC::GenEvent * genEvent(McEventCollection *mcEventCollection) const
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx:452
iGeant4::G4TransportTool::m_doTiming
Gaudi::Property< bool > m_doTiming
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:110
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ISF::Geant4
@ Geant4
Definition: SimulationFlavor.h:23
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ISF::BaseSimulatorTool::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
The timing service for general usage.
Definition: BaseSimulatorTool.h:115
iGeant4::G4TransportTool::m_inputConverter
ServiceHandle< ISF::IInputConverter > m_inputConverter
Service to convert ISF_Particles into a G4Event.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:152
iGeant4::G4TransportTool::m_accumulatedEventTime
float m_accumulatedEventTime
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:112
ISF::ISFParticleVector
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
Definition: ISFParticleContainer.h:26
calibdata.exception
exception
Definition: calibdata.py:496
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hist_file_dump.f
f
Definition: hist_file_dump.py:135
iGeant4::G4TransportTool::m_rndmGenSvc
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:142
iGeant4::G4TransportTool::m_fastSimTool
PublicToolHandle< IFastSimulationMasterTool > m_fastSimTool
Fast Simulation Master Tool.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:158
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
ISF::BaseSimulatorTool
Definition: BaseSimulatorTool.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize
virtual StatusCode sysInitialize() override
Perform system initialization for an algorithm.
ISF::BaseSimulatorTool::setupEvent
virtual StatusCode setupEvent(const EventContext &) override
Setup Event chain - in case of a begin-of event action is needed.
Definition: BaseSimulatorTool.h:63
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
iGeant4::G4TransportTool::m_eventTimer
G4Timer * m_eventTimer
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:117
ISF::BaseSimulatorTool::initialize
virtual StatusCode initialize() override
Definition: BaseSimulatorTool.h:57
iGeant4::G4TransportTool::finalizeOnce
void finalizeOnce()
G4 finalization called only by the first tool instance.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx:252
iGeant4::G4TransportTool::m_useMT
Gaudi::Property< bool > m_useMT
Activate multi-threading configuration.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:139
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
iGeant4::G4TransportTool::passbackAction_t
G4UA::iGeant4::TrackProcessorUserActionBase passbackAction_t
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:121
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
iGeant4::G4TransportTool::m_recordFlux
Gaudi::Property< bool > m_recordFlux
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:134
iGeant4::G4TransportTool::m_userActionSvc
ServiceHandle< G4UA::IUserActionSvc > m_userActionSvc
user action service
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:148
iGeant4::G4TransportTool::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:144
iGeant4::G4TransportTool::simulateVector
virtual StatusCode simulateVector(const EventContext &ctx, const ISF::ISFParticleVector &particles, ISF::ISFParticleContainer &secondaries, McEventCollection *mcEventCollection, McEventCollection *shadowTruth=nullptr) override
Simulation call for vectors of particles.
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx:279
iGeant4::G4TransportTool::ATLAS_THREAD_SAFE
passbackActionMap_t m_secondaryActions ATLAS_THREAD_SAFE
Definition: ISF_Geant4/ISF_Geant4Tools/src/TransportTool.h:123