G4NistElementBuilder Class Reference

#include <G4NistElementBuilder.hh>


Public Member Functions

 G4NistElementBuilder (G4int vb)
 ~G4NistElementBuilder ()
G4ElementFindOrBuildElement (G4int Z, G4bool buildIsotopes=true)
G4ElementFindOrBuildElement (const G4String &symb, G4bool buildIsotopes=true)
void PrintElement (G4int Z)
const std::vector< G4String > & GetElementNames () const
G4int GetZ (const G4String &symb)
G4double GetAtomicMassAmu (const G4String &symb)
G4double GetAtomicMassAmu (G4int Z)
G4double GetIsotopeMass (G4int Z, G4int N)
G4double GetAtomicMass (G4int Z, G4int N)
G4double GetTotalElectronBindingEnergy (G4int Z) const
G4double GetIsotopeAbundance (G4int Z, G4int N)
G4int GetNistFirstIsotopeN (G4int Z)
G4int GetNumberOfNistIsotopes (G4int Z)
G4int GetMaxNumElements ()
void SetVerbose (G4int)


Detailed Description

Definition at line 69 of file G4NistElementBuilder.hh.


Constructor & Destructor Documentation

G4NistElementBuilder::G4NistElementBuilder ( G4int  vb  ) 

Definition at line 66 of file G4NistElementBuilder.cc.

References maxNumElements.

00066                                                   :
00067   verbose(vb), first(true)
00068 {
00069   nFirstIsotope[0] = 0;
00070   nIsotopes[0] = 0;
00071   relAbundance[0] = 0.0;
00072   Initialise();
00073   for(G4int i=0; i<maxNumElements; ++i) {elmIndex[i] = -1;}
00074 }

G4NistElementBuilder::~G4NistElementBuilder (  ) 

Definition at line 78 of file G4NistElementBuilder.cc.

00079 {}


Member Function Documentation

G4Element * G4NistElementBuilder::FindOrBuildElement ( const G4String symb,
G4bool  buildIsotopes = true 
)

Definition at line 101 of file G4NistElementBuilder.cc.

References FindOrBuildElement(), G4cout, G4endl, and maxNumElements.

00103 {
00104   if(first) {
00105     if(verbose > 0) {
00106       G4cout << "### NIST DataBase for Elements is used" << G4endl;
00107     }
00108     first = false;
00109   }
00110   G4Element* elm = 0;
00111   for(G4int Z = 1; Z<maxNumElements; ++Z) {
00112     if(symb == elmSymbol[Z]) { 
00113       elm = FindOrBuildElement(Z, buildIsotopes);
00114       break;
00115     }
00116   }
00117   return elm;
00118 }

G4Element * G4NistElementBuilder::FindOrBuildElement ( G4int  Z,
G4bool  buildIsotopes = true 
)

Definition at line 122 of file G4NistElementBuilder.cc.

References G4Element::GetElementTable(), G4Element::GetIndex(), and maxNumElements.

Referenced by G4NistManager::FindOrBuildElement(), and FindOrBuildElement().

00124 {
00125   G4Element* anElement = 0;
00126   if(Z <= 0 || Z >= maxNumElements) { return anElement; }
00127 
00128   // Nist or user defined element does exist
00129   if(elmIndex[Z] >= 0) {
00130     const G4ElementTable* theElementTable = G4Element::GetElementTable();
00131     anElement = (*theElementTable)[elmIndex[Z]];
00132 
00133     // build new element
00134   } else {
00135     anElement = BuildElement(Z, buildIsotopes);
00136     if(anElement) { elmIndex[Z] = anElement->GetIndex(); }
00137   }  
00138   return anElement;
00139 }

G4double G4NistElementBuilder::GetAtomicMass ( G4int  Z,
G4int  N 
) [inline]

Definition at line 180 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetAtomicMass(), and PrintElement().

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 }

G4double G4NistElementBuilder::GetAtomicMassAmu ( G4int  Z  )  [inline]

Definition at line 161 of file G4NistElementBuilder.hh.

References maxNumElements.

00162 {
00163   G4double a = 0.0;
00164   if(Z>0 && Z<maxNumElements) { a = atomicMass[Z]; }
00165   return a;
00166 }

G4double G4NistElementBuilder::GetAtomicMassAmu ( const G4String symb  ) 

Definition at line 92 of file G4NistElementBuilder.cc.

References maxNumElements.

Referenced by G4NistMaterialBuilder::ConstructNewIdealGasMaterial(), and G4NistManager::GetAtomicMassAmu().

