source: trunk/source/materials/include/G4NistManager.hh @ 1315

Last change on this file since 1315 was 1315, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 15.3 KB
Line 
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,v 1.24 2010/04/29 11:11:56 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
28//
29//
30// -------------------------------------------------------------------
31//
32// GEANT4 Class header file
33//
34// File name:     G4NistManager
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 23.12.2004
39//
40// Modifications:
41// 27.02.06 V.Ivanchneko add GetAtomicMassAmu and ConstructNewGasMaterial
42// 11.05.06 V.Ivanchneko add warning flag to FindMaterial method
43// 17.10.06 V.Ivanchneko add methods: GetAtomicMass, GetNistElementNames,
44//                       GetNistMaterialNames
45// 02.05.07 V.Ivanchneko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes
46// 28.07.07 V.Ivanchneko make simple methods inline
47// 28.10.07 V.Ivanchneko add state, T, P to maetrial build
48// 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method
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 "globals.hh"
70#include "G4Material.hh"
71#include "G4NistElementBuilder.hh"
72#include "G4NistMaterialBuilder.hh"
73
74class G4NistMessenger;
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
78
79class G4NistManager
80{
81
82public:
83
84  static G4NistManager* Instance();
85  ~G4NistManager();
86
87  // Get G4Element by index
88  //
89  inline G4Element* GetElement(size_t index);
90 
91  // Find or build G4Element by atomic number
92  //
93  inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes=true);
94 
95  // Find or build G4Element by symbol
96  //
97  inline G4Element* FindOrBuildElement(const G4String& symb, 
98                                       G4bool isotopes=true);
99
100  // Get number of elements
101  //
102  inline size_t GetNumberOfElements() const;
103
104  // Get atomic number by element symbol
105  //
106  inline G4int GetZ(const G4String& symb) const;
107
108  // Get the mass of the element in amu for the natuaral isotope composition
109  // with electron shell
110  //
111  inline G4double GetAtomicMassAmu(G4int Z) const;
112
113  // Get mass of the isotope in Geant4 units without electron shell
114  //
115  inline G4double GetIsotopeMass(G4int Z, G4int N) const;
116
117  // Get mass of the isotope in Geant4 units with electron shell
118  //
119  inline G4double GetAtomicMass(G4int Z, G4int N) const;
120
121  // Get total ionisation energy of an atom
122  //
123  inline G4double GetTotalElectronBindingEnergy(G4int Z) const;
124
125  // Get N for the first natural isotope
126  //
127  inline G4int GetNistFirstIsotopeN(G4int Z) const;
128
129  // Get number of natural isotopes
130  //
131  inline G4int GetNumberOfNistIsotopes(G4int Z) const;
132
133  // Get natural isotope abandance
134  //
135  inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
136
137  // Print element by Z
138  //
139  inline void PrintElement(G4int Z); 
140
141  // Print element from internal DB by symbol, if "all" - print all elements
142  //
143  void PrintElement(const G4String&);   
144
145  // Print G4Element by name, if "all" - print all G4Elements
146  //
147  void PrintG4Element(const G4String&); 
148
149  // Access to the vector of Geant4 predefined element names
150  //
151  inline const std::vector<G4String>& GetNistElementNames() const;
152
153  // Access mean ionisation energy for atoms (Z <= 98)
154  //
155  inline G4double GetMeanIonisationEnergy(G4int Z) const;
156
157  // Get G4Material by index
158  //
159  inline G4Material* GetMaterial(size_t index);
160 
161  // Find or build a G4Material by name, from the Geant4 dataBase
162  //
163  inline G4Material* FindOrBuildMaterial(const G4String& name, 
164                                         G4bool isotopes=true,
165                                         G4bool warning=false);
166 
167  // Construct a G4Material from scratch by atome count
168  //
169  inline G4Material* ConstructNewMaterial(
170                                  const G4String& name,
171                                  const std::vector<G4String>& elm,
172                                  const std::vector<G4int>& nbAtoms,
173                                  G4double dens, 
174                                  G4bool isotopes=true,
175                                  G4State   state    = kStateSolid,     
176                                  G4double  temp     = STP_Temperature, 
177                                  G4double  pressure = STP_Pressure); 
178                                     
179  // Construct a G4Material from scratch by fraction mass
180  //
181  inline G4Material* ConstructNewMaterial(
182                                  const G4String& name,
183                                  const std::vector<G4String>& elm,
184                                  const std::vector<G4double>& weight,
185                                  G4double dens, 
186                                  G4bool isotopes=true,
187                                  G4State   state    = kStateSolid,     
188                                  G4double  temp     = STP_Temperature, 
189                                  G4double  pressure = STP_Pressure); 
190
191  // Construct a gas G4Material from scratch by atome count
192  //
193  inline G4Material* ConstructNewGasMaterial(const G4String& name,
194                                             const G4String& nameNist,
195                                             G4double temp, 
196                                             G4double pres, 
197                                             G4bool isotopes=true);
198
199  // Get number of G4Materials
200  //
201  inline size_t GetNumberOfMaterials();
202 
203  inline G4int GetVerbose();
204
205  void SetVerbose(G4int);
206
207  // Print G4Material by name
208  //
209  void PrintG4Material(const G4String&);
210
211  // Print predefined Geant4 materials:
212  // "simple" - only pure materials in basic state (Z = 1, ..., 98)
213  // "compound" - NIST compounds
214  // "hep" - HEP materials and compounds
215  // "all" - all
216  //
217  inline void ListMaterials(const G4String&);
218
219  // Access to the list of names of Geant4 predefined materials
220  //
221  inline const std::vector<G4String>& GetNistMaterialNames() const;
222
223  // Fast computation of Z^1/3
224  //
225  inline G4double GetZ13(G4double Z);
226  inline G4double GetZ13(G4int Z);
227
228  // Fast computation of A^0.27 for natuaral abandances
229  //
230  inline G4double GetA27(G4int Z);
231
232  // Fast computation of log(A)
233  //
234  inline G4double GetLOGA(G4double A);
235  inline G4double GetLOGZ(G4int Z);
236
237  // Fast computation of log(A) for natuaral abandances
238  //
239  inline G4double GetLOGA(G4int Z);
240
241private:
242
243  G4NistManager();
244  static G4NistManager* instance;
245
246  G4double POWERZ13[256];
247  G4double LOGA[256];
248  G4double POWERA27[101];
249  G4double LOGAZ[101];
250 
251  std::vector<G4Element*>   elements;
252  std::vector<G4Material*>  materials;
253 
254  size_t   nElements;
255  size_t   nMaterials;
256 
257  G4int    verbose;
258
259  G4NistElementBuilder*    elmBuilder;
260  G4NistMaterialBuilder*   matBuilder;
261  G4NistMessenger*         messenger;
262
263};
264
265//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
266//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
267
268inline size_t G4NistManager::GetNumberOfMaterials() 
269{
270  return nMaterials;
271}
272
273//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
274
275inline G4Element* G4NistManager::GetElement(size_t index)
276{
277  G4Element* elm = 0; 
278  const G4ElementTable* theElementTable = G4Element::GetElementTable();
279  if(index < theElementTable->size()) { elm = (*theElementTable)[index]; }
280  return elm;
281}
282
283//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
284
285inline 
286G4Element* G4NistManager::FindOrBuildElement(G4int Z, G4bool isotopes)
287{
288  return elmBuilder->FindOrBuildElement(Z, isotopes);
289}
290
291//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
292
293inline
294G4Element* G4NistManager::FindOrBuildElement(const G4String& symb,
295                                                   G4bool isotopes)
296{
297  return elmBuilder->FindOrBuildElement(symb, isotopes);
298}
299
300//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301
302inline size_t G4NistManager::GetNumberOfElements() const
303{ 
304  return nElements;
305}
306
307//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
308
309inline G4int G4NistManager::GetZ(const G4String& symb) const
310{
311  return elmBuilder->GetZ(symb);
312}
313
314//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
315
316inline G4double G4NistManager::GetAtomicMassAmu(G4int Z) const
317{
318  return elmBuilder->GetA(Z);
319}
320
321//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
322
323inline 
324G4double G4NistManager::GetIsotopeMass(G4int Z, G4int N) const
325{
326  return elmBuilder->GetIsotopeMass(Z, N);
327}
328
329//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
330
331inline 
332G4double G4NistManager::GetAtomicMass(G4int Z, G4int N) const
333{
334  return elmBuilder->GetAtomicMass(Z, N);
335}
336
337//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
338
339inline 
340G4double G4NistManager::GetTotalElectronBindingEnergy(G4int Z) const
341{
342  return elmBuilder->GetTotalElectronBindingEnergy(Z);
343}
344
345//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
346
347inline 
348G4double G4NistManager::GetIsotopeAbundance(G4int Z, G4int N) const
349{
350  return elmBuilder->GetIsotopeAbundance(Z, N);
351}
352
353//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
354
355inline 
356G4int G4NistManager::GetNistFirstIsotopeN(G4int Z) const
357{
358  return elmBuilder->GetNistFirstIsotopeN(Z);
359}
360
361//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
362
363inline 
364G4int G4NistManager::GetNumberOfNistIsotopes(G4int Z) const
365{
366  return elmBuilder->GetNumberOfNistIsotopes(Z);
367}
368
369//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
370
371inline 
372const std::vector<G4String>& G4NistManager::GetNistElementNames() const
373{
374  return elmBuilder->GetElementNames();
375}
376
377//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
378
379inline G4double G4NistManager::GetMeanIonisationEnergy(G4int Z) const
380{
381  return matBuilder->GetMeanIonisationEnergy(Z-1);
382}
383
384//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
385
386inline void G4NistManager::PrintElement(G4int Z)
387{
388  elmBuilder->PrintElement(Z);
389}
390
391//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
392
393inline G4Material* G4NistManager::GetMaterial(size_t index)
394{
395  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
396  G4Material* mat = 0;
397  if(index < theMaterialTable->size()) mat = (*theMaterialTable)[index];
398  return mat;
399}
400
401//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
402
403inline G4int G4NistManager::GetVerbose()
404{
405  return verbose;
406}
407
408//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
409
410inline
411G4Material* G4NistManager::FindOrBuildMaterial(const G4String& name,
412                                               G4bool isotopes,
413                                               G4bool warning)
414{
415  return matBuilder->FindOrBuildMaterial(name, isotopes, warning); 
416}
417
418//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
419
420inline G4Material* G4NistManager::ConstructNewMaterial(
421                                      const G4String& name,
422                                      const std::vector<G4String>& elm,
423                                      const std::vector<G4int>& nbAtoms,
424                                      G4double dens, 
425                                      G4bool isotopes,
426                                      G4State   state,     
427                                      G4double  T, 
428                                      G4double  P) 
429
430{
431  return 
432    matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes,state,T,P);
433}
434
435//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
436
437inline G4Material* G4NistManager::ConstructNewMaterial(
438                                      const G4String& name,
439                                      const std::vector<G4String>& elm,
440                                      const std::vector<G4double>& w,
441                                      G4double dens, 
442                                      G4bool isotopes,
443                                      G4State   state,     
444                                      G4double  T, 
445                                      G4double  P) 
446{
447  return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes,state,T,P);
448}
449
450//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
451
452inline G4Material* G4NistManager::ConstructNewGasMaterial(
453                                      const G4String& name,
454                                      const G4String& nameNist,
455                                      G4double temp, G4double pres, 
456                                      G4bool isotopes)
457{
458  return matBuilder->ConstructNewGasMaterial(name,nameNist,
459                                             temp,pres,isotopes);
460}
461
462//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
463
464inline void G4NistManager::ListMaterials(const G4String& list)
465{
466  matBuilder->ListMaterials(list);
467}
468
469//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
470
471inline
472const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
473{
474  return matBuilder->GetMaterialNames();
475}
476
477//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
478
479inline G4double G4NistManager::GetZ13(G4double Z)
480{
481  G4int iz = G4int(Z);
482  G4double x = (Z - G4double(iz))/(3.0*Z);
483  if(iz > 255) iz = 255;
484  else if(iz < 0) iz = 0;
485  return POWERZ13[iz]*(1.0 + x);
486}
487
488//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
489
490inline G4double G4NistManager::GetZ13(G4int Z)
491{
492  return POWERZ13[Z];
493}
494
495//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
496
497inline G4double G4NistManager::GetA27(G4int Z)
498{
499  G4double res = 0.0;
500  if(Z < 101) res = POWERA27[Z]; 
501  return res;
502}
503
504//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
505
506inline G4double G4NistManager::GetLOGZ(G4int Z)
507{
508  G4double res = 0.0;
509  if(Z < 256) res = LOGA[Z];
510  return res;
511}
512
513//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
514
515inline G4double G4NistManager::GetLOGA(G4double A)
516{
517  G4int ia = G4int(A);
518  G4double x = (A - G4double(ia))/A;
519  if(ia > 255) ia = 255;
520  else if(ia < 0) ia = 0;
521  return LOGA[ia] + x*(1.0 - 0.5*x);
522}
523
524//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
525
526inline G4double G4NistManager::GetLOGA(G4int Z)
527{
528  G4double res = 0.0;
529  if(Z < 101) res = LOGAZ[Z]; 
530  return res;
531}
532
533//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
534
535#endif
536
Note: See TracBrowser for help on using the repository browser.