Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4IonTable.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// G4IonTable
27//
28// Class description:
29//
30// G4IonTable stores all pointers to G4ParticleDefinition.
31
32// Author: H.Kurashige, 27 June 1998
33// --------------------------------------------------------------------
34#ifndef G4IonTable_hh
35#define G4IonTable_hh 1
36
37#include <cmath>
38#include <vector>
39#include <map>
40
41#include "G4ios.hh"
42#include "globals.hh"
44#include "G4ParticleTable.hh"
45#include "G4Ions.hh"
46
47class G4ParticleTable;
48class G4VIsotopeTable;
50class G4NuclideTable;
51
53{
54 public:
55
56 using G4IonList =
57 std::multimap<G4int, const G4ParticleDefinition*>;
59 std::multimap<G4int, const G4ParticleDefinition*>::iterator;
60
61 G4IonTable();
63 // Constructor, destructor
64
65 G4IonTable(const G4IonTable&) = delete;
66 G4IonTable& operator= (const G4IonTable&) = delete;
67 // Forbidden copy constructor and assignment operator
68
69 static G4IonTable* GetIonTable();
70
71 void WorkerG4IonTable();
72 // Method is used by each worker thread to copy the content
73 // from the master thread.
74
76 // Destructor for worker
77
79 // Get number of elements defined in the IonTable
80
82 // Register Isotope table
83
84 G4VIsotopeTable* GetIsotopeTable(std::size_t idx=0) const;
85 // G4IonTable asks properties of isotopes to G4VIsotopeTable
86 // by using FindIsotope(G4IsotopeProperty* property) method
87
88 void CreateAllIon();
89 // All ground state ions are created.
90 // Stable ground states are defined in G4NuclearProperty
91
92 void CreateAllIsomer();
93 // All excited ions with long life time (>1.0*ns) are created.
94 // Isomers are defined in G4VIsotopeTable
95
97 void PreloadNuclide();
98 // All nuclide with a life time longer than certain value are created
99 // prior to the event loop
100
101 // --------------------------------------------------------------
102 // FindIon/GetIon
103 // FindIon() methods return pointer of ion if it exists.
104 // GetIon() methods also return pointer of ion; the designated
105 // ion is created if it does not exist.
106 //
107 // !! PDGCharge in G4ParticleDefinition of ions is !!
108 // !! electric charge of nucleus (i.e. fully ionized ions) !!
109 // --------------------------------------------------------------
110
111 // Find/Get "ground state" and "excited state"
112 //
119 char flbChar, G4int J=0);
121 G4int J=0);
125 char flbChar, G4int J=0);
126 // Z: Atomic Number
127 // A: Atomic Mass (nn + np +nlambda)
128 // nL: Number of Lambda
129 // E: Excitation energy
130 // lvl: Isomer Level 0: ground state)
131 // flb: Floating level base (enum defined in G4Ions.hh)
132 // flbChar: Floating level base denoted by a character
133 // (<null>,X,Y,Z,U,V,W,R,S,T,A,B,C,D,E)
134 // J: Total Angular momentum (in unit of 1/2) : not used
135
137 // The ion can be retrieved by using PDG encoding
138 // !! Only ground state can be obtained .i.e. Isomer = 0
139
140 // Find/Get "excited state"
141 //
148 char flbChar, G4int J=0);
150 G4int J=0);
154 char flbChar, G4int J=0);
155 // Z: Atomic Number
156 // A: Atomic Mass (nn + np +nlambda)
157 // nL: Number of Lambda
158 // E: Excitaion energy
159 // lvl: Isomer Level 0: ground state)
160 // flb: Floating level base (enum defined in G4Ions.hh)
161 // flbChar: Floating level base denoted by a character
162 // (<null>,X,Y,Z,U,V,W,R,S,T,A,B,C,D,E)
163 // J: Total Angular momentum (in unit of 1/2) : not used
164
165 static G4bool IsIon(const G4ParticleDefinition*);
166 // Return true if the particle is ion
167
169 // Return true if the particle is anti_ion
170
171 const G4String& GetIonName(G4int Z, G4int A, G4int lvl=0) const;
176 const G4String& GetIonName(G4int Z, G4int A, G4int nL, G4int lvl) const;
177 // Get ion name
178
180 G4double E=0.0, G4int lvl=0);
181 // Get PDG code for Ions.
182 // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
183 // For a nucleus consisting of np protons and nn neutrons
184 // A = np + nn and Z = np.
185 // I gives the isomer level, with I = 0 corresponding
186 // to the ground state and I >0 to excitations
187
189 G4double E=0.0, G4int lvl=0);
190 // Get PDG code for Hyper-Nucleus Ions.
191 // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
192 // For a nucleus consisting of np protons and nn neutrons
193 // A = np + nn +nlambda and Z = np.
194 // nL = nlambda
195 // I gives the isomer level, with I = 0 corresponding
196 // to the ground state and I >0 to excitations
197
199 G4int& Z, G4int& A,
200 G4double& E, G4int& lvl);
202 G4int& Z, G4int& A, G4int& L,
203 G4double& E, G4int& lvl);
204 // Energy will not be given even for excited state!!
205
206 G4double GetIonMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const;
207 G4double GetNucleusMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const;
208 G4double GetIsomerMass(G4int Z, G4int A, G4int lvl=0) const;
209 // These methods returns Nucleus (i.e. full ionized atom) mass, where
210 // Z is Atomic Number (number of protons) and
211 // A is Atomic Number (number of nucleons and hyperons)
212 // nL is number of lambda (A= nn + np + nlambda)
213 // lvl is isomer level
214
218 G4double GetLifeTime(G4int Z, G4int A, G4double E, char flbChar) const;
219 // Returns a life time of an ion. -1 for stable ion, and -1001 for ion
220 // that is not listed in G4NuclideTable
221
224
225 G4int Entries() const;
226 // Return number of ions in the table
227
229 // Return the pointer of index-th ion in the table
230
231 G4bool Contains(const G4ParticleDefinition* particle) const;
232 // Return 'true' if the ion exists
233
234 void Insert(const G4ParticleDefinition* particle);
235 void Remove(const G4ParticleDefinition* particle);
236 // Insert/Remove an ion in the table
237
238 void clear();
239 // Erase all contents in the list (not delete just remove)
240
241 G4int size() const;
242 // Return number of ions in the table
243
244 void DumpTable(const G4String& particle_name = "ALL") const;
245 // Dump information of particles specified by name
246
247 public:
248
249 void InitializeLightIons();
250 // Needed for MT
251
253 static G4ThreadLocal std::vector<G4VIsotopeTable*> * fIsotopeTableList;
255 static std::vector<G4VIsotopeTable*> * fIsotopeTableListShadow;
256 // It is very important for multithreaded Geant4 to keep only one copy of
257 // the particle table pointer and the ion table pointer. However, we try
258 // to let each worker thread hold its own copy of the particle dictionary
259 // and the ion list. This implementation is equivalent to make the ion
260 // table thread private. The two shadow ponters are used by each worker
261 // thread to copy the content from the master thread
262
263 enum { numberOfElements = 118};
265
266#ifdef G4MULTITHREADED
267 static G4Mutex ionTableMutex;
268#endif
269
270 protected:
271
278
285
286 void InsertWorker(const G4ParticleDefinition* particle);
287
288 // Create Ion
289
291 G4Ions::G4FloatLevelBase flb) const;
293 // Ask properties of isotopes
294
297
300 // Return true if the particle is pre-defined ion
301
303 // Add process manager to ions with name of 'ionName'
304
305 G4int GetVerboseLevel() const;
306 // Get Verbose Level defined in G4ParticleTable
307
308 private:
309
310 G4NuclideTable* pNuclideTable = nullptr;
311
312 G4bool isIsomerCreated = false;
313 // Isomer table and flag of creation
314};
315
316// ------------------------
317// Inline methods
318// ------------------------
319
320inline
322{
323 return numberOfElements;
324}
325
326#endif
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
void PreloadNuclide()
Definition: G4IonTable.cc:1884
G4bool Contains(const G4ParticleDefinition *particle) const
Definition: G4IonTable.cc:1935
const G4String & GetIonName(G4int Z, G4int A, G4int lvl=0) const
Definition: G4IonTable.cc:1229
void Remove(const G4ParticleDefinition *particle)
Definition: G4IonTable.cc:1594
static G4ThreadLocal std::vector< G4VIsotopeTable * > * fIsotopeTableList
Definition: G4IonTable.hh:253
void PrepareNuclideTable()
Definition: G4IonTable.cc:1875
static G4IonList * fIonListShadow
Definition: G4IonTable.hh:254
G4IonTable(const G4IonTable &)=delete
G4bool IsLightAntiIon(const G4ParticleDefinition *) const
Definition: G4IonTable.cc:1366
void CreateAllIsomer()
Definition: G4IonTable.cc:1867
G4double GetNucleusMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
Definition: G4IonTable.cc:1435
void clear()
Definition: G4IonTable.cc:1526
static G4bool GetNucleusByEncoding(G4int encoding, G4int &Z, G4int &A, G4double &E, G4int &lvl)
Definition: G4IonTable.cc:1100
G4ParticleDefinition * GetMuonicAtom(G4Ions const *)
Definition: G4IonTable.cc:2167
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:522
G4ParticleDefinition * GetParticle(G4int index) const
Definition: G4IonTable.cc:1905
G4bool IsLightIon(const G4ParticleDefinition *) const
Definition: G4IonTable.cc:1354
std::multimap< G4int, const G4ParticleDefinition * > G4IonList
Definition: G4IonTable.hh:57
void DestroyWorkerG4IonTable()
Definition: G4IonTable.cc:214
static std::vector< G4VIsotopeTable * > * fIsotopeTableListShadow
Definition: G4IonTable.hh:255
void DumpTable(const G4String &particle_name="ALL") const
Definition: G4IonTable.cc:1666
@ numberOfElements
Definition: G4IonTable.hh:263
void WorkerG4IonTable()
Definition: G4IonTable.cc:180
static G4ThreadLocal G4IonList * fIonList
Definition: G4IonTable.hh:252
G4ParticleDefinition * GetLightIon(G4int Z, G4int A) const
Definition: G4IonTable.cc:1378
static G4IonTable * GetIonTable()
Definition: G4IonTable.cc:170
G4double GetLifeTime(const G4ParticleDefinition *) const
Definition: G4IonTable.cc:2132
void RegisterIsotopeTable(G4VIsotopeTable *table)
Definition: G4IonTable.cc:1786
static G4bool IsIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:1302
G4ParticleDefinition * FindIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:935
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int lvl=0)
Definition: G4IonTable.cc:1055
G4int Entries() const
Definition: G4IonTable.cc:1962
void InsertWorker(const G4ParticleDefinition *particle)
Definition: G4IonTable.cc:1565
std::multimap< G4int, const G4ParticleDefinition * >::iterator G4IonListIterator
Definition: G4IonTable.hh:59
G4IonTable & operator=(const G4IonTable &)=delete
G4int GetNumberOfElements() const
Definition: G4IonTable.hh:321
void AddProcessManager(G4ParticleDefinition *)
Definition: G4IonTable.cc:1711
void Insert(const G4ParticleDefinition *particle)
Definition: G4IonTable.cc:1548
G4double GetIonMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
Definition: G4IonTable.cc:1517
G4int GetVerboseLevel() const
Definition: G4IonTable.cc:1703
static const G4String elementName[numberOfElements]
Definition: G4IonTable.hh:264
G4double GetIsomerMass(G4int Z, G4int A, G4int lvl=0) const
Definition: G4IonTable.cc:1509
static G4bool IsAntiIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:1328
G4IsotopeProperty * FindIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb) const
Definition: G4IonTable.cc:1815
G4VIsotopeTable * GetIsotopeTable(std::size_t idx=0) const
Definition: G4IonTable.cc:1802
void CreateAllIon()
Definition: G4IonTable.cc:1859
void InitializeLightIons()
Definition: G4IonTable.cc:205
G4int size() const
Definition: G4IonTable.cc:1970
G4ParticleDefinition * GetLightAntiIon(G4int Z, G4int A) const
Definition: G4IonTable.cc:1406
G4ParticleDefinition * FindIonInMaster(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:2061
G4ParticleDefinition * CreateIon(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb)
Definition: G4IonTable.cc:245
Definition: G4Ions.hh:52
G4FloatLevelBase
Definition: G4Ions.hh:83
#define G4ThreadLocal
Definition: tls.hh:77