ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RunManagerKernel.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4RunManagerKernel.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 
30 // class description:
31 //
32 // This is a class for mandatory control of GEANT4 kernel.
33 //
34 // This class is constructed by G4RunManager. If a user uses his/her own
35 // class instead of G4RunManager, this class must be instantiated by
36 // him/herself at the very beginning of the application and must be deleted
37 // at the very end of the application. Also, following methods must be
38 // invoked in the proper order.
39 // DefineWorldVolume
40 // InitializePhysics
41 // RunInitialization
42 // RunTermination
43 //
44 // User must provide his/her own classes derived from the following
45 // abstract class and register it to the RunManagerKernel.
46 // G4VUserPhysicsList - Particle types, Processes and Cuts
47 //
48 // G4RunManagerKernel does not have any eveny loop. Handling of events
49 // is managed by G4RunManager.
50 //
51 
52 #ifndef G4RunManagerKernel_h
53 #define G4RunManagerKernel_h 1
54 
55 class G4VUserPhysicsList;
56 
57 class G4VPhysicalVolume;
58 class G4Region;
59 class G4ExceptionHandler;
60 class G4StackManager;
61 class G4TrackingManager;
63 
64 #include "globals.hh"
65 #include "G4EventManager.hh"
66 
68 {
69  public: // with description
71  // Static method which returns the singleton pointer of G4RunManagerKernel or
72  // its derived class.
73 
74  private:
76 
77  public: // with description
78 
80  virtual ~G4RunManagerKernel();
81  // The constructor and the destructor. The user must construct this class
82  // object at the beginning of his/her main() and must delete it at the
83  // bottom of the main(), unless he/she used G4RunManager.
84  public:
86  protected:
87  //Constructor to be used by derived classes
88  G4RunManagerKernel(RMKType rmkType);
90 
91  public: // with description
92  void DefineWorldVolume(G4VPhysicalVolume * worldVol,
93  G4bool topologyIsChanged=true);
94 
96  G4bool topologyIsChanged=true);
97 
98  // This method must be invoked if the geometry setup has been changed between
99  // runs. The flag 'topologyIsChanged' will specify if the geometry topology is
100  // different from the original one used in the previous run; if not, it must be
101  // set to false, so that the original optimisation and navigation history is
102  // preserved. This method is invoked also at initialisation.
103 
104  void SetPhysics(G4VUserPhysicsList* uPhys);
105  // This method must be invoked at least once by the user with a valid
106  // concrete implementation of user physics list.
107 
108  void InitializePhysics();
109  // This method must be invoked at least once by the user to build physics
110  // processes.
111 
112  G4bool RunInitialization(G4bool fakeRun=false);
113  // Trigger geometry closing and physics table constructions.
114  // It returns TRUE if all procedures went well.
115 
116  void RunTermination();
117  // Set the application state to G4State_Idle so that the user can modify
118  // physics/geometry.
119 
120  public:
122 
123  protected:
124  void SetupDefaultRegion();
125  //Called by DefineWorldVolume
126  void SetupPhysics();
127  void ResetNavigator();
128  void BuildPhysicsTables(G4bool fakeRun);
129  void CheckRegions();
130 
131  public: // with description
132  void UpdateRegion();
133  // Update region list.
134  // This method is mandatory before invoking following two dump methods.
135  // At RunInitialization(), this method is automatically invoked, and thus
136  // the user needs not invoke.
137 
138  void DumpRegion(const G4String& rname) const;
139  // Dump information of a region.
140 
141  void DumpRegion(G4Region* region=0) const;
142  // Dump information of a region.
143  // If the pointer is NULL, all regions are shown.
144 
145  private:
154 
158  protected:
162  public: // with description
164  { geometryNeedsToBeClosed = true; }
165  // This method must be invoked (or equivalent UI commands can be used)
166  // in case the user changes his/her detector geometry.
167  // This method is automatically invoked from DefineWorldVolume() method.
168 
170  { physicsNeedsToBeReBuilt = true; }
171  // This method must be invoked in case the user changes his/her physics
172  // process(es), e.g. (in)activate some processes. Once this method is
173  // invoked, regardless of cuts are changed or not, BuildPhysicsTable()
174  // of PhysicsList is invoked for refreshing all physics tables.
175 
176  public:
178  { return eventManager; }
180  { return eventManager->GetStackManager(); }
182  { return eventManager->GetTrackingManager(); }
186  { return eventManager->GetPrimaryTransformer(); }
187 
188  inline const G4String& GetVersionString() const
189  { return versionString; }
190 
191  inline void SetVerboseLevel(G4int vl)
192  { verboseLevel = vl; }
193 
195  {
196  if(geometryToBeOptimized != vl)
197  {
200  }
201  }
202 
204  { return numberOfParallelWorld; }
206  { numberOfParallelWorld = i; }
207 
209  { return physicsList; }
210 
212  { return currentWorld; }
213  private:
214  void CheckRegularGeometry();
216  void SetScoreSplitter();
217 
219 
220  public:
222  { return numberOfStaticAllocators; }
223 protected:
224  virtual void SetupShadowProcess() const;
225  // This method will setup the G4VProcesses
226  // instances to have a reference to the process instance
227  // created by the master thread. See G4VProcess::GetMasterProcess
228 
229  void PropagateGenericIonID();
230 };
231 
232 #endif
233