Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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//
27// $Id$
28//
29//
30
31// class description:
32//
33// This is a class for mandatory control of GEANT4 kernel.
34//
35// This class is constructed by G4RunManager. If a user uses his/her own
36// class instead of G4RunManager, this class must be instantiated by
37// him/herself at the very beginning of the application and must be deleted
38// at the very end of the application. Also, following methods must be
39// invoked in the proper order.
40// DefineWorldVolume
41// InitializePhysics
42// RunInitialization
43// RunTermination
44//
45// User must provide his/her own classes derived from the following
46// abstract class and register it to the RunManagerKernel.
47// G4VUserPhysicsList - Particle types, Processes and Cuts
48//
49// G4RunManagerKernel does not have any eveny loop. Handling of events
50// is managed by G4RunManager.
51//
52
53#ifndef G4RunManagerKernel_h
54#define G4RunManagerKernel_h 1
55
57
59class G4Region;
61class G4StackManager;
64
65#include "globals.hh"
66#include "G4EventManager.hh"
67
69{
70 public: // with description
72 // Static method which returns the singleton pointer of G4RunManagerKernel or
73 // its derived class.
74
75 private:
76 static G4RunManagerKernel* fRunManagerKernel;
77
78 public: // with description
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
85 public: // with description
87 G4bool topologyIsChanged=true);
88 // This method must be invoked if the geometry setup has been changed between
89 // runs. The flag 'topologyIsChanged' will specify if the geometry topology is
90 // different from the original one used in the previous run; if not, it must be
91 // set to false, so that the original optimisation and navigation history is
92 // preserved. This method is invoked also at initialisation.
93
94 void SetPhysics(G4VUserPhysicsList* uPhys);
95 // This method must be invoked at least once by the user with a valid
96 // concrete implementation of user physics list.
97
98 void InitializePhysics();
99 // This method must be invoked at least once by the user to build physics
100 // processes.
101
103 // Trigger geometry closing and physics table constructions.
104 // It returns TRUE if all procedures went well.
105
106 void RunTermination();
107 // Set the application state to G4State_Idle so that the user can modify
108 // physics/geometry.
109
110 private:
111 void ResetNavigator();
112 void BuildPhysicsTables();
113 void CheckRegions();
114
115 public: // with description
116 void UpdateRegion();
117 // Update region list.
118 // This method is mandatory before invoking following two dump methods.
119 // At RunInitialization(), this method is automatically invoked, and thus
120 // the user needs not invoke.
121
122 void DumpRegion(const G4String& rname) const;
123 // Dump information of a region.
124
125 void DumpRegion(G4Region* region=0) const;
126 // Dump information of a region.
127 // If the pointer is NULL, all regions are shown.
128
129 private:
130 G4VUserPhysicsList * physicsList;
131 G4VPhysicalVolume* currentWorld;
132 G4bool geometryInitialized;
133 G4bool physicsInitialized;
134 G4bool geometryNeedsToBeClosed;
135 G4bool geometryToBeOptimized;
136 G4bool physicsNeedsToBeReBuilt;
137 G4int verboseLevel;
138 G4int numberOfParallelWorld;
139
140 G4EventManager * eventManager;
141 G4ExceptionHandler* defaultExceptionHandler;
142 G4Region* defaultRegion;
143 G4Region* defaultRegionForParallelWorld;
144 G4String versionString;
145
146 public: // with description
148 { geometryNeedsToBeClosed = true; }
149 // This method must be invoked (or equivalent UI commands can be used)
150 // in case the user changes his/her detector geometry.
151 // This method is automatically invoked from DefineWorldVolume() method.
152
154 { physicsNeedsToBeReBuilt = true; }
155 // This method must be invoked in case the user changes his/her physics
156 // process(es), e.g. (in)activate some processes. Once this method is
157 // invoked, regardless of cuts are changed or not, BuildPhysicsTable()
158 // of PhysicsList is invoked for refreshing all physics tables.
159
160 public:
162 { return eventManager; }
164 { return eventManager->GetStackManager(); }
166 { return eventManager->GetTrackingManager(); }
168 { eventManager->SetPrimaryTransformer(pt); }
170 { return eventManager->GetPrimaryTransformer(); }
171
172 inline const G4String& GetVersionString() const
173 { return versionString; }
174
175 inline void SetVerboseLevel(G4int vl)
176 { verboseLevel = vl; }
177
179 {
180 if(geometryToBeOptimized != vl)
181 {
182 geometryToBeOptimized = vl;
183 geometryNeedsToBeClosed = true;
184 }
185 }
186
188 { return numberOfParallelWorld; }
190 { numberOfParallelWorld = i; }
191
192 private:
193 void CheckRegularGeometry();
194 G4bool ConfirmCoupledTransportation();
195 void SetScoreSplitter();
196};
197
198#endif
199
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4PrimaryTransformer * GetPrimaryTransformer() const
void SetPrimaryTransformer(G4PrimaryTransformer *tf)
G4TrackingManager * GetTrackingManager() const
G4StackManager * GetStackManager() const
G4PrimaryTransformer * GetPrimaryTransformer() const
static G4RunManagerKernel * GetRunManagerKernel()
void SetPhysics(G4VUserPhysicsList *uPhys)
G4StackManager * GetStackManager() const
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void SetNumberOfParallelWorld(G4int i)
G4EventManager * GetEventManager() const
void SetGeometryToBeOptimized(G4bool vl)
G4int GetNumberOfParallelWorld() const
void SetPrimaryTransformer(G4PrimaryTransformer *pt)
void DumpRegion(const G4String &rname) const
const G4String & GetVersionString() const
void SetVerboseLevel(G4int vl)
G4TrackingManager * GetTrackingManager() const