Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 67044 2013-01-30 08:50:06Z 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);
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 = CLHEP::STP_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 = CLHEP::STP_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 = CLHEP::STP_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 = CLHEP::STP_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  // "all" - all
244  //
245  inline void ListMaterials(const G4String&);
246 
247  // Access to the list of names of Geant4 predefined materials
248  //
249  inline const std::vector<G4String>& GetNistMaterialNames() const;
250 
251  // Fast computation of Z^1/3
252  //
253  inline G4double GetZ13(G4double Z);
254  inline G4double GetZ13(G4int Z);
255 
256  // Fast computation of A^0.27 for natuaral abandances
257  //
258  inline G4double GetA27(G4int Z);
259 
260  // Fast computation of log(A)
261  //
262  inline G4double GetLOGA(G4double A);
263  inline G4double GetLOGZ(G4int Z);
264 
265  // Fast computation of log(A) for natuaral abandances
266  //
267  inline G4double GetLOGA(G4int Z);
268 
269 private:
270 
271  G4NistManager();
272  static G4NistManager* instance;
273 
274  G4Pow* g4pow;
275  G4double POWERA27[101];
276  G4double LOGAZ[101];
277 
278  std::vector<G4Element*> elements;
279  std::vector<G4Material*> materials;
280 
281  size_t nElements;
282  size_t nMaterials;
283 
284  G4int verbose;
285 
286  G4NistElementBuilder* elmBuilder;
287  G4NistMaterialBuilder* matBuilder;
288  G4NistMessenger* messenger;
289 
290 };
291 
292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
294 
296 {
297  return nMaterials;
298 }
299 
300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301 
303 {
304  G4Element* elm = 0;
305  const G4ElementTable* theElementTable = G4Element::GetElementTable();
306  if(index < theElementTable->size()) { elm = (*theElementTable)[index]; }
307  return elm;
308 }
309 
310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
311 
312 inline
314 {
315  return elmBuilder->FindOrBuildElement(Z, isotopes);
316 }
317 
318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
319 
320 inline
322  G4bool isotopes)
323 {
324  return elmBuilder->FindOrBuildElement(symb, isotopes);
325 }
326 
327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
328 
330 {
331  return nElements;
332 }
333 
334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
335 
336 inline G4int G4NistManager::GetZ(const G4String& symb) const
337 {
338  return elmBuilder->GetZ(symb);
339 }
340 
341 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
342 
344 {
345  return elmBuilder->GetAtomicMassAmu(symb);
346 }
347 
348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
349 
351 {
352  return elmBuilder->GetAtomicMassAmu(Z);
353 }
354 
355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
356 
357 inline
359 {
360  return elmBuilder->GetIsotopeMass(Z, N);
361 }
362 
363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
364 
365 inline
367 {
368  return elmBuilder->GetAtomicMass(Z, N);
369 }
370 
371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
372 
373 inline
375 {
376  return elmBuilder->GetTotalElectronBindingEnergy(Z);
377 }
378 
379 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
380 
381 inline
383 {
384  return elmBuilder->GetIsotopeAbundance(Z, N);
385 }
386 
387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
388 
389 inline
391 {
392  return elmBuilder->GetNistFirstIsotopeN(Z);
393 }
394 
395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
396 
397 inline
399 {
400  return elmBuilder->GetNumberOfNistIsotopes(Z);
401 }
402 
403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
404 
405 inline
406 const std::vector<G4String>& G4NistManager::GetNistElementNames() const
407 {
408  return elmBuilder->GetElementNames();
409 }
410 
411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
412 
414 {
415  return matBuilder->GetMeanIonisationEnergy(Z-1);
416 }
417 
418 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
419 
421 {
422  elmBuilder->PrintElement(Z);
423 }
424 
425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
426 
428 {
429  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
430  G4Material* mat = 0;
431  if(index < theMaterialTable->size()) mat = (*theMaterialTable)[index];
432  return mat;
433 }
434 
435 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
436 
438 {
439  return verbose;
440 }
441 
442 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
443 
444 inline
446  G4bool isotopes,
447  G4bool warning)
448 {
449  return matBuilder->FindOrBuildMaterial(name, isotopes, warning);
450 }
451 
452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
453 
455  const G4String& name,
456  const std::vector<G4String>& elm,
457  const std::vector<G4int>& nbAtoms,
458  G4double dens,
459  G4bool isotopes,
460  G4State state,
461  G4double T,
462  G4double P)
463 
464 {
465  return
466  matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes,state,T,P);
467 }
468 
469 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
470 
472  const G4String& name,
473  const std::vector<G4String>& elm,
474  const std::vector<G4double>& w,
475  G4double dens,
476  G4bool isotopes,
477  G4State state,
478  G4double T,
479  G4double P)
480 {
481  return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes,state,T,P);
482 }
483 
484 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
485 
487  const G4String& name,
488  const G4String& nameNist,
489  G4double temp, G4double pres,
490  G4bool isotopes)
491 {
492  return matBuilder->ConstructNewGasMaterial(name,nameNist,
493  temp,pres,isotopes);
494 }
495 
496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
497 
499  const G4String& name,
500  const std::vector<G4String>& elm,
501  const std::vector<G4int>& nbAtoms,
502  G4bool isotopes,
503  G4double T,
504  G4double P)
505 {
506  return
507  matBuilder->ConstructNewIdealGasMaterial(name,elm,nbAtoms,isotopes,T,P);
508 }
509 
510 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
511 
512 inline void G4NistManager::ListMaterials(const G4String& list)
513 {
514  matBuilder->ListMaterials(list);
515 }
516 
517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
518 
519 inline
520 const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
521 {
522  return matBuilder->GetMaterialNames();
523 }
524 
525 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
526 
528 {
529  return g4pow->A13(A);
530 }
531 
532 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
533 
535 {
536  return g4pow->Z13(Z);
537 }
538 
539 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
540 
542 {
543  G4double res = 0.0;
544  if(Z < 101) { res = POWERA27[Z]; }
545  return res;
546 }
547 
548 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
549 
551 {
552  return g4pow->logZ(Z);
553 }
554 
555 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
556 
558 {
559  return g4pow->logA(A);
560 }
561 
562 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
563 
565 {
566  G4double res = 0.0;
567  if(Z < 101) { res = LOGAZ[Z]; }
568  return res;
569 }
570 
571 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
572 
573 #endif
574