Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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::G4NistElementBuilder ( G4int  vb)

Definition at line 66 of file G4NistElementBuilder.cc.

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}
const G4int maxNumElements
int G4int
Definition: G4Types.hh:66

◆ ~G4NistElementBuilder()

G4NistElementBuilder::~G4NistElementBuilder ( )

Definition at line 78 of file G4NistElementBuilder.cc.

79{}

Member Function Documentation

◆ FindOrBuildElement() [1/2]

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

Definition at line 101 of file G4NistElementBuilder.cc.

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

◆ FindOrBuildElement() [2/2]

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

Definition at line 122 of file G4NistElementBuilder.cc.

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

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

◆ GetAtomicMass()

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

Definition at line 180 of file G4NistElementBuilder.hh.

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]] + Z*CLHEP::electron_mass_c2 - bindingEnergy[Z];
186 }
187 return mass;
188}
double G4double
Definition: G4Types.hh:64

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

◆ GetAtomicMassAmu() [1/2]

G4double G4NistElementBuilder::GetAtomicMassAmu ( const G4String symb)

Definition at line 92 of file G4NistElementBuilder.cc.

93{
95 do {--Z;} while( Z>0 && elmSymbol[Z] != name);
96 return GetAtomicMassAmu(Z);
97}
G4double GetAtomicMassAmu(const G4String &symb)

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

◆ GetAtomicMassAmu() [2/2]

G4double G4NistElementBuilder::GetAtomicMassAmu ( G4int  Z)
inline

Definition at line 161 of file G4NistElementBuilder.hh.

162{
163 G4double a = 0.0;
164 if(Z>0 && Z<maxNumElements) { a = atomicMass[Z]; }
165 return a;
166}

◆ GetElementNames()

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

Definition at line 226 of file G4NistElementBuilder.hh.

227{
228 return elmNames;
229}

Referenced by G4NistManager::GetNistElementNames().

◆ GetIsotopeAbundance()

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

Definition at line 201 of file G4NistElementBuilder.hh.

202{
203 G4double x = 0.0;
204 G4int i = N - nFirstIsotope[Z];
205 if(i >= 0 && i <nIsotopes[Z]) {x = relAbundance[i + idxIsotopes[Z]];}
206 return x;
207}

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

◆ GetIsotopeMass()

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

Definition at line 170 of file G4NistElementBuilder.hh.

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}

Referenced by G4NistManager::GetIsotopeMass().

◆ GetMaxNumElements()

G4int G4NistElementBuilder::GetMaxNumElements ( )
inline

Definition at line 233 of file G4NistElementBuilder.hh.

234{
235 return maxNumElements-1;
236}

◆ GetNistFirstIsotopeN()

G4int G4NistElementBuilder::GetNistFirstIsotopeN ( G4int  Z)
inline

◆ GetNumberOfNistIsotopes()

G4int G4NistElementBuilder::GetNumberOfNistIsotopes ( G4int  Z)
inline

◆ GetTotalElectronBindingEnergy()

G4double G4NistElementBuilder::GetTotalElectronBindingEnergy ( G4int  Z) const
inline

Definition at line 193 of file G4NistElementBuilder.hh.

194{
195 return bindingEnergy[Z];
196}

Referenced by G4NistManager::GetTotalElectronBindingEnergy().

◆ GetZ()

G4int G4NistElementBuilder::GetZ ( const G4String symb)

Definition at line 83 of file G4NistElementBuilder.cc.

84{
86 do {--Z;} while( Z>0 && elmSymbol[Z] != name);
87 return Z;
88}

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

◆ PrintElement()

void G4NistElementBuilder::PrintElement ( G4int  Z)

Definition at line 201 of file G4NistElementBuilder.cc.

202{
203 G4int imin = Z;
204 G4int imax = Z+1;
205 if (Z == 0) {
206 imin = 1;
207 imax = maxNumElements;
208 }
209 if(imax > maxNumElements) { imax = maxNumElements; }
210
211 for(G4int i=imin; i<imax; ++i) {
212 G4int nc = nIsotopes[i];
213 G4cout << "Nist Element: <" << elmSymbol[i]
214 << "> Z= " << i
215 << " Aeff(amu)= " << atomicMass[i] << " "
216 << nc << " isotopes:"
217 << G4endl;
218 G4int j;
219 G4int idx = idxIsotopes[i];
220 G4int n0 = nFirstIsotope[i];
221 G4cout << " N: ";
222 for(j=0; j<nc; ++j) {G4cout << n0 + j << " ";}
223 G4cout << G4endl;
224 G4cout << " mass(amu): ";
225 for(j=0; j<nc; ++j) {G4cout << GetAtomicMass(i, n0 + j) << " ";}
226 G4cout << G4endl;
227 G4cout << " abanbance: ";
228 for(j=0; j<nc; ++j) {G4cout << relAbundance[idx + j] << " ";}
229 G4cout << G4endl;
230 }
231}
G4double GetAtomicMass(G4int Z, G4int N)

Referenced by G4NistManager::PrintElement().

◆ SetVerbose()

void G4NistElementBuilder::SetVerbose ( G4int  val)
inline

Definition at line 240 of file G4NistElementBuilder.hh.

241{
242 verbose = val;
243}

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


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