G4NistManager.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4NistManager.hh 67044 2013-01-30 08:50:06Z gcosmo $
00027 //
00028 // -------------------------------------------------------------------
00029 //
00030 // GEANT4 Class header file
00031 //
00032 // File name:     G4NistManager
00033 //
00034 // Author:        Vladimir Ivanchenko
00035 //
00036 // Creation date: 23.12.2004
00037 //
00038 // Modifications:
00039 // 27.02.06 V.Ivanchneko add GetAtomicMassAmu and ConstructNewGasMaterial
00040 // 11.05.06 V.Ivanchneko add warning flag to FindMaterial method
00041 // 17.10.06 V.Ivanchneko add methods: GetAtomicMass, GetNistElementNames,
00042 //                       GetNistMaterialNames
00043 // 02.05.07 V.Ivanchneko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes 
00044 // 28.07.07 V.Ivanchneko make simple methods inline
00045 // 28.10.07 V.Ivanchneko add state, T, P to maetrial build
00046 // 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method 
00047 // 01.11.10 V.Ivanchneko add G4Pow for fast computations 
00048 // 09.02.12 P.Gumplinger add ConstructNewIdealGasMaterial
00049 //
00050 // Class Description:
00051 //
00052 // A utility static class
00053 //
00054 
00055 // -------------------------------------------------------------------
00056 //
00057 // Class Description:
00058 //
00059 // Element data from the NIST DB on Atomic Weights and Isotope Compositions
00060 // http://physics.nist.gov/PhysRefData/Compositions/index.html
00061 //
00062 // -------------------------------------------------------------------
00063 //
00064 
00065 #ifndef G4NistManager_h
00066 #define G4NistManager_h 1
00067 
00068 #include <vector>
00069 #include <CLHEP/Units/PhysicalConstants.h>
00070 
00071 #include "globals.hh"
00072 #include "G4Material.hh"
00073 #include "G4NistElementBuilder.hh"
00074 #include "G4NistMaterialBuilder.hh"
00075 #include "G4Pow.hh"
00076 
00077 class G4NistMessenger;
00078 
00079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00080 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00081 
00082 class G4NistManager
00083 {
00084 
00085 public:
00086 
00087   static G4NistManager* Instance();
00088   ~G4NistManager();
00089 
00090   // Get G4Element by index
00091   //
00092   inline G4Element* GetElement(size_t index);
00093   
00094   // Find or build G4Element by atomic number
00095   //
00096   inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes=true);
00097   
00098   // Find or build G4Element by symbol
00099   //
00100   inline G4Element* FindOrBuildElement(const G4String& symb, 
00101                                        G4bool isotopes=true);
00102 
00103   // Get number of elements
00104   //
00105   inline size_t GetNumberOfElements() const;
00106 
00107   // Get atomic number by element symbol
00108   //
00109   inline G4int GetZ(const G4String& symb) const;
00110 
00111   // Get atomic weight by element symbol - mean mass in units of amu of 
00112   // an atom with electron shell for the natural isotope composition 
00113   //
00114   inline G4double GetAtomicMassAmu(const G4String& symb) const;
00115 
00116   // Get atomic weight in atomic units - mean mass in units of amu of an atom 
00117   // with electron shell for the natural isotope composition 
00118   //
00119   inline G4double GetAtomicMassAmu(G4int Z) const;
00120 
00121   // Get mass of isotope without electron shell in Geant4 energy units 
00122   //
00123   inline G4double GetIsotopeMass(G4int Z, G4int N) const;
00124 
00125   // Get mass in Geant4 energy units of an atom of a particular isotope 
00126   // with the electron shell  
00127   //
00128   inline G4double GetAtomicMass(G4int Z, G4int N) const;
00129 
00130   // Get total ionisation energy of an atom
00131   //
00132   inline G4double GetTotalElectronBindingEnergy(G4int Z) const;
00133 
00134   // Get N for the first natural isotope
00135   //
00136   inline G4int GetNistFirstIsotopeN(G4int Z) const;
00137 
00138   // Get number of natural isotopes
00139   //
00140   inline G4int GetNumberOfNistIsotopes(G4int Z) const;
00141 
00142   // Get natural isotope abandance
00143   //
00144   inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
00145 
00146   // Print element by Z
00147   //
00148   inline void PrintElement(G4int Z);  
00149 
00150   // Print element from internal DB by symbol, if "all" - print all elements
00151   //
00152   void PrintElement(const G4String&);    
00153 
00154   // Print G4Element by name, if "all" - print all G4Elements
00155   //
00156   void PrintG4Element(const G4String&);  
00157 
00158   // Access to the vector of Geant4 predefined element names 
00159   //
00160   inline const std::vector<G4String>& GetNistElementNames() const;
00161 
00162   // Access mean ionisation energy for atoms (Z <= 98) 
00163   //
00164   inline G4double GetMeanIonisationEnergy(G4int Z) const;
00165 
00166   // Get G4Material by index 
00167   //
00168   inline G4Material* GetMaterial(size_t index);
00169   
00170   // Find or build a G4Material by name, from the Geant4 dataBase
00171   //
00172   inline G4Material* FindOrBuildMaterial(const G4String& name, 
00173                                          G4bool isotopes=true,
00174                                          G4bool warning=false);
00175   
00176   // Build G4Material with user defined name and density on base
00177   // of a material from Geant4 dataBase
00178   //
00179   G4Material* BuildMaterialWithNewDensity(const G4String& name,
00180                                           const G4String& basename, 
00181                                           G4double density = 0.0,
00182                                           G4double temp = CLHEP::STP_Temperature,  
00183                                           G4double pres = CLHEP::STP_Pressure);  
00184 
00185   // Construct a G4Material from scratch by atome count
00186   // 
00187   inline G4Material* ConstructNewMaterial(
00188                                   const G4String& name,
00189                                   const std::vector<G4String>& elm,
00190                                   const std::vector<G4int>& nbAtoms,
00191                                   G4double dens, 
00192                                   G4bool isotopes=true,
00193                                   G4State   state    = kStateSolid,     
00194                                   G4double  temp     = CLHEP::STP_Temperature,  
00195                                   G4double  pressure = CLHEP::STP_Pressure); 
00196 
00197   // Construct a G4Material from scratch by fraction mass
00198   // 
00199   inline G4Material* ConstructNewMaterial(
00200                                   const G4String& name,
00201                                   const std::vector<G4String>& elm,
00202                                   const std::vector<G4double>& weight,
00203                                   G4double dens, 
00204                                   G4bool isotopes=true,
00205                                   G4State   state    = kStateSolid,     
00206                                   G4double  temp     = CLHEP::STP_Temperature,  
00207                                   G4double  pressure = CLHEP::STP_Pressure); 
00208 
00209   // Construct a gas G4Material from scratch by atome count
00210   // 
00211   inline G4Material* ConstructNewGasMaterial(const G4String& name,
00212                                              const G4String& nameNist,
00213                                              G4double temp, 
00214                                              G4double pres, 
00215                                              G4bool isotopes=true);
00216 
00217   // Construct an ideal gas G4Material from scratch by atom count
00218   //
00219   inline G4Material* ConstructNewIdealGasMaterial(
00220                                   const G4String& name,
00221                                   const std::vector<G4String>& elm,
00222                                   const std::vector<G4int>& nbAtoms,
00223                                   G4bool isotopes    = true,
00224                                   G4double  temp     = CLHEP::STP_Temperature,
00225                                   G4double  pressure = CLHEP::STP_Pressure);
00226                                       
00227   // Get number of G4Materials
00228   //
00229   inline size_t GetNumberOfMaterials();
00230   
00231   inline G4int GetVerbose();
00232 
00233   void SetVerbose(G4int);
00234 
00235   // Print G4Material by name
00236   //
00237   void PrintG4Material(const G4String&);
00238 
00239   // Print predefined Geant4 materials:
00240   // "simple" - only pure materials in basic state (Z = 1, ..., 98)
00241   // "compound" - NIST compounds
00242   // "hep" - HEP materials and compounds
00243   // "all" - all
00244   //
00245   inline void ListMaterials(const G4String&);
00246 
00247   // Access to the list of names of Geant4 predefined materials
00248   //
00249   inline const std::vector<G4String>& GetNistMaterialNames() const;
00250 
00251   // Fast computation of Z^1/3
00252   //
00253   inline G4double GetZ13(G4double Z);
00254   inline G4double GetZ13(G4int Z);
00255 
00256   // Fast computation of A^0.27 for natuaral abandances
00257   //
00258   inline G4double GetA27(G4int Z);
00259 
00260   // Fast computation of log(A)
00261   //
00262   inline G4double GetLOGA(G4double A);
00263   inline G4double GetLOGZ(G4int Z);
00264 
00265   // Fast computation of log(A) for natuaral abandances
00266   //
00267   inline G4double GetLOGA(G4int Z);
00268 
00269 private:
00270 
00271   G4NistManager();
00272   static G4NistManager* instance;
00273 
00274   G4Pow* g4pow;
00275   G4double POWERA27[101];
00276   G4double LOGAZ[101];
00277   
00278   std::vector<G4Element*>   elements;
00279   std::vector<G4Material*>  materials;
00280   
00281   size_t   nElements;
00282   size_t   nMaterials;
00283   
00284   G4int    verbose;
00285 
00286   G4NistElementBuilder*    elmBuilder;
00287   G4NistMaterialBuilder*   matBuilder;
00288   G4NistMessenger*         messenger;
00289 
00290 };
00291 
00292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00294 
00295 inline size_t G4NistManager::GetNumberOfMaterials() 
00296 {
00297   return nMaterials;
00298 }
00299 
00300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00301 
00302 inline G4Element* G4NistManager::GetElement(size_t index)
00303 {
00304   G4Element* elm = 0; 
00305   const G4ElementTable* theElementTable = G4Element::GetElementTable();
00306   if(index < theElementTable->size()) { elm = (*theElementTable)[index]; }
00307   return elm;
00308 }
00309 
00310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00311 
00312 inline 
00313 G4Element* G4NistManager::FindOrBuildElement(G4int Z, G4bool isotopes)
00314 {
00315   return elmBuilder->FindOrBuildElement(Z, isotopes);
00316 }
00317 
00318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00319 
00320 inline
00321 G4Element* G4NistManager::FindOrBuildElement(const G4String& symb,
00322                                                    G4bool isotopes)
00323 {
00324   return elmBuilder->FindOrBuildElement(symb, isotopes);
00325 }
00326 
00327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00328 
00329 inline size_t G4NistManager::GetNumberOfElements() const
00330 { 
00331   return nElements;
00332 }
00333 
00334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00335 
00336 inline G4int G4NistManager::GetZ(const G4String& symb) const
00337 {
00338   return elmBuilder->GetZ(symb);
00339 }
00340 
00341 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00342 
00343 inline G4double G4NistManager::GetAtomicMassAmu(const G4String& symb) const
00344 {
00345   return elmBuilder->GetAtomicMassAmu(symb);
00346 }
00347 
00348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00349 
00350 inline G4double G4NistManager::GetAtomicMassAmu(G4int Z) const
00351 {
00352   return elmBuilder->GetAtomicMassAmu(Z);
00353 }
00354 
00355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00356 
00357 inline 
00358 G4double G4NistManager::GetIsotopeMass(G4int Z, G4int N) const
00359 {
00360   return elmBuilder->GetIsotopeMass(Z, N);
00361 }
00362 
00363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00364 
00365 inline 
00366 G4double G4NistManager::GetAtomicMass(G4int Z, G4int N) const
00367 {
00368   return elmBuilder->GetAtomicMass(Z, N);
00369 }
00370 
00371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00372 
00373 inline 
00374 G4double G4NistManager::GetTotalElectronBindingEnergy(G4int Z) const
00375 {
00376   return elmBuilder->GetTotalElectronBindingEnergy(Z);
00377 }
00378 
00379 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00380 
00381 inline 
00382 G4double G4NistManager::GetIsotopeAbundance(G4int Z, G4int N) const
00383 {
00384   return elmBuilder->GetIsotopeAbundance(Z, N);
00385 }
00386 
00387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00388 
00389 inline 
00390 G4int G4NistManager::GetNistFirstIsotopeN(G4int Z) const
00391 {
00392   return elmBuilder->GetNistFirstIsotopeN(Z);
00393 }
00394 
00395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00396 
00397 inline 
00398 G4int G4NistManager::GetNumberOfNistIsotopes(G4int Z) const
00399 {
00400   return elmBuilder->GetNumberOfNistIsotopes(Z);
00401 }
00402 
00403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00404 
00405 inline 
00406 const std::vector<G4String>& G4NistManager::GetNistElementNames() const
00407 {
00408   return elmBuilder->GetElementNames();
00409 }
00410 
00411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00412 
00413 inline G4double G4NistManager::GetMeanIonisationEnergy(G4int Z) const
00414 {
00415   return matBuilder->GetMeanIonisationEnergy(Z-1);
00416 }
00417 
00418 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00419 
00420 inline void G4NistManager::PrintElement(G4int Z)
00421 {
00422   elmBuilder->PrintElement(Z);
00423 }
00424 
00425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00426 
00427 inline G4Material* G4NistManager::GetMaterial(size_t index)
00428 {
00429   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
00430   G4Material* mat = 0;
00431   if(index < theMaterialTable->size()) mat = (*theMaterialTable)[index];
00432   return mat;
00433 }
00434 
00435 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00436 
00437 inline G4int G4NistManager::GetVerbose()
00438 {
00439   return verbose;
00440 }
00441 
00442 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00443 
00444 inline
00445 G4Material* G4NistManager::FindOrBuildMaterial(const G4String& name,
00446                                                G4bool isotopes,
00447                                                G4bool warning)
00448 {
00449   return matBuilder->FindOrBuildMaterial(name, isotopes, warning);  
00450 }
00451 
00452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00453 
00454 inline G4Material* G4NistManager::ConstructNewMaterial(
00455                                       const G4String& name,
00456                                       const std::vector<G4String>& elm,
00457                                       const std::vector<G4int>& nbAtoms,
00458                                       G4double dens, 
00459                                       G4bool isotopes,
00460                                       G4State   state,     
00461                                       G4double  T,  
00462                                       G4double  P) 
00463 
00464 {
00465   return 
00466     matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes,state,T,P);
00467 }
00468 
00469 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00470 
00471 inline G4Material* G4NistManager::ConstructNewMaterial(
00472                                       const G4String& name,
00473                                       const std::vector<G4String>& elm,
00474                                       const std::vector<G4double>& w,
00475                                       G4double dens, 
00476                                       G4bool isotopes,
00477                                       G4State   state,     
00478                                       G4double  T,  
00479                                       G4double  P) 
00480 {
00481   return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes,state,T,P);
00482 }
00483 
00484 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00485 
00486 inline G4Material* G4NistManager::ConstructNewGasMaterial(
00487                                       const G4String& name,
00488                                       const G4String& nameNist,
00489                                       G4double temp, G4double pres, 
00490                                       G4bool isotopes)
00491 {
00492   return matBuilder->ConstructNewGasMaterial(name,nameNist,
00493                                              temp,pres,isotopes);
00494 }
00495 
00496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00497 
00498 inline G4Material* G4NistManager::ConstructNewIdealGasMaterial(
00499                                       const G4String& name,
00500                                       const std::vector<G4String>& elm,
00501                                       const std::vector<G4int>& nbAtoms,
00502                                       G4bool isotopes,
00503                                       G4double  T,
00504                                       G4double  P)
00505 {
00506   return
00507     matBuilder->ConstructNewIdealGasMaterial(name,elm,nbAtoms,isotopes,T,P);
00508 }
00509 
00510 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00511 
00512 inline void G4NistManager::ListMaterials(const G4String& list)
00513 {
00514   matBuilder->ListMaterials(list);
00515 }
00516 
00517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00518 
00519 inline
00520 const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
00521 {
00522   return matBuilder->GetMaterialNames();
00523 }
00524 
00525 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00526 
00527 inline G4double G4NistManager::GetZ13(G4double A)
00528 {
00529   return g4pow->A13(A);
00530 }
00531 
00532 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00533 
00534 inline G4double G4NistManager::GetZ13(G4int Z)
00535 {
00536   return g4pow->Z13(Z);
00537 }
00538 
00539 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00540 
00541 inline G4double G4NistManager::GetA27(G4int Z)
00542 {
00543   G4double res = 0.0;
00544   if(Z < 101) { res = POWERA27[Z]; } 
00545   return res;
00546 }
00547 
00548 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00549 
00550 inline G4double G4NistManager::GetLOGZ(G4int Z)
00551 {
00552   return g4pow->logZ(Z);
00553 }
00554 
00555 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00556 
00557 inline G4double G4NistManager::GetLOGA(G4double A)
00558 {
00559   return g4pow->logA(A);
00560 }
00561 
00562 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00563 
00564 inline G4double G4NistManager::GetLOGA(G4int Z)
00565 {
00566   G4double res = 0.0;
00567   if(Z < 101) { res = LOGAZ[Z]; } 
00568   return res;
00569 }
00570 
00571 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00572 
00573 #endif
00574 

Generated on Mon May 27 17:49:05 2013 for Geant4 by  doxygen 1.4.7