Geant4 11.1.1
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 ()=default
 
G4ElementFindElement (G4int Z) const
 
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 67 of file G4NistElementBuilder.hh.

Constructor & Destructor Documentation

◆ G4NistElementBuilder()

G4NistElementBuilder::G4NistElementBuilder ( G4int  vb)
explicit

Definition at line 70 of file G4NistElementBuilder.cc.

70 :
71 verbose(vb)
72{
73 nFirstIsotope[0] = 0;
74 nIsotopes[0] = 0;
75 relAbundance[0] = 0.0;
76 Initialise();
77 for(int& i : elmIndex)
78 {
79 i = -1;
80 }
81}

◆ ~G4NistElementBuilder()

G4NistElementBuilder::~G4NistElementBuilder ( )
default

Member Function Documentation

◆ FindElement()

G4Element * G4NistElementBuilder::FindElement ( G4int  Z) const
inline

Definition at line 251 of file G4NistElementBuilder.hh.

252{
253 const G4ElementTable* theElementTable = G4Element::GetElementTable();
254 return (Z > 0 && Z < maxNumElements && elmIndex[Z] >= 0) ?
255 (*theElementTable)[elmIndex[Z]] : nullptr;
256}
std::vector< G4Element * > G4ElementTable
const G4int maxNumElements
const G4int Z[17]
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:403

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

◆ FindOrBuildElement() [1/2]

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

Definition at line 117 of file G4NistElementBuilder.cc.

118{
119 G4Element* elm = nullptr;
120 const G4ElementTable* theElementTable = G4Element::GetElementTable();
121 size_t nelm = theElementTable->size();
122 for(size_t i=0; i<nelm; ++i) {
123 if(symb == ((*theElementTable)[i])->GetSymbol()) {
124 elm = (*theElementTable)[i];
125 break;
126 }
127 }
128 if(nullptr == elm) {
129 for(G4int Z = 1; Z<maxNumElements; ++Z) {
130 if(symb == elmSymbol[Z]) {
131 elm = BuildElement(Z);
132 break;
133 }
134 }
135 }
136 return elm;
137}
int G4int
Definition: G4Types.hh:85

◆ FindOrBuildElement() [2/2]

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

Definition at line 105 of file G4NistElementBuilder.cc.

106{
107 G4Element* anElement = FindElement(Z);
108 if(anElement == nullptr && Z > 0 && Z < maxNumElements) {
109 anElement = BuildElement(Z);
110 }
111 return anElement;
112}
G4Element * FindElement(G4int Z) const

Referenced by G4NistManager::FindOrBuildElement().

◆ GetAtomicMass()

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

Definition at line 178 of file G4NistElementBuilder.hh.

179{
180 G4double mass = 0.0;
181 if(Z > 0 && Z < maxNumElements) {
182 G4int i = N - nFirstIsotope[Z];
183 if(i >= 0 && i <nIsotopes[Z]) {
184 mass = massIsotopes[i + idxIsotopes[Z]] +
185 Z*CLHEP::electron_mass_c2 - bindingEnergy[Z];
186 }
187 }
188 return mass;
189}
double G4double
Definition: G4Types.hh:83
#define N
Definition: crc32.c:56

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

◆ GetAtomicMassAmu() [1/2]

G4double G4NistElementBuilder::GetAtomicMassAmu ( const G4String symb) const

Definition at line 95 of file G4NistElementBuilder.cc.

96{
98 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
99 do {--Z;} while( Z>0 && elmSymbol[Z] != name);
100 return GetAtomicMassAmu(Z);
101}
G4double GetAtomicMassAmu(const G4String &symb) const

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

◆ GetAtomicMassAmu() [2/2]

G4double G4NistElementBuilder::GetAtomicMassAmu ( G4int  Z) const
inline

Definition at line 159 of file G4NistElementBuilder.hh.

160{
161 return (Z>0 && Z<maxNumElements) ? atomicMass[Z] : 0.0;
162}

