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