00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef G4NistElementBuilder_h
00029 #define G4NistElementBuilder_h 1
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #include <vector>
00058 #include <CLHEP/Units/PhysicalConstants.h>
00059
00060 #include "globals.hh"
00061
00062
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
00077 G4Element* FindOrBuildElement (G4int Z, G4bool buildIsotopes = true);
00078
00079
00080 G4Element* FindOrBuildElement (const G4String& symb,
00081 G4bool buildIsotopes = true);
00082
00083 void PrintElement (G4int Z);
00084
00085
00086 const std::vector<G4String>& GetElementNames() const;
00087
00088
00089 G4int GetZ(const G4String& symb);
00090
00091
00092 G4double GetAtomicMassAmu(const G4String& symb);
00093
00094
00095
00096 inline G4double GetAtomicMassAmu(G4int Z);
00097
00098
00099 inline G4double GetIsotopeMass(G4int Z, G4int N);
00100
00101
00102
00103 inline G4double GetAtomicMass(G4int Z, G4int N);
00104
00105
00106 inline G4double GetTotalElectronBindingEnergy(G4int Z) const;
00107
00108
00109 inline G4double GetIsotopeAbundance (G4int Z, G4int N);
00110
00111
00112 inline G4int GetNistFirstIsotopeN(G4int Z);
00113
00114
00115 inline G4int GetNumberOfNistIsotopes(G4int Z);
00116
00117
00118 inline G4int GetMaxNumElements();
00119
00120 inline void SetVerbose(G4int);
00121
00122 private:
00123
00124 void Initialise();
00125
00126
00127
00128
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
00134 G4Element* BuildElement(G4int Z, G4bool buildIsotopes);
00135
00136 private:
00137
00138 G4String elmSymbol [maxNumElements];
00139 G4double atomicMass [maxNumElements];
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];
00148 G4double sigMass [maxAbundance];
00149 G4double relAbundance [maxAbundance];
00150
00151 G4int index;
00152 G4int verbose;
00153 G4bool first;
00154
00155 std::vector<G4String> elmNames;
00156 };
00157
00158
00159
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
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
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
00191
00192 inline
00193 G4double G4NistElementBuilder::GetTotalElectronBindingEnergy(G4int Z) const
00194 {
00195 return bindingEnergy[Z];
00196 }
00197
00198
00199
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
00210
00211 inline G4int G4NistElementBuilder::GetNistFirstIsotopeN(G4int Z)
00212 {
00213 return nFirstIsotope[Z];
00214 }
00215
00216
00217
00218 inline G4int G4NistElementBuilder::GetNumberOfNistIsotopes(G4int Z)
00219 {
00220 return nIsotopes[Z];
00221 }
00222
00223
00224
00225 inline
00226 const std::vector<G4String>& G4NistElementBuilder::GetElementNames() const
00227 {
00228 return elmNames;
00229 }
00230
00231
00232
00233 inline G4int G4NistElementBuilder::GetMaxNumElements()
00234 {
00235 return maxNumElements-1;
00236 }
00237
00238
00239
00240 inline void G4NistElementBuilder::SetVerbose(G4int val)
00241 {
00242 verbose = val;
00243 }
00244
00245
00246
00247
00248 #endif