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