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

Last change on this file since 1354 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 15.2 KB
RevLine 
[822]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//
[1315]26// $Id: G4NistManager.hh,v 1.24 2010/04/29 11:11:56 vnivanch Exp $
[1337]27// GEANT4 tag $Name: geant4-09-04-beta-01 $
[822]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
[1315]48// 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method
[822]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
[850]87 // Get G4Element by index
[822]88 //
89 inline G4Element* GetElement(size_t index);
90
91 // Find or build G4Element by atomic number
[850]92 //
[822]93 inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes=true);
94
95 // Find or build G4Element by symbol
[850]96 //
[822]97 inline G4Element* FindOrBuildElement(const G4String& symb,
98 G4bool isotopes=true);
99
[850]100 // Get number of elements
101 //
102 inline size_t GetNumberOfElements() const;
[822]103
[850]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 //
[822]111 inline G4double GetAtomicMassAmu(G4int Z) const;
112
[850]113 // Get mass of the isotope in Geant4 units without electron shell
114 //
[822]115 inline G4double GetIsotopeMass(G4int Z, G4int N) const;
[850]116
117 // Get mass of the isotope in Geant4 units with electron shell
118 //
[822]119 inline G4double GetAtomicMass(G4int Z, G4int N) const;
120
[850]121 // Get total ionisation energy of an atom
122 //
123 inline G4double GetTotalElectronBindingEnergy(G4int Z) const;
[822]124
[850]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 //
[822]135 inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
136
[850]137 // Print element by Z
138 //
[822]139 inline void PrintElement(G4int Z);
140
[850]141 // Print element from internal DB by symbol, if "all" - print all elements
142 //
[822]143 void PrintElement(const G4String&);
[850]144
145 // Print G4Element by name, if "all" - print all G4Elements
146 //
[822]147 void PrintG4Element(const G4String&);
148
[850]149 // Access to the vector of Geant4 predefined element names
150 //
[822]151 inline const std::vector<G4String>& GetNistElementNames() const;
152
[1315]153 // Access mean ionisation energy for atoms (Z <= 98)
154 //
155 inline G4double GetMeanIonisationEnergy(G4int Z) const;
156
[850]157 // Get G4Material by index
[822]158 //
159 inline G4Material* GetMaterial(size_t index);
160
[850]161 // Find or build a G4Material by name, from the Geant4 dataBase
[822]162 //
163 inline G4Material* FindOrBuildMaterial(const G4String& name,
164 G4bool isotopes=true,
165 G4bool warning=false);
166
[850]167 // Construct a G4Material from scratch by atome count
[822]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
[850]179 // Construct a G4Material from scratch by fraction mass
[822]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
[850]191 // Construct a gas G4Material from scratch by atome count
[822]192 //
193 inline G4Material* ConstructNewGasMaterial(const G4String& name,
194 const G4String& nameNist,
195 G4double temp,
196 G4double pres,
197 G4bool isotopes=true);
198
[850]199 // Get number of G4Materials
200 //
[822]201 inline size_t GetNumberOfMaterials();
202
203 inline G4int GetVerbose();
204
205 void SetVerbose(G4int);
206
[850]207 // Print G4Material by name
208 //
[822]209 void PrintG4Material(const G4String&);
210
[850]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 //
[822]217 inline void ListMaterials(const G4String&);
218
[850]219 // Access to the list of names of Geant4 predefined materials
220 //
[822]221 inline const std::vector<G4String>& GetNistMaterialNames() const;
222
[850]223 // Fast computation of Z^1/3
224 //
225 inline G4double GetZ13(G4double Z);
226 inline G4double GetZ13(G4int Z);
[822]227
[850]228 // Fast computation of A^0.27 for natuaral abandances
229 //
230 inline G4double GetA27(G4int Z);
[822]231
[850]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
[822]241private:
242
243 G4NistManager();
244 static G4NistManager* instance;
245
[850]246 G4double POWERZ13[256];
247 G4double LOGA[256];
248 G4double POWERA27[101];
249 G4double LOGAZ[101];
[822]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
[850]268inline size_t G4NistManager::GetNumberOfMaterials()
[822]269{
270 return nMaterials;
271}
272
273//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
274
[850]275inline G4Element* G4NistManager::GetElement(size_t index)
[822]276{
277 G4Element* elm = 0;
278 const G4ElementTable* theElementTable = G4Element::GetElementTable();
[1315]279 if(index < theElementTable->size()) { elm = (*theElementTable)[index]; }
[822]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
[850]302inline size_t G4NistManager::GetNumberOfElements() const
[822]303{
304 return nElements;
305}
306
307//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
308
[850]309inline G4int G4NistManager::GetZ(const G4String& symb) const
[822]310{
311 return elmBuilder->GetZ(symb);
312}
313
314//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
315
[850]316inline G4double G4NistManager::GetAtomicMassAmu(G4int Z) const
[822]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
[850]340G4double G4NistManager::GetTotalElectronBindingEnergy(G4int Z) const
341{
342 return elmBuilder->GetTotalElectronBindingEnergy(Z);
343}
344
345//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
346
347inline
[822]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
[1315]379inline G4double G4NistManager::GetMeanIonisationEnergy(G4int Z) const
380{
381 return matBuilder->GetMeanIonisationEnergy(Z-1);
382}
383
384//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
385
[850]386inline void G4NistManager::PrintElement(G4int Z)
[822]387{
388 elmBuilder->PrintElement(Z);
389}
390
391//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
392
[850]393inline G4Material* G4NistManager::GetMaterial(size_t index)
[822]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
[850]403inline G4int G4NistManager::GetVerbose()
[822]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
[850]420inline G4Material* G4NistManager::ConstructNewMaterial(
[822]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
[850]437inline G4Material* G4NistManager::ConstructNewMaterial(
[822]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
[850]452inline G4Material* G4NistManager::ConstructNewGasMaterial(
[822]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
[850]464inline void G4NistManager::ListMaterials(const G4String& list)
[822]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
[850]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
[822]535#endif
536
Note: See TracBrowser for help on using the repository browser.