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({})
55 ATH_MSG_ERROR (
"Could not retrieve the DetectorGeometrySvc" );
57 description <<
"InitializeGeometry: Failed to retrieve IDetectorGeometrySvc.";
58 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrieveDetGeoSvc", FatalException,
description);
63 G4RunManager::SetUserInitialization(
m_detGeoSvc->GetDetectorConstruction());
65 G4RunManager::InitializeGeometry();
68 ATH_MSG_WARNING(
" User Detector not set!!! Geometry NOT initialized!!!" );
83 kernel->InitializePhysics();
84 physicsInitialized =
true;
90 description <<
"InitializePhysics: Failed to retrieve IPhysicsListSvc.";
91 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrievePLTool", FatalException,
description);
98 ATH_MSG_ERROR (
"Could not retrieve the FastSim master tool" );
100 description <<
"InitializePhysics: Failed to retrieve IFastSimulationMasterTool.";
101 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrieveFastSimMaster", FatalException,
description);
106 description <<
"InitializePhysics: Call to IFastSimulationMasterTool::initializeFastSims failed.";
107 G4Exception(
"G4AtlasRunManager",
"FailedToInitializeFastSims", FatalException,
description);
121 G4StateManager* stateManager = G4StateManager::GetStateManager();
122 stateManager->SetNewState(G4State_GeomClosed);
124 currentEvent =
event;
126 eventManager->ProcessOneEvent(currentEvent);
127 if (currentEvent->IsAborted()) {
128 ATH_MSG_WARNING(
"G4AtlasRunManager::ProcessEvent: Event Aborted at Detector Simulation level" );
129 currentEvent =
nullptr;
135 this->StackPreviousEvent(currentEvent);
136 bool abort = currentEvent->IsAborted();
137 currentEvent =
nullptr;
149 this->CleanUpPreviousEvents();
150 previousEvents->clear();
153 userRunAction->EndOfRunAction(currentRun);
157 currentRun =
nullptr;
161 G4StateManager* stateManager = G4StateManager::GetStateManager();
162 stateManager->SetNewState(G4State_Idle);
165 G4GeometryManager::GetInstance()->OpenGeometry();
167 ATH_MSG_VERBOSE(
"Terminating the run... State is " << stateManager->GetStateString( stateManager->GetCurrentState() ) );
168 kernel->RunTermination();
171 userRunAction =
nullptr;
172 userEventAction =
nullptr;
173 userSteppingAction =
nullptr;
174 userStackingAction =
nullptr;
175 userTrackingAction =
nullptr;
176 userDetector =
nullptr;
177 userPrimaryGeneratorAction =
nullptr;