ATLAS Offline Software
G4AtlasAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local includes
6 #include "G4AtlasAlg.h"
7 #include "G4AtlasFluxRecorder.h"
9 
12 
13 // Can we safely include all of these?
18 
19 // Geant4 includes
20 #include "G4StateManager.hh"
21 #include "G4TransportationManager.hh"
22 #include "G4RunManagerKernel.hh"
23 #include "G4EventManager.hh"
24 #include "G4Navigator.hh"
25 #include "G4PropagatorInField.hh"
26 #include "G4TrackingManager.hh"
27 #include "G4StackManager.hh"
28 #include "G4UImanager.hh"
29 #include "G4ScoringManager.hh"
30 #include "G4VUserPhysicsList.hh"
31 #include "G4VModularPhysicsList.hh"
32 #include "G4ParallelWorldPhysics.hh"
33 #include "G4GDMLParser.hh"
34 
35 // CLHEP includes
36 #include "CLHEP/Random/RandomEngine.h"
37 
38 // Athena includes
39 #include "StoreGate/ReadHandle.h"
40 #include "StoreGate/WriteHandle.h"
43 #include "GaudiKernel/IThreadInitTool.h"
46 
47 
48 // call_once mutexes
49 #include <mutex>
50 static std::once_flag initializeOnceFlag;
51 static std::once_flag finalizeOnceFlag;
52 static std::once_flag releaseGeoModelOnceFlag;
53 
55 
56 
57 G4AtlasAlg::G4AtlasAlg(const std::string& name, ISvcLocator* pSvcLocator)
58  : AthAlgorithm(name, pSvcLocator)
59 {
60  // Verbosities
61  declareProperty("Verbosities", m_verbosities);
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
66 
68 {
69  ATH_MSG_DEBUG("Start of initialize()");
70 
71  // Read the simplified geometry for FastCaloSim track transportation if requested
72  if(!m_simplifiedGeoPath.empty()) {
73  std::string geoFile = PathResolverFindCalibFile(m_simplifiedGeoPath);
74 
75  if (geoFile.empty()) {
76  ATH_MSG_FATAL("Could not find simplified geometry file: " << m_simplifiedGeoPath);
77  return StatusCode::FAILURE;
78  }
79 
80  G4GDMLParser parser;
81  parser.Read(geoFile, false);
82  }
83 
84  // Create the scoring manager if requested
85  if (m_recordFlux) G4ScoringManager::GetScoringManager();
86 
87  ATH_CHECK( m_userActionSvc.retrieve() );
88 
89  // One-time initialization
90  try {
91  std::call_once(initializeOnceFlag, &G4AtlasAlg::initializeOnce, this);
92  }
93  catch(const std::exception& e) {
94  ATH_MSG_ERROR("Failure in G4AtlasAlg::initializeOnce: " << e.what());
95  return StatusCode::FAILURE;
96  }
97 
98  ATH_CHECK( m_rndmGenSvc.retrieve() );
99  ATH_CHECK(m_actionTools.retrieve());
100 
101  ATH_CHECK(m_senDetTool.retrieve());
102  ATH_CHECK(m_fastSimTool.retrieve());
103 
104  // Truth
105  ATH_CHECK( m_truthRecordSvc.retrieve() );
106  ATH_MSG_INFO( "- Using ISF TruthRecordSvc : " << m_truthRecordSvc.typeAndName() );
107  ATH_CHECK( m_geoIDSvc.retrieve() );
108  ATH_MSG_INFO( "- Using ISF GeoIDSvc : " << m_geoIDSvc.typeAndName() );
109 
110  TruthStrategyManager& sManager = TruthStrategyManager::GetStrategyManager_nc();
111  sManager.SetISFTruthSvc( &(*m_truthRecordSvc) );
112  sManager.SetISFGeoIDSvc( &(*m_geoIDSvc) );
113 
114  // I/O
115  ATH_CHECK( m_inputTruthCollectionKey.initialize());
116  ATH_CHECK( m_outputTruthCollectionKey.initialize());
117  ATH_CHECK( m_eventInfoKey.initialize() );
118 
119  ATH_CHECK(m_inputConverter.retrieve());
120  if ( not m_truthPreselectionTool.empty() ) {
121  ATH_CHECK(m_truthPreselectionTool.retrieve());
122  }
123 
124  if ( not m_qspatcher.empty() ) {
125  ATH_CHECK( m_qspatcher.retrieve() );
126  }
127 
128  ATH_MSG_DEBUG("End of initialize()");
129  return StatusCode::SUCCESS;
130 }
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
134 {
135  // Assign physics list
136  if(m_physListSvc.retrieve().isFailure()) {
137  throw std::runtime_error("Could not initialize ATLAS PhysicsListSvc!");
138  }
139  for (const auto& action_tool : m_actionTools) {
140  if (m_userActionSvc->addActionTool(action_tool).isFailure()) {
141  throw std::runtime_error("Failed to add action tool "+action_tool.name());
142  }
143  }
144 
145  // Create the (master) run manager
146  if(m_useMT) {
147 #ifdef G4MULTITHREADED
148  auto* runMgr ATLAS_THREAD_SAFE = // protected by std::call_once above
149  G4AtlasMTRunManager::GetG4AtlasMTRunManager();
150  m_physListSvc->SetPhysicsList();
151  runMgr->SetDetGeoSvc( m_detGeoSvc.typeAndName() );
152  runMgr->SetFastSimMasterTool(m_fastSimTool.typeAndName() );
153  runMgr->SetPhysListSvc( m_physListSvc.typeAndName() );
154  // Worker Thread initialization used to create worker run manager on demand.
155  std::unique_ptr<G4AtlasUserWorkerThreadInitialization> workerInit =
156  std::make_unique<G4AtlasUserWorkerThreadInitialization>();
157  workerInit->SetDetGeoSvc( m_detGeoSvc.typeAndName() );
158  workerInit->SetFastSimMasterTool( m_fastSimTool.typeAndName() );
159  runMgr->SetUserInitialization( workerInit.release() );
160  std::unique_ptr<G4AtlasActionInitialization> actionInitialization =
161  std::make_unique<G4AtlasActionInitialization>(m_userActionSvc.get());
162  runMgr->SetUserInitialization(actionInitialization.release());
163 #else
164  throw std::runtime_error("Trying to use multi-threading in non-MT build!");
165 #endif
166  }
167  // Single-threaded run manager
168  else {
169  auto* runMgr ATLAS_THREAD_SAFE = // safe because single-threaded
170  G4AtlasRunManager::GetG4AtlasRunManager();
171  m_physListSvc->SetPhysicsList();
172  runMgr->SetRecordFlux( m_recordFlux, std::make_unique<G4AtlasFluxRecorder>() );
173  runMgr->SetLogLevel( int(msg().level()) ); // Synch log levels
174  runMgr->SetDetGeoSvc( m_detGeoSvc.typeAndName() );
175  runMgr->SetFastSimMasterTool(m_fastSimTool.typeAndName() );
176  runMgr->SetPhysListSvc(m_physListSvc.typeAndName() );
177  std::unique_ptr<G4AtlasActionInitialization> actionInitialization =
178  std::make_unique<G4AtlasActionInitialization>(m_userActionSvc.get());
179  runMgr->SetUserInitialization(actionInitialization.release());
180  }
181 
182  // G4 user interface commands
183  G4UImanager *ui = G4UImanager::GetUIpointer();
184 
185  // Load custom libraries
186  if (!m_libList.empty()) {
187  ATH_MSG_INFO("G4AtlasAlg specific libraries requested ");
188  std::string temp="/load "+m_libList;
189  ui->ApplyCommand(temp);
190  }
191  // Load custom physics
192  if (!m_physList.empty()) {
193  ATH_MSG_INFO("requesting a specific physics list "<< m_physList);
194  std::string temp="/Physics/GetPhysicsList "+m_physList;
195  ui->ApplyCommand(temp);
196  }
197  // Load custom magnetic field
198  if (!m_fieldMap.empty()) {
199  ATH_MSG_INFO("requesting a specific field map "<< m_fieldMap);
200  ATH_MSG_INFO("the field is initialized straight away");
201  std::string temp="/MagneticField/Select "+m_fieldMap;
202  ui->ApplyCommand(temp);
203  ui->ApplyCommand("/MagneticField/Initialize");
204  }
205 
206  // Send UI commands
207  ATH_MSG_DEBUG("G4 Command: Trying at the end of initializeOnce()");
208  for (const auto& g4command : m_g4commands) {
209  int returnCode = ui->ApplyCommand( g4command );
210  commandLog(returnCode, g4command);
211  }
212 
213  // Code from G4AtlasSvc
214  auto* rm = G4RunManager::GetRunManager();
215  if(!rm) {
216  throw std::runtime_error("Run manager retrieval has failed");
217  }
218  rm->Initialize(); // Initialization differs slightly in multi-threading.
219  // TODO: add more details about why this is here.
220  if(!m_useMT && rm->ConfirmBeamOnCondition()) {
221  rm->RunInitialization();
222  }
223 
224  ATH_MSG_INFO( "retireving the Detector Geometry Service" );
225  if(m_detGeoSvc.retrieve().isFailure()) {
226  throw std::runtime_error("Could not initialize ATLAS DetectorGeometrySvc!");
227  }
228 
229  if(m_userLimitsSvc.retrieve().isFailure()) {
230  throw std::runtime_error("Could not initialize ATLAS UserLimitsSvc!");
231  }
232 
234  G4VModularPhysicsList* thePhysicsList=dynamic_cast<G4VModularPhysicsList*>(m_physListSvc->GetPhysicsList());
235  if (!thePhysicsList) {
236  throw std::runtime_error("Failed dynamic_cast!! this is not a G4VModularPhysicsList!");
237  }
238 #if G4VERSION_NUMBER >= 1010
239  std::vector<std::string>& parallelWorldNames=m_detGeoSvc->GetParallelWorldNames();
240  for (auto& it: parallelWorldNames) {
241  thePhysicsList->RegisterPhysics(new G4ParallelWorldPhysics(it,true));
242  }
243 #endif
244  }
245 
246  return;
247 }
248 
250 {
251  if (m_verbosities.size()>0) {
252  G4TransportationManager *tm = G4TransportationManager::GetTransportationManager();
253  G4RunManagerKernel *rmk = G4RunManagerKernel::GetRunManagerKernel();
254  G4EventManager *em = G4EventManager::GetEventManager();
255 
256  auto itr = m_verbosities.end();
257  if ((itr = m_verbosities.find("Navigator")) != m_verbosities.end()) {
258  tm->GetNavigatorForTracking()->SetVerboseLevel( atof(itr->second.data()) );
259  }
260  if ((itr = m_verbosities.find("Propagator")) != m_verbosities.end()) {
261  tm->GetPropagatorInField()->SetVerboseLevel( atof(itr->second.data()) );
262  }
263  if ((itr = m_verbosities.find("Tracking")) != m_verbosities.end()) {
264  rmk->GetTrackingManager()->SetVerboseLevel( atof(itr->second.data()) );
265  }
266  if ((itr = m_verbosities.find("Stepping")) != m_verbosities.end()) {
267  rmk->GetTrackingManager()->GetSteppingManager()->
268  SetVerboseLevel( atof(itr->second.data()) );
269  }
270  if ((itr = m_verbosities.find("Stacking")) != m_verbosities.end()) {
271  rmk->GetStackManager()->SetVerboseLevel( atof(itr->second.data()) );
272  }
273  if ((itr = m_verbosities.find("Event")) != m_verbosities.end()) {
274  em->SetVerboseLevel( atof(itr->second.data()) );
275  }
276  } // End of the setting of verbosities
277 
278 }
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
281 
283 {
284  ATH_MSG_DEBUG(std::endl<<std::endl<<std::endl);
285  ATH_MSG_DEBUG("++++++++++++ G4AtlasAlg finalized ++++++++++++" <<std::endl<<std::endl);
286 
287  // One time finalization
288  try {
289  std::call_once(finalizeOnceFlag, &G4AtlasAlg::finalizeOnce, this);
290  }
291  catch(const std::exception& e) {
292  ATH_MSG_ERROR("Failure in G4AtlasAlg::finalizeOnce: " << e.what());
293  return StatusCode::FAILURE;
294  }
295 
296  return StatusCode::SUCCESS;
297 }
298 
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
301 {
302  ATH_MSG_DEBUG("\t terminating the current G4 run");
303  auto runMgr = G4RunManager::GetRunManager();
304  runMgr->RunTermination();
305 }
306 
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
308 
310 {
311  static std::atomic<unsigned int> n_Event=0;
312  ATH_MSG_DEBUG("++++++++++++ G4AtlasAlg execute ++++++++++++");
313 
314 #ifdef G4MULTITHREADED
315  // In some rare cases, TBB may create more physical worker threads than
316  // were requested via the pool size. This can happen at any time.
317  // In that case, those extra threads will not have had the thread-local
318  // initialization done, leading to a crash. Try to detect that and do
319  // the initialization now if needed.
320  if (G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume() == nullptr)
321  {
322  ToolHandle<IThreadInitTool> ti ("G4ThreadInitTool", nullptr);
323  ATH_CHECK( ti.retrieve() );
324  ti->initThread();
325  }
326 #endif
327 
328  n_Event += 1;
329 
330  if (n_Event<=10 || (n_Event%100) == 0) {
331  ATH_MSG_ALWAYS("G4AtlasAlg: Event num. " << n_Event << " start processing");
332  }
333 
334  // Release GeoModel Geometry if necessary
335  if (m_releaseGeoModel) {
336  try {
337  std::call_once(releaseGeoModelOnceFlag, &G4AtlasAlg::releaseGeoModel, this);
338  }
339  catch(const std::exception& e) {
340  ATH_MSG_ERROR("Failure in G4AtlasAlg::releaseGeoModel: " << e.what());
341  return StatusCode::FAILURE;
342  }
343  }
344 
345  const EventContext& ctx = Gaudi::Hive::currentContext();
346  // Set the RNG to use for this event. We need to reset it for MT jobs
347  // because of the mismatch between Gaudi slot-local and G4 thread-local RNG.
348  ATHRNG::RNGWrapper* rngWrapper = m_rndmGenSvc->getEngine(this, m_randomStreamName);
349  rngWrapper->setSeed( m_randomStreamName, ctx);
350  G4Random::setTheEngine(*rngWrapper);
351 
352  ATH_MSG_DEBUG("Calling SimulateG4Event");
353 
354  ATH_CHECK(m_senDetTool->BeginOfAthenaEvent());
355  ATH_CHECK(m_fastSimTool->BeginOfAthenaEvent());
356 
358  if (!inputTruthCollection.isValid()) {
359  ATH_MSG_FATAL("Unable to read input GenEvent collection " << inputTruthCollection.name() << " in store " << inputTruthCollection.store());
360  return StatusCode::FAILURE;
361  }
362  ATH_MSG_DEBUG("Found input GenEvent collection " << inputTruthCollection.name() << " in store " << inputTruthCollection.store());
363  // create the output Truth collection
365  std::unique_ptr<McEventCollection> shadowTruth{};
366  if (m_useShadowEvent) {
367  outputTruthCollection = std::make_unique<McEventCollection>();
368  // copy input Evgen collection to shadow Truth collection
369  shadowTruth = std::make_unique<McEventCollection>(*inputTruthCollection);
370  for (HepMC::GenEvent* currentGenEvent : *shadowTruth ) {
371  // Apply QS patch if required
372  if ( not m_qspatcher.empty() ) {
373  ATH_CHECK(m_qspatcher->applyWorkaround(*currentGenEvent));
374  }
375  // Copy GenEvent and remove daughters of quasi-stable particles to be simulated
376  std::unique_ptr<HepMC::GenEvent> outputEvent = m_truthPreselectionTool->filterGenEvent(*currentGenEvent);
377  outputTruthCollection->push_back(outputEvent.release());
378  }
379  }
380  else {
381  // copy input Evgen collection to output Truth collection
382  outputTruthCollection = std::make_unique<McEventCollection>(*inputTruthCollection);
383  // empty shadow Truth collection
384  shadowTruth = std::make_unique<McEventCollection>();
385  // Apply QS patch if required
386  if ( not m_qspatcher.empty() ) {
387  for (HepMC::GenEvent* currentGenEvent : *outputTruthCollection ) {
388  ATH_CHECK(m_qspatcher->applyWorkaround(*currentGenEvent));
389  }
390  }
391  }
392 
393  ATH_MSG_DEBUG("Recorded output GenEvent collection " << outputTruthCollection.name() << " in store " << outputTruthCollection.store());
394 
395  const int largestGeneratedParticleBC = (outputTruthCollection->empty()) ? HepMC::UNDEFINED_ID
396  : HepMC::maxGeneratedParticleBarcode(outputTruthCollection->at(0)); // TODO make this more robust
397  const int largestGeneratedVertexBC = (outputTruthCollection->empty()) ? HepMC::UNDEFINED_ID
398  : HepMC::maxGeneratedVertexBarcode(outputTruthCollection->at(0)); // TODO make this more robust
399  // tell TruthService we're starting a new event
400  ATH_CHECK( m_truthRecordSvc->initializeTruthCollection(largestGeneratedParticleBC, largestGeneratedVertexBC) );
401 
402  G4Event *inputEvent{};
403  ATH_CHECK( m_inputConverter->convertHepMCToG4Event(*outputTruthCollection, inputEvent, *shadowTruth) );
404 
405  bool abort = false;
406  // Worker run manager
407  // Custom class has custom method call: ProcessEvent.
408  // So, grab custom singleton class directly, rather than base.
409  // Maybe that should be changed! Then we can use a base pointer.
410  if(m_useMT) {
411 #ifdef G4MULTITHREADED
412  auto* workerRM = G4AtlasWorkerRunManager::GetG4AtlasWorkerRunManager();
413  abort = workerRM->ProcessEvent(inputEvent);
414 #else
415  ATH_MSG_ERROR("Trying to use multi-threading in non-MT build!");
416  return StatusCode::FAILURE;
417 #endif
418  }
419  else {
420  auto* workerRM ATLAS_THREAD_SAFE = // single-threaded case
421  G4AtlasRunManager::GetG4AtlasRunManager();
422  abort = workerRM->ProcessEvent(inputEvent);
423  }
424  if (abort) {
425  ATH_MSG_WARNING("Event was aborted !! ");
426  ATH_MSG_WARNING("Simulation will now go on to the next event ");
427  if (m_killAbortedEvents) {
428  ATH_MSG_WARNING("setFilterPassed is now False");
429  setFilterPassed(false);
430  }
431  if (m_flagAbortedEvents) {
433  if (!eventInfo.isValid()) {
434  ATH_MSG_FATAL( "Failed to retrieve xAOD::EventInfo while trying to update the error state!" );
435  return StatusCode::FAILURE;
436  }
437  else {
439  ATH_MSG_WARNING( "Set error state in xAOD::EventInfo!" );
440  }
441  }
442  }
443 
444  // Register all of the collections if there are any new-style SDs
445  ATH_CHECK(m_senDetTool->EndOfAthenaEvent());
446  ATH_CHECK(m_fastSimTool->EndOfAthenaEvent());
447 
448  ATH_CHECK( m_truthRecordSvc->releaseEvent() );
449 
450  // Remove QS patch if required
451  if(!m_qspatcher.empty()) {
452  for (HepMC::GenEvent* currentGenEvent : *outputTruthCollection ) {
453  ATH_CHECK(m_qspatcher->removeWorkaround(*currentGenEvent));
454  }
455  }
456 
457  return StatusCode::SUCCESS;
458 }
459 
460 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
461 
463 {
464  ISvcLocator *svcLocator = Gaudi::svcLocator(); // from Bootstrap
465  IGeoModelSvc *geoModel(nullptr);
466  if(svcLocator->service("GeoModelSvc",geoModel).isFailure()) {
467  ATH_MSG_WARNING( " ----> Unable to retrieve GeoModelSvc" );
468  }
469  else {
470  if(geoModel->clear().isFailure()) {
471  ATH_MSG_WARNING( " ----> GeoModelSvc::clear() failed" );
472  }
473  else {
474  ATH_MSG_INFO( " ----> GeoModelSvc::clear() succeeded " );
475  }
476  }
477  m_releaseGeoModel=false; // Don't do that again...
478  return;
479 }
480 
481 void G4AtlasAlg::commandLog(int returnCode, const std::string& commandString) const
482 {
483  switch(returnCode) {
484  case 0: { ATH_MSG_DEBUG("G4 Command: " << commandString << " - Command Succeeded"); } break;
485  case 100: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Command Not Found!"); } break;
486  case 200: {
487  auto* stateManager = G4StateManager::GetStateManager();
488  ATH_MSG_DEBUG("G4 Command: " << commandString << " - Illegal Application State (" <<
489  stateManager->GetStateString(stateManager->GetCurrentState()) << ")!");
490  } break;
491  case 300: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Out of Range!"); } break;
492  case 400: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Unreadable!"); } break;
493  case 500: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Out of Candidates!"); } break;
494  case 600: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Alias Not Found!"); } break;
495  default: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Unknown Status!"); } break;
496  }
497 
498 }
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
python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
G4AtlasAlg::m_flagAbortedEvents
Gaudi::Property< bool > m_flagAbortedEvents
Definition: G4AtlasAlg.h:103
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4AtlasAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: G4AtlasAlg.h:106
IGeoModelSvc
Definition: IGeoModelSvc.h:17
G4AtlasMTRunManager.h
TruthStrategyManager::SetISFTruthSvc
void SetISFTruthSvc(ISF::ITruthSvc *truthSvc)
Define which ISF TruthService to use.
Definition: TruthStrategyManager.cxx:53
SG::ReadHandle< McEventCollection >
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
G4AtlasAlg::finalize
StatusCode finalize() override
Finalize the algorithm and invoke G4 run termination.
Definition: G4AtlasAlg.cxx:282
initialize
void initialize()
Definition: run_EoverP.cxx:894
G4AtlasActionInitialization.h
G4AtlasAlg::m_senDetTool
PublicToolHandle< ISensitiveDetectorMasterTool > m_senDetTool
Sensitive Detector Master Tool.
Definition: G4AtlasAlg.h:152
ATLAS_NOT_THREAD_SAFE
StatusCode G4AtlasAlg::initialize ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
Definition: G4AtlasAlg.cxx:67
G4AtlasAlg::m_fieldMap
Gaudi::Property< std::string > m_fieldMap
Definition: G4AtlasAlg.h:121
skel.it
it
Definition: skel.GENtoEVGEN.py:423
HepMC::maxGeneratedVertexBarcode
int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent)
Definition: MagicNumbers.h:377
G4AtlasAlg::m_recordFlux
Gaudi::Property< bool > m_recordFlux
Definition: G4AtlasAlg.h:124
TruthStrategyManager.h
G4AtlasAlg::m_detGeoSvc
ServiceHandle< IDetectorGeometrySvc > m_detGeoSvc
Detector Geometry Service (builds G4 Geometry)
Definition: G4AtlasAlg.h:140
G4AtlasAlg::m_releaseGeoModel
Gaudi::Property< bool > m_releaseGeoModel
Definition: G4AtlasAlg.h:123
IGeoModelSvc::clear
virtual StatusCode clear()=0
G4AtlasAlg::m_physListSvc
ServiceHandle< IPhysicsListSvc > m_physListSvc
Physics List Tool.
Definition: G4AtlasAlg.h:150
G4AtlasAlg::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition: G4AtlasAlg.h:134
G4AtlasUserWorkerThreadInitialization.h
G4AtlasAlg::commandLog
void commandLog(int returnCode, const std::string &commandString) const
This command prints a message about a G4Command depending on its returnCode.
Definition: G4AtlasAlg.cxx:481
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
xAOD::EventInfo_v1::Error
@ Error
The sub-detector issued an error.
Definition: EventInfo_v1.h:349
G4AtlasAlg::m_userLimitsSvc
ServiceHandle< IUserLimitsSvc > m_userLimitsSvc
Definition: G4AtlasAlg.h:136
G4AtlasRunManager.h
G4AtlasAlg::m_truthPreselectionTool
ToolHandle< ISF::IGenEventFilter > m_truthPreselectionTool
Definition: G4AtlasAlg.h:145
WriteHandle.h
Handle class for recording to StoreGate.
G4AtlasAlg::m_inputTruthCollectionKey
SG::ReadHandleKey< McEventCollection > m_inputTruthCollectionKey
input hard scatter collection
Definition: G4AtlasAlg.h:104
TruthStrategyManager::SetISFGeoIDSvc
void SetISFGeoIDSvc(ISF::IGeoIDSvc *geoIDSvc)
Define which ISF GeoIDSvc to use.
Definition: TruthStrategyManager.cxx:59
G4AtlasAlg::m_inputConverter
ServiceHandle< ISF::IInputConverter > m_inputConverter
Service to convert ISF_Particles into a G4Event.
Definition: G4AtlasAlg.h:148
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
G4AtlasAlg::m_fastSimTool
PublicToolHandle< IFastSimulationMasterTool > m_fastSimTool
Fast Simulation Master Tool.
Definition: G4AtlasAlg.h:154
G4AtlasAlg::finalizeOnce
void finalizeOnce()
G4 finalization called only by the first alg instance.
Definition: G4AtlasAlg.cxx:300
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
G4AtlasAlg::execute
StatusCode execute() override
Simulate one Athena event.
Definition: G4AtlasAlg.cxx:309
G4AtlasWorkerRunManager.h
G4AtlasAlg::m_useShadowEvent
BooleanProperty m_useShadowEvent
Definition: G4AtlasAlg.h:130
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition: StoreGate/src/VarHandleBase.cxx:379
calibdata.exception
exception
Definition: calibdata.py:496
TruthStrategyManager
Singleton class for creating truth incidents.
Definition: TruthStrategyManager.h:23
G4AtlasAlg::initializeG4
void initializeG4()
Poorly named possibly unused method which sets some verbosities.
Definition: G4AtlasAlg.cxx:249
ATH_MSG_ALWAYS
#define ATH_MSG_ALWAYS(x)
Definition: AthMsgStreamMacros.h:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:55
G4AtlasAlg::m_g4commands
Gaudi::Property< std::vector< std::string > > m_g4commands
Commands to send to the G4 UI.
Definition: G4AtlasAlg.h:126
PathResolver.h
G4AtlasAlg.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
G4AtlasAlg::releaseGeoModel
void releaseGeoModel()
Releases the GeoModel geometry from memory once it has been used to build the G4 geometry and is no-l...
Definition: G4AtlasAlg.cxx:462
G4AtlasAlg::m_physList
Gaudi::Property< std::string > m_physList
Definition: G4AtlasAlg.h:120
RNGWrapper.h
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
SG::WriteHandle< McEventCollection >
G4AtlasAlg::m_useMT
Gaudi::Property< bool > m_useMT
Activate multi-threading configuration.
Definition: G4AtlasAlg.h:128
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
G4AtlasAlg::m_truthRecordSvc
ServiceHandle< ISF::ITruthSvc > m_truthRecordSvc
Central Truth Service.
Definition: G4AtlasAlg.h:109
G4AtlasAlg::m_actionTools
PublicToolHandleArray< G4UA::IUserActionTool > m_actionTools
Definition: G4AtlasAlg.h:156
G4AtlasAlg::G4AtlasAlg
G4AtlasAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
Definition: G4AtlasAlg.cxx:57
HepMC::maxGeneratedParticleBarcode
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Definition: MagicNumbers.h:361
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
G4AtlasAlg::m_verbosities
std::map< std::string, std::string > m_verbosities
Verbosity settings for Geant4.
Definition: G4AtlasAlg.h:114
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
G4AtlasAlg::m_userActionSvc
ServiceHandle< G4UA::IUserActionSvc > m_userActionSvc
User Action Service.
Definition: G4AtlasAlg.h:138
G4AtlasAlg::m_qspatcher
ServiceHandle< Simulation::IZeroLifetimePatcher > m_qspatcher
Quasi-Stable Particle Simulation Patcher.
Definition: G4AtlasAlg.h:143
xAOD::EventInfo_v1::updateErrorState
bool updateErrorState(const EventFlagSubDet subDet, const EventFlagErrorState state) const
Update the error state for one particular sub-detector.
Definition: EventInfo_v1.cxx:856
G4AtlasAlg::m_killAbortedEvents
Gaudi::Property< bool > m_killAbortedEvents
Definition: G4AtlasAlg.h:102
CI_EMPFlowData22test.returnCode
returnCode
Definition: CI_EMPFlowData22test.py:16
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
ReadHandle.h
Handle class for reading from StoreGate.
G4AtlasAlg::m_rndmGenSvc
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number service.
Definition: G4AtlasAlg.h:132
G4AtlasAlg::m_libList
Gaudi::Property< std::string > m_libList
Definition: G4AtlasAlg.h:119
checker_macros.h
Define macros for attributes used to control the static checker.
IGeoModelSvc.h
G4AtlasAlg::m_outputTruthCollectionKey
SG::WriteHandleKey< McEventCollection > m_outputTruthCollectionKey
output hard scatter truth collection
Definition: G4AtlasAlg.h:105
xAOD::EventInfo_v1::Core
@ Core
Core flags describing the event.
Definition: EventInfo_v1.h:339
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
G4AtlasAlg::m_activateParallelGeometries
Gaudi::Property< bool > m_activateParallelGeometries
Definition: G4AtlasAlg.h:129
G4AtlasAlg::initializeOnce
void initializeOnce()
G4 initialization called only by the first alg instance.
Definition: G4AtlasAlg.cxx:133
G4AtlasFluxRecorder.h