G4NistMaterialBuilder.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: G4NistMaterialBuilder.hh 67044 2013-01-30 08:50:06Z gcosmo $
00027 
00028 #ifndef G4NistMaterialBuilder_h
00029 #define G4NistMaterialBuilder_h 1
00030 
00031 //---------------------------------------------------------------------------
00032 //
00033 // ClassName:   G4NistMaterialBuilder
00034 //
00035 // Description: Utility class to hold and manipulate G4Materials
00036 //
00037 // Author:      V.Ivanchenko 21.11.2004
00038 //
00039 // Modifications:
00040 // 31.10.05 Add chemical effect and gas properties (V.Ivanchenko)
00041 // 27.02.06 V.Ivanchneko add ConstructNewGasMaterial
00042 // 11.05.06 V.Ivanchneko add warning flag to FindOrBuildMaterial method
00043 // 27.07.06 V.Ivanchneko set defaul warning=true for FindOrBuildMaterial
00044 // 27.07.07 V.Ivanchneko add matIndex vector to control built materials
00045 // 28.07.07 V.Ivanchneko add BuildMaterial method using Nist index
00046 // 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method using Nist index
00047 // 09.02.12 P.Gumplinger add ConstructNewIdealGasMaterial
00048 //
00049 //----------------------------------------------------------------------------
00050 //
00051 // Class Description:
00052 //
00053 // Element data from the NIST DB on Atomic Weights and Isotope Compositions
00054 // http://physics.nist.gov/PhysRefData/Compositions/index.html
00055 //
00056 
00057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00058 
00059 #include <vector>
00060 #include <CLHEP/Units/PhysicalConstants.h>
00061 
00062 #include "globals.hh"
00063 #include "G4Material.hh"
00064 
00065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00066 
00067 class G4NistElementBuilder;
00068 
00069 class G4NistMaterialBuilder
00070 {
00071 public:
00072 
00073   G4NistMaterialBuilder(G4NistElementBuilder*, G4int verb=0);
00074                         
00075   ~G4NistMaterialBuilder();
00076  
00077   // Find or build a G4Material by name, from dataBase
00078   //
00079   G4Material* FindOrBuildMaterial (const G4String& name, 
00080                                    G4bool isotopes=true,
00081                                    G4bool warning =true);
00082                                             
00083   // construct a G4Material from scratch by atome count
00084   // 
00085   G4Material* ConstructNewMaterial (const G4String& name,
00086                                     const std::vector<G4String>& elm,
00087                                     const std::vector<G4int>& nbAtoms,
00088                                     G4double  dens, 
00089                                     G4bool    isotopes = true,
00090                                     G4State   state    = kStateSolid,     
00091                                     G4double  temp     = CLHEP::STP_Temperature,  
00092                                     G4double  pressure = CLHEP::STP_Pressure);
00093 
00094   // construct a G4Material from scratch by fraction mass
00095   //
00096   G4Material* ConstructNewMaterial (const G4String& name,
00097                                     const std::vector<G4String>& elm,
00098                                     const std::vector<G4double>& weight,
00099                                     G4double  dens, 
00100                                     G4bool    isotopes = true,
00101                                     G4State   state    = kStateSolid,     
00102                                     G4double  temp     = CLHEP::STP_Temperature,  
00103                                     G4double  pressure = CLHEP::STP_Pressure); 
00104 
00105 
00106   // construct a gas G4Material from scratch by atome count
00107   // 
00108   G4Material* ConstructNewGasMaterial(const G4String& name, 
00109                                       const G4String& nameDB,
00110                                       G4double temp, G4double pres, 
00111                                       G4bool isotopes = true);
00112 
00113   // Construct an ideal gas G4Material from scratch by atom count
00114   //
00115   G4Material* ConstructNewIdealGasMaterial(const G4String& name,
00116                                            const std::vector<G4String>& elm,
00117                                            const std::vector<G4int>& nbAtoms,
00118                                            G4bool    isotopes = true,
00119                                            G4double  temp     = CLHEP::STP_Temperature,
00120                                            G4double  pressure = CLHEP::STP_Pressure); 
00121                                       
00122   // verbosity level defined by G4NistManager
00123   //
00124   void SetVerbose(G4int val);
00125 
00126   // cout predefined materials:
00127   // "simple" - only pure materials in basic state (Z = 1, ..., 98)
00128   // "compound" - NIST compounds
00129   // "hep" - HEP materials and compounds
00130   // "biochemical" - bio-chemical materials 
00131   // "all" - all
00132   //
00133   void ListMaterials(const G4String&);
00134 
00135   // cout lists of predefined materials
00136   //
00137   void ListNistSimpleMaterials();
00138   void ListNistCompoundMaterials();
00139   void ListHepMaterials();
00140   void ListSpaceMaterials();
00141   void ListBioChemicalMaterials();
00142 
00143   // access to the list of names of Geant4 predefined materials
00144   //
00145   const std::vector<G4String>& GetMaterialNames() const;
00146 
00147   // access to the NIST mean ionisation potentials
00148   //
00149   inline G4double GetMeanIonisationEnergy(G4int index) const;
00150 
00151 private:
00152 
00153   void Initialise();
00154   void NistSimpleMaterials();
00155   void NistCompoundMaterials();
00156   void HepAndNuclearMaterials();
00157   void SpaceMaterials();
00158   void BioChemicalMaterials();
00159 
00160   // add parameters of material from NIST DB to internal vectors
00161   // density in g/cm3, mean ionisation potential in eV
00162   // 
00163   void AddMaterial(const G4String& nameMat, G4double dens, G4int Z=0,
00164                    G4double pot=0.0, G4int ncomp=1,
00165                    G4State=kStateSolid, G4bool stp = true);
00166 
00167   void AddGas(const G4String& nameMat, G4double t=CLHEP::STP_Temperature,
00168                                        G4double p=CLHEP::STP_Pressure);
00169 
00170   void AddElementByWeightFraction(G4int Z, G4double);
00171   void AddElementByAtomCount     (G4int Z, G4int);
00172 
00173   void AddElementByWeightFraction(const G4String& name, G4double);
00174   void AddElementByAtomCount     (const G4String& name, G4int);
00175 
00176   // build a G4Material from dataBase
00177   G4Material* BuildMaterial(G4int idx, G4bool isotopes);
00178 
00179   void DumpElm(G4int);
00180   void DumpMix(G4int);
00181 
00182 private:
00183 
00184   G4NistElementBuilder*  elmBuilder;
00185 
00186   G4int                  verbose;
00187   G4int                  nMaterials;
00188   G4int                  nComponents;
00189   G4int                  nCurrent;
00190   G4int                  nElementary;
00191   G4int                  nNIST;
00192   G4int                  nHEP;
00193   G4int                  nSpace;
00194 
00195   std::vector<G4String>  names;
00196   std::vector<G4String>  chFormulas;
00197 
00198   std::vector<G4double>  densities;
00199   std::vector<G4double>  ionPotentials;
00200   std::vector<G4State>   states;
00201   std::vector<G4double>  fractions;
00202   std::vector<G4bool>    atomCount;
00203   std::vector<G4int>     components;
00204   std::vector<G4int>     indexes;
00205   std::vector<G4int>     elements;
00206   std::vector<G4int>     matIndex;
00207   std::vector<G4bool>    STP;
00208 
00209   std::vector<G4int>     idxGas;
00210   std::vector<G4double>  gasTemperature;
00211   std::vector<G4double>  gasPressure;
00212 
00213   G4bool                 first;
00214 
00215 };
00216 
00217 inline const std::vector<G4String>& 
00218        G4NistMaterialBuilder::GetMaterialNames() const
00219 {
00220   return names;
00221 }
00222 
00223 inline G4double 
00224 G4NistMaterialBuilder::GetMeanIonisationEnergy(G4int index) const
00225 {
00226   G4double res = 10*index;
00227   if(index >= 0 && index < nMaterials) { res = ionPotentials[index]; }
00228   return res;
00229 }
00230 
00231 #endif

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