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(
66 G4RunManager::InitializeGeometry();
69 ATH_MSG_WARNING(
" User Detector not set!!! Geometry NOT initialized!!!" );
84 kernel->InitializePhysics();
85 physicsInitialized =
true;
91 description <<
"InitializePhysics: Failed to retrieve IPhysicsListSvc.";
92 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrievePLTool", FatalException,
description);
99 ATH_MSG_ERROR (
"Could not retrieve the FastSim master tool" );
101 description <<
"InitializePhysics: Failed to retrieve IFastSimulationMasterTool.";
102 G4Exception(
"G4AtlasRunManager",
"CouldNotRetrieveFastSimMaster", FatalException,
description);
107 description <<
"InitializePhysics: Call to IFastSimulationMasterTool::initializeFastSims failed.";
108 G4Exception(
"G4AtlasRunManager",
"FailedToInitializeFastSims", FatalException,
description);
122 G4StateManager* stateManager = G4StateManager::GetStateManager();
123 stateManager->SetNewState(G4State_GeomClosed);
125 currentEvent =
event;
127 eventManager->ProcessOneEvent(currentEvent);
128 if (currentEvent->IsAborted()) {
129 ATH_MSG_WARNING(
"G4AtlasRunManager::ProcessEvent: Event Aborted at Detector Simulation level" );
130 currentEvent =
nullptr;
136 this->StackPreviousEvent(currentEvent);
137 bool abort = currentEvent->IsAborted();
138 currentEvent =
nullptr;
150 this->CleanUpPreviousEvents();
151 previousEvents->clear();
154 userRunAction->EndOfRunAction(currentRun);
158 currentRun =
nullptr;
162 G4StateManager* stateManager = G4StateManager::GetStateManager();
163 stateManager->SetNewState(G4State_Idle);
166 G4GeometryManager::GetInstance()->OpenGeometry();
168 ATH_MSG_VERBOSE(
"Terminating the run... State is " << stateManager->GetStateString( stateManager->GetCurrentState() ) );
169 kernel->RunTermination();
172 userRunAction =
nullptr;
173 userEventAction =
nullptr;
174 userSteppingAction =
nullptr;
175 userStackingAction =
nullptr;
176 userTrackingAction =
nullptr;
177 userDetector =
nullptr;
178 userPrimaryGeneratorAction =
nullptr;