Geant4 11.1.1
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//
29// GEANT4 Class header file
30//
31// File name: G4NistManager
32//
33// Author: Vladimir Ivanchenko
34//
35// Creation date: 23.12.2004
36//
37// Modifications:
38// 27.02.06 V.Ivanchneko add GetAtomicMassAmu and ConstructNewGasMaterial
39// 11.05.06 V.Ivanchneko add warning flag to FindMaterial method
40// 17.10.06 V.Ivanchneko add methods: GetAtomicMass, GetNistElementNames,
41// GetNistMaterialNames
42// 02.05.07 V.Ivanchneko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes
43// 28.07.07 V.Ivanchneko make simple methods inline
44// 28.10.07 V.Ivanchneko add state, T, P to maetrial build
45// 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method
46// 01.11.10 V.Ivanchneko add G4Pow for fast computations
47// 09.02.12 P.Gumplinger add ConstructNewIdealGasMaterial
48//
49// Class Description:
50//
51// A utility static class
52//
53
54// -------------------------------------------------------------------
55//
56// Class Description:
57//
58// Element data from the NIST DB on Atomic Weights and Isotope Compositions
59// http://physics.nist.gov/PhysRefData/Compositions/index.html
60//
61// -------------------------------------------------------------------
62//
63
64#ifndef G4NistManager_h
65#define G4NistManager_h 1
66
67#include <vector>
69
70#include "globals.hh"
71#include "G4Material.hh"
75#include "G4Pow.hh"
76
77class G4NistMessenger;
78
79//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
80//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
81
83{
84
85public:
86
87 static G4NistManager* Instance();
89
90 // Get G4Element by index
91 //
92 inline G4Element* GetElement(size_t index) const;
93
94 // Find or build G4Element by atomic number
95 //
96 inline G4Element* FindElement(G4int Z) const;
97 inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes=true);
98
99 // Find or build G4Element by symbol
100 //
101 inline G4Element* FindOrBuildElement(const G4String& symb,
102 G4bool isotopes=true);
103
104 // Get number of elements
105 //
106 inline size_t GetNumberOfElements() const;
107
108 // Get atomic number by element symbol
109 //
110 inline G4int GetZ(const G4String& symb) const;
111
112 // Get atomic weight by element symbol - mean mass in units of amu of
113 // an atom with electron shell for the natural isotope composition
114 //
115 inline G4double GetAtomicMassAmu(const G4String& symb) const;
116
117 // Get atomic weight in atomic units - mean mass in units of amu of an atom
118 // with electron shell for the natural isotope composition
119 //
120 inline G4double GetAtomicMassAmu(G4int Z) const;
121
122 // Get mass of isotope without electron shell in Geant4 energy units
123 //
124 inline G4double GetIsotopeMass(G4int Z, G4int N) const;
125
126 // Get mass in Geant4 energy units of an atom of a particular isotope
127 // with the electron shell
128 //
129 inline G4double GetAtomicMass(G4int Z, G4int N) const;
130
131 // Get total ionisation energy of an atom
132 //
134
135 // Get N for the first natural isotope
136 //
137 inline G4int GetNistFirstIsotopeN(G4int Z) const;
138
139 // Get number of natural isotopes
140 //
141 inline G4int GetNumberOfNistIsotopes(G4int Z) const;
142
143 // Get natural isotope abundance
144 //
145 inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
146
147 // Print element by Z
148 //
149 inline void PrintElement(G4int Z) const;
150
151 // Print element from internal DB by symbol, if "all" - print all elements
152 //
153 void PrintElement(const G4String&) const;
154
155 // Print G4Element by name, if "all" - print all G4Elements
156 //
157 void PrintG4Element(const G4String&) const;
158
159 // Access to the vector of Geant4 predefined element names
160 //
161 inline const std::vector<G4String>& GetNistElementNames() const;
162
163 // Access mean ionisation energy for atoms (Z <= 98) by its index
164 //
166
167 // Access nominal density by atomic number for simple materials and
168 // by the index for other NIST materials
169 //
170 inline G4double GetNominalDensity(G4int Z) const;
171
172 // Get G4Material by index
173 //
174 inline G4Material* GetMaterial(size_t index) const;
175
176 // Find or build a G4Material by name, from the Geant4 dataBase
177 //
178 inline G4Material* FindMaterial(const G4String& name) const;
179 inline G4Material* FindOrBuildMaterial(const G4String& name,
180 G4bool isotopes=true,
181 G4bool warning=false);
182
183 // Find or build a simple material via atomic number
184 //
185 inline G4Material* FindSimpleMaterial(G4int Z) const;
187 G4bool warning=false);
188
189 // Build G4Material with user defined name and density on base
190 // of a material from Geant4 dataBase
191 //
193 const G4String& basename,
194 G4double density = 0.0,
195 G4double temp = NTP_Temperature,
196 G4double pres = CLHEP::STP_Pressure);
197
198 // Construct a G4Material from scratch by atome count
199 // temperature and pressure should be consistent with the density
200 //
202 const G4String& name,
203 const std::vector<G4String>& elm,
204 const std::vector<G4int>& nbAtoms,
205 G4double dens,
206 G4bool isotopes=true,
207 G4State state = kStateSolid,
208 G4double temp = NTP_Temperature,
209 G4double pressure = CLHEP::STP_Pressure);
210
211 // Construct a G4Material from scratch by fraction mass
212 // temperature and pressure should be consistent with the density
213 //
215 const G4String& name,
216 const std::vector<G4String>& elm,
217 const std::vector<G4double>& weight,
218 G4double dens,
219 G4bool isotopes=true,
220 G4State state = kStateSolid,
221 G4double temp = NTP_Temperature,
222 G4double pressure = CLHEP::STP_Pressure);
223
224 // Construct a gas G4Material from scratch by atome count
225 //
226 inline G4Material* ConstructNewGasMaterial(const G4String& name,
227 const G4String& nameNist,
228 G4double temp,
229 G4double pres,
230 G4bool isotopes=true);
231
232 // Construct an ideal gas G4Material from scratch by atom count
233 //
235 const G4String& name,
236 const std::vector<G4String>& elm,
237 const std::vector<G4int>& nbAtoms,
238 G4bool isotopes = true,
239 G4double temp = NTP_Temperature,
240 G4double pressure = CLHEP::STP_Pressure);
241
242 // enable/disable density effect calculator by material name
243 //
245
246 // enable/disable density effect calculator by material pointer
247 //
249
250 // Get number of G4Materials
251 //
252 inline size_t GetNumberOfMaterials() const;
253
254 inline G4int GetVerbose() const;
255
256 void SetVerbose(G4int);
257
258 // Print G4Material by name
259 //
260 void PrintG4Material(const G4String&) const;
261
262 // Print predefined Geant4 materials:
263 // "simple" - only pure materials in basic state (Z = 1, ..., 98)
264 // "compound" - NIST compounds
265 // "hep" - HEP materials and compounds
266 // "bio" - bio-medical materials and compounds
267 // "all" - all
268 //
269 inline void ListMaterials(const G4String&) const;
270
271 // Access to the list of names of Geant4 predefined materials
272 //
273 inline const std::vector<G4String>& GetNistMaterialNames() const;
274
275 // Fast computation of Z^1/3
276 //
277 inline G4double GetZ13(G4double Z) const;
278 inline G4double GetZ13(G4int Z) const;
279
280 // Fast computation of A^0.27 for natuaral abundances
281 //
282 inline G4double GetA27(G4int Z) const;
283
284 // Fast computation of log(A)
285 //
286 inline G4double GetLOGZ(G4int Z) const;
287 inline G4double GetLOGAMU(G4int Z) const;
288
290
291private:
292
293 explicit G4NistManager();
294
295 static G4NistManager* instance;
296
297 std::vector<G4Element*> elements;
298 std::vector<G4Material*> materials;
299
300 G4ICRU90StoppingData* fICRU90;
301 G4NistElementBuilder* elmBuilder;
302 G4NistMaterialBuilder* matBuilder;
303 G4NistMessenger* messenger;
304 G4Pow* g4pow;
305
306 G4double POWERA27[101];
307 G4double LOGAZ[101];
308
309 size_t nElements;
310 size_t nMaterials;
311 G4int verbose;
312};
313
314//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
315//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
316
318{
319 return nMaterials;
320}
321
322//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
323
324inline G4Element* G4NistManager::GetElement(size_t index) const
325{
326 const G4ElementTable* theElementTable = G4Element::GetElementTable();
327 return (index < theElementTable->size()) ? (*theElementTable)[index] : nullptr;
328}
329
330//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
331
332inline
334{
335 return elmBuilder->FindElement(Z);
336}
337
338//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
339
340inline
342{
343 return elmBuilder->FindOrBuildElement(Z, isotopes);
344}
345
346//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
347
348inline
350 G4bool isotopes)
351{
352 return elmBuilder->FindOrBuildElement(symb, isotopes);
353}
354
355//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
356
358{
359 return nElements;
360}
361
362//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
363
364inline G4int G4NistManager::GetZ(const G4String& symb) const
365{
366 return elmBuilder->GetZ(symb);
367}
368
369//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
370
372{
373 return elmBuilder->GetAtomicMassAmu(symb);
374}
375
376//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
377
379{
380 return elmBuilder->GetAtomicMassAmu(Z);
381}
382
383//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
384
385inline
387{
388 return elmBuilder->GetIsotopeMass(Z, N);
389}
390
391//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
392
393inline
395{
396 return elmBuilder->GetAtomicMass(Z, N);
397}
398
399//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
400
401inline
403{
404 return elmBuilder->GetTotalElectronBindingEnergy(Z);
405}
406
407//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
408
409inline
411{
412 return elmBuilder->GetIsotopeAbundance(Z, N);
413}
414
415//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
416
417inline
419{
420 return elmBuilder->GetNistFirstIsotopeN(Z);
421}
422
423//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
424
425inline
427{
428 return elmBuilder->GetNumberOfNistIsotopes(Z);
429}
430
431//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
432
433inline
434const std::vector<G4String>& G4NistManager::GetNistElementNames() const
435{
436 return elmBuilder->GetElementNames();
437}
438
439//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
440
442{
443 return matBuilder->GetMeanIonisationEnergy(Z);
444}
445
446//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
447
449{
450 return matBuilder->GetNominalDensity(Z);
451}
452
453//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
454
456{
457 elmBuilder->PrintElement(Z);
458}
459
460//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
461
462inline G4Material* G4NistManager::GetMaterial(size_t index) const
463{
464 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
465 return (index < theMaterialTable->size()) ? (*theMaterialTable)[index] : nullptr;
466}
467
468//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
469
471{
472 return verbose;
473}
474
475//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
476
477inline
479{
480 return matBuilder->FindMaterial(name);
481}
482
483//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
484
485inline
487 G4bool, G4bool warning)
488{
489 return matBuilder->FindOrBuildMaterial(name, warning);
490}
491
492//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
493
494inline
496{
497 return matBuilder->FindSimpleMaterial(Z);
498}
499
500//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
501
502inline
504{
505 return matBuilder->FindOrBuildSimpleMaterial(Z, warning);
506}
507
508//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
509
511 const G4String& name,
512 const std::vector<G4String>& elm,
513 const std::vector<G4int>& nbAtoms,
514 G4double dens,
515 G4bool,
516 G4State state,
517 G4double T,
518 G4double P)
519
520{
521 return
522 matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,state,T,P);
523}
524
525//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
526
528 const G4String& name,
529 const std::vector<G4String>& elm,
530 const std::vector<G4double>& w,
531 G4double dens,
532 G4bool,
533 G4State state,
534 G4double T,
535 G4double P)
536{
537 return matBuilder->ConstructNewMaterial(name,elm,w,dens,state,T,P);
538}
539
540//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
541
543 const G4String& name,
544 const G4String& nameNist,
545 G4double temp, G4double pres,
546 G4bool)
547{
548 return matBuilder->ConstructNewGasMaterial(name,nameNist,temp,pres);
549}
550
551//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
552
554 const G4String& name,
555 const std::vector<G4String>& elm,
556 const std::vector<G4int>& nbAtoms,
557 G4bool,
558 G4double T,
559 G4double P)
560{
561 return
562 matBuilder->ConstructNewIdealGasMaterial(name,elm,nbAtoms,T,P);
563}
564
565//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
566
567inline void G4NistManager::ListMaterials(const G4String& list) const
568{
569 matBuilder->ListMaterials(list);
570}
571
572//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
573
574inline
575const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
576{
577 return matBuilder->GetMaterialNames();
578}
579
580//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
581
583{
584 return g4pow->A13(A);
585}
586
587//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
588
590{
591 return g4pow->Z13(Z);
592}
593
594//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
595
597{
598 return (0 <= Z && Z < 101) ? POWERA27[Z] : g4pow->powZ(Z, 0.27);
599}
600
601//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
602
604{
605 return g4pow->logZ(Z);
606}
607
608//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
609
611{
612 return (0 <= Z && Z < 101) ? LOGAZ[Z] : 0.0;
613}
614
615//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
616
617#endif
618
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
G4State
Definition: G4Material.hh:110
@ kStateSolid
Definition: G4Material.hh:110
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:403
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:677
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:56