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
G4VPhysicsConstructor.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VPhysicsConstructor.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
// GEANT 4 class header file
31
// Class Description:
32
// This class is an virtual class for constructing
33
// particles and processes. This class objects will be
34
// registered to G4VPhysicsList.
35
//
36
// User must implement following four virtual methods
37
// in his own concrete class derived from this class.
38
//
39
// all necessary particle type will be instantiated
40
// virtual void ConstructParticle();
41
//
42
// all physics processes will be instantiated and
43
// registered to the process manager of each particle type
44
// virtual void ConstructProcess();
45
//
46
// Only one physics constructor can be registered to
47
// Modular Physics List for each "physics_type".
48
// Physics constructors with same "physics_type" can be
49
// replaced by using the method of
50
// G4VModularPhysicsList::ReplacePhysics()
51
//
52
//
53
// -------------------------------------------
54
// History
55
// first version 12 Nov. 2000 by H.Kurashige
56
// Add physicsType 14 Mar. 2011 by H.Kurashige
57
// Add RegisterProcess 1 May 2011 by H.Kurashige
58
// Add G4PhysicsBuilderInterface 21 Apr 2017 by A.Dotti
59
// ------------------------------------------------------------
60
#ifndef G4VPhysicsConstructor_h
61
#define G4VPhysicsConstructor_h 1
62
63
#include "
globals.hh
"
64
#include "
rundefs.hh
"
65
#include "
G4ios.hh
"
66
#include "
G4ParticleTable.hh
"
67
#include "
G4PhysicsListHelper.hh
"
68
#include "
G4VUPLSplitter.hh
"
69
#include <vector>
70
71
class
G4PhysicsBuilderInterface
;
72
73
class
G4VPCData
74
{
75
//Encapsulate the fields of class G4VPhysicsConstructor
76
//that are per-thread.
77
public
:
78
using
PhysicsBuilders_V
=std::vector<G4PhysicsBuilderInterface*>;
79
void
initialize
();
80
G4ParticleTable::G4PTblDicIterator
*
_aParticleIterator
;
81
PhysicsBuilders_V
*
_builders
;
82
};
83
84
// The type G4VPCManager is introduced to encapsulate the methods used by
85
// both the master thread and worker threads to allocate memory space for
86
// the fields encapsulated by the class G4VPCData. When each thread
87
// changes the value for these fields, it refers to them using a macro
88
// definition defined below. For every G4VPhysicsConstructor instance,
89
// there is a corresponding G4VPCData instance. All G4VPCData instances
90
// are organized by the class G4VUPLManager as an array.
91
// The field "int g4vuplInstanceID" is added to the class G4VUserPhysicsList.
92
// The value of this field in each G4VUserPhysicsList instance is the
93
// subscript of the corresponding G44VUPLData instance.
94
// In order to use the class G44VUPLManager, we add a static member in the class
95
// G4VUserPhysicsList as follows: "static G4VUPLManager subInstanceManager".
96
// Both the master thread and worker threads change the length of the array
97
// for G44VUPLData instances mutually along with G4VUserPhysicsList
98
// instances are created. For each worker thread, it dynamically creates ions.
99
// Consider any thread A, if there is any other thread which creates an ion.
100
// This ion is shared by the thread A. So the thread A leaves an empty space
101
// in the array of G4PDefData instances for the ion.
102
//
103
// Important Note: you may wonder why we are introducing this mechanism
104
// since there is only one PL for each application.
105
// This is true, in the sense that only one PL is allowed
106
// to be associated to a G4RunManager, however user can instantiate
107
// as many PLs are needed and at run-time select one of the PLs to be used
108
// we thus need this mechanism to guarantee that the system works without
109
// problems in case of this (unusual) case. This may be reviewed in the future
110
typedef
G4VUPLSplitter<G4VPCData>
G4VPCManager
;
111
typedef
G4VPCManager
G4VPhyscicsConstructorManager
;
112
113
// This macros change the references to fields that are now encapsulated
114
// in the class G4VPCData.
115
//
116
// Note1: the use of this-> this is needed to avoid compilation errors
117
// when using templated class with T=G4VUserPhysicsList. Don't know why.
118
// Note2: the name of the first #define is different, because otherwise
119
// we need to change its use in all classes that inherits from
120
// this base class (all examples). However one should note comment
121
// on JIRA task: http://jira-geant4.kek.jp/browse/DEV-27
122
123
//#define aParticleIterator ((subInstanceManager.offset[g4vpcInstanceID])._aParticleIterator)
124
125
class
G4VPhysicsConstructor
126
{
127
public
:
// with description
128
129
G4VPhysicsConstructor
(
const
G4String
& =
""
);
130
G4VPhysicsConstructor
(
const
G4String
&
name
,
G4int
physics_type);
131
virtual
~G4VPhysicsConstructor
();
132
133
virtual
void
ConstructParticle
()=0;
134
// This method will be invoked in the Construct() method.
135
// each particle type will be instantiated
136
137
virtual
void
ConstructProcess
()=0;
138
// This method will be invoked in the Construct() method.
139
// each physics process will be instantiated and
140
// registered to the process manager of each particle type
141
142
inline
void
SetPhysicsName
(
const
G4String
& =
""
);
143
inline
const
G4String
&
GetPhysicsName
()
const
;
144
145
inline
void
SetPhysicsType
(
G4int
);
146
inline
G4int
GetPhysicsType
()
const
;
147
148
inline
void
SetVerboseLevel
(
G4int
value
);
149
inline
G4int
GetVerboseLevel
()
const
;
150
// set/get controle flag for output message
151
// 0: Silent
152
// 1: Warning message
153
// 2: More
154
// verbose level is set equal to physics list when registered
155
156
protected
:
157
158
inline
G4bool
RegisterProcess
(
G4VProcess
* process,
159
G4ParticleDefinition
*
particle
);
160
// Register a process to the particle type
161
// according to the ordering parameter table
162
// 'true' is returned if the process is registerd successfully
163
164
protected
:
165
G4int
verboseLevel
;
166
G4String
namePhysics
;
167
G4int
typePhysics
;
168
169
G4ParticleTable
*
theParticleTable
;
170
G4int
g4vpcInstanceID
;
171
G4RUN_DLL
static
G4VPCManager
subInstanceManager
;
172
G4ParticleTable::G4PTblDicIterator
*
GetParticleIterator
()
const
;
173
using
PhysicsBuilder_V
=
G4VPCData::PhysicsBuilders_V
;
174
//This returns a copy of the vector of pointers
175
PhysicsBuilder_V
GetBuilders
()
const
;
176
void
AddBuilder
(
G4PhysicsBuilderInterface
* bld);
177
public
:
178
inline
G4int
GetInstanceID
()
const
;
179
static
const
G4VPCManager
&
GetSubInstanceManager
();
180
181
//Method called by kernel to destroy thread-local
182
//data, equivalent to destructor in sequential mode
183
//Derived classes implementing this method, must also call
184
//this base class method.
185
virtual
void
TerminateWorker
();
186
};
187
188
// Inlined methods
189
190
inline
void
G4VPhysicsConstructor::SetVerboseLevel
(
G4int
value
)
191
{
192
verboseLevel
=
value
;
193
}
194
195
inline
G4int
G4VPhysicsConstructor::GetVerboseLevel
()
const
196
{
197
return
verboseLevel
;
198
}
199
200
inline
void
G4VPhysicsConstructor::SetPhysicsName
(
const
G4String
&
name
)
201
{
202
namePhysics
=
name
;
203
}
204
205
inline
const
G4String
&
G4VPhysicsConstructor::GetPhysicsName
()
const
206
{
207
return
namePhysics
;
208
}
209
210
inline
void
G4VPhysicsConstructor::SetPhysicsType
(
G4int
val)
211
{
212
if
(val>0)
typePhysics
= val;
213
}
214
215
inline
G4int
G4VPhysicsConstructor::GetPhysicsType
()
const
216
{
217
return
typePhysics
;
218
}
219
220
inline
221
G4bool
G4VPhysicsConstructor::RegisterProcess
(
G4VProcess
* process,
222
G4ParticleDefinition
*
particle
)
223
{
224
return
G4PhysicsListHelper::GetPhysicsListHelper
()->
RegisterProcess
(process,particle);
225
//return aPLHelper->RegisterProcess(process, particle);
226
}
227
228
inline
229
const
G4VPCManager
&
G4VPhysicsConstructor::GetSubInstanceManager
()
230
{
231
return
subInstanceManager
;
232
}
233
#endif
234
235
236
237
geant4
tree
geant4-10.6-release
source
run
include
G4VPhysicsConstructor.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:53
using
1.8.2 with
ECCE GitHub integration