Geant4  10.01
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 // $Id: G4NistElementBuilder.hh 72057 2013-07-04 13:07:29Z 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>
58 #include <CLHEP/Units/PhysicalConstants.h>
59 
60 #include "globals.hh"
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
64 const G4int maxNumElements = 108;
65 const G4int maxAbundance = 3500;
66 
67 class G4Element;
68 
70 {
71 public:
72 
75 
76  // Find or build a G4Element by atomic number
77  G4Element* FindOrBuildElement (G4int Z, G4bool buildIsotopes = true);
78 
79  // Find or build a G4Element by symbol
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
107 
108  // Get natural isotope abandance
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 abandances (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
135 
136 private:
137 
144 
146 
150 
154 
155  std::vector<G4String> elmNames;
156 };
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160 
162 {
163  G4double a = 0.0;
164  if(Z>0 && Z<maxNumElements) { a = atomicMass[Z]; }
165  return a;
166 }
167 
168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169 
171 {
172  G4double mass = 0.0;
173  G4int i = N - nFirstIsotope[Z];
174  if(i >= 0 && i <nIsotopes[Z]) {mass = massIsotopes[i + idxIsotopes[Z]];}
175  return mass;
176 }
177 
178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179 
181 {
182  G4double mass = 0.0;
183  G4int i = N - nFirstIsotope[Z];
184  if(i >= 0 && i <nIsotopes[Z]) {
185  mass = massIsotopes[i + idxIsotopes[Z]] +
186  Z*CLHEP::electron_mass_c2 - bindingEnergy[Z];
187  }
188  return mass;
189 }
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192 
193 inline
195 {
196  return bindingEnergy[Z];
197 }
198 
199 
200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201 
202 inline
204 {
205  G4double x = 0.0;
206  G4int i = N - nFirstIsotope[Z];
207  if(i >= 0 && i <nIsotopes[Z]) {x = relAbundance[i + idxIsotopes[Z]];}
208  return x;
209 }
210 
211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
212 
214 {
215  return nFirstIsotope[Z];
216 }
217 
218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
219 
221 {
222  return nIsotopes[Z];
223 }
224 
225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
226 
227 inline
228 const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
229 {
230  return elmNames;
231 }
232 
233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
234 
236 {
237  return maxNumElements-1;
238 }
239 
240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
241 
243 {
244  verbose = val;
245 }
246 
247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
248 
249 
250 #endif
G4int GetMaxNumElements() const
G4String symbol
Definition: TRTMaterials.hh:40
G4double atomicMass[maxNumElements]
const G4int maxAbundance
G4double GetTotalElectronBindingEnergy(G4int Z) const
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4int GetNumberOfNistIsotopes(G4int Z) const
G4double a
Definition: TRTMaterials.hh:39
G4double sigMass[maxAbundance]
G4int idxIsotopes[maxNumElements]
G4double GetAtomicMassAmu(const G4String &symb) const
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
G4int nIsotopes[maxNumElements]
G4double massIsotopes[maxAbundance]
G4String elmSymbol[maxNumElements]
G4double relAbundance[maxAbundance]
G4double bindingEnergy[maxNumElements]
G4int nFirstIsotope[maxNumElements]
G4int GetZ(const G4String &symb) const
void AddElement(const G4String &symbol, G4int Z, G4int NumberOfIsotopes, const G4int &N, const G4double &A, const G4double &sigmaA, const G4double &W)
bool G4bool
Definition: G4Types.hh:79
G4int elmIndex[maxNumElements]
G4int GetNistFirstIsotopeN(G4int Z) const
void PrintElement(G4int Z) const
static const G4double A[nN]
G4double GetIsotopeMass(G4int Z, G4int N) const
G4Element * BuildElement(G4int Z)
const std::vector< G4String > & GetElementNames() const
G4Element * FindOrBuildElement(G4int Z, G4bool buildIsotopes=true)
std::vector< G4String > elmNames
double G4double
Definition: G4Types.hh:76
G4double GetAtomicMass(G4int Z, G4int N) const