Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NistElementBuilder.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
27#ifndef G4NistElementBuilder_h
28#define G4NistElementBuilder_h 1
29
30//---------------------------------------------------------------------------
31//
32// ClassName: G4NistElementBuilder
33//
34// Description: Utility class to hold and manipulate G4Elements defined from
35// Nist data base
36//
37// Author: V.Ivanchenko 21.11.2004
38//
39// Modifications:
40// 27.02.06 V.Ivanchenko Return m=0 if Z&N combination is out of NIST
41// 27.02.06 V.Ivanchenko add GetAtomicMassAmu
42// 17.10.06 V.Ivanchenko add GetAtomicMass and GetNistElementNames methods
43// 02.05.07 V.Ivanchenko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes
44// 06.08.08 V.Ivanchenko add binding energy parameterisation and use isotope
45// mass in G4 units
46//
47//----------------------------------------------------------------------------
48//
49// Class Description:
50//
51// Element data from the NIST DB on Atomic Weights and Isotope Compositions
52// http://physics.nist.gov/PhysRefData/Compositions/index.html
53//
54//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55
56#include <vector>
58
59#include "globals.hh"
60#include "G4Element.hh"
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
65const G4int maxAbundance = 3500;
66
68{
69public:
70
71 explicit G4NistElementBuilder(G4int vb);
73
74 // Find or build a G4Element by atomic number
75 inline G4Element* FindElement (G4int Z) const;
76 G4Element* FindOrBuildElement (G4int Z, G4bool buildIsotopes = true);
77
78 // Find or build a G4Element by symbol
80 G4bool buildIsotopes = true);
81 // print element information
82 void PrintElement (G4int Z) const;
83
84 // Access to the vector of Geant4 predefined element names
85 const std::vector<G4String>& GetElementNames() const;
86
87 // Get atomic number by element symbol
88 G4int GetZ(const G4String& symb) const;
89
90 // Get atomic weight in atomic units by element symbol
91 G4double GetAtomicMassAmu(const G4String& symb) const;
92
93 // Get atomic weight in atomic units - mean mass in units of amu of an atom
94 // with electron shell for the natural isotope composition
95 inline G4double GetAtomicMassAmu(G4int Z) const;
96
97 // Get mass of isotope without electron shell in Geant4 energy units
98 inline G4double GetIsotopeMass(G4int Z, G4int N) const;
99
100 // Get mass in Geant4 energy units of an atom of a particular isotope
101 // with the electron shell
102 inline G4double GetAtomicMass(G4int Z, G4int N) const;
103
104 // Get total ionisation energy of an atom
106
107 // Get natural isotope abundance
108 inline G4double GetIsotopeAbundance (G4int Z, G4int N) const;
109
110 // Get N for the first natural isotope
111 inline G4int GetNistFirstIsotopeN(G4int Z) const;
112
113 // Get number of natural isotopes
114 inline G4int GetNumberOfNistIsotopes(G4int Z) const;
115
116 // Get max Z in the Geant4 element database
117 inline G4int GetMaxNumElements() const;
118
119 inline void SetVerbose(G4int);
120
121private:
122
123 void Initialise();
124
125 // Add element parameters to internal G4 database:
126 // Z - atomic number, N - number of nucleons, A - atomic mass (amu),
127 // sigmaA - accuracy of mass in last digits, W - natural abundances (percent)
128 void AddElement(const G4String& symbol, G4int Z, G4int NumberOfIsotopes,
129 const G4int& N, const G4double& A, const G4double& sigmaA,
130 const G4double& W);
131
132 // Build a G4Element from the G4 dataBase
133 G4Element* BuildElement(G4int Z);
134
135private:
136
137 G4String elmSymbol [maxNumElements];
138 G4double atomicMass [maxNumElements]; // amu
139 G4double bindingEnergy [maxNumElements];
140 G4int nIsotopes [maxNumElements];
141 G4int nFirstIsotope [maxNumElements];
142 G4int idxIsotopes [maxNumElements];
143
144 G4int elmIndex [maxNumElements];
145
146 G4double massIsotopes [maxAbundance]; // G4 units
147 G4double sigMass [maxAbundance]; // G4 units
148 G4double relAbundance [maxAbundance];
149
150 G4int index;
151 G4int verbose;
152
153 std::vector<G4String> elmNames;
154};
155
156//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
157//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158
160{
161 return (Z>0 && Z<maxNumElements) ? atomicMass[Z] : 0.0;
162}
163
164//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
165
167{
168 G4double mass = 0.0;
169 if(Z > 0 && Z < maxNumElements) {
170 G4int i = N - nFirstIsotope[Z];
171 if(i >= 0 && i <nIsotopes[Z]) {mass = massIsotopes[i + idxIsotopes[Z]];}
172 }
173 return mass;
174}
175
176//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177
179{
180 G4double mass = 0.0;
181 if(Z > 0 && Z < maxNumElements) {
182 G4int i = N - nFirstIsotope[Z];
183 if(i >= 0 && i <nIsotopes[Z]) {
184 mass = massIsotopes[i + idxIsotopes[Z]] +
185 Z*CLHEP::electron_mass_c2 - bindingEnergy[Z];
186 }
187 }
188 return mass;
189}
190
191//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192
193inline
195{
196 return (Z > 0 && Z < maxNumElements) ? bindingEnergy[Z] : 0.0;
197}
198
199
200//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201
202inline
204{
205 G4double x = 0.0;
206 if(Z > 0 && Z < maxNumElements) {
207 G4int i = N - nFirstIsotope[Z];
208 if(i >= 0 && i <nIsotopes[Z]) { x = relAbundance[i + idxIsotopes[Z]]; }
209 }
210 return x;
211}
212
213//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
214
216{
217 return (Z > 0 && Z < maxNumElements) ? nFirstIsotope[Z] : 0;
218}
219
220//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221
223{
224 return (Z > 0 && Z < maxNumElements) ? nIsotopes[Z] : 0;
225}
226
227//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
228
229inline
230const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
231{
232 return elmNames;
233}
234
235//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
236
238{
239 return maxNumElements-1;
240}
241
242//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
243
245{
246 verbose = val;
247}
248
249//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
250
252{
253 const G4ElementTable* theElementTable = G4Element::GetElementTable();
254 return (Z > 0 && Z < maxNumElements && elmIndex[Z] >= 0) ?
255 (*theElementTable)[elmIndex[Z]] : nullptr;
256}
257
258//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
259
260
261#endif
std::vector< G4Element * > G4ElementTable
const G4int maxNumElements
const G4int maxAbundance
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]
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:403
G4double GetAtomicMass(G4int Z, G4int N) const
G4double GetAtomicMassAmu(const G4String &symb) const
~G4NistElementBuilder()=default
G4double GetIsotopeMass(G4int Z, G4int N) const
G4Element * FindOrBuildElement(G4int Z, G4bool buildIsotopes=true)
G4int GetNumberOfNistIsotopes(G4int Z) const
G4int GetZ(const G4String &symb) const
G4Element * FindElement(G4int Z) const
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4int GetNistFirstIsotopeN(G4int Z) const
const std::vector< G4String > & GetElementNames() const
void PrintElement(G4int Z) const
G4double GetTotalElectronBindingEnergy(G4int Z) const
#define N
Definition: crc32.c:56
#define W
Definition: crc32.c:84