Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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
 
const std::vector< G4String > & GetElementNames () const
 
G4int GetZ (const G4String &symb) const
 
G4double GetAtomicMassAmu (const G4String &symb) const
 
G4double GetAtomicMassAmu (G4int Z) const
 
G4double GetIsotopeMass (G4int Z, G4int N) const
 
G4double GetAtomicMass (G4int Z, G4int N) const
 
G4double GetTotalElectronBindingEnergy (G4int Z) const
 
G4double GetIsotopeAbundance (G4int Z, G4int N) const
 
G4int GetNistFirstIsotopeN (G4int Z) const
 
G4int GetNumberOfNistIsotopes (G4int Z) const
 
G4int GetMaxNumElements () const
 
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.

66  :
67  verbose(vb), first(true)
68 {
69  nFirstIsotope[0] = 0;
70  nIsotopes[0] = 0;
71  relAbundance[0] = 0.0;
72  Initialise();
73  for(G4int i=0; i<maxNumElements; ++i) {elmIndex[i] = -1;}
74 }
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
G4NistElementBuilder::~G4NistElementBuilder ( )

Definition at line 78 of file G4NistElementBuilder.cc.

79 {}

Member Function Documentation

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

Definition at line 121 of file G4NistElementBuilder.cc.

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

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

122 {
123  G4Element* anElement = 0;
124  if(Z <= 0 || Z >= maxNumElements) { return anElement; }
125 
126  // Nist or user defined element does exist
127  if(elmIndex[Z] >= 0) {
128  const G4ElementTable* theElementTable = G4Element::GetElementTable();
129  anElement = (*theElementTable)[elmIndex[Z]];
130 
131  // build new element
132  } else {
133  anElement = BuildElement(Z);
134  if(anElement) { elmIndex[Z] = anElement->GetIndex(); }
135  }
136  return anElement;
137 }
const G4int maxNumElements
size_t GetIndex() const
Definition: G4Element.hh:181
std::vector< G4Element * > G4ElementTable
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
G4Element * G4NistElementBuilder::FindOrBuildElement ( const G4String symb,
G4bool  buildIsotopes = true 
)

Definition at line 101 of file G4NistElementBuilder.cc.

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

102 {
103  if(first) {
104  if(verbose > 0) {
105  G4cout << "### NIST DataBase for Elements is used" << G4endl;
106  }
107  first = false;
108  }
109  G4Element* elm = 0;
110  for(G4int Z = 1; Z<maxNumElements; ++Z) {
111  if(symb == elmSymbol[Z]) {
112  elm = FindOrBuildElement(Z);
113  break;
114  }
115  }
116  return elm;
117 }
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
G4GLOB_DLL std::ostream G4cout
G4Element * FindOrBuildElement(G4int Z, G4bool buildIsotopes=true)
#define G4endl
Definition: G4ios.hh:61
G4double G4NistElementBuilder::GetAtomicMass ( G4int  Z,
G4int  N 
) const
inline

Definition at line 180 of file G4NistElementBuilder.hh.

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

181 {
182  G4double mass = 0.0;
183  G4int i = N - nFirstIsotope[Z];
184  if(i >= 0 && i <nIsotopes[Z]) {
185  mass = massIsotopes[i + idxIsotopes[Z]] +
186  Z*CLHEP::electron_mass_c2 - bindingEnergy[Z];
187  }
188  return mass;
189 }
int G4int
Definition: G4Types.hh:78
**D E S C R I P T I O N
double G4double
Definition: G4Types.hh:76
G4double G4NistElementBuilder::GetAtomicMassAmu ( const G4String symb) const

Definition at line 92 of file G4NistElementBuilder.cc.

References maxNumElements.

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

93 {
95  do {--Z;} while( Z>0 && elmSymbol[Z] != name);
96  return GetAtomicMassAmu(Z);
97 }
const XML_Char * name
G4double GetAtomicMassAmu(const G4String &symb) const
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
G4double G4NistElementBuilder::GetAtomicMassAmu ( G4int  Z) const
inline

Definition at line 161 of file G4NistElementBuilder.hh.

References test::a, and maxNumElements.

