Geant4 11.2.2
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// Class Description:
48//
49// Element data from the NIST DB on Atomic Weights and Isotope Compositions
50// http://physics.nist.gov/PhysRefData/Compositions/index.html
51//
52
53#include "G4Element.hh"
54#include "globals.hh"
55
57
58#include <vector>
59
61const G4int maxAbundance = 3500;
62
64{
65 public:
66 explicit G4NistElementBuilder(G4int vb);
68
69 // Find or build a G4Element by atomic number
70 inline G4Element* FindElement(G4int Z) const;
71 G4Element* FindOrBuildElement(G4int Z, G4bool buildIsotopes = true);
72
73 // Find or build a G4Element by symbol
74 G4Element* FindOrBuildElement(const G4String& symb, G4bool buildIsotopes = true);
75 // print element information
76 void PrintElement(G4int Z) const;
77
78 // Access to the vector of Geant4 predefined element names
79 const std::vector<G4String>& GetElementNames() const;
80
81 // Get atomic number by element symbol
82 G4int GetZ(const G4String& symb) const;
83
84 // Get atomic weight in atomic units by element symbol
85 G4double GetAtomicMassAmu(const G4String& symb) const;
86
87 // Get atomic weight in atomic units - mean mass in units of amu of an atom
88 // with electron shell for the natural isotope composition
89 inline G4double GetAtomicMassAmu(G4int Z) const;
90
91 // Get mass of isotope without electron shell in Geant4 energy units
92 inline G4double GetIsotopeMass(G4int Z, G4int N) const;
93
94 // Get mass in Geant4 energy units of an atom of a particular isotope
95 // with the electron shell
96 inline G4double GetAtomicMass(G4int Z, G4int N) const;
97
98 // Get total ionisation energy of an atom
100
101 // Get natural isotope abundance
102 inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
103
104 // Get N for the first natural isotope
105 inline G4int GetNistFirstIsotopeN(G4int Z) const;
106
107 // Get number of natural isotopes
108 inline G4int GetNumberOfNistIsotopes(G4int Z) const;
109
110 // Get max Z in the Geant4 element database
111 inline G4int GetMaxNumElements() const;
112
113 inline void SetVerbose(G4int);
114
115 private:
116 void Initialise();
117
118 // Add element parameters to internal G4 database:
119 // Z - atomic number, N - number of nucleons, A - atomic mass (amu),
120 // sigmaA - accuracy of mass in last digits, W - natural abundances (percent)
121 void AddElement(const G4String& symbol, G4int Z, G4int NumberOfIsotopes, const G4int& N,
122 const G4double& A, const G4double& sigmaA, const G4double& W);
123
124 // Build a G4Element from the G4 dataBase
125 G4Element* BuildElement(G4int Z);
126
127 private:
128 G4String elmSymbol[maxNumElements];
129 G4double atomicMass[maxNumElements]; // amu
130 G4double bindingEnergy[maxNumElements];
131 G4int nIsotopes[maxNumElements];
132 G4int nFirstIsotope[maxNumElements];
133 G4int idxIsotopes[maxNumElements];
134
135 G4int elmIndex[maxNumElements];
136
137 G4double massIsotopes[maxAbundance]; // G4 units
138 G4double sigMass[maxAbundance]; // G4 units
139 G4double relAbundance[maxAbundance];
140
141 G4int index;
142 G4int verbose;
143
144 std::vector<G4String> elmNames;
145};
146
147//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148
150{
151 return (Z > 0 && Z < maxNumElements) ? atomicMass[Z] : 0.0;
152}
153
154//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155
157{
158 G4double mass = 0.0;
159 if (Z > 0 && Z < maxNumElements) {
160 G4int i = N - nFirstIsotope[Z];
161 if (i >= 0 && i < nIsotopes[Z]) {
162 mass = massIsotopes[i + idxIsotopes[Z]];
163 }
164 }
165 return mass;
166}
167
168//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169
171{
172 G4double mass = 0.0;
173 if (Z > 0 && Z < maxNumElements) {
174 G4int i = N - nFirstIsotope[Z];
175 if (i >= 0 && i < nIsotopes[Z]) {
176 mass = massIsotopes[i + idxIsotopes[Z]] + Z * CLHEP::electron_mass_c2 - bindingEnergy[Z];
177 }
178 }
179 return mass;
180}
181
182//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
183
185{
186 return (Z > 0 && Z < maxNumElements) ? bindingEnergy[Z] : 0.0;
187}
188
189//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
190
192{
193 G4double x = 0.0;
194 if (Z > 0 && Z < maxNumElements) {
195 G4int i = N - nFirstIsotope[Z];
196 if (i >= 0 && i < nIsotopes[Z]) {
197 x = relAbundance[i + idxIsotopes[Z]];
198 }
199 }
200 return x;
201}
202
203//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204
206{
207 return (Z > 0 && Z < maxNumElements) ? nFirstIsotope[Z] : 0;
208}
209
210//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
211
213{
214 return (Z > 0 && Z < maxNumElements) ? nIsotopes[Z] : 0;
215}
216
217//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
218
219inline const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
220{
221 return elmNames;
222}
223
224//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
225
227
228//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229
230inline void G4NistElementBuilder::SetVerbose(G4int val) { verbose = val; }
231
232//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
233
235{
236 const G4ElementTable* theElementTable = G4Element::GetElementTable();
237 return (Z > 0 && Z < maxNumElements && elmIndex[Z] >= 0) ? (*theElementTable)[elmIndex[Z]]
238 : nullptr;
239}
240
241#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 G4double A[17]
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389
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:57
#define W
Definition crc32.c:85