Geant4-11
G4RunManagerKernel.hh
Go to the documentation of this file.
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// G4RunManagerKernel
27//
28// Class description:
29//
30// This is a class for mandatory control of the Geant4 kernel.
31//
32// This class is constructed by G4RunManager. If a user adopts his/her own
33// class instead of G4RunManager, this class must be instantiated by at the
34// very beginning of the application and must be deleted at the very end.
35// In addition, the following methods must be invoked in the proper order:
36// DefineWorldVolume()
37// InitializePhysics()
38// RunInitialization()
39// RunTermination()
40//
41// User must provide his/her own classes derived from the following abstract
42// class and register it to G4RunManagerKernel:
43// G4VUserPhysicsList - Particle types, Processes and Cuts
44//
45// G4RunManagerKernel does not have any event loop. Handling of events
46// is managed by G4RunManager.
47
48// Author: M.Asai, 1 August 2003
49// --------------------------------------------------------------------
50#ifndef G4RunManagerKernel_hh
51#define G4RunManagerKernel_hh 1
52
53#include "globals.hh"
54#include "G4EventManager.hh"
55
58class G4Region;
60class G4StackManager;
63
65{
66 public:
67
69 // Static method returning the singleton pointer of
70 // G4RunManagerKernel or its derived class.
71
73 virtual ~G4RunManagerKernel();
74 // The constructor and the destructor. The user must construct this class
75 // object at the beginning of his/her main() and must delete it at the
76 // bottom of the main(), unless he/she used G4RunManager.
77
79 G4bool topologyIsChanged = true);
80
82 G4bool topologyIsChanged = true);
83 // This method must be invoked if the geometry setup has been changed
84 // between runs. The flag "topologyIsChanged" will specify if the
85 // geometry topology is different from the original one used in the
86 // previous run; if not, it must be set to false, so that the original
87 // optimisation and navigation history is preserved. This method is
88 // invoked also at initialisation.
89
90 void SetPhysics(G4VUserPhysicsList* uPhys);
91 // This method must be invoked at least once with a valid concrete
92 // implementation of user physics list.
93
94 void InitializePhysics();
95 // This method must be invoked at least once to build physics processes.
96
97 G4bool RunInitialization(G4bool fakeRun = false);
98 // Trigger geometry closing and physics table constructions.
99 // It returns TRUE if all procedures went well.
100
101 void RunTermination();
102 // Set the application state to 'Idle' so that the user can modify
103 // physics/geometry.
104
105 void UpdateRegion();
106 // Update region list. This method is mandatory before invoking the
107 // following two dump methods.
108 // At RunInitialization(), this method is automatically invoked.
109
110 void DumpRegion(const G4String& rname) const;
111 // Dump information of a region.
112
113 void DumpRegion(G4Region* region = nullptr) const;
114 // Dump information of a region.
115 // If the pointer is NULL, all regions are shown.
116
118
120 // This method must be invoked (or equivalent UI commands can be used)
121 // in case the user changes his/her detector geometry.
122 // This method is automatically invoked from DefineWorldVolume().
123
125 // This method must be invoked in case the user changes his/her physics
126 // process(es), e.g. (in)activate some processes. Once this method is
127 // invoked, regardless of cuts changed or not, BuildPhysicsTable() of
128 // a PhysicsList is invoked for refreshing all physics tables.
129
130 inline G4EventManager* GetEventManager() const { return eventManager; }
132 {
134 }
136 {
138 }
140 {
142 }
144 {
146 }
147
148 inline const G4String& GetVersionString() const { return versionString; }
149
150 inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
151
153 {
154 if(geometryToBeOptimized != vl)
155 {
158 }
159 }
160
162 {
164 }
166
168
170
172 {
174 }
175
177 {
181 };
182
183 protected:
184
186 // Constructor to be used by derived classes.
187
188 void SetupDefaultRegion();
189 // Called by DefineWorldVolume().
190 void SetupPhysics();
191 void ResetNavigator();
192 void BuildPhysicsTables(G4bool fakeRun);
193 void CheckRegions();
194
195 virtual void SetupShadowProcess() const;
196 // This method will setup the G4VProcesses instances to have a reference
197 // to the process instance created by the master thread.
198 // See G4VProcess::GetMasterProcess().
199
201
202 private:
203
206 void SetScoreSplitter();
207
208 protected:
209
214
215 private:
216
225
229
231
233};
234
235#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4PrimaryTransformer * GetPrimaryTransformer() const
void SetPrimaryTransformer(G4PrimaryTransformer *tf)
G4TrackingManager * GetTrackingManager() const
G4StackManager * GetStackManager() const
G4PrimaryTransformer * GetPrimaryTransformer() const
G4Region * defaultRegionForParallelWorld
static G4RunManagerKernel * GetRunManagerKernel()
void SetPhysics(G4VUserPhysicsList *uPhys)
G4ExceptionHandler * defaultExceptionHandler
static G4ThreadLocal G4RunManagerKernel * fRunManagerKernel
G4StackManager * GetStackManager() const
G4VPhysicalVolume * GetCurrentWorld() const
G4int GetNumberOfStaticAllocators() const
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void SetNumberOfParallelWorld(G4int i)
G4EventManager * GetEventManager() const
void SetGeometryToBeOptimized(G4bool vl)
G4bool RunInitialization(G4bool fakeRun=false)
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4VPhysicalVolume * currentWorld
G4VUserPhysicsList * GetPhysicsList() const
virtual void SetupShadowProcess() const
G4int GetNumberOfParallelWorld() const
G4VUserPhysicsList * physicsList
void SetPrimaryTransformer(G4PrimaryTransformer *pt)
void DumpRegion(const G4String &rname) const
G4EventManager * eventManager
void BuildPhysicsTables(G4bool fakeRun)
const G4String & GetVersionString() const
void SetVerboseLevel(G4int vl)
G4TrackingManager * GetTrackingManager() const
#define G4ThreadLocal
Definition: tls.hh:77