Geant4  10.00.p03
G4NistMaterialBuilder.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: G4NistMaterialBuilder.hh 72057 2013-07-04 13:07:29Z gcosmo $
27 
28 #ifndef G4NistMaterialBuilder_h
29 #define G4NistMaterialBuilder_h 1
30 
31 //---------------------------------------------------------------------------
32 //
33 // ClassName: G4NistMaterialBuilder
34 //
35 // Description: Utility class to hold and manipulate G4Materials
36 //
37 // Author: V.Ivanchenko 21.11.2004
38 //
39 // Modifications:
40 // 31.10.05 Add chemical effect and gas properties (V.Ivanchenko)
41 // 27.02.06 V.Ivanchneko add ConstructNewGasMaterial
42 // 11.05.06 V.Ivanchneko add warning flag to FindOrBuildMaterial method
43 // 27.07.06 V.Ivanchneko set defaul warning=true for FindOrBuildMaterial
44 // 27.07.07 V.Ivanchneko add matIndex vector to control built materials
45 // 28.07.07 V.Ivanchneko add BuildMaterial method using Nist index
46 // 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method using Nist index
47 // 09.02.12 P.Gumplinger add ConstructNewIdealGasMaterial
48 //
49 //----------------------------------------------------------------------------
50 //
51 // Class Description:
52 //
53 // Element data from the NIST DB on Atomic Weights and Isotope Compositions
54 // http://physics.nist.gov/PhysRefData/Compositions/index.html
55 //
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 #include <vector>
60 #include <CLHEP/Units/PhysicalConstants.h>
61 
62 #include "globals.hh"
63 #include "G4Material.hh"
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
68 
70 {
71 public:
72 
74 
76 
77  // Find or build a G4Material by name, from dataBase
78  //
80  G4bool isotopes=true,
81  G4bool warning =true);
82 
83  // construct a G4Material from scratch by atome count
84  //
86  const std::vector<G4String>& elm,
87  const std::vector<G4int>& nbAtoms,
88  G4double dens,
89  G4bool isotopes = true,
90  G4State state = kStateSolid,
91  G4double temp = CLHEP::STP_Temperature,
92  G4double pressure = CLHEP::STP_Pressure);
93 
94  // construct a G4Material from scratch by fraction mass
95  //
97  const std::vector<G4String>& elm,
98  const std::vector<G4double>& weight,
99  G4double dens,
100  G4bool isotopes = true,
101  G4State state = kStateSolid,
102  G4double temp = CLHEP::STP_Temperature,
103  G4double pressure = CLHEP::STP_Pressure);
104 
105 
106  // construct a gas G4Material from scratch by atome count
107  //
109  const G4String& nameDB,
110  G4double temp, G4double pres,
111  G4bool isotopes = true);
112 
113  // Construct an ideal gas G4Material from scratch by atom count
114  //
116  const std::vector<G4String>& elm,
117  const std::vector<G4int>& nbAtoms,
118  G4bool isotopes = true,
119  G4double temp = CLHEP::STP_Temperature,
120  G4double pressure = CLHEP::STP_Pressure);
121 
122  // verbosity level defined by G4NistManager
123  //
124  void SetVerbose(G4int val);
125 
126  // cout predefined materials:
127  // "simple" - only pure materials in basic state (Z = 1, ..., 98)
128  // "compound" - NIST compounds
129  // "hep" - HEP materials and compounds
130  // "biochemical" - bio-chemical materials
131  // "all" - all
132  //
133  void ListMaterials(const G4String&) const;
134 
135  // cout lists of predefined materials
136  //
137  void ListNistSimpleMaterials() const;
138  void ListNistCompoundMaterials() const;
139  void ListHepMaterials() const;
140  void ListSpaceMaterials() const;
141  void ListBioChemicalMaterials() const;
142 
143  // access to the list of names of Geant4 predefined materials
144  //
145  const std::vector<G4String>& GetMaterialNames() const;
146 
147  // access to the NIST mean ionisation potentials
148  //
149  inline G4double GetMeanIonisationEnergy(G4int index) const;
150 
151 private:
152 
153  void Initialise();
154  void NistSimpleMaterials();
155  void NistCompoundMaterials();
156  void HepAndNuclearMaterials();
157  void SpaceMaterials();
158  void BioChemicalMaterials();
159 
160  // add parameters of material from NIST DB to internal vectors
161  // density in g/cm3, mean ionisation potential in eV
162  //
163  void AddMaterial(const G4String& nameMat, G4double dens, G4int Z=0,
164  G4double pot=0.0, G4int ncomp=1,
165  G4State=kStateSolid, G4bool stp = true);
166 
167  void AddGas(const G4String& nameMat, G4double t=CLHEP::STP_Temperature,
168  G4double p=CLHEP::STP_Pressure);
169 
172 
173  void AddElementByWeightFraction(const G4String& name, G4double);
174  void AddElementByAtomCount (const G4String& name, G4int);
175 
176  // build a G4Material from dataBase
178 
179  void DumpElm(G4int) const;
180  void DumpMix(G4int) const;
181 
182 private:
183 
185 
194 
195  std::vector<G4String> names;
196  std::vector<G4String> chFormulas;
197 
198  std::vector<G4double> densities;
199  std::vector<G4double> ionPotentials;
200  std::vector<G4State> states;
201  std::vector<G4double> fractions;
202  std::vector<G4bool> atomCount;
203  std::vector<G4int> components;
204  std::vector<G4int> indexes;
205  std::vector<G4int> elements;
206  std::vector<G4int> matIndex;
207  std::vector<G4bool> STP;
208 
209  std::vector<G4int> idxGas;
210  std::vector<G4double> gasTemperature;
211  std::vector<G4double> gasPressure;
212 
214 
215 };
216 
217 inline const std::vector<G4String>&
219 {
220  return names;
221 }
222 
223 inline G4double
225 {
226  G4double res = 10*index;
227  if(index >= 0 && index < nMaterials) { res = ionPotentials[index]; }
228  return res;
229 }
230 
231 #endif
std::vector< G4double > gasPressure
G4double GetMeanIonisationEnergy(G4int index) const
G4Material * ConstructNewMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=CLHEP::STP_Temperature, G4double pressure=CLHEP::STP_Pressure)
void AddGas(const G4String &nameMat, G4double t=CLHEP::STP_Temperature, G4double p=CLHEP::STP_Pressure)
G4NistElementBuilder * elmBuilder
void ListBioChemicalMaterials() const
G4State
Definition: G4Material.hh:114
std::vector< G4String > names
G4String name
Definition: TRTMaterials.hh:40
std::vector< G4double > densities
void ListMaterials(const G4String &) const
int G4int
Definition: G4Types.hh:78
G4Material * ConstructNewGasMaterial(const G4String &name, const G4String &nameDB, G4double temp, G4double pres, G4bool isotopes=true)
void AddMaterial(const G4String &nameMat, G4double dens, G4int Z=0, G4double pot=0.0, G4int ncomp=1, G4State=kStateSolid, G4bool stp=true)
G4NistMaterialBuilder(G4NistElementBuilder *, G4int verb=0)
std::vector< G4int > idxGas
bool G4bool
Definition: G4Types.hh:79
std::vector< G4int > indexes
G4Material * BuildMaterial(G4int idx)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
std::vector< G4double > gasTemperature
void AddElementByWeightFraction(G4int Z, G4double)
void ListNistCompoundMaterials() const
std::vector< G4bool > atomCount
std::vector< G4int > elements
std::vector< G4State > states
std::vector< G4bool > STP
std::vector< G4double > ionPotentials
std::vector< G4int > matIndex
std::vector< G4String > chFormulas
std::vector< G4int > components
G4Material * ConstructNewIdealGasMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4bool isotopes=true, G4double temp=CLHEP::STP_Temperature, G4double pressure=CLHEP::STP_Pressure)
const std::vector< G4String > & GetMaterialNames() const
double G4double
Definition: G4Types.hh:76
std::vector< G4double > fractions
void AddElementByAtomCount(G4int Z, G4int)