Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NistManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25
26// -------------------------------------------------------------------
27//
28// GEANT4 Class header file
29//
30// File name: G4NistManager
31//
32// Author: Vladimir Ivanchenko
33//
34// Creation date: 23.12.2004
35//
36// Modifications:
37// 27.02.06 V.Ivanchneko add GetAtomicMassAmu and ConstructNewGasMaterial
38// 11.05.06 V.Ivanchneko add warning flag to FindMaterial method
39// 17.10.06 V.Ivanchneko add methods: GetAtomicMass, GetNistElementNames,
40// GetNistMaterialNames
41// 02.05.07 V.Ivanchneko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes
42// 28.07.07 V.Ivanchneko make simple methods inline
43// 28.10.07 V.Ivanchneko add state, T, P to maetrial build
44// 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method
45// 01.11.10 V.Ivanchneko add G4Pow for fast computations
46// 09.02.12 P.Gumplinger add ConstructNewIdealGasMaterial
47//
48// Class Description:
49//
50// A utility static class
51//
52// Element data from the NIST DB on Atomic Weights and Isotope Compositions
53// http://physics.nist.gov/PhysRefData/Compositions/index.html
54//
55// -------------------------------------------------------------------
56
57#ifndef G4NistManager_h
58#define G4NistManager_h 1
59
61#include "G4Material.hh"
64#include "G4Pow.hh"
65#include "globals.hh"
66
68
69#include <vector>
70
71class G4NistMessenger;
72
74{
75 public:
76 static G4NistManager* Instance();
78
79 // Get G4Element by index
80 //
81 inline G4Element* GetElement(size_t index) const;
82
83 // Find or build G4Element by atomic number
84 //
85 inline G4Element* FindElement(G4int Z) const;
86 inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes = true);
87
88 // Find or build G4Element by symbol
89 //
90 inline G4Element* FindOrBuildElement(const G4String& symb, G4bool isotopes = true);
91
92 // Get number of elements
93 //
94 inline size_t GetNumberOfElements() const;
95
96 // Get atomic number by element symbol
97 //
98 inline G4int GetZ(const G4String& symb) const;
99
100 // Get atomic weight by element symbol - mean mass in units of amu of
101 // an atom with electron shell for the natural isotope composition
102 //
103 inline G4double GetAtomicMassAmu(const G4String& symb) const;
104
105 // Get atomic weight in atomic units - mean mass in units of amu of an atom
106 // with electron shell for the natural isotope composition
107 //
108 inline G4double GetAtomicMassAmu(G4int Z) const;
109
110 // Get mass of isotope without electron shell in Geant4 energy units
111 //
112 inline G4double GetIsotopeMass(G4int Z, G4int N) const;
113
114 // Get mass in Geant4 energy units of an atom of a particular isotope
115 // with the electron shell
116 //
117 inline G4double GetAtomicMass(G4int Z, G4int N) const;
118
119 // Get total ionisation energy of an atom
120 //
122
123 // Get N for the first natural isotope
124 //
125 inline G4int GetNistFirstIsotopeN(G4int Z) const;
126
127 // Get number of natural isotopes
128 //
129 inline G4int GetNumberOfNistIsotopes(G4int Z) const;
130
131 // Get natural isotope abundance
132 //
133 inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
134
135 // Print element by Z
136 //
137 inline void PrintElement(G4int Z) const;
138
139 // Print element from internal DB by symbol, if "all" - print all elements
140 //
141 void PrintElement(const G4String&) const;
142
143 // Print G4Element by name, if "all" - print all G4Elements
144 //
145 void PrintG4Element(const G4String&) const;
146
147 // Access to the vector of Geant4 predefined element names
148 //
149 inline const std::vector<G4String>& GetNistElementNames() const;
150
151 // Access mean ionisation energy for atoms (Z <= 98) by its index
152 //
153 inline G4double GetMeanIonisationEnergy(G4int Z) const;
154
155 // Access nominal density by atomic number for simple materials and
156 // by the index for other NIST materials
157 //
158 inline G4double GetNominalDensity(G4int Z) const;
159
160 // Get G4Material by index
161 //
162 inline G4Material* GetMaterial(size_t index) const;
163
164 // Find or build a G4Material by name, from the Geant4 dataBase
165 //
166 inline G4Material* FindMaterial(const G4String& name) const;
168 const G4String& name, G4bool isotopes = true, G4bool warning = false);
169
170 // Find or build a simple material via atomic number
171 //
172 inline G4Material* FindSimpleMaterial(G4int Z) const;
173 inline G4Material* FindOrBuildSimpleMaterial(G4int Z, G4bool warning = false);
174
175 // Build G4Material with user defined name and density on base
176 // of a material from Geant4 dataBase
177 //
178 G4Material* BuildMaterialWithNewDensity(const G4String& name, const G4String& basename,
179 G4double density = 0.0, G4double temp = NTP_Temperature, G4double pres = CLHEP::STP_Pressure);
180
181 // Construct a G4Material from scratch by atome count
182 // temperature and pressure should be consistent with the density
183 //
184 inline G4Material* ConstructNewMaterial(const G4String& name, const std::vector<G4String>& elm,
185 const std::vector<G4int>& nbAtoms, G4double dens, G4bool isotopes = true,
186 G4State state = kStateSolid, G4double temp = NTP_Temperature,
187 G4double pressure = CLHEP::STP_Pressure);
188
189 // Construct a G4Material from scratch by fraction mass
190 // temperature and pressure should be consistent with the density
191 //
192 inline G4Material* ConstructNewMaterial(const G4String& name, const std::vector<G4String>& elm,
193 const std::vector<G4double>& weight, G4double dens, G4bool isotopes = true,
194 G4State state = kStateSolid, G4double temp = NTP_Temperature,
195 G4double pressure = CLHEP::STP_Pressure);
196
197 // Construct a gas G4Material from scratch by atome count
198 //
199 inline G4Material* ConstructNewGasMaterial(const G4String& name, const G4String& nameNist,
200 G4double temp, G4double pres, G4bool isotopes = true);
201
202 // Construct an ideal gas G4Material from scratch by atom count
203 //
205 const std::vector<G4String>& elm, const std::vector<G4int>& nbAtoms, G4bool isotopes = true,
206 G4double temp = NTP_Temperature, G4double pressure = CLHEP::STP_Pressure);
207
208 // enable/disable density effect calculator by material name
209 //
211
212 // enable/disable density effect calculator by material pointer
213 //
215
216 // Get number of G4Materials
217 //
218 inline size_t GetNumberOfMaterials() const;
219
220 inline G4int GetVerbose() const;
221
222 void SetVerbose(G4int);
223
224 // Print G4Material by name
225 //
226 void PrintG4Material(const G4String&) const;
227
228 // Print predefined Geant4 materials:
229 // "simple" - only pure materials in basic state (Z = 1, ..., 98)
230 // "compound" - NIST compounds
231 // "hep" - HEP materials and compounds
232 // "bio" - bio-medical materials and compounds
233 // "all" - all
234 //
235 inline void ListMaterials(const G4String&) const;
236
237 // Access to the list of names of Geant4 predefined materials
238 //
239 inline const std::vector<G4String>& GetNistMaterialNames() const;
240
241 // Fast computation of Z^1/3
242 //
243 inline G4double GetZ13(G4double Z) const;
244 inline G4double GetZ13(G4int Z) const;
245
246 // Fast computation of A^0.27 for natuaral abundances
247 //
248 inline G4double GetA27(G4int Z) const;
249
250 // Fast computation of log(A)
251 //
252 inline G4double GetLOGZ(G4int Z) const;
253 inline G4double GetLOGAMU(G4int Z) const;
254
256
257 private:
259
260 static G4NistManager* instance;
261
262 std::vector<G4Element*> elements;
263 std::vector<G4Material*> materials;
264
265 G4ICRU90StoppingData* fICRU90;
266 G4NistElementBuilder* elmBuilder;
267 G4NistMaterialBuilder* matBuilder;
268 G4NistMessenger* messenger;
269 G4Pow* g4pow;
270
271 G4double POWERA27[101];
272 G4double LOGAZ[101];
273
274 size_t nElements;
275 size_t nMaterials;
276 G4int verbose;
277};
278
279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
280
281inline size_t G4NistManager::GetNumberOfMaterials() const { return nMaterials; }
282
283//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
284
285inline G4Element* G4NistManager::GetElement(size_t index) const
286{
287 const G4ElementTable* theElementTable = G4Element::GetElementTable();
288 return (index < theElementTable->size()) ? (*theElementTable)[index] : nullptr;
289}
290
291//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
292
293inline G4Element* G4NistManager::FindElement(G4int Z) const { return elmBuilder->FindElement(Z); }
294
295//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
296
298{
299 return elmBuilder->FindOrBuildElement(Z, isotopes);
300}
301
302//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
303
305{
306 return elmBuilder->FindOrBuildElement(symb, isotopes);
307}
308
309//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
310
311inline size_t G4NistManager::GetNumberOfElements() const { return nElements; }
312
313//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314
315inline G4int G4NistManager::GetZ(const G4String& symb) const { return elmBuilder->GetZ(symb); }
316
317//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318
320{
321 return elmBuilder->GetAtomicMassAmu(symb);
322}
323
324//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
325
327{
328 return elmBuilder->GetAtomicMassAmu(Z);
329}
330
331//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
332
334{
335 return elmBuilder->GetIsotopeMass(Z, N);
336}
337
338//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
339
341{
342 return elmBuilder->GetAtomicMass(Z, N);
343}
344
345//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
346
351
352//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
353
355{
356 return elmBuilder->GetIsotopeAbundance(Z, N);
357}
358
359//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360
362{
363 return elmBuilder->GetNistFirstIsotopeN(Z);
364}
365
366//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
367
369{
370 return elmBuilder->GetNumberOfNistIsotopes(Z);
371}
372
373//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
374
375inline const std::vector<G4String>& G4NistManager::GetNistElementNames() const
376{
377 return elmBuilder->GetElementNames();
378}
379
380//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
381
383{
384 return matBuilder->GetMeanIonisationEnergy(Z);
385}
386
387//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
388
390{
391 return matBuilder->GetNominalDensity(Z);
392}
393
394//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
395
396inline void G4NistManager::PrintElement(G4int Z) const { elmBuilder->PrintElement(Z); }
397
398//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
399
400inline G4Material* G4NistManager::GetMaterial(size_t index) const
401{
402 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
403 return (index < theMaterialTable->size()) ? (*theMaterialTable)[index] : nullptr;
404}
405
406//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
407
408inline G4int G4NistManager::GetVerbose() const { return verbose; }
409
410//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
411
413{
414 return matBuilder->FindMaterial(name);
415}
416
417//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
418
420{
421 return matBuilder->FindOrBuildMaterial(name, warning);
422}
423
424//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
425
427{
428 return matBuilder->FindSimpleMaterial(Z);
429}
430
431//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
432
434{
435 return matBuilder->FindOrBuildSimpleMaterial(Z, warning);
436}
437
438//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
439
441 const std::vector<G4String>& elm, const std::vector<G4int>& nbAtoms, G4double dens, G4bool,
442 G4State state, G4double T, G4double P)
443
444{
445 return matBuilder->ConstructNewMaterial(name, elm, nbAtoms, dens, state, T, P);
446}
447
448//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
449
451 const std::vector<G4String>& elm, const std::vector<G4double>& w, G4double dens, G4bool,
452 G4State state, G4double T, G4double P)
453{
454 return matBuilder->ConstructNewMaterial(name, elm, w, dens, state, T, P);
455}
456
457//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
458
460 const G4String& name, const G4String& nameNist, G4double temp, G4double pres, G4bool)
461{
462 return matBuilder->ConstructNewGasMaterial(name, nameNist, temp, pres);
463}
464
465//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
466
468 const std::vector<G4String>& elm, const std::vector<G4int>& nbAtoms, G4bool, G4double T,
469 G4double P)
470{
471 return matBuilder->ConstructNewIdealGasMaterial(name, elm, nbAtoms, T, P);
472}
473
474//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
475
476inline void G4NistManager::ListMaterials(const G4String& list) const
477{
478 matBuilder->ListMaterials(list);
479}
480
481//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
482
483inline const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
484{
485 return matBuilder->GetMaterialNames();
486}
487
488//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
489
490inline G4double G4NistManager::GetZ13(G4double A) const { return g4pow->A13(A); }
491
492//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
493
494inline G4double G4NistManager::GetZ13(G4int Z) const { return g4pow->Z13(Z); }
495
496//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
497
499{
500 return (0 <= Z && Z < 101) ? POWERA27[Z] : g4pow->powZ(Z, 0.27);
501}
502
503//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
504
505inline G4double G4NistManager::GetLOGZ(G4int Z) const { return g4pow->logZ(Z); }
506
507//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
508
510{
511 return (0 <= Z && Z < 101) ? LOGAZ[Z] : 0.0;
512}
513
514//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
515
516#endif
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
G4State
@ kStateSolid
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389
static G4MaterialTable * GetMaterialTable()
G4double GetAtomicMass(G4int Z, G4int N) const
G4double GetAtomicMassAmu(const G4String &symb) const
G4double GetIsotopeMass(G4int Z, G4int N) const
G4Element * FindOrBuildElement(G4int Z, G4bool buildIsotopes=true)
G4int GetNumberOfNistIsotopes(G4int Z) const
G4int GetZ(const G4String &symb) const
G4Element * FindElement(G4int Z) const
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4int GetNistFirstIsotopeN(G4int Z) const
const std::vector< G4String > & GetElementNames() const
void PrintElement(G4int Z) const
G4double GetTotalElectronBindingEnergy(G4int Z) const
G4Material * ConstructNewGasMaterial(const G4String &name, const G4String &nameNist, G4double temp, G4double pres, G4bool isotopes=true)
G4int GetNumberOfNistIsotopes(G4int Z) const
G4ICRU90StoppingData * GetICRU90StoppingData()
G4double GetA27(G4int Z) const
G4Element * FindElement(G4int Z) const
G4double GetTotalElectronBindingEnergy(G4int Z) const
G4double GetZ13(G4double Z) const
G4Material * FindSimpleMaterial(G4int Z) const
void PrintElement(G4int Z) const
void SetDensityEffectCalculatorFlag(const G4String &, G4bool)
G4int GetVerbose() const
G4Material * ConstructNewIdealGasMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4bool isotopes=true, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
G4double GetIsotopeMass(G4int Z, G4int N) const
G4Element * GetElement(size_t index) const
const std::vector< G4String > & GetNistMaterialNames() const
G4double GetAtomicMass(G4int Z, G4int N) const
G4Material * FindOrBuildSimpleMaterial(G4int Z, G4bool warning=false)
void ListMaterials(const G4String &) const
G4Material * BuildMaterialWithNewDensity(const G4String &name, const G4String &basename, G4double density=0.0, G4double temp=NTP_Temperature, G4double pres=CLHEP::STP_Pressure)
G4double GetMeanIonisationEnergy(G4int Z) const
const std::vector< G4String > & GetNistElementNames() const
void PrintG4Material(const G4String &) const
void PrintG4Element(const G4String &) const
G4Material * ConstructNewMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
G4double GetLOGZ(G4int Z) const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4Material * FindMaterial(const G4String &name) const
G4int GetZ(const G4String &symb) const
G4int GetNistFirstIsotopeN(G4int Z) const
size_t GetNumberOfElements() const
static G4NistManager * Instance()
void SetVerbose(G4int)
size_t GetNumberOfMaterials() const
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
G4Material * GetMaterial(size_t index) const
G4double GetLOGAMU(G4int Z) const
G4double GetAtomicMassAmu(const G4String &symb) const
G4double GetNominalDensity(G4int Z) const
G4double GetMeanIonisationEnergy(G4int index) const
G4Material * ConstructNewMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double dens, G4State state=kStateSolid, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
void ListMaterials(const G4String &) const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool warning=true)
G4Material * ConstructNewIdealGasMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
const std::vector< G4String > & GetMaterialNames() const
G4double GetNominalDensity(G4int index) const
G4Material * FindSimpleMaterial(G4int Z) const
G4Material * FindOrBuildSimpleMaterial(G4int Z, G4bool warning)
G4Material * FindMaterial(const G4String &name) const
G4Material * ConstructNewGasMaterial(const G4String &name, const G4String &nameDB, G4double temp, G4double pres)
Definition G4Pow.hh:49
G4double logZ(G4int Z) const
Definition G4Pow.hh:137
G4double A13(G4double A) const
Definition G4Pow.cc:116
G4double powZ(G4int Z, G4double y) const
Definition G4Pow.hh:225
G4double Z13(G4int Z) const
Definition G4Pow.hh:123
#define N
Definition crc32.c:57