| [822] | 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.13 2007/07/26 18:52:12 vnivanch Exp $
|
|---|
| 27 | // GEANT4 tag $Name: $
|
|---|
| 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.Ivanchneko add GetAtomicMassAmu
|
|---|
| 44 | // 17.10.06 V.Ivanchneko add GetAtomicMass and GetNistElementNames methods
|
|---|
| 45 | // 02.05.07 V.Ivanchneko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes
|
|---|
| 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 "globals.hh"
|
|---|
| 57 | #include "G4AtomicShells.hh"
|
|---|
| 58 | #include <vector>
|
|---|
| 59 |
|
|---|
| 60 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 61 |
|
|---|
| 62 | const G4int maxNumElements = 108;
|
|---|
| 63 | const G4int maxAbundance = 3500;
|
|---|
| 64 |
|
|---|
| 65 | class G4Element;
|
|---|
| 66 |
|
|---|
| 67 | class G4NistElementBuilder
|
|---|
| 68 | {
|
|---|
| 69 | public:
|
|---|
| 70 | G4NistElementBuilder(G4int vb);
|
|---|
| 71 | ~G4NistElementBuilder();
|
|---|
| 72 |
|
|---|
| 73 | G4int GetZ (const G4String& symb);
|
|---|
| 74 | G4double GetA (G4int Z);
|
|---|
| 75 | G4double GetIsotopeMass (G4int Z, G4int N);
|
|---|
| 76 | G4double GetAtomicMass (G4int Z, G4int N);
|
|---|
| 77 |
|
|---|
| 78 | G4double GetIsotopeAbundance (G4int Z, G4int N);
|
|---|
| 79 |
|
|---|
| 80 | G4int GetNistFirstIsotopeN(G4int Z);
|
|---|
| 81 | G4int GetNumberOfNistIsotopes(G4int Z);
|
|---|
| 82 |
|
|---|
| 83 | G4int GetMaxNumElements();
|
|---|
| 84 |
|
|---|
| 85 | void SetVerbose (G4int);
|
|---|
| 86 | void PrintElement (G4int Z);
|
|---|
| 87 |
|
|---|
| 88 | // Find or build a G4Element by atomic number
|
|---|
| 89 | G4Element* FindOrBuildElement (G4int Z, G4bool buildIsotopes = true);
|
|---|
| 90 |
|
|---|
| 91 | // Find or build a G4Element by symbol
|
|---|
| 92 | G4Element* FindOrBuildElement (const G4String& symb,
|
|---|
| 93 | G4bool buildIsotopes = true);
|
|---|
| 94 |
|
|---|
| 95 | // Return reference to vector of element names
|
|---|
| 96 | const std::vector<G4String>& GetElementNames() const;
|
|---|
| 97 |
|
|---|
| 98 | private:
|
|---|
| 99 |
|
|---|
| 100 | void Initialise();
|
|---|
| 101 |
|
|---|
| 102 | void AddElement(const G4String& symbol, G4int Z, G4int nc, const G4int& N,
|
|---|
| 103 | const G4double& A, const G4double& sA, const G4double& W);
|
|---|
| 104 |
|
|---|
| 105 | // Build a G4Element from dataBase
|
|---|
| 106 | G4Element* BuildElement(G4int Z, G4bool buildIsotopes);
|
|---|
| 107 |
|
|---|
| 108 | private:
|
|---|
| 109 |
|
|---|
| 110 | G4String elmSymbol [maxNumElements];
|
|---|
| 111 | G4double atomicMass [maxNumElements];
|
|---|
| 112 | G4int nIsotopes [maxNumElements];
|
|---|
| 113 | G4int nFirstIsotope [maxNumElements];
|
|---|
| 114 | G4int idxIsotopes [maxNumElements];
|
|---|
| 115 |
|
|---|
| 116 | G4int elmIndex [maxNumElements];
|
|---|
| 117 |
|
|---|
| 118 | G4double massIsotopes [maxAbundance];
|
|---|
| 119 | G4double sigMass [maxAbundance];
|
|---|
| 120 | G4double relAbundance [maxAbundance];
|
|---|
| 121 |
|
|---|
| 122 | G4int limitNumElements; // protection
|
|---|
| 123 | G4int index;
|
|---|
| 124 | G4int verbose;
|
|---|
| 125 | G4bool first;
|
|---|
| 126 |
|
|---|
| 127 | std::vector<G4String> elmNames;
|
|---|
| 128 | G4AtomicShells aShell;
|
|---|
| 129 | };
|
|---|
| 130 |
|
|---|
| 131 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 132 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 133 |
|
|---|
| 134 | inline G4int G4NistElementBuilder::GetZ(const G4String& name)
|
|---|
| 135 | {
|
|---|
| 136 | G4int Z = maxNumElements;
|
|---|
| 137 | do {Z--;} while( Z>0 && elmSymbol[Z] != name);
|
|---|
| 138 | return Z;
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 142 |
|
|---|
| 143 | inline G4double G4NistElementBuilder::GetA(G4int Z)
|
|---|
| 144 | {
|
|---|
| 145 | G4double a = 0.0;
|
|---|
| 146 | if(Z>0 && Z<maxNumElements) a = atomicMass[Z];
|
|---|
| 147 | return a;
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 151 |
|
|---|
| 152 | inline G4double G4NistElementBuilder::GetIsotopeMass(G4int Z, G4int N)
|
|---|
| 153 | {
|
|---|
| 154 | G4double m = 0.0;
|
|---|
| 155 | G4int i = N - nFirstIsotope[Z];
|
|---|
| 156 | if(i >= 0 && i <nIsotopes[Z])
|
|---|
| 157 | m = massIsotopes[i + idxIsotopes[Z]]*amu_c2
|
|---|
| 158 | - Z*electron_mass_c2 + aShell.GetTotalBindingEnergy(Z);
|
|---|
| 159 | return m;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 163 |
|
|---|
| 164 | inline G4double G4NistElementBuilder::GetAtomicMass(G4int Z, G4int N)
|
|---|
| 165 | {
|
|---|
| 166 | G4double m = 0.0;
|
|---|
| 167 | G4int i = N - nFirstIsotope[Z];
|
|---|
| 168 | if(i >= 0 && i <nIsotopes[Z])
|
|---|
| 169 | m = massIsotopes[i + idxIsotopes[Z]]*amu_c2;
|
|---|
| 170 | return m;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 174 |
|
|---|
| 175 | inline G4double G4NistElementBuilder::GetIsotopeAbundance(G4int Z, G4int N)
|
|---|
| 176 | {
|
|---|
| 177 | G4double x = 0.0;
|
|---|
| 178 | G4int i = N - nFirstIsotope[Z];
|
|---|
| 179 | if(i >= 0 && i <nIsotopes[Z]) x = relAbundance[i + idxIsotopes[Z]];
|
|---|
| 180 | return x;
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 184 |
|
|---|
| 185 | inline G4int G4NistElementBuilder::GetNistFirstIsotopeN(G4int Z)
|
|---|
| 186 | {
|
|---|
| 187 | return nFirstIsotope[Z];
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 191 |
|
|---|
| 192 | inline G4int G4NistElementBuilder::GetNumberOfNistIsotopes(G4int Z)
|
|---|
| 193 | {
|
|---|
| 194 | return nIsotopes[Z];
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 198 |
|
|---|
| 199 | inline
|
|---|
| 200 | const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
|
|---|
| 201 | {
|
|---|
| 202 | return elmNames;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 206 |
|
|---|
| 207 | inline G4int G4NistElementBuilder::GetMaxNumElements()
|
|---|
| 208 | {
|
|---|
| 209 | return maxNumElements-1;
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 213 |
|
|---|
| 214 | inline void G4NistElementBuilder::SetVerbose(G4int val)
|
|---|
| 215 | {
|
|---|
| 216 | verbose = val;
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 | #endif
|
|---|