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
G4NistElementBuilder.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4NistElementBuilder.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
#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>
57
#include <
CLHEP/Units/PhysicalConstants.h
>
58
59
#include "
globals.hh
"
60
#include "
G4Element.hh
"
61
#include "
G4Threading.hh
"
62
63
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
65
const
G4int
maxNumElements
= 108;
66
const
G4int
maxAbundance
= 3500;
67
68
class
G4NistElementBuilder
69
{
70
public
:
71
72
explicit
G4NistElementBuilder
(
G4int
vb);
73
~G4NistElementBuilder
();
74
75
// Find or build a G4Element by atomic number
76
inline
G4Element
*
FindElement
(
G4int
Z
)
const
;
77
G4Element
*
FindOrBuildElement
(
G4int
Z,
G4bool
buildIsotopes =
true
);
78
79
// Find or build a G4Element by symbol
80
G4Element
*
FindOrBuildElement
(
const
G4String
& symb,
81
G4bool
buildIsotopes =
true
);
82
// print element information
83
void
PrintElement
(
G4int
Z)
const
;
84
85
// Access to the vector of Geant4 predefined element names
86
const
std::vector<G4String>&
GetElementNames
()
const
;
87
88
// Get atomic number by element symbol
89
G4int
GetZ
(
const
G4String
& symb)
const
;
90
91
// Get atomic weight in atomic units by element symbol
92
G4double
GetAtomicMassAmu
(
const
G4String
& symb)
const
;
93
94
// Get atomic weight in atomic units - mean mass in units of amu of an atom
95
// with electron shell for the natural isotope composition
96
inline
G4double
GetAtomicMassAmu
(
G4int
Z)
const
;
97
98
// Get mass of isotope without electron shell in Geant4 energy units
99
inline
G4double
GetIsotopeMass
(
G4int
Z,
G4int
N
)
const
;
100
101
// Get mass in Geant4 energy units of an atom of a particular isotope
102
// with the electron shell
103
inline
G4double
GetAtomicMass
(
G4int
Z,
G4int
N)
const
;
104
105
// Get total ionisation energy of an atom
106
inline
G4double
GetTotalElectronBindingEnergy
(
G4int
Z)
const
;
107
108
// Get natural isotope abundance
109
inline
G4double
GetIsotopeAbundance
(
G4int
Z,
G4int
N)
const
;
110
111
// Get N for the first natural isotope
112
inline
G4int
GetNistFirstIsotopeN
(
G4int
Z)
const
;
113
114
// Get number of natural isotopes
115
inline
G4int
GetNumberOfNistIsotopes
(
G4int
Z)
const
;
116
117
// Get max Z in the Geant4 element database
118
inline
G4int
GetMaxNumElements
()
const
;
119
120
inline
void
SetVerbose
(
G4int
);
121
122
private
:
123
124
void
Initialise
();
125
126
// Add element parameters to internal G4 database:
127
// Z - atomic number, N - number of nucleons, A - atomic mass (amu),
128
// sigmaA - accuracy of mass in last digits, W - natural abundances (percent)
129
void
AddElement
(
const
G4String
& symbol,
G4int
Z,
G4int
NumberOfIsotopes,
130
const
G4int
& N,
const
G4double
&
A
,
const
G4double
& sigmaA,
131
const
G4double
& W);
132
133
// Build a G4Element from the G4 dataBase
134
G4Element
*
BuildElement
(
G4int
Z);
135
136
private
:
137
138
G4String
elmSymbol
[
maxNumElements
];
139
G4double
atomicMass
[
maxNumElements
];
// amu
140
G4double
bindingEnergy
[
maxNumElements
];
141
G4int
nIsotopes
[
maxNumElements
];
142
G4int
nFirstIsotope
[
maxNumElements
];
143
G4int
idxIsotopes
[
maxNumElements
];
144
145
G4int
elmIndex
[
maxNumElements
];
146
147
G4double
massIsotopes
[
maxAbundance
];
// G4 units
148
G4double
sigMass
[
maxAbundance
];
// G4 units
149
G4double
relAbundance
[
maxAbundance
];
150
151
G4int
index
;
152
G4int
verbose
;
153
154
std::vector<G4String>
elmNames
;
155
#ifdef G4MULTITHREADED
156
static
G4Mutex
nistElementMutex;
157
#endif
158
};
159
160
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
162
163
inline
G4double
G4NistElementBuilder::GetAtomicMassAmu
(
G4int
Z
)
const
164
{
165
return
(Z>0 && Z<
maxNumElements
) ?
atomicMass
[
Z
] : 0.0;
166
}
167
168
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169
170
inline
G4double
G4NistElementBuilder::GetIsotopeMass
(
G4int
Z
,
G4int
N
)
const
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]) {mass =
massIsotopes
[i +
idxIsotopes
[
Z
]];}
176
}
177
return
mass
;
178
}
179
180
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181
182
inline
G4double
G4NistElementBuilder::GetAtomicMass
(
G4int
Z
,
G4int
N
)
const
183
{
184
G4double
mass
= 0.0;
185
if
(Z > 0 && Z <
maxNumElements
) {
186
G4int
i = N -
nFirstIsotope
[
Z
];
187
if
(i >= 0 && i <
nIsotopes
[Z]) {
188
mass =
massIsotopes
[i +
idxIsotopes
[
Z
]] +
189
Z*
CLHEP::electron_mass_c2
-
bindingEnergy
[
Z
];
190
}
191
}
192
return
mass
;
193
}
194
195
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
196
197
inline
198
G4double
G4NistElementBuilder::GetTotalElectronBindingEnergy
(
G4int
Z
)
const
199
{
200
return
(Z > 0 && Z <
maxNumElements
) ?
bindingEnergy
[
Z
] : 0.0;
201
}
202
203
204
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
205
206
inline
207
G4double
G4NistElementBuilder::GetIsotopeAbundance
(
G4int
Z
,
G4int
N
)
const
208
{
209
G4double
x
= 0.0;
210
if
(Z > 0 && Z <
maxNumElements
) {
211
G4int
i = N -
nFirstIsotope
[
Z
];
212
if
(i >= 0 && i <
nIsotopes
[Z]) { x =
relAbundance
[i +
idxIsotopes
[
Z
]]; }
213
}
214
return
x
;
215
}
216
217
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
218
219
inline
G4int
G4NistElementBuilder::GetNistFirstIsotopeN
(
G4int
Z
)
const
220
{
221
return
(Z > 0 && Z <
maxNumElements
) ?
nFirstIsotope
[
Z
] : 0;
222
}
223
224
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
225
226
inline
G4int
G4NistElementBuilder::GetNumberOfNistIsotopes
(
G4int
Z
)
const
227
{
228
return
(Z > 0 && Z <
maxNumElements
) ?
nIsotopes
[
Z
] : 0;
229
}
230
231
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232
233
inline
234
const
std::vector<G4String>&
G4NistElementBuilder::GetElementNames
()
const
235
{
236
return
elmNames
;
237
}
238
239
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
240
241
inline
G4int
G4NistElementBuilder::GetMaxNumElements
()
const
242
{
243
return
maxNumElements
-1;
244
}
245
246
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
247
248
inline
void
G4NistElementBuilder::SetVerbose
(
G4int
val)
249
{
250
verbose
= val;
251
}
252
253
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
254
255
inline
G4Element
*
G4NistElementBuilder::FindElement
(
G4int
Z
)
const
256
{
257
const
G4ElementTable
* theElementTable =
G4Element::GetElementTable
();
258
return
(Z > 0 && Z <
maxNumElements
&&
elmIndex
[Z] >= 0) ?
259
(*theElementTable)[
elmIndex
[
Z
]] :
nullptr
;
260
}
261
262
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263
264
265
#endif
geant4
tree
geant4-10.6-release
source
materials
include
G4NistElementBuilder.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:22
using
1.8.2 with
ECCE GitHub integration