00093 {
00094   G4int Z = maxNumElements;
00095   do {--Z;} while( Z>0 && elmSymbol[Z] != name);
00096   return GetAtomicMassAmu(Z);
00097 }

const std::vector< G4String > & G4NistElementBuilder::GetElementNames (  )  const [inline]

Definition at line 226 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetNistElementNames().

00227 {
00228   return elmNames;
00229 }

G4double G4NistElementBuilder::GetIsotopeAbundance ( G4int  Z,
G4int  N 
) [inline]

Definition at line 201 of file G4NistElementBuilder.hh.

Referenced by G4LENDModel::create_used_target_map(), G4LENDCrossSection::create_used_target_map(), and G4NistManager::GetIsotopeAbundance().

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 }

G4double G4NistElementBuilder::GetIsotopeMass ( G4int  Z,
G4int  N 
) [inline]

Definition at line 170 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetIsotopeMass().

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 }

G4int G4NistElementBuilder::GetMaxNumElements (  )  [inline]

Definition at line 233 of file G4NistElementBuilder.hh.

References maxNumElements.

00234 {
00235   return maxNumElements-1;
00236 }

G4int G4NistElementBuilder::GetNistFirstIsotopeN ( G4int  Z  )  [inline]

Definition at line 211 of file G4NistElementBuilder.hh.

Referenced by G4LENDModel::create_used_target_map(), G4LENDCrossSection::create_used_target_map(), and G4NistManager::GetNistFirstIsotopeN().

00212 {
00213   return nFirstIsotope[Z];
00214 }

G4int G4NistElementBuilder::GetNumberOfNistIsotopes ( G4int  Z  )  [inline]

Definition at line 218 of file G4NistElementBuilder.hh.

Referenced by G4LENDModel::create_used_target_map(), G4LENDCrossSection::create_used_target_map(), and G4NistManager::GetNumberOfNistIsotopes().

00219 {
00220   return nIsotopes[Z];
00221 }

G4double G4NistElementBuilder::GetTotalElectronBindingEnergy ( G4int  Z  )  const [inline]

Definition at line 193 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetTotalElectronBindingEnergy().

00194 {
00195   return bindingEnergy[Z];
00196 }

G4int G4NistElementBuilder::GetZ ( const G4String symb  ) 

Definition at line 83 of file G4NistElementBuilder.cc.

References maxNumElements.

Referenced by G4NistMaterialBuilder::ConstructNewIdealGasMaterial(), G4NistMaterialBuilder::ConstructNewMaterial(), G4NistManager::GetZ(), and G4NistManager::PrintElement().

00084 {
00085   G4int Z = maxNumElements;
00086   do {--Z;} while( Z>0 && elmSymbol[Z] != name);
00087   return Z;
00088 }

void G4NistElementBuilder::PrintElement ( G4int  Z  ) 

Definition at line 201 of file G4NistElementBuilder.cc.

References G4cout, G4endl, GetAtomicMass(), and maxNumElements.

Referenced by G4NistManager::PrintElement().

00202 {
00203   G4int imin = Z;
00204   G4int imax = Z+1;
00205   if (Z == 0) {
00206     imin = 1;
00207     imax = maxNumElements;
00208   }
00209   if(imax > maxNumElements) { imax = maxNumElements; }
00210 
00211   for(G4int i=imin; i<imax; ++i) {
00212     G4int nc = nIsotopes[i];
00213     G4cout << "Nist Element: <" << elmSymbol[i]
00214            << ">  Z= " << i
00215            << "  Aeff(amu)= " << atomicMass[i] << "  "
00216            << nc << " isotopes:"
00217            << G4endl;
00218     G4int j;
00219     G4int idx = idxIsotopes[i];
00220     G4int n0  = nFirstIsotope[i];
00221     G4cout << "             N: ";
00222     for(j=0; j<nc; ++j) {G4cout << n0 + j << "  ";}
00223     G4cout << G4endl;
00224     G4cout << "          mass(amu): ";
00225     for(j=0; j<nc; ++j) {G4cout << GetAtomicMass(i, n0 + j) << " ";}
00226     G4cout << G4endl;
00227     G4cout << "     abanbance: ";
00228     for(j=0; j<nc; ++j) {G4cout << relAbundance[idx + j] << " ";}
00229     G4cout << G4endl;
00230   }
00231 }

void G4NistElementBuilder::SetVerbose ( G4int   )  [inline]

Definition at line 240 of file G4NistElementBuilder.hh.

Referenced by G4NistMaterialBuilder::SetVerbose(), and G4NistManager::SetVerbose().

00241 {
00242   verbose = val;
00243 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:44 2013 for Geant4 by  doxygen 1.4.7