ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
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
;
62
class
G4PrimaryTransformer
;
63
64
#include "
globals.hh
"
65
#include "
G4EventManager.hh
"
66
67
class
G4RunManagerKernel
68
{
69
public
:
// with description
70
static
G4RunManagerKernel
*
GetRunManagerKernel
();
71
// Static method which returns the singleton pointer of G4RunManagerKernel or
72
// its derived class.
73
74
private
:
75
static
G4ThreadLocal
G4RunManagerKernel
*
fRunManagerKernel
;
76
77
public
:
// with description
78
79
G4RunManagerKernel
();
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
:
85
enum
RMKType
{
sequentialRMK
,
masterRMK
,
workerRMK
};
86
protected
:
87
//Constructor to be used by derived classes
88
G4RunManagerKernel
(
RMKType
rmkType);
89
RMKType
runManagerKernelType
;
90
91
public
:
// with description
92
void
DefineWorldVolume
(
G4VPhysicalVolume
* worldVol,
93
G4bool
topologyIsChanged=
true
);
94
95
void
WorkerDefineWorldVolume
(
G4VPhysicalVolume
* worldVol,
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
:
121
void
WorkerUpdateWorldVolume
();
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
:
146
G4VUserPhysicsList
*
physicsList
;
147
G4VPhysicalVolume
*
currentWorld
;
148
G4bool
geometryInitialized
;
149
G4bool
physicsInitialized
;
150
G4bool
geometryToBeOptimized
;
151
G4bool
physicsNeedsToBeReBuilt
;
152
G4int
verboseLevel
;
153
G4int
numberOfParallelWorld
;
154
155
G4EventManager
*
eventManager
;
156
G4ExceptionHandler
*
defaultExceptionHandler
;
157
G4String
versionString
;
158
protected
:
159
G4Region
*
defaultRegion
;
160
G4Region
*
defaultRegionForParallelWorld
;
161
G4bool
geometryNeedsToBeClosed
;
162
public
:
// with description
163
inline
void
GeometryHasBeenModified
()
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
169
inline
void
PhysicsHasBeenModified
()
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
:
177
inline
G4EventManager
*
GetEventManager
()
const
178
{
return
eventManager
; }
179
inline
G4StackManager
*
GetStackManager
()
const
180
{
return
eventManager
->
GetStackManager
(); }
181
inline
G4TrackingManager
*
GetTrackingManager
()
const
182
{
return
eventManager
->
GetTrackingManager
(); }
183
inline
void
SetPrimaryTransformer
(
G4PrimaryTransformer
*
pt
)
184
{
eventManager
->
SetPrimaryTransformer
(pt); }
185
inline
G4PrimaryTransformer
*
GetPrimaryTransformer
()
const
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
194
inline
void
SetGeometryToBeOptimized
(
G4bool
vl)
195
{
196
if
(
geometryToBeOptimized
!= vl)
197
{
198
geometryToBeOptimized
= vl;
199
geometryNeedsToBeClosed
=
true
;
200
}
201
}
202
203
inline
G4int
GetNumberOfParallelWorld
()
const
204
{
return
numberOfParallelWorld
; }
205
inline
void
SetNumberOfParallelWorld
(
G4int
i)
206
{
numberOfParallelWorld
= i; }
207
208
inline
G4VUserPhysicsList
*
GetPhysicsList
()
const
209
{
return
physicsList
; }
210
211
inline
G4VPhysicalVolume
*
GetCurrentWorld
()
const
212
{
return
currentWorld
; }
213
private
:
214
void
CheckRegularGeometry
();
215
G4bool
ConfirmCoupledTransportation
();
216
void
SetScoreSplitter
();
217
218
G4int
numberOfStaticAllocators
;
219
220
public
:
221
inline
G4int
GetNumberOfStaticAllocators
()
const
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
geant4
tree
geant4-10.6-release
source
run
include
G4RunManagerKernel.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:53
using
1.8.2 with
ECCE GitHub integration