9#include <simulation/kernel/RunManager.h>
10#include <simulation/kernel/RandomEngine.h>
11#include <framework/logging/Logger.h>
13#include <framework/pcore/ProcHandler.h>
15#include <CLHEP/Random/Random.h>
17#include <G4LogicalVolumeStore.hh>
18#include <G4PhysicalVolumeStore.hh>
19#include <G4SolidStore.hh>
20#include <G4RegionStore.hh>
21#include <G4GeometryManager.hh>
25using namespace Belle2::Simulation;
41 SetGeometryToBeOptimized(
true);
45 G4RunManager::Initialize();
54 if (ConfirmBeamOnCondition()) {
56 SetRunIDCounter(runNumber);
59 ConstructScoringWorlds();
62 B2FATAL(
"The Geant4 kernel was not initialized properly ! The method 'ConfirmBeamOnCondition()' failed. ");
70 currentEvent = GenerateEvent(evtNumber);
71 eventManager->ProcessOneEvent(currentEvent);
72 AnalyzeEvent(currentEvent);
74 StackPreviousEvent(currentEvent);
104 G4LogicalVolumeStore::GetInstance()->clear();
105 G4PhysicalVolumeStore::GetInstance()->clear();
106 G4SolidStore::GetInstance()->clear();
107 G4RegionStore::GetInstance()->clear();
110 G4GeometryManager::GetInstance()->OpenGeometry();
static bool isOutputProcess()
Return true if the process is an output process.
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
Interface class to make Geant4 use the Belle2 RandomGenerator.
The run manager controls the flow of the Geant4 program and manages the event loop(s) within a run.
virtual ~RunManager()
The RunManager destructor.
void beginRun(int runNumber)
Prepares Geant4 for a new run.
void destroy()
Destroys the RunManager at the end of the simulation.
void processEvent(int evtNumber)
Process a single event in Geant4.
std::vector< G4AssemblyVolume * > m_AssemblyVolumes
Vector of pointers to G4AssemblyVolumes.
void endRun()
Terminates a Geant4 run.
void Initialize()
Initialize the Kernel.
RandomEngine * m_randomEngine
Pointer to RandomEngine to avoid memory leak by creating it in the constructor and deleting it in the...
static RunManager * m_instance
Pointer that saves the instance of this class.
static RunManager & Instance()
Static method to get a reference to the RunManager instance.
RunManager()
The constructor is hidden to avoid that someone creates an instance of this class.
Abstract base class for different kinds of events.