◆ GetElementNames()

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

Definition at line 230 of file G4NistElementBuilder.hh.

231{
232 return elmNames;
233}

Referenced by G4NistManager::GetNistElementNames().

◆ GetIsotopeAbundance()

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

Definition at line 203 of file G4NistElementBuilder.hh.

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

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

◆ GetIsotopeMass()

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

Definition at line 166 of file G4NistElementBuilder.hh.

167{
168 G4double mass = 0.0;
169 if(Z > 0 && Z < maxNumElements) {
170 G4int i = N - nFirstIsotope[Z];
171 if(i >= 0 && i <nIsotopes[Z]) {mass = massIsotopes[i + idxIsotopes[Z]];}
172 }
173 return mass;
174}

Referenced by G4NistManager::GetIsotopeMass().

◆ GetMaxNumElements()

G4int G4NistElementBuilder::GetMaxNumElements ( ) const
inline

Definition at line 237 of file G4NistElementBuilder.hh.

238{
239 return maxNumElements-1;
240}

◆ GetNistFirstIsotopeN()

G4int G4NistElementBuilder::GetNistFirstIsotopeN ( G4int  Z) const
inline

Definition at line 215 of file G4NistElementBuilder.hh.

216{
217 return (Z > 0 && Z < maxNumElements) ? nFirstIsotope[Z] : 0;
218}

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

◆ GetNumberOfNistIsotopes()

G4int G4NistElementBuilder::GetNumberOfNistIsotopes ( G4int  Z) const
inline

◆ GetTotalElectronBindingEnergy()

G4double G4NistElementBuilder::GetTotalElectronBindingEnergy ( G4int  Z) const
inline

Definition at line 194 of file G4NistElementBuilder.hh.

195{
196 return (Z > 0 && Z < maxNumElements) ? bindingEnergy[Z] : 0.0;
197}

Referenced by G4NistManager::GetTotalElectronBindingEnergy().

◆ GetZ()

G4int G4NistElementBuilder::GetZ ( const G4String symb) const

Definition at line 85 of file G4NistElementBuilder.cc.

86{
88 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
89 do {--Z;} while( Z>0 && elmSymbol[Z] != name);
90 return Z;
91}

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

◆ PrintElement()

void G4NistElementBuilder::PrintElement ( G4int  Z) const

Definition at line 197 of file G4NistElementBuilder.cc.

198{
199 G4int imin = Z;
200 G4int imax = Z+1;
201 if (Z == 0) {
202 imin = 1;
203 imax = maxNumElements;
204 }
205 if(imax > maxNumElements) { imax = maxNumElements; }
206
207 for(G4int i=imin; i<imax; ++i) {
208 G4int nc = nIsotopes[i];
209 G4cout << "Nist Element: <" << elmSymbol[i]
210 << "> Z= " << i
211 << " Aeff(amu)= " << atomicMass[i] << " "
212 << nc << " isotopes:"
213 << G4endl;
214 G4int j;
215 G4int idx = idxIsotopes[i];
216 G4int n0 = nFirstIsotope[i];
217 G4cout << " N: ";
218 for(j=0; j<nc; ++j) {G4cout << n0 + j << " ";}
219 G4cout << G4endl;
220 G4cout << " mass(amu): ";
221 for(j=0; j<nc; ++j) {G4cout << GetAtomicMass(i, n0 + j) << " ";}
222 G4cout << G4endl;
223 G4cout << " abundance: ";
224 for(j=0; j<nc; ++j) {G4cout << relAbundance[idx + j] << " ";}
225 G4cout << G4endl;
226 }
227}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4double GetAtomicMass(G4int Z, G4int N) const

Referenced by G4NistManager::PrintElement().

◆ SetVerbose()

void G4NistElementBuilder::SetVerbose ( G4int  val)
inline

Definition at line 244 of file G4NistElementBuilder.hh.

245{
246 verbose = val;
247}

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


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