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
G4ParticleTable.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4ParticleTable.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
//
32
// History: first implementation, based on object model of
33
// 27 June 1996, H.Kurashige
34
// ------------------------------------------------------------
35
// added fParticleMessenger 14 Nov., 97 H.Kurashige
36
// added Create/DeleteMessenger 06 Jul., 98 H.Kurashige
37
// modified FindIon 02 Aug., 98 H.Kurashige
38
// added dictionary for encoding 24 Sep., 98 H.Kurashige
39
// added RemoveAllParticles() 8 Nov., 98 H.Kurashige
40
// --------------------------------
41
// fixed some improper codings 08 Apr., 99 H.Kurashige
42
// modified FindIon/GetIon methods 17 AUg., 99 H.Kurashige
43
// implement new version for using STL map instaed of RW PtrHashedDictionary
44
// 28 ct., 99 H.Kurashige
45
// modified implementation of Remove 21 Mar.,08 H.Kurashige
46
// remove G4ShortLivedTable 25 July, 13 H.Kurashige
47
// added support for MuonicAtom September, 17 K.L.Genser
48
//
49
50
#ifndef G4ParticleTable_h
51
#define G4ParticleTable_h 1
52
53
#include <map>
54
55
#include "
G4ios.hh
"
56
#include "
globals.hh
"
57
#include "
G4Threading.hh
"
58
#include "
G4ParticleDefinition.hh
"
59
#include "
G4ParticleTableIterator.hh
"
60
61
class
G4UImessenger
;
62
class
G4ParticleMessenger
;
63
class
G4IonTable
;
64
65
class
G4ParticleTable
66
{
67
// Class Description
68
// G4ParticleTable is the table of pointer to G4ParticleDefinition
69
// G4ParticleTable is a "singleton" (only one and staic object)
70
// In G4ParticleTable, each G4ParticleDefinition pointer is stored
71
// with its name as a key to itself. So, each G4ParticleDefinition
72
// object must have unique name for itself.
73
//
74
75
public
:
76
77
typedef
G4ParticleTableIterator<G4String, G4ParticleDefinition*>::Map
G4PTblDictionary
;
78
typedef
G4ParticleTableIterator<G4String, G4ParticleDefinition*>
G4PTblDicIterator
;
79
typedef
G4ParticleTableIterator<G4int, G4ParticleDefinition*>::Map
G4PTblEncodingDictionary
;
80
typedef
G4ParticleTableIterator<G4int, G4ParticleDefinition*>
G4PTblEncodingDicIterator
;
81
82
protected
:
83
// default constructor
84
G4ParticleTable
();
85
// Copy constructor and assignment operator
86
G4ParticleTable
(
const
G4ParticleTable
&
right
);
87
G4ParticleTable
&
operator=
(
const
G4ParticleTable
&);
88
89
public
:
90
91
void
SlaveG4ParticleTable
();
92
void
WorkerG4ParticleTable
();
93
// This method is similar to the constructor. It is used by each worker
94
// thread to achieve the partial effect as that of the master thread.
95
96
virtual
~G4ParticleTable
();
97
void
DestroyWorkerG4ParticleTable
();
98
// This method is similar to the destructor. It is used by each worker
99
// thread to achieve the partial effect as that of the master thread.
100
101
public
:
// With Description
102
static
G4ParticleTable
*
GetParticleTable
();
103
// return the pointer to G4ParticleTable object
104
// G4ParticleTable is a "singleton" and can get its pointer by this function
105
// At the first time of calling this function, the G4ParticleTable object
106
// is instantiated
107
108
G4bool
contains
(
const
G4ParticleDefinition
*
particle
)
const
;
109
G4bool
contains
(
const
G4String
&particle_name)
const
;
110
// returns TRUE if the ParticleTable contains
111
112
G4int
entries
()
const
;
113
G4int
size
()
const
;
114
// returns the number of Particles in the ParticleTable
115
116
G4ParticleDefinition
*
GetParticle
(
G4int
index)
const
;
117
// returns a pointer to i-th particles in the ParticleTable
118
// 0<= index < entries()
119
120
const
G4String
&
GetParticleName
(
G4int
index)
const
;
121
// returns name of i-th particles in the ParticleTable
122
123
G4ParticleDefinition
*
FindParticle
(
G4int
PDGEncoding );
124
G4ParticleDefinition
*
FindParticle
(
const
G4String
&particle_name);
125
G4ParticleDefinition
*
FindParticle
(
const
G4ParticleDefinition
*
particle
);
126
// returns a pointer to the particle (0 if not contained)
127
128
G4ParticleDefinition
*
FindAntiParticle
(
G4int
PDGEncoding );
129
G4ParticleDefinition
*
FindAntiParticle
(
const
G4String
&particle_name);
130
G4ParticleDefinition
*
FindAntiParticle
(
const
G4ParticleDefinition
*
particle
);
131
// returns a pointer to its anti-particle (0 if not contained)
132
133
G4PTblDicIterator
*
GetIterator
()
const
;
134
// return the pointer of Iterator (RW compatible)
135
136
void
DumpTable
(
const
G4String
&particle_name =
"ALL"
);
137
// dump information of particles specified by name
138
139
public
:
//With Description
140
141
G4IonTable
*
GetIonTable
()
const
;
142
// return the pointer to G4IonTable object
143
144
145
public
:
// With Description
146
G4ParticleDefinition
*
Insert
(
G4ParticleDefinition
*
particle
);
147
// insert the particle into ParticleTable
148
// return value is same as particle if successfully inserted
149
// or pointer to another G4ParticleDefinition object
150
// which has same name of particle
151
// or 0 if fail to insert by another reason
152
153
G4ParticleDefinition
*
Remove
(
G4ParticleDefinition
*
particle
);
154
// Remove the particle from the table (not delete)
155
156
void
RemoveAllParticles
();
157
// remove all particles from G4ParticleTable
158
159
void
DeleteAllParticles
();
160
// remove and delete all particles from G4ParticleTable
161
162
public
:
163
G4UImessenger
*
CreateMessenger
();
164
void
DeleteMessenger
();
165
// create/delete messenger for the particle table
166
// these methods are supposed to be invoked by G4RunManager only
167
168
protected
:
169
170
const
G4PTblDictionary
*
GetDictionary
()
const
;
171
172
const
G4String
&
GetKey
(
const
G4ParticleDefinition
*
particle
)
const
;
173
// return key value of the particle (i.e. particle name)
174
175
const
G4PTblEncodingDictionary
*
GetEncodingDictionary
()
const
;
176
// return the pointer to EncodingDictionary
177
178
private
:
179
G4int
verboseLevel
;
180
// controle flag for output message
181
// 0: Silent
182
// 1: Warning message
183
// 2: More
184
185
public
:
186
void
SetVerboseLevel
(
G4int
value
);
187
G4int
GetVerboseLevel
()
const
;
188
189
static
G4ThreadLocal
G4ParticleMessenger
*
fParticleMessenger
;
190
static
G4ThreadLocal
G4PTblDictionary
*
fDictionary
;
191
static
G4ThreadLocal
G4PTblDicIterator
*
fIterator
;
192
static
G4ThreadLocal
G4PTblEncodingDictionary
*
fEncodingDictionary
;
193
// These fields should be thread local or thread private. For a singleton
194
// class, we can change any member field as static without any problem
195
// because there is only one instance. Then we are allowed to add
196
// "G4ThreadLocal".
197
198
//01.25.2009 Xin Dong: Phase II change for Geant4 multi-threading.
199
//Phase I changes this member to be thread local
200
//,while each thread holds its own copy of particles.
201
//Phase II changes this member back in order to share particles.
202
static
G4ParticleTable
*
fgParticleTable
;
203
204
static
G4IonTable
*
fIonTable
;
205
// This field should be thread private. However, we have to keep one copy
206
// of the ion table pointer. So we change all important fields of G4IonTable
207
// to the thread local variable.
208
209
// These shadow pointers are used by each worker thread to copy the content
210
// from the master thread.
211
212
static
G4ParticleMessenger
*
fParticleMessengerShadow
;
213
static
G4PTblDictionary
*
fDictionaryShadow
;
214
static
G4PTblDicIterator
*
fIteratorShadow
;
215
static
G4PTblEncodingDictionary
*
fEncodingDictionaryShadow
;
216
217
private
:
218
const
G4String
noName
;
219
220
G4bool
readyToUse
;
221
G4ParticleDefinition
*
genericIon
;
222
G4ParticleDefinition
*
genericMuonicAtom
;
223
224
public
:
225
void
SetReadiness
(
G4bool
val=
true
);
226
G4bool
GetReadiness
()
const
;
227
G4ParticleDefinition
*
GetGenericIon
()
const
;
228
void
SetGenericIon
(
G4ParticleDefinition
*);
229
G4ParticleDefinition
*
GetGenericMuonicAtom
()
const
;
230
void
SetGenericMuonicAtom
(
G4ParticleDefinition
*);
231
private
:
232
void
CheckReadiness
()
const
;
233
234
235
#ifdef G4MULTITHREADED
236
public
:
237
//Andrea Dotti January 16. Shared instance of a mutex
238
static
G4GLOB_DLL
G4Mutex
& particleTableMutex();
239
static
G4GLOB_DLL
G4int
& lockCount();
240
#endif
241
};
242
#include "G4ParticleTable.icc"
243
244
#endif
geant4
tree
geant4-10.6-release
source
particles
management
include
G4ParticleTable.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:24
using
1.8.2 with
ECCE GitHub integration