Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
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 // $Id: G4NistElementBuilder.hh 105820 2017-08-22 08:03:26Z gcosmo $
27 
28 #ifndef G4NistElementBuilder_h
29 #define G4NistElementBuilder_h 1
30 
31 //---------------------------------------------------------------------------
32 //
33 // ClassName: G4NistElementBuilder
34 //
35 // Description: Utility class to hold and manipulate G4Elements defined from
36 // Nist data base
37 //
38 // Author: V.Ivanchenko 21.11.2004
39 //
40 // Modifications:
41 // 27.02.06 V.Ivanchenko Return m=0 if Z&N combination is out of NIST
42 // 27.02.06 V.Ivanchenko add GetAtomicMassAmu
43 // 17.10.06 V.Ivanchenko add GetAtomicMass and GetNistElementNames methods
44 // 02.05.07 V.Ivanchenko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes
45 // 06.08.08 V.Ivanchenko add binding energy parameterisation and use isotope
46 // mass in G4 units
47 //
48 //----------------------------------------------------------------------------
49 //
50 // Class Description:
51 //
52 // Element data from the NIST DB on Atomic Weights and Isotope Compositions
53 // http://physics.nist.gov/PhysRefData/Compositions/index.html
54 //
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
57 #include <vector>
59 
60 #include "globals.hh"
61 #include "G4Element.hh"
62 #include "G4Threading.hh"
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
66 const G4int maxNumElements = 108;
67 const G4int maxAbundance = 3500;
68 
70 {
71 public:
72 
73  explicit G4NistElementBuilder(G4int vb);
75 
76  // Find or build a G4Element by atomic number
77  inline G4Element* FindElement (G4int Z) const;
78  G4Element* FindOrBuildElement (G4int Z, G4bool buildIsotopes = true);
79 
80  // Find or build a G4Element by symbol
81  G4Element* FindOrBuildElement (const G4String& symb,
82  G4bool buildIsotopes = true);
83  // print element information
84  void PrintElement (G4int Z) const;
85 
86  // Access to the vector of Geant4 predefined element names
87  const std::vector<G4String>& GetElementNames() const;
88 
89  // Get atomic number by element symbol
90  G4int GetZ(const G4String& symb) const;
91 
92  // Get atomic weight in atomic units by element symbol
93  G4double GetAtomicMassAmu(const G4String& symb) const;
94 
95  // Get atomic weight in atomic units - mean mass in units of amu of an atom
96  // with electron shell for the natural isotope composition
97  inline G4double GetAtomicMassAmu(G4int Z) const;
98 
99  // Get mass of isotope without electron shell in Geant4 energy units
100  inline G4double GetIsotopeMass(G4int Z, G4int N) const;
101 
102  // Get mass in Geant4 energy units of an atom of a particular isotope
103  // with the electron shell
104  inline G4double GetAtomicMass(G4int Z, G4int N) const;
105 
106  // Get total ionisation energy of an atom
108 
109  // Get natural isotope abundance
110  inline G4double GetIsotopeAbundance (G4int Z, G4int N) const;
111 
112  // Get N for the first natural isotope
113  inline G4int GetNistFirstIsotopeN(G4int Z) const;
114 
115  // Get number of natural isotopes
116  inline G4int GetNumberOfNistIsotopes(G4int Z) const;
117 
118  // Get max Z in the Geant4 element database
119  inline G4int GetMaxNumElements() const;
120 
121  inline void SetVerbose(G4int);
122 
123 private:
124 
125  void Initialise();
126 
127  // Add element parameters to internal G4 database:
128  // Z - atomic number, N - number of nucleons, A - atomic mass (amu),
129  // sigmaA - accuracy of mass in last digits, W - natural abundances (percent)
130  void AddElement(const G4String& symbol, G4int Z, G4int NumberOfIsotopes,
131  const G4int& N, const G4double& A, const G4double& sigmaA,
132  const G4double& W);
133 
134  // Build a G4Element from the G4 dataBase
136 
137 private:
138 
145 
147 
151 
154 
155  std::vector<G4String> elmNames;
156 #ifdef G4MULTITHREADED
157  static G4Mutex nistElementMutex;
158 #endif
159 };
160 
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
163 
165 {
166  return (Z>0 && Z<maxNumElements) ? atomicMass[Z] : 0.0;
167 }
168 
169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
170 
172 {
173  G4double mass = 0.0;
174  if(Z > 0 && Z < maxNumElements) {
175  G4int i = N - nFirstIsotope[Z];
176  if(i >= 0 && i <nIsotopes[Z]) {mass = massIsotopes[i + idxIsotopes[Z]];}
177  }
178  return mass;
179 }
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
182 
184 {
185  G4double mass = 0.0;
186  if(Z > 0 && Z < maxNumElements) {
187  G4int i = N - nFirstIsotope[Z];
188  if(i >= 0 && i <nIsotopes[Z]) {
189  mass = massIsotopes[i + idxIsotopes[Z]] +
191  }
192  }
193  return mass;
194 }
195 
196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
197 
198 inline
200 {
201  return (Z > 0 && Z < maxNumElements) ? bindingEnergy[Z] : 0.0;
202 }
203 
204 
205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
206 
207 inline
209 {
210  G4double x = 0.0;
211  if(Z > 0 && Z < maxNumElements) {
212  G4int i = N - nFirstIsotope[Z];
213  if(i >= 0 && i <nIsotopes[Z]) { x = relAbundance[i + idxIsotopes[Z]]; }
214  }
215  return x;
216 }
217 
218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
219 
221 {
222  return (Z > 0 && Z < maxNumElements) ? nFirstIsotope[Z] : 0;
223 }
224 
225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
226 
228 {
229  return (Z > 0 && Z < maxNumElements) ? nIsotopes[Z] : 0;
230 }
231 
232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
233 
234 inline
235 const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
236 {
237  return elmNames;
238 }
239 
240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
241 
243 {
244  return maxNumElements-1;
245 }
246 
247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
248 
250 {
251  verbose = val;
252 }
253 
254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
255 
257 {
258  const G4ElementTable* theElementTable = G4Element::GetElementTable();
259  return (Z > 0 && Z < maxNumElements && elmIndex[Z] >= 0) ?
260  (*theElementTable)[elmIndex[Z]] : nullptr;
261 }
262 
263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
264 
265 
266 #endif
Float_t x
Definition: compare.C:6
G4int nIsotopes[maxNumElements]
G4double atomicMass[maxNumElements]
G4Element * BuildElement(G4int Z)
G4double GetTotalElectronBindingEnergy(G4int Z) const
G4int GetNistFirstIsotopeN(G4int Z) const
G4int idxIsotopes[maxNumElements]
G4double relAbundance[maxAbundance]
const std::vector< G4String > & GetElementNames() const
Float_t Z
G4String elmSymbol[maxNumElements]
G4double GetIsotopeMass(G4int Z, G4int N) const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double GetAtomicMass(G4int Z, G4int N) const
**D E S C R I P T I O N
void AddElement(const G4String &symbol, G4int Z, G4int NumberOfIsotopes, const G4int &N, const G4double &A, const G4double &sigmaA, const G4double &W)
G4double GetAtomicMassAmu(const G4String &symb) const
static constexpr double electron_mass_c2
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4int GetNumberOfNistIsotopes(G4int Z) const
std::vector< G4Element * > G4ElementTable
G4double bindingEnergy[maxNumElements]
double A(double temperature)
G4Element * FindOrBuildElement(G4int Z, G4bool buildIsotopes=true)
G4int GetMaxNumElements() const
const G4int maxAbundance
G4int elmIndex[maxNumElements]
const G4int maxNumElements
int G4int
Definition: G4Types.hh:78
G4double massIsotopes[maxAbundance]
G4Element * FindElement(G4int Z) const
void PrintElement(G4int Z) const
G4int nFirstIsotope[maxNumElements]
G4int GetZ(const G4String &symb) const
std::vector< G4String > elmNames
G4double sigMass[maxAbundance]
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:398
std::mutex G4Mutex
Definition: G4Threading.hh:84