source: trunk/source/materials/include/G4NistElementBuilder.hh @ 1317

Last change on this file since 1317 was 1196, checked in by garnier, 15 years ago

update CVS release candidate geant4.9.3.01

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