G4NistElementBuilder.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4NistElementBuilder.hh 67044 2013-01-30 08:50:06Z gcosmo $
00027 
00028 #ifndef G4NistElementBuilder_h
00029 #define G4NistElementBuilder_h 1
00030 
00031 //---------------------------------------------------------------------------
00032 //
00033 // ClassName:   G4NistElementBuilder
00034 //
00035 // Description: Utility class to hold and manipulate G4Elements defined from
00036 //              Nist data base
00037 //
00038 // Author:      V.Ivanchenko 21.11.2004
00039 //
00040 // Modifications:
00041 // 27.02.06 V.Ivanchenko Return m=0 if Z&N combination is out of NIST  
00042 // 27.02.06 V.Ivanchenko add GetAtomicMassAmu 
00043 // 17.10.06 V.Ivanchenko add GetAtomicMass and GetNistElementNames methods
00044 // 02.05.07 V.Ivanchenko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes 
00045 // 06.08.08 V.Ivanchenko add binding energy parameterisation and use isotope 
00046 //                       mass in G4 units 
00047 //
00048 //----------------------------------------------------------------------------
00049 //
00050 // Class Description:
00051 //
00052 // Element data from the NIST DB on Atomic Weights and Isotope Compositions
00053 // http://physics.nist.gov/PhysRefData/Compositions/index.html
00054 //
00055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00056 
00057 #include <vector>
00058 #include <CLHEP/Units/PhysicalConstants.h>
00059 
00060 #include "globals.hh"
00061 
00062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00063 
00064 const G4int maxNumElements = 108;
00065 const G4int maxAbundance   = 3500;
00066 
00067 class G4Element;
00068 
00069 class G4NistElementBuilder
00070 {
00071 public:
00072 
00073   G4NistElementBuilder(G4int vb);
00074   ~G4NistElementBuilder();
00075 
00076   // Find or build a G4Element by atomic number
00077   G4Element* FindOrBuildElement (G4int Z, G4bool buildIsotopes = true);
00078 
00079   // Find  or build a G4Element by symbol
00080   G4Element* FindOrBuildElement (const G4String& symb,
00081                                  G4bool buildIsotopes = true);
00082   // print element information
00083   void PrintElement (G4int Z);
00084 
00085   // Access to the vector of Geant4 predefined element names 
00086   const std::vector<G4String>& GetElementNames() const;
00087 
00088   // Get atomic number by element symbol
00089   G4int GetZ(const G4String& symb);
00090 
00091   // Get atomic weight in atomic units by element symbol
00092   G4double GetAtomicMassAmu(const G4String& symb);
00093 
00094   // Get atomic weight in atomic units - mean mass in units of amu of an atom 
00095   // with electron shell for the natural isotope composition 
00096   inline G4double GetAtomicMassAmu(G4int Z);
00097 
00098   // Get mass of isotope without electron shell in Geant4 energy units 
00099   inline G4double GetIsotopeMass(G4int Z, G4int N);
00100 
00101   // Get mass in Geant4 energy units of an atom of a particular isotope 
00102   // with the electron shell  
00103   inline G4double GetAtomicMass(G4int Z, G4int N);
00104 
00105   // Get total ionisation energy of an atom
00106   inline G4double GetTotalElectronBindingEnergy(G4int Z) const;
00107 
00108   // Get natural isotope abandance
00109   inline G4double GetIsotopeAbundance (G4int Z, G4int N);
00110 
00111   // Get N for the first natural isotope
00112   inline G4int GetNistFirstIsotopeN(G4int Z);
00113 
00114   // Get number of natural isotopes
00115   inline G4int GetNumberOfNistIsotopes(G4int Z);
00116 
00117   // Get max Z in the Geant4 element database
00118   inline G4int GetMaxNumElements(); 
00119 
00120   inline void SetVerbose(G4int);
00121 
00122 private:
00123 
00124   void Initialise();
00125 
00126   // Add element parameters to internal G4 database: 
00127   // Z - atomic number, N - number of nucleons, A - atomic mass (amu),
00128   // sigmaA - accuracy of mass in last digits, W - natural abandances (percent) 
00129   void AddElement(const G4String& symbol, G4int Z, G4int NumberOfIsotopes,
00130                   const G4int& N, const G4double& A, const G4double& sigmaA, 
00131                   const G4double& W);
00132 
00133   // Build a G4Element from the G4 dataBase
00134   G4Element* BuildElement(G4int Z, G4bool buildIsotopes);
00135 
00136 private:
00137 
00138   G4String   elmSymbol     [maxNumElements];
00139   G4double   atomicMass    [maxNumElements];  // amu
00140   G4double   bindingEnergy [maxNumElements];
00141   G4int      nIsotopes     [maxNumElements];
00142   G4int      nFirstIsotope [maxNumElements];
00143   G4int      idxIsotopes   [maxNumElements];
00144 
00145   G4int      elmIndex      [maxNumElements];
00146 
00147   G4double   massIsotopes  [maxAbundance];    // G4 units
00148   G4double   sigMass       [maxAbundance];    // G4 units
00149   G4double   relAbundance  [maxAbundance];
00150 
00151   G4int      index;
00152   G4int      verbose;
00153   G4bool     first;
00154 
00155   std::vector<G4String>    elmNames;
00156 };
00157 
00158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00160 
00161 inline G4double G4NistElementBuilder::GetAtomicMassAmu(G4int Z)
00162 {
00163   G4double a = 0.0;
00164   if(Z>0 && Z<maxNumElements) { a = atomicMass[Z]; }
00165   return a;
00166 }
00167 
00168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00169 
00170 inline G4double G4NistElementBuilder::GetIsotopeMass(G4int Z, G4int N)
00171 {
00172   G4double mass = 0.0;
00173   G4int i = N - nFirstIsotope[Z];
00174   if(i >= 0 && i <nIsotopes[Z]) {mass = massIsotopes[i + idxIsotopes[Z]];}
00175   return mass;
00176 }
00177 
00178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00179 
00180 inline G4double G4NistElementBuilder::GetAtomicMass(G4int Z, G4int N)
00181 {
00182   G4double mass = 0.0;
00183   G4int i = N - nFirstIsotope[Z];
00184   if(i >= 0 && i <nIsotopes[Z]) {
00185     mass = massIsotopes[i + idxIsotopes[Z]] + Z*CLHEP::electron_mass_c2 - bindingEnergy[Z]; 
00186   }
00187   return mass;
00188 }
00189 
00190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00191 
00192 inline 
00193 G4double G4NistElementBuilder::GetTotalElectronBindingEnergy(G4int Z) const
00194 {
00195   return bindingEnergy[Z];
00196 }
00197 
00198 
00199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00200 
00201 inline G4double G4NistElementBuilder::GetIsotopeAbundance(G4int Z, G4int N)
00202 {
00203   G4double x = 0.0;
00204   G4int i = N - nFirstIsotope[Z];
00205   if(i >= 0 && i <nIsotopes[Z]) {x = relAbundance[i + idxIsotopes[Z]];}
00206   return x;
00207 }
00208 
00209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00210 
00211 inline G4int G4NistElementBuilder::GetNistFirstIsotopeN(G4int Z) 
00212 {
00213   return nFirstIsotope[Z];
00214 }
00215 
00216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00217 
00218 inline G4int G4NistElementBuilder::GetNumberOfNistIsotopes(G4int Z) 
00219 {
00220   return nIsotopes[Z];
00221 }
00222 
00223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00224 
00225 inline 
00226 const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
00227 {
00228   return elmNames;
00229 }
00230 
00231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00232 
00233 inline G4int G4NistElementBuilder::GetMaxNumElements() 
00234 {
00235   return maxNumElements-1;
00236 }
00237 
00238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00239 
00240 inline void G4NistElementBuilder::SetVerbose(G4int val) 
00241 {
00242   verbose = val;
00243 }
00244 
00245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00246 
00247 
00248 #endif

Generated on Mon May 27 17:49:05 2013 for Geant4 by  doxygen 1.4.7