Geant4 10.7.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 ()
 
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 68 of file G4NistElementBuilder.hh.

Constructor & Destructor Documentation

◆ G4NistElementBuilder()

G4NistElementBuilder::G4NistElementBuilder ( G4int  vb)
explicit

Definition at line 68 of file G4NistElementBuilder.cc.

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

◆ ~G4NistElementBuilder()

G4NistElementBuilder::~G4NistElementBuilder ( )

Definition at line 80 of file G4NistElementBuilder.cc.

81{}

Member Function Documentation

◆ FindElement()

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

Definition at line 255 of file G4NistElementBuilder.hh.

256{
257 const G4ElementTable* theElementTable = G4Element::GetElementTable();
258 return (Z > 0 && Z < maxNumElements && elmIndex[Z] >= 0) ?
259 (*theElementTable)[elmIndex[Z]] : nullptr;
260}
std::vector< G4Element * > G4ElementTable
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:397

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

◆ FindOrBuildElement() [1/2]

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

Definition at line 125 of file G4NistElementBuilder.cc.

126{
127 G4Element* elm = nullptr;
128 const G4ElementTable* theElementTable = G4Element::GetElementTable();
129 size_t nelm = theElementTable->size();
130 for(size_t i=0; i<nelm; ++i) {
131 if(symb == ((*theElementTable)[i])->GetSymbol()) {
132 elm = (*theElementTable)[i];
133 break;
134 }
135 }
136 if(nullptr == elm) {
137 for(G4int Z = 1; Z<maxNumElements; ++Z) {
138 if(symb == elmSymbol[Z]) {
139#ifdef G4MULTITHREADED
140 G4MUTEXLOCK(&nistElementMutex);
141#endif
142 if(elmIndex[Z] < 0) { elm = BuildElement(Z); }
143 if(elm) { elmIndex[Z] = elm->GetIndex(); }
144#ifdef G4MULTITHREADED
145 G4MUTEXUNLOCK(&nistElementMutex);
146#endif
147 break;
148 }
149 }
150 }
151 return elm;
152}
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
size_t GetIndex() const
Definition: G4Element.hh:181

◆ 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#ifdef G4MULTITHREADED
110 G4MUTEXLOCK(&nistElementMutex);
111#endif
112 if(elmIndex[Z] < 0) { anElement = BuildElement(Z); }
113 if(anElement) { elmIndex[Z] = anElement->GetIndex(); }
114#ifdef G4MULTITHREADED
115 G4MUTEXUNLOCK(&nistElementMutex);
116#endif
117 }
118 return anElement;
119}
G4Element * FindElement(G4int Z) const

Referenced by G4NistManager::FindOrBuildElement().

◆ GetAtomicMass()

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

Definition at line 182 of file G4NistElementBuilder.hh.

183{
184 G4double mass = 0.0;
185 if(Z > 0 && Z < maxNumElements) {
186 G4int i = N - nFirstIsotope[Z];
187 if(i >= 0 && i <nIsotopes[Z]) {
188 mass = massIsotopes[i + idxIsotopes[Z]] +
189 Z*CLHEP::electron_mass_c2 - bindingEnergy[Z];
190 }
191 }
192 return mass;
193}
double G4double
Definition: G4Types.hh:83

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

164{
165 return (Z>0 && Z<maxNumElements) ? atomicMass[Z] : 0.0;
166}

◆ GetElementNames()

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

Definition at line 234 of file G4NistElementBuilder.hh.

235{
236 return elmNames;
237}

Referenced by G4NistManager::GetNistElementNames().

◆ GetIsotopeAbundance()

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

Definition at line 207 of file G4NistElementBuilder.hh.

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

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 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]) {mass = massIsotopes[i + idxIsotopes[Z]];}
176 }
177 return mass;
178}

Referenced by G4NistManager::GetIsotopeMass().

◆ GetMaxNumElements()

G4int G4NistElementBuilder::GetMaxNumElements ( ) const
inline

Definition at line 241 of file G4NistElementBuilder.hh.

242{
243 return maxNumElements-1;
244}

◆ GetNistFirstIsotopeN()

G4int G4NistElementBuilder::GetNistFirstIsotopeN ( G4int  Z) const
inline

Definition at line 219 of file G4NistElementBuilder.hh.

220{
221 return (Z > 0 && Z < maxNumElements) ? nFirstIsotope[Z] : 0;
222}

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

227{
228 return (Z > 0 && Z < maxNumElements) ? nIsotopes[Z] : 0;
229}

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

199{
200 return (Z > 0 && Z < maxNumElements) ? bindingEnergy[Z] : 0.0;
201}

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 203 of file G4NistElementBuilder.cc.

204{
205 G4int imin = Z;
206 G4int imax = Z+1;
207 if (Z == 0) {
208 imin = 1;
209 imax = maxNumElements;
210 }
211 if(imax > maxNumElements) { imax = maxNumElements; }
212
213 for(G4int i=imin; i<imax; ++i) {
214 G4int nc = nIsotopes[i];
215 G4cout << "Nist Element: <" << elmSymbol[i]
216 << "> Z= " << i
217 << " Aeff(amu)= " << atomicMass[i] << " "
218 << nc << " isotopes:"
219 << G4endl;
220 G4int j;
221 G4int idx = idxIsotopes[i];
222 G4int n0 = nFirstIsotope[i];
223 G4cout << " N: ";
224 for(j=0; j<nc; ++j) {G4cout << n0 + j << " ";}
225 G4cout << G4endl;
226 G4cout << " mass(amu): ";
227 for(j=0; j<nc; ++j) {G4cout << GetAtomicMass(i, n0 + j) << " ";}
228 G4cout << G4endl;
229 G4cout << " abundance: ";
230 for(j=0; j<nc; ++j) {G4cout << relAbundance[idx + j] << " ";}
231 G4cout << G4endl;
232 }
233}
#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 248 of file G4NistElementBuilder.hh.

249{
250 verbose = val;
251}

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


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