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