162 {
163  G4double a = 0.0;
164  if(Z>0 && Z<maxNumElements) { a = atomicMass[Z]; }
165  return a;
166 }
const G4int maxNumElements
double G4double
Definition: G4Types.hh:76
const std::vector< G4String > & G4NistElementBuilder::GetElementNames ( ) const
inline

Definition at line 228 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetNistElementNames().

229 {
230  return elmNames;
231 }
G4double G4NistElementBuilder::GetIsotopeAbundance ( G4int  Z,
G4int  N 
) const
inline

Definition at line 203 of file G4NistElementBuilder.hh.

References test::x.

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

204 {
205  G4double x = 0.0;
206  G4int i = N - nFirstIsotope[Z];
207  if(i >= 0 && i <nIsotopes[Z]) {x = relAbundance[i + idxIsotopes[Z]];}
208  return x;
209 }
int G4int
Definition: G4Types.hh:78
**D E S C R I P T I O N
double G4double
Definition: G4Types.hh:76
G4double G4NistElementBuilder::GetIsotopeMass ( G4int  Z,
G4int  N 
) const
inline

Definition at line 170 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetIsotopeMass().

171 {
172  G4double mass = 0.0;
173  G4int i = N - nFirstIsotope[Z];
174  if(i >= 0 && i <nIsotopes[Z]) {mass = massIsotopes[i + idxIsotopes[Z]];}
175  return mass;
176 }
int G4int
Definition: G4Types.hh:78
**D E S C R I P T I O N
double G4double
Definition: G4Types.hh:76
G4int G4NistElementBuilder::GetMaxNumElements ( ) const
inline

Definition at line 235 of file G4NistElementBuilder.hh.

References maxNumElements.

236 {
237  return maxNumElements-1;
238 }
const G4int maxNumElements
G4int G4NistElementBuilder::GetNistFirstIsotopeN ( G4int  Z) const
inline

Definition at line 213 of file G4NistElementBuilder.hh.

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

214 {
215  return nFirstIsotope[Z];
216 }
G4int G4NistElementBuilder::GetNumberOfNistIsotopes ( G4int  Z) const
inline
G4double G4NistElementBuilder::GetTotalElectronBindingEnergy ( G4int  Z) const
inline

Definition at line 194 of file G4NistElementBuilder.hh.

Referenced by G4NistManager::GetTotalElectronBindingEnergy().

195 {
196  return bindingEnergy[Z];
197 }
G4int G4NistElementBuilder::GetZ ( const G4String symb) const

Definition at line 83 of file G4NistElementBuilder.cc.

References maxNumElements.

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

84 {
86  do {--Z;} while( Z>0 && elmSymbol[Z] != name);
87  return Z;
88 }
const XML_Char * name
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
void G4NistElementBuilder::PrintElement ( G4int  Z) const

Definition at line 188 of file G4NistElementBuilder.cc.

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

Referenced by G4NistManager::PrintElement().

189 {
190  G4int imin = Z;
191  G4int imax = Z+1;
192  if (Z == 0) {
193  imin = 1;
194  imax = maxNumElements;
195  }
196  if(imax > maxNumElements) { imax = maxNumElements; }
197 
198  for(G4int i=imin; i<imax; ++i) {
199  G4int nc = nIsotopes[i];
200  G4cout << "Nist Element: <" << elmSymbol[i]
201  << "> Z= " << i
202  << " Aeff(amu)= " << atomicMass[i] << " "
203  << nc << " isotopes:"
204  << G4endl;
205  G4int j;
206  G4int idx = idxIsotopes[i];
207  G4int n0 = nFirstIsotope[i];
208  G4cout << " N: ";
209  for(j=0; j<nc; ++j) {G4cout << n0 + j << " ";}
210  G4cout << G4endl;
211  G4cout << " mass(amu): ";
212  for(j=0; j<nc; ++j) {G4cout << GetAtomicMass(i, n0 + j) << " ";}
213  G4cout << G4endl;
214  G4cout << " abanbance: ";
215  for(j=0; j<nc; ++j) {G4cout << relAbundance[idx + j] << " ";}
216  G4cout << G4endl;
217  }
218 }
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4double GetAtomicMass(G4int Z, G4int N) const
void G4NistElementBuilder::SetVerbose ( G4int  val)
inline

Definition at line 242 of file G4NistElementBuilder.hh.

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

243 {
244  verbose = val;
245 }

The documentation for this class was generated from the following files: