Belle II Software  release-08-01-10
ExtManager.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 // It is the main interface for the user to define the setup and
10 // start the propagation. Initializes GEANT4 for the propagation.
11 
12 #ifndef EXTMANAGER_H
13 #define EXTMANAGER_H
14 
15 #include <globals.hh>
16 #include <G4ApplicationState.hh>
17 #include <G4ErrorPropagatorData.hh>
18 #include <G4ErrorPropagator.hh>
19 
20 class G4ErrorTarget;
21 class G4ErrorTrajState;
22 class G4RunManager;
23 class G4VUserDetectorConstruction;
24 class G4VPhysicalVolume;
25 class G4VUserPhysicsList;
26 class G4UserRunAction;
27 class G4UserEventAction;
28 class G4UserStackingAction;
29 class G4UserTrackingAction;
30 class G4UserSteppingAction;
31 class G4MagneticField;
32 class G4MagIntegratorStepper;
33 class G4EquationOfMotion;
34 class G4ChordFinder;
35 class G4Mag_UsualEqRhs;
36 class G4VisManager;
37 class G4Track;
38 class G4VExceptionHandler;
39 
40 namespace Belle2 {
46  namespace Simulation {
47 
50  class ExtManager {
51 
52  public:
53 
55  ~ExtManager();
56 
58  static ExtManager* GetManager();
59 
61  void EventTermination(G4ErrorMode);
62 
64  void RunTermination();
65 
67  void Initialize(const char [], const std::string&, double, double, bool, int, const std::vector<std::string>&);
68 
70  void InitTrackPropagation(G4ErrorMode);
71 
73  G4int PropagateOneStep(G4ErrorTrajState* currentTS, G4ErrorMode mode = G4ErrorMode_PropForwards);
74 
76  inline G4ErrorPropagator* GetPropagator() const { return m_Propagator; }
77 
78  private:
79 
81  ExtManager();
82 
84  ExtManager(ExtManager&) = delete;
85 
88 
89  private:
90 
93 
95  G4ApplicationState m_G4State;
96 
98  G4ErrorPropagator* m_Propagator;
99 
101  G4RunManager* m_G4RunMgr;
102 
104  G4UserTrackingAction* m_TrackingAction;
105 
107  G4UserSteppingAction* m_SteppingAction;
108 
110  G4VExceptionHandler* m_StepExceptionHandler;
111 
113  G4MagneticField* m_MagneticField;
114 
116  G4MagneticField* m_UncachedField;
117 
119  G4Mag_UsualEqRhs* m_MagFldEquation;
120 
122  G4MagIntegratorStepper* m_Stepper;
123 
125  G4ChordFinder* m_ChordFinder;
126 
128  G4MagIntegratorStepper* m_StdStepper;
129 
131  G4EquationOfMotion* m_ForwardEquationOfMotion;
132 
134  G4EquationOfMotion* m_BackwardEquationOfMotion;
135 
137  G4VisManager* m_VisManager;
138 
139  };
140 
141  } // end of namespace Simulation
142 
144 } // end of namespace Belle2
145 
146 #endif // EXTMANAGER_H
It is the main interface for the user to define the setup and start the propagation.
Definition: ExtManager.h:50
G4VisManager * m_VisManager
Pointer to the visualization manager (if used)
Definition: ExtManager.h:137
G4RunManager * m_G4RunMgr
Pointer to the simulation's G4RunManager (if any)
Definition: ExtManager.h:101
G4MagIntegratorStepper * m_Stepper
Pointer to the equation-of-motion stepper (if not the default)
Definition: ExtManager.h:122
G4VExceptionHandler * m_StepExceptionHandler
Pointer to the G4VExceptionHandler used in PropagateOneStep()
Definition: ExtManager.h:110
static ExtManager * GetManager()
Get pointer to the instance of this singleton class (create if needed)
Definition: ExtManager.cc:72
G4MagIntegratorStepper * m_StdStepper
Pointer to the standard equation-of-motion stepper.
Definition: ExtManager.h:128
void RunTermination()
Terminate a run and set state to G4ErrorState_Init.
Definition: ExtManager.cc:150
void EventTermination(G4ErrorMode)
Terminate an event and set state to G4ErrorState_Init.
Definition: ExtManager.cc:136
ExtManager & operator=(ExtManager &)=delete
Assignment operator is undefined for singleton; user calls ExtManager::GetManager() instead.
static ExtManager * m_Manager
Stores pointer to the singleton class.
Definition: ExtManager.h:92
G4MagneticField * m_UncachedField
Pointer to the uncached magnetic field (might be superseded by its cached version)
Definition: ExtManager.h:116
G4Mag_UsualEqRhs * m_MagFldEquation
Pointer to the equation of motion in the magnetic field (if not the default)
Definition: ExtManager.h:119
G4MagneticField * m_MagneticField
Pointer to the (un)cached magnetic field.
Definition: ExtManager.h:113
G4UserTrackingAction * m_TrackingAction
Pointer to the simulation's TrackingAction (if any)
Definition: ExtManager.h:104
G4EquationOfMotion * m_ForwardEquationOfMotion
Pointer to the forward-propagation equation of motion.
Definition: ExtManager.h:131
ExtManager(ExtManager &)=delete
copy constructor is undefined for singleton; user calls ExtManager::GetManager() instead
G4ApplicationState m_G4State
Initial state of the G4RunManager (=PreInitif FullSimModule not present)
Definition: ExtManager.h:95
G4UserSteppingAction * m_SteppingAction
Pointer to the simulation's SteppingAction (if any)
Definition: ExtManager.h:107
void InitTrackPropagation(G4ErrorMode)
Initialize for propagation of a track and set state to G4ErrorState_Propagating.
Definition: ExtManager.cc:106
ExtManager()
constructor is hidden: user calls ExtManager::GetManager() instead
Definition: ExtManager.cc:78
G4EquationOfMotion * m_BackwardEquationOfMotion
Pointer to the equation of motion that accommodates back-propagation.
Definition: ExtManager.h:134
void Initialize(const char[], const std::string &, double, double, bool, int, const std::vector< std::string > &)
Initialize Geant4 and Geant4e.
Definition: ExtManager.cc:176
G4int PropagateOneStep(G4ErrorTrajState *currentTS, G4ErrorMode mode=G4ErrorMode_PropForwards)
Propagate a track by one step.
Definition: ExtManager.cc:122
G4ChordFinder * m_ChordFinder
Pointer to the equation-of-motion chord finder (if not the default)
Definition: ExtManager.h:125
G4ErrorPropagator * GetPropagator() const
Get the propagator.
Definition: ExtManager.h:76
G4ErrorPropagator * m_Propagator
Stores pointer to the propagator.
Definition: ExtManager.h:98
Abstract base class for different kinds of events.