Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 97248 2016-05-30 15:00:11Z 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>
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) 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  //
165  inline G4double GetMeanIonisationEnergy(G4int Z) const;
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  //
201  const G4String& name,
202  const std::vector<G4String>& elm,
203  const std::vector<G4int>& nbAtoms,
204  G4double dens,
205  G4bool isotopes=true,
206  G4State state = kStateSolid,
207  G4double temp = NTP_Temperature,
208  G4double pressure = CLHEP::STP_Pressure);
209 
210  // Construct a G4Material from scratch by fraction mass
211  //
213  const G4String& name,
214  const std::vector<G4String>& elm,
215  const std::vector<G4double>& weight,
216  G4double dens,
217  G4bool isotopes=true,
218  G4State state = kStateSolid,
219  G4double temp = NTP_Temperature,
220  G4double pressure = CLHEP::STP_Pressure);
221 
222  // Construct a gas G4Material from scratch by atome count
223  //
224  inline G4Material* ConstructNewGasMaterial(const G4String& name,
225  const G4String& nameNist,
226  G4double temp,
227  G4double pres,
228  G4bool isotopes=true);
229 
230  // Construct an ideal gas G4Material from scratch by atom count
231  //
233  const G4String& name,
234  const std::vector<G4String>& elm,
235  const std::vector<G4int>& nbAtoms,
236  G4bool isotopes = true,
237  G4double temp = NTP_Temperature,
238  G4double pressure = CLHEP::STP_Pressure);
239 
240  // Get number of G4Materials
241  //
242  inline size_t GetNumberOfMaterials() const;
243 
244  inline G4int GetVerbose() const;
245 
246  void SetVerbose(G4int);
247 
248  // Print G4Material by name
249  //
250  void PrintG4Material(const G4String&) const;
251 
252  // Print predefined Geant4 materials:
253  // "simple" - only pure materials in basic state (Z = 1, ..., 98)
254  // "compound" - NIST compounds
255  // "hep" - HEP materials and compounds
256  // "bio" - bio-medical materials and compounds
257  // "all" - all
258  //
259  inline void ListMaterials(const G4String&) const;
260 
261  // Access to the list of names of Geant4 predefined materials
262  //
263  inline const std::vector<G4String>& GetNistMaterialNames() const;
264 
265  // Fast computation of Z^1/3
266  //
267  inline G4double GetZ13(G4double Z) const;
268  inline G4double GetZ13(G4int Z) const;
269 
270  // Fast computation of A^0.27 for natuaral abundances
271  //
272  inline G4double GetA27(G4int Z) const;
273 
274  // Fast computation of log(A)
275  //
276  inline G4double GetLOGZ(G4int Z) const;
277  inline G4double GetLOGAMU(G4int Z) const;
278 
279 private:
280 
281  G4NistManager();
282  static G4NistManager* instance;
283 
284  G4Pow* g4pow;
285  G4double POWERA27[101];
286  G4double LOGAZ[101];
287 
288  std::vector<G4Element*> elements;
289  std::vector<G4Material*> materials;
290 
291  size_t nElements;
292  size_t nMaterials;
293 
294  G4int verbose;
295 
296  G4NistElementBuilder* elmBuilder;
297  G4NistMaterialBuilder* matBuilder;
298  G4NistMessenger* messenger;
299 
300 };
301 
302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304 
306 {
307  return nMaterials;
308 }
309 
310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
311 
312 inline G4Element* G4NistManager::GetElement(size_t index) const
313 {
314  const G4ElementTable* theElementTable = G4Element::GetElementTable();
315  return (index < theElementTable->size()) ? (*theElementTable)[index] : nullptr;
316 }
317 
318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
319 
320 inline
322 {
323  return elmBuilder->FindElement(Z);
324 }
325 
326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
327 
328 inline
330 {
331  return elmBuilder->FindOrBuildElement(Z, isotopes);
332 }
333 
334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
335 
336 inline
338  G4bool isotopes)
339 {
340  return elmBuilder->FindOrBuildElement(symb, isotopes);
341 }
342 
343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
344 
346 {
347  return nElements;
348 }
349 
350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
351 
352 inline G4int G4NistManager::GetZ(const G4String& symb) const
353 {
354  return elmBuilder->GetZ(symb);
355 }
356 
357 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
358 
360 {
361  return elmBuilder->GetAtomicMassAmu(symb);
362 }
363 
364 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
365 
367 {
368  return elmBuilder->GetAtomicMassAmu(Z);
369 }
370 
371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
372 
373 inline
375 {
376  return elmBuilder->GetIsotopeMass(Z, N);
377 }
378 
379 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
380 
381 inline
383 {
384  return elmBuilder->GetAtomicMass(Z, N);
385 }
386 
387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
388 
389 inline
391 {
392  return elmBuilder->GetTotalElectronBindingEnergy(Z);
393 }
394 
395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
396 
397 inline
399 {
400  return elmBuilder->GetIsotopeAbundance(Z, N);
401 }
402 
403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
404 
405 inline
407 {
408  return elmBuilder->GetNistFirstIsotopeN(Z);
409 }
410 
411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
412 
413 inline
415 {
416  return elmBuilder->GetNumberOfNistIsotopes(Z);
417 }
418 
419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
420 
421 inline
422 const std::vector<G4String>& G4NistManager::GetNistElementNames() const
423 {
424  return elmBuilder->GetElementNames();
425 }
426 
427 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
428 
430 {
431  return matBuilder->GetMeanIonisationEnergy(Z);
432 }
433 
434 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
435 
437 {
438  return matBuilder->GetNominalDensity(Z);
439 }
440 
441 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
442 
444 {
445  elmBuilder->PrintElement(Z);
446 }
447 
448 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
449 
450 inline G4Material* G4NistManager::GetMaterial(size_t index) const
451 {
452  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
453  return (index < theMaterialTable->size()) ? (*theMaterialTable)[index] : nullptr;
454 }
455 
456 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
457 
459 {
460  return verbose;
461 }
462 
463 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
464 
465 inline
467 {
468  return matBuilder->FindMaterial(name);
469 }
470 
471 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
472 
473 inline
475  G4bool isotopes,
476  G4bool warning)
477 {
478  return matBuilder->FindOrBuildMaterial(name, isotopes, warning);
479 }
480 
481 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
482 
483 inline
485 {
486  return matBuilder->FindSimpleMaterial(Z);
487 }
488 
489 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
490 
491 inline
493 {
494  return matBuilder->FindOrBuildSimpleMaterial(Z, warning);
495 }
496 
497 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
498 
500  const G4String& name,
501  const std::vector<G4String>& elm,
502  const std::vector<G4int>& nbAtoms,
503  G4double dens,
504  G4bool isotopes,
505  G4State state,
506  G4double T,
507  G4double P)
508 
509 {
510  return
511  matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes,state,T,P);
512 }
513 
514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
515 
517  const G4String& name,
518  const std::vector<G4String>& elm,
519  const std::vector<G4double>& w,
520  G4double dens,
521  G4bool isotopes,
522  G4State state,
523  G4double T,
524  G4double P)
525 {
526  return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes,state,T,P);
527 }
528 
529 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
530 
532  const G4String& name,
533  const G4String& nameNist,
534  G4double temp, G4double pres,
535  G4bool isotopes)
536 {
537  return matBuilder->ConstructNewGasMaterial(name,nameNist,
538  temp,pres,isotopes);
539 }
540 
541 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
542 
544  const G4String& name,
545  const std::vector<G4String>& elm,
546  const std::vector<G4int>& nbAtoms,
547  G4bool isotopes,
548  G4double T,
549  G4double P)
550 {
551  return
552  matBuilder->ConstructNewIdealGasMaterial(name,elm,nbAtoms,isotopes,T,P);
553 }
554 
555 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
556 
557 inline void G4NistManager::ListMaterials(const G4String& list) const
558 {
559  matBuilder->ListMaterials(list);
560 }
561 
562 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
563 
564 inline
565 const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
566 {
567  return matBuilder->GetMaterialNames();
568 }
569 
570 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
571 
573 {
574  return g4pow->A13(A);
575 }
576 
577 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
578 
580 {
581  return g4pow->Z13(Z);
582 }
583 
584 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
585 
587 {
588  return (0 <= Z && Z < 101) ? POWERA27[Z] : 0.0;
589 }
590 
591 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
592 
594 {
595  return g4pow->logZ(Z);
596 }
597 
598 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
599 
601 {
602  return (0 <= Z && Z < 101) ? LOGAZ[Z] : 0.0;
603 }
604 
605 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
606 
607 #endif
608 
const int N
Definition: mixmax.h:43
const XML_Char * name
Definition: expat.h:151
G4double GetTotalElectronBindingEnergy(G4int Z) const
size_t GetNumberOfElements() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4double GetMeanIonisationEnergy(G4int index) const
G4Material * GetMaterial(size_t index) const
Definition: G4Pow.hh:56
G4Material * FindOrBuildSimpleMaterial(G4int Z, G4bool warning=false)
G4State
Definition: G4Material.hh:114
G4double GetNominalDensity(G4int index) const
G4double GetTotalElectronBindingEnergy(G4int Z) const
G4int GetVerbose() const
G4double GetA27(G4int Z) const
const std::vector< G4String > & GetNistElementNames() const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
G4double GetIsotopeAbundance(G4int Z, G4int N) const
const std::vector< G4String > & GetNistMaterialNames() const
G4int GetNumberOfNistIsotopes(G4int Z) const
void ListMaterials(const G4String &) const
static constexpr double STP_Pressure
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()
G4Element * FindElement(G4int Z) const
static double P[]
G4Material * FindMaterial(const G4String &name) const
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 logZ(G4int Z) const
Definition: G4Pow.hh:166
G4double GetZ13(G4double Z) 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 Z13(G4int Z) const
Definition: G4Pow.hh:127
double A(double temperature)
G4int GetZ(const G4String &symb) const
void SetVerbose(G4int)
bool G4bool
Definition: G4Types.hh:79
void PrintG4Material(const G4String &) const
G4int GetNistFirstIsotopeN(G4int Z) const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
G4double GetLOGZ(G4int Z) const
G4double GetIsotopeAbundance(G4int Z, G4int N) const
void PrintElement(G4int Z) const
G4int GetNumberOfNistIsotopes(G4int Z) const
size_t GetNumberOfMaterials() const
G4double GetIsotopeMass(G4int Z, G4int N) const
G4Element * FindElement(G4int Z) const
G4double GetAtomicMass(G4int Z, G4int N) const
G4int GetZ(const G4String &symb) const
G4double GetLOGAMU(G4int Z) const
G4double A13(G4double A) const
Definition: G4Pow.hh:132
void PrintElement(G4int Z) const
G4Material * FindMaterial(const G4String &name) 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 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)
static const G4double NTP_Temperature
Definition: G4Material.hh:116
const std::vector< G4String > & GetElementNames() const
G4Material * FindSimpleMaterial(G4int Z) 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
G4Element * GetElement(size_t index) const
G4double GetIsotopeMass(G4int Z, G4int N) const
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:398
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
G4double GetMeanIonisationEnergy(G4int Z) const
G4Material * FindSimpleMaterial(G4int Z) const
void PrintG4Element(const G4String &) const
G4double GetAtomicMass(G4int Z, G4int N) const
G4Material * FindOrBuildSimpleMaterial(G4int Z, G4bool warning)