Belle II Software  release-08-01-10
RunManager Class Reference

The run manager controls the flow of the Geant4 program and manages the event loop(s) within a run. More...

#include <RunManager.h>

Inheritance diagram for RunManager:
Collaboration diagram for RunManager:

Classes

class  SingletonDestroyer
 Destroyer class to delete the instance of the RunManager class when the program terminates. More...
 

Public Member Functions

void beginRun (int runNumber)
 Prepares Geant4 for a new run. More...
 
void processEvent (int evtNumber)
 Process a single event in Geant4. More...
 
void endRun ()
 Terminates a Geant4 run.
 
void destroy ()
 Destroys the RunManager at the end of the simulation. More...
 
void Initialize ()
 Initialize the Kernel.
 
void addAssemblyVolume (G4AssemblyVolume *vol)
 Register a G4AssemblyVolume.
 

Static Public Member Functions

static RunManagerInstance ()
 Static method to get a reference to the RunManager instance. More...
 

Private Member Functions

 RunManager ()
 The constructor is hidden to avoid that someone creates an instance of this class.
 
 RunManager (const RunManager &)
 Disable/Hide the copy constructor.
 
RunManageroperator= (const RunManager &)
 Disable/Hide the copy assignment operator.
 
virtual ~RunManager ()
 The RunManager destructor.
 

Private Attributes

std::vector< G4AssemblyVolume * > m_AssemblyVolumes
 Vector of pointers to G4AssemblyVolumes.
 
RandomEnginem_randomEngine
 Pointer to RandomEngine to avoid memory leak by creating it in the constructor and deleting it in the destructor.
 

Static Private Attributes

static RunManagerm_instance = NULL
 Pointer that saves the instance of this class.
 

Friends

class SingletonDestroyer
 

Detailed Description

The run manager controls the flow of the Geant4 program and manages the event loop(s) within a run.

The run manager is also responsible for managing initialization procedures, including methods in the user initialization classes. By definition of Geant4, this class has to be a singleton.

Definition at line 32 of file RunManager.h.

Member Function Documentation

◆ beginRun()

void beginRun ( int  runNumber)

Prepares Geant4 for a new run.

Parameters
runNumberThe current number of the run.

Definition at line 49 of file RunManager.cc.

50 {
51  //Initialize Geometry FIXME: done run independent at the moment
52  //InitializeGeometry();
53  //Check if all the necessary initializations have already be done.
54  if (ConfirmBeamOnCondition()) {
55  //Set run number
56  SetRunIDCounter(runNumber);
57 
58  //Finish initialization
59  ConstructScoringWorlds();
60  RunInitialization();
61  } else {
62  B2FATAL("The Geant4 kernel was not initialized properly ! The method 'ConfirmBeamOnCondition()' failed. ");
63  }
64 }

◆ destroy()

void destroy ( )

Destroys the RunManager at the end of the simulation.

Required by Geant4.

Definition at line 85 of file RunManager.cc.

◆ Instance()

RunManager & Instance ( )
static

Static method to get a reference to the RunManager instance.

Returns
A reference to an instance of this class.

Definition at line 29 of file RunManager.cc.

◆ processEvent()

void processEvent ( int  evtNumber)

Process a single event in Geant4.

Parameters
evtNumberThe current number of the event.

Definition at line 67 of file RunManager.cc.


The documentation for this class was generated from the following files: