Geant4 11.2.2
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 63 of file G4NistElementBuilder.hh.

Constructor & Destructor Documentation

◆ G4NistElementBuilder()

G4NistElementBuilder::G4NistElementBuilder ( G4int vb)
explicit

Definition at line 67 of file G4NistElementBuilder.cc.

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

◆ ~G4NistElementBuilder()

G4NistElementBuilder::~G4NistElementBuilder ( )
default

Member Function Documentation

◆ FindElement()

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

Definition at line 234 of file G4NistElementBuilder.hh.

235{
236 const G4ElementTable* theElementTable = G4Element::GetElementTable();
237 return (Z > 0 && Z < maxNumElements && elmIndex[Z] >= 0) ? (*theElementTable)[elmIndex[Z]]
238 : nullptr;
239}
std::vector< G4Element * > G4ElementTable
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389

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

◆ FindOrBuildElement() [1/2]

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

Definition at line 115 of file G4NistElementBuilder.cc.

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

◆ FindOrBuildElement() [2/2]

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

Definition at line 104 of file G4NistElementBuilder.cc.

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

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

◆ GetAtomicMass()

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

Definition at line 170 of file G4NistElementBuilder.hh.

171{
172 G4double mass = 0.0;
173 if (Z > 0 && Z < maxNumElements) {
174 G4int i = N - nFirstIsotope[Z];
175 if (i >= 0 && i < nIsotopes[Z]) {
176 mass = massIsotopes[i + idxIsotopes[Z]] + Z * CLHEP::electron_mass_c2 - bindingEnergy[Z];
177 }
178 }
179 return mass;
180}
double G4double
Definition G4Types.hh:83
#define N
Definition crc32.c:57

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

◆ GetAtomicMassAmu() [1/2]

G4double G4NistElementBuilder::GetAtomicMassAmu ( const G4String & symb) const

Definition at line 92 of file G4NistElementBuilder.cc.

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

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

◆ GetAtomicMassAmu() [2/2]

G4double G4NistElementBuilder::GetAtomicMassAmu ( G4int Z) const
inline

Definition at line 149 of file G4NistElementBuilder.hh.

150{
151 return (Z > 0 && Z < maxNumElements) ? atomicMass[Z] : 0.0;
152}

◆ GetElementNames()

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

Definition at line 219 of file G4NistElementBuilder.hh.

220{
221 return elmNames;
222}

Referenced by G4NistManager::GetNistElementNames().

◆ GetIsotopeAbundance()

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

Definition at line 191 of file G4NistElementBuilder.hh.

192{
193 G4double x = 0.0;
194 if (Z > 0 && Z < maxNumElements) {
195 G4int i = N - nFirstIsotope[Z];
196 if (i >= 0 && i < nIsotopes[Z]) {
197 x = relAbundance[i + idxIsotopes[Z]];
198 }
199 }
200 return x;
201}

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 156 of file G4NistElementBuilder.hh.

157{
158 G4double mass = 0.0;
159 if (Z > 0 && Z < maxNumElements) {
160 G4int i = N - nFirstIsotope[Z];
161 if (i >= 0 && i < nIsotopes[Z]) {
162 mass = massIsotopes[i + idxIsotopes[Z]];
163 }
164 }
165 return mass;
166}

Referenced by G4NistManager::GetIsotopeMass().

◆ GetMaxNumElements()

G4int G4NistElementBuilder::GetMaxNumElements ( ) const
inline

Definition at line 226 of file G4NistElementBuilder.hh.

226{ return maxNumElements - 1; }

◆ GetNistFirstIsotopeN()

G4int G4NistElementBuilder::GetNistFirstIsotopeN ( G4int Z) const
inline

Definition at line 205 of file G4NistElementBuilder.hh.

206{
207 return (Z > 0 && Z < maxNumElements) ? nFirstIsotope[Z] : 0;
208}

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

◆ GetNumberOfNistIsotopes()

G4int G4NistElementBuilder::GetNumberOfNistIsotopes ( G4int Z) const
inline

Definition at line 212 of file G4NistElementBuilder.hh.

213{
214 return (Z > 0 && Z < maxNumElements) ? nIsotopes[Z] : 0;
215}

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

◆ GetTotalElectronBindingEnergy()

G4double G4NistElementBuilder::GetTotalElectronBindingEnergy ( G4int Z) const
inline

Definition at line 184 of file G4NistElementBuilder.hh.

185{
186 return (Z > 0 && Z < maxNumElements) ? bindingEnergy[Z] : 0.0;
187}

Referenced by G4NistManager::GetTotalElectronBindingEnergy().

◆ GetZ()

G4int G4NistElementBuilder::GetZ ( const G4String & symb) const

Definition at line 80 of file G4NistElementBuilder.cc.

81{
83 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
84 do {
85 --Z;
86 } while (Z > 0 && elmSymbol[Z] != name);
87 return Z;
88}

Referenced by G4NistMaterialBuilder::ConstructNewIdealGasMaterial(), G4NistMaterialBuilder::ConstructNewMaterial(), 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) {
206 imax = maxNumElements;
207 }
208
209 for (G4int i = imin; i < imax; ++i) {
210 G4int nc = nIsotopes[i];
211 G4cout << "Nist Element: <" << elmSymbol[i] << "> Z= " << i << " Aeff(amu)= " << atomicMass[i]
212 << " " << nc << " isotopes:" << G4endl;
213 G4int j;
214 G4int idx = idxIsotopes[i];
215 G4int n0 = nFirstIsotope[i];
216 G4cout << " N: ";
217 for (j = 0; j < nc; ++j) {
218 G4cout << n0 + j << " ";
219 }
220 G4cout << G4endl;
221 G4cout << " mass(amu): ";
222 for (j = 0; j < nc; ++j) {
223 G4cout << GetAtomicMass(i, n0 + j) << " ";
224 }
225 G4cout << G4endl;
226 G4cout << " abundance: ";
227 for (j = 0; j < nc; ++j) {
228 G4cout << relAbundance[idx + j] << " ";
229 }
230 G4cout << G4endl;
231 }
232}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4double GetAtomicMass(G4int Z, G4int N) const

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

◆ SetVerbose()

void G4NistElementBuilder::SetVerbose ( G4int val)
inline

Definition at line 230 of file G4NistElementBuilder.hh.

230{ verbose = val; }

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


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