Geant4-11
source
run
include
G4VModularPhysicsList.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
// G4VModularPhysicsList
27
//
28
// Class description:
29
//
30
// This class is a subclass of G4VUserPhysicsList.
31
// The user should register his/her physics constructors by using:
32
// G4VModularPhysicsList::RegsiterPhysics()
33
// to construt particles and processes.
34
//
35
// Only one physics constructor can be registered for each "physics_type".
36
// Physics constructors with same "physics_type" can be replaced using the
37
// G4VModularPhysicsList::ReplacePhysics() method.
38
39
// Original author: H.Kurashige (Kobe University), 12 November 2000
40
// --------------------------------------------------------------------
41
#ifndef G4VModularPhysicsList_hh
42
#define G4VModularPhysicsList_hh 1
43
44
#include <vector>
45
46
#include "
G4ios.hh
"
47
#include "
globals.hh
"
48
#include "
rundefs.hh
"
49
50
#include "
G4VPhysicsConstructor.hh
"
51
#include "
G4VUPLSplitter.hh
"
52
#include "
G4VUserPhysicsList.hh
"
53
54
class
G4VMPLData
55
{
56
// Encapsulate the fields of class G4VModularPhysicsList
57
// that are per-thread.
58
59
public
:
60
61
void
initialize
();
62
using
G4PhysConstVectorData
= std::vector<G4VPhysicsConstructor*>;
63
// See: https://jira-geant4.kek.jp/browse/DEV-284
64
G4PhysConstVectorData
*
physicsVector
=
nullptr
;
65
};
66
67
// The type G4VMPLManager is introduced to encapsulate the methods used by
68
// both the master thread and worker threads to allocate memory space for
69
// the fields encapsulated by the class G4VMPLData. When each thread
70
// changes the value for these fields, it refers to them using a macro
71
// definition defined below. For every G4VUserPhysicsList instance,
72
// there is a corresponding G4VMPLData instance. All G4VMPLData instances
73
// are organized by the class G4VMPLManager as an array.
74
// The field "int G4VMPLInstanceID" is added to the class G4VUserPhysicsList.
75
// The value of this field in each G4VUserPhysicsList instance is the
76
// subscript of the corresponding G44VUPLData instance.
77
// In order to use the class G44VUPLManager, we add a static member in the class
78
// G4VUserPhysicsList as follows: "static G4VMPLManager subInstanceManager".
79
// Both the master thread and worker threads change the length of the array
80
// for G44VUPLData instances mutually along with G4VUserPhysicsList
81
// instances are created.
82
//
83
using
G4VMPLManager
=
G4VUPLSplitter<G4VMPLData>
;
84
using
G4VModularPhysicsListSubInstanceManager
=
G4VMPLManager
;
85
86
class
G4VModularPhysicsList
:
public
virtual
G4VUserPhysicsList
87
{
88
public
:
89
90
G4VModularPhysicsList
();
91
virtual
~G4VModularPhysicsList
();
92
93
virtual
void
ConstructParticle
()
override
;
94
// This method will be invoked in the Construct() method.
95
// Each particle type will be instantiated.
96
97
virtual
void
ConstructProcess
()
override
;
98
// This method will be invoked in the Construct() method.
99
// Each physics process will be instantiated and
100
// registered to the process manager of each particle type.
101
102
void
RegisterPhysics
(
G4VPhysicsConstructor
*);
103
// Register Physics Constructor.
104
105
const
G4VPhysicsConstructor
*
GetPhysics
(
G4int
index)
const
;
106
const
G4VPhysicsConstructor
*
GetPhysics
(
const
G4String
&
name
)
const
;
107
const
G4VPhysicsConstructor
*
GetPhysicsWithType
(
G4int
physics_type)
const
;
108
109
void
ReplacePhysics
(
G4VPhysicsConstructor
*);
110
// Replace the Physics Constructor.
111
// The existing physics constructor with same physics_type as one of
112
// the given physics constructor is replaced (existing physics will be
113
// deleted). If a corresponding physics constructor is NOT found,
114
// the given physics constructor is just added.
115
116
void
RemovePhysics
(
G4VPhysicsConstructor
*);
117
void
RemovePhysics
(
G4int
type);
118
void
RemovePhysics
(
const
G4String
&
name
);
119
// Remove the Physics Constructor from the list.
120
121
inline
G4int
GetInstanceID
()
const
;
122
static
const
G4VMPLManager
&
GetSubInstanceManager
();
123
virtual
void
TerminateWorker
()
override
;
124
125
void
SetVerboseLevel
(
G4int
value);
126
G4int
GetVerboseLevel
()
const
;
127
// Set/get control flag for output message
128
// 0: Silent
129
// 1: Warning message
130
// 2: More
131
// given verbose level is set to all physics constructors.
132
133
protected
:
134
135
G4VModularPhysicsList
(
const
G4VModularPhysicsList
&);
136
G4VModularPhysicsList
&
operator=
(
const
G4VModularPhysicsList
&);
137
// Protected copy constructor and assignment operator.
138
139
using
G4PhysConstVector
=
G4VMPLData::G4PhysConstVectorData
;
140
141
G4int
verboseLevel
= 0;
142
G4int
g4vmplInstanceID
= 0;
143
G4RUN_DLL
static
G4VMPLManager
G4VMPLsubInstanceManager
;
144
};
145
146
// Inline methods implementations
147
148
inline
G4int
G4VModularPhysicsList::GetVerboseLevel
()
const
149
{
150
return
verboseLevel
;
151
}
152
153
inline
G4int
G4VModularPhysicsList::GetInstanceID
()
const
154
{
155
return
g4vmplInstanceID
;
156
}
157
158
inline
const
G4VMPLManager
&
G4VModularPhysicsList::GetSubInstanceManager
()
159
{
160
return
G4VMPLsubInstanceManager
;
161
}
162
163
#endif
G4int
int G4int
Definition:
G4Types.hh:85
G4VMPLManager
G4VUPLSplitter< G4VMPLData > G4VMPLManager
Definition:
G4VModularPhysicsList.hh:83
G4VPhysicsConstructor.hh
G4VUPLSplitter.hh
G4VUserPhysicsList.hh
G4ios.hh
G4String
Definition:
G4String.hh:62
G4VMPLData
Definition:
G4VModularPhysicsList.hh:55
G4VMPLData::G4PhysConstVectorData
std::vector< G4VPhysicsConstructor * > G4PhysConstVectorData
Definition:
G4VModularPhysicsList.hh:62
G4VMPLData::physicsVector
G4PhysConstVectorData * physicsVector
Definition:
G4VModularPhysicsList.hh:64
G4VMPLData::initialize
void initialize()
Definition:
G4VModularPhysicsList.cc:44
G4VModularPhysicsList
Definition:
G4VModularPhysicsList.hh:87
G4VModularPhysicsList::~G4VModularPhysicsList
virtual ~G4VModularPhysicsList()
Definition:
G4VModularPhysicsList.cc:57
G4VModularPhysicsList::TerminateWorker
virtual void TerminateWorker() override
Definition:
G4VModularPhysicsList.cc:434
G4VModularPhysicsList::ConstructParticle
virtual void ConstructParticle() override
Definition:
G4VModularPhysicsList.cc:113
G4VModularPhysicsList::G4VModularPhysicsList
G4VModularPhysicsList()
Definition:
G4VModularPhysicsList.cc:50
G4VModularPhysicsList::SetVerboseLevel
void SetVerboseLevel(G4int value)
Definition:
G4VModularPhysicsList.cc:422
G4VModularPhysicsList::operator=
G4VModularPhysicsList & operator=(const G4VModularPhysicsList &)
Definition:
G4VModularPhysicsList.cc:76
G4VModularPhysicsList::GetInstanceID
G4int GetInstanceID() const
Definition:
G4VModularPhysicsList.hh:153
G4VModularPhysicsList::ConstructProcess
virtual void ConstructProcess() override
Definition:
G4VModularPhysicsList.cc:137
G4VModularPhysicsList::GetVerboseLevel
G4int GetVerboseLevel() const
Definition:
G4VModularPhysicsList.hh:148
G4VModularPhysicsList::RegisterPhysics
void RegisterPhysics(G4VPhysicsConstructor *)
Definition:
G4VModularPhysicsList.cc:150
G4VModularPhysicsList::G4VMPLsubInstanceManager
static G4RUN_DLL G4VMPLManager G4VMPLsubInstanceManager
Definition:
G4VModularPhysicsList.hh:143
G4VModularPhysicsList::G4PhysConstVector
G4VMPLData::G4PhysConstVectorData G4PhysConstVector
Definition:
G4VModularPhysicsList.hh:139
G4VModularPhysicsList::RemovePhysics
void RemovePhysics(G4VPhysicsConstructor *)
Definition:
G4VModularPhysicsList.cc:308
G4VModularPhysicsList::GetPhysicsWithType
const G4VPhysicsConstructor * GetPhysicsWithType(G4int physics_type) const
Definition:
G4VModularPhysicsList.cc:406
G4VModularPhysicsList::ReplacePhysics
void ReplacePhysics(G4VPhysicsConstructor *)
Definition:
G4VModularPhysicsList.cc:211
G4VModularPhysicsList::g4vmplInstanceID
G4int g4vmplInstanceID
Definition:
G4VModularPhysicsList.hh:142
G4VModularPhysicsList::GetSubInstanceManager
static const G4VMPLManager & GetSubInstanceManager()
Definition:
G4VModularPhysicsList.hh:158
G4VModularPhysicsList::GetPhysics
const G4VPhysicsConstructor * GetPhysics(G4int index) const
Definition:
G4VModularPhysicsList.cc:378
G4VModularPhysicsList::verboseLevel
G4int verboseLevel
Definition:
G4VModularPhysicsList.hh:141
G4VPhysicsConstructor
Definition:
G4VPhysicsConstructor.hh:109
G4VUPLSplitter
Definition:
G4VUPLSplitter.hh:63
G4VUserPhysicsList
Definition:
G4VUserPhysicsList.hh:107
globals.hh
G4InuclParticleNames::name
const char * name(G4int ptype)
Definition:
G4InuclParticleNames.hh:76
rundefs.hh
G4RUN_DLL
#define G4RUN_DLL
Definition:
rundefs.hh:45
Generated by
1.9.3