8 #include "G4GeometryManager.hh"
9 #include "G4LogicalVolumeStore.hh"
10 #include "G4ParallelWorldScoringProcess.hh"
11 #include "G4RegionStore.hh"
13 #include "G4ScoringManager.hh"
14 #include "G4StateManager.hh"
15 #include "G4TransportationManager.hh"
16 #include "G4UImanager.hh"
17 #include "G4UserRunAction.hh"
18 #include "G4Version.hh"
26 , m_fastSimTool(
"FastSimulationMasterTool")
27 , m_physListSvc(
"PhysicsListSvc",
"G4AtlasRunManager")
28 , m_detGeoSvc(
"DetectorGeometrySvc",
"G4AtlasRunManager")
29 , m_volumeSmartlessLevel({})
54 ATH_MSG_ERROR (
"Could not retrieve the DetectorGeometrySvc" );
56 description <<
"InitializeGeometry: Failed to retrieve IDetectorGeometrySvc.";
57 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrieveDetGeoSvc", FatalException,
description);
62 G4RunManager::SetUserInitialization(
m_detGeoSvc->GetDetectorConstruction());
64 G4RunManager::InitializeGeometry();
67 ATH_MSG_WARNING(
" User Detector not set!!! Geometry NOT initialized!!!" );
82 kernel->InitializePhysics();
83 physicsInitialized =
true;
89 description <<
"InitializePhysics: Failed to retrieve IPhysicsListSvc.";
90 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrievePLTool", FatalException,
description);
97 ATH_MSG_ERROR (
"Could not retrieve the FastSim master tool" );
99 description <<
"InitializePhysics: Failed to retrieve IFastSimulationMasterTool.";
100 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrieveFastSimMaster", FatalException,
description);
105 description <<
"InitializePhysics: Call to IFastSimulationMasterTool::initializeFastSims failed.";
106 G4Exception(
"G4AtlasRunManager",
"FailedToInitializeFastSims", FatalException,
description);
120 G4StateManager* stateManager = G4StateManager::GetStateManager();
121 stateManager->SetNewState(G4State_GeomClosed);
123 currentEvent =
event;
125 eventManager->ProcessOneEvent(currentEvent);
126 if (currentEvent->IsAborted()) {
127 ATH_MSG_WARNING(
"G4AtlasRunManager::ProcessEvent: Event Aborted at Detector Simulation level" );
128 currentEvent =
nullptr;
134 this->StackPreviousEvent(currentEvent);
135 bool abort = currentEvent->IsAborted();
136 currentEvent =
nullptr;
148 this->CleanUpPreviousEvents();
149 previousEvents->clear();
152 userRunAction->EndOfRunAction(currentRun);
156 currentRun =
nullptr;
160 G4StateManager* stateManager = G4StateManager::GetStateManager();
161 stateManager->SetNewState(G4State_Idle);
164 G4GeometryManager::GetInstance()->OpenGeometry();
166 ATH_MSG_VERBOSE(
"Terminating the run... State is " << stateManager->GetStateString( stateManager->GetCurrentState() ) );
167 kernel->RunTermination();
170 userRunAction =
nullptr;
171 userEventAction =
nullptr;
172 userSteppingAction =
nullptr;
173 userStackingAction =
nullptr;
174 userTrackingAction =
nullptr;
175 userDetector =
nullptr;
176 userPrimaryGeneratorAction =
nullptr;