Geant4  10.01.p03
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 88957 2015-03-16 16:46:05Z 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 abandance
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  // Get G4Material by index
167  //
168  inline G4Material* GetMaterial(size_t index);
169 
170  // Find or build a G4Material by name, from the Geant4 dataBase
171  //
173  G4bool isotopes=true,
174  G4bool warning=false);
175 
176  // Build G4Material with user defined name and density on base
177  // of a material from Geant4 dataBase
178  //
180  const G4String& basename,
181  G4double density = 0.0,
182  G4double temp = NTP_Temperature,
183  G4double pres = CLHEP::STP_Pressure);
184 
185  // Construct a G4Material from scratch by atome count
186  //
188  const G4String& name,
189  const std::vector<G4String>& elm,
190  const std::vector<G4int>& nbAtoms,
191  G4double dens,
192  G4bool isotopes=true,
193  G4State state = kStateSolid,
194  G4double temp = NTP_Temperature,
195  G4double pressure = CLHEP::STP_Pressure);
196 
197  // Construct a G4Material from scratch by fraction mass
198  //
200  const G4String& name,
201  const std::vector<G4String>& elm,
202  const std::vector<G4double>& weight,
203  G4double dens,
204  G4bool isotopes=true,
205  G4State state = kStateSolid,
206  G4double temp = NTP_Temperature,
207  G4double pressure = CLHEP::STP_Pressure);
208 
209  // Construct a gas G4Material from scratch by atome count
210  //
211  inline G4Material* ConstructNewGasMaterial(const G4String& name,
212  const G4String& nameNist,
213  G4double temp,
214  G4double pres,
215  G4bool isotopes=true);
216 
217  // Construct an ideal gas G4Material from scratch by atom count
218  //
220  const G4String& name,
221  const std::vector<G4String>& elm,
222  const std::vector<G4int>& nbAtoms,
223  G4bool isotopes = true,
224  G4double temp = NTP_Temperature,
225  G4double pressure = CLHEP::STP_Pressure);
226 
227  // Get number of G4Materials
228  //
229  inline size_t GetNumberOfMaterials();
230 
231  inline G4int GetVerbose();
232 
233  void SetVerbose(G4int);
234 
235  // Print G4Material by name
236  //
237  void PrintG4Material(const G4String&);
238 
239  // Print predefined Geant4 materials:
240  // "simple" - only pure materials in basic state (Z = 1, ..., 98)
241  // "compound" - NIST compounds
242  // "hep" - HEP materials and compounds
243  // "bio" - bio-medical materials and compounds
244  // "all" - all
245  //
246  inline void ListMaterials(const G4String&);
247 
248  // Access to the list of names of Geant4 predefined materials
249  //
250  inline const std::vector<G4String>& GetNistMaterialNames() const;
251 
252  // Fast computation of Z^1/3
253  //
254  inline G4double GetZ13(G4double Z);
255  inline G4double GetZ13(G4int Z);
256 
257  // Fast computation of A^0.27 for natuaral abandances
258  //
259  inline G4double GetA27(G4int Z);
260 
261  // Fast computation of log(A)
262  //
263  inline G4double GetLOGA(G4double A);
264  inline G4double GetLOGZ(G4int Z);
265 
266  // Fast computation of log(A) for natuaral abandances
267  //
268  inline G4double GetLOGA(G4int Z);
269 
270 private:
271 
272  G4NistManager();
274 
278 
279  std::vector<G4Element*> elements;
280  std::vector<G4Material*> materials;
281 
282  size_t nElements;
283  size_t nMaterials;
284 
286 
290 
291 };
292 
293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
295 
297 {
298  return nMaterials;
299 }
300 
301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
302 
304 {
305  G4Element* elm = 0;
306  const G4ElementTable* theElementTable = G4Element::GetElementTable();
307  if(index < theElementTable->size()) { elm = (*theElementTable)[index]; }
308  return elm;
309 }
310 
311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
312 
313 inline
315 {
316  return elmBuilder->FindOrBuildElement(Z, isotopes);
317 }
318 
319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
320 
321 inline
323  G4bool isotopes)
324 {
325  return elmBuilder->FindOrBuildElement(symb, isotopes);
326 }
327 
328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
329 
331 {
332  return nElements;
333 }
334 
335 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
336 
337 inline G4int G4NistManager::GetZ(const G4String& symb) const
338 {
339  return elmBuilder->GetZ(symb);
340 }
341 
342 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
343 
345 {
346  return elmBuilder->GetAtomicMassAmu(symb);
347 }
348 
349 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
350 
352 {
353  return elmBuilder->GetAtomicMassAmu(Z);
354 }
355 
356 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
357 
358 inline
360 {
361  return elmBuilder->GetIsotopeMass(Z, N);
362 }
363 
364 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
365 
366 inline
368 {
369  return elmBuilder->GetAtomicMass(Z, N);
370 }
371 
372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
373 
374 inline
376 {
378 }
379 
380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
381 
382 inline
384 {
385  return elmBuilder->GetIsotopeAbundance(Z, N);
386 }
387 
388 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
389 
390 inline
392 {
393  return elmBuilder->GetNistFirstIsotopeN(Z);
394 }
395 
396 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
397 
398 inline
400 {
402 }
403 
404 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
405 
406 inline
407 const std::vector<G4String>& G4NistManager::GetNistElementNames() const
408 {
409  return elmBuilder->GetElementNames();
410 }
411 
412 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
413 
415 {
416  return matBuilder->GetMeanIonisationEnergy(Z-1);
417 }
418 
419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
420 
422 {
424 }
425 
426 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
427 
429 {
430  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
431  G4Material* mat = 0;
432  if(index < theMaterialTable->size()) mat = (*theMaterialTable)[index];
433  return mat;
434 }
435 
436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
437 
439 {
440  return verbose;
441 }
442 
443 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
444 
445 inline
447  G4bool isotopes,
448  G4bool warning)
449 {
450  return matBuilder->FindOrBuildMaterial(name, isotopes, warning);
451 }
452 
453 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
454 
456  const G4String& name,
457  const std::vector<G4String>& elm,
458  const std::vector<G4int>& nbAtoms,
459  G4double dens,
460  G4bool isotopes,
461  G4State state,
462  G4double T,
463  G4double P)
464 
465 {
466  return
467  matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes,state,T,P);
468 }
469 
470 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
471 
473  const G4String& name,
474  const std::vector<G4String>& elm,
475  const std::vector<G4double>& w,
476  G4double dens,
477  G4bool isotopes,
478  G4State state,
479  G4double T,
480  G4double P)
481 {
482  return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes,state,T,P);
483 }
484 
485 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
486 
488  const G4String& name,
489  const G4String& nameNist,
490  G4double temp, G4double pres,
491  G4bool isotopes)
492 {
493  return matBuilder->ConstructNewGasMaterial(name,nameNist,
494  temp,pres,isotopes);
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  G4bool isotopes,
504  G4double T,
505  G4double P)
506 {
507  return
508  matBuilder->ConstructNewIdealGasMaterial(name,elm,nbAtoms,isotopes,T,P);
509 }
510 
511 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
512 
513 inline void G4NistManager::ListMaterials(const G4String& list)
514 {
515  matBuilder->ListMaterials(list);
516 }
517 
518 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
519 
520 inline
521 const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
522 {
523  return matBuilder->GetMaterialNames();
524 }
525 
526 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
527 
529 {
530  return g4pow->A13(A);
531 }
532 
533 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
534 
536 {
537  return g4pow->Z13(Z);
538 }
539 
540 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
541 
543 {
544  G4double res = 0.0;
545  if(Z < 101) { res = POWERA27[Z]; }
546  return res;
547 }
548 
549 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
550 
552 {
553  return g4pow->logZ(Z);
554 }
555 
556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
557 
559 {
560  return g4pow->logA(A);
561 }
562 
563 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
564 
566 {
567  G4double res = 0.0;
568  if(Z < 101) { res = LOGAZ[Z]; }
569  return res;
570 }
571 
572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
573 
574 #endif
575 
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
void PrintElement(G4int Z)
G4State
Definition: G4Material.hh:114
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:588
std::vector< G4Material * > G4MaterialTable
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 &)
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:163
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
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 &)
static const G4double A[nN]
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 logA(G4double A) const
Definition: G4Pow.hh:191
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
double G4double
Definition: G4Types.hh:76
G4double GetIsotopeMass(G4int Z, G4int N) const
G4double GetLOGA(G4double A)
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:403
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
G4double GetMeanIonisationEnergy(G4int Z) const
G4double GetAtomicMass(G4int Z, G4int N) const
std::vector< G4Element * > elements