Geant4  10.02
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 91920 2015-08-11 09:50:13Z 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 
84  // Find or build a simple material via atomic number
85  //
87 
88  // construct a G4Material from scratch by atome count
89  //
91  const std::vector<G4String>& elm,
92  const std::vector<G4int>& nbAtoms,
93  G4double dens,
94  G4bool isotopes = true,
95  G4State state = kStateSolid,
96  G4double temp = NTP_Temperature,
97  G4double pressure = CLHEP::STP_Pressure);
98 
99  // construct a G4Material from scratch by fraction mass
100  //
102  const std::vector<G4String>& elm,
103  const std::vector<G4double>& weight,
104  G4double dens,
105  G4bool isotopes = true,
106  G4State state = kStateSolid,
107  G4double temp = NTP_Temperature,
108  G4double pressure = CLHEP::STP_Pressure);
109 
110 
111  // construct a gas G4Material from scratch by atome count
112  //
114  const G4String& nameDB,
115  G4double temp, G4double pres,
116  G4bool isotopes = true);
117 
118  // Construct an ideal gas G4Material from scratch by atom count
119  //
121  const std::vector<G4String>& elm,
122  const std::vector<G4int>& nbAtoms,
123  G4bool isotopes = true,
124  G4double temp = NTP_Temperature,
125  G4double pressure = CLHEP::STP_Pressure);
126 
127  // verbosity level defined by G4NistManager
128  //
129  void SetVerbose(G4int val);
130 
131  // cout predefined materials:
132  // "simple" - only pure materials in basic state (Z = 1, ..., 98)
133  // "compound" - NIST compounds
134  // "hep" - HEP materials and compounds
135  // "biochemical" - bio-chemical materials
136  // "all" - all
137  //
138  void ListMaterials(const G4String&) const;
139 
140  // cout lists of predefined materials
141  //
142  void ListNistSimpleMaterials() const;
143  void ListNistCompoundMaterials() const;
144  void ListHepMaterials() const;
145  void ListSpaceMaterials() const;
146  void ListBioChemicalMaterials() const;
147 
148  // access to the list of names of Geant4 predefined materials
149  //
150  const std::vector<G4String>& GetMaterialNames() const;
151 
152  // access to the NIST mean ionisation potentials and nominal densities
153  //
154  inline G4double GetMeanIonisationEnergy(G4int index) const;
155  inline G4double GetNominalDensity(G4int index) const;
156 
157 private:
158 
159  void Initialise();
160  void NistSimpleMaterials();
161  void NistCompoundMaterials();
162  void NistCompoundMaterials2();
163  void HepAndNuclearMaterials();
164  void SpaceMaterials();
165  void BioChemicalMaterials();
166 
167  // add parameters of material from NIST DB to internal vectors
168  // density in g/cm3, mean ionisation potential in eV
169  //
170  void AddMaterial(const G4String& nameMat, G4double dens, G4int Z=0,
171  G4double pot=0.0, G4int ncomp=1,
172  G4State=kStateSolid, G4bool stp = true);
173 
174  void AddGas(const G4String& nameMat, G4double t=NTP_Temperature,
175  G4double p=CLHEP::STP_Pressure);
176 
179 
180  void AddElementByWeightFraction(const G4String& name, G4double);
181  void AddElementByAtomCount (const G4String& name, G4int);
182 
183  // build a G4Material from dataBase
185 
186  void DumpElm(G4int) const;
187  void DumpMix(G4int) const;
188 
189 private:
190 
192 
201 
202  std::vector<G4String> names;
203  std::vector<G4String> chFormulas;
204 
205  std::vector<G4double> densities;
206  std::vector<G4double> ionPotentials;
207  std::vector<G4State> states;
208  std::vector<G4double> fractions;
209  std::vector<G4bool> atomCount;
210  std::vector<G4int> components;
211  std::vector<G4int> indexes;
212  std::vector<G4int> elements;
213  std::vector<G4int> matIndex;
214  std::vector<G4bool> STP;
215 
216  std::vector<G4int> idxGas;
217  std::vector<G4double> gasTemperature;
218  std::vector<G4double> gasPressure;
219 
221 
222 };
223 
224 inline const std::vector<G4String>&
226 {
227  return names;
228 }
229 
230 inline G4double
232 {
233  G4double res = 10*index;
234  if(index >= 0 && index < nMaterials) { res = ionPotentials[index]; }
235  return res;
236 }
237 
238 inline G4double
240 {
241  G4double res = 0.0;
242  if(index >= 0 && index < nMaterials) { res = densities[index]; }
243  return res;
244 }
245 
246 #endif
std::vector< G4double > gasPressure
G4double GetMeanIonisationEnergy(G4int index) const
G4NistElementBuilder * elmBuilder
void ListBioChemicalMaterials() const
G4State
Definition: G4Material.hh:114
G4double GetNominalDensity(G4int index) const
std::vector< G4String > names
G4String name
Definition: TRTMaterials.hh:40
std::vector< G4double > densities
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=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
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
void AddGas(const G4String &nameMat, G4double t=NTP_Temperature, G4double p=CLHEP::STP_Pressure)
std::vector< G4State > states
std::vector< G4bool > STP
std::vector< G4double > ionPotentials
G4Material * ConstructNewIdealGasMaterial(const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4bool isotopes=true, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
std::vector< G4int > matIndex
std::vector< G4String > chFormulas
static const G4double NTP_Temperature
Definition: G4Material.hh:116
std::vector< G4int > components
const std::vector< G4String > & GetMaterialNames() const
double G4double
Definition: G4Types.hh:76
std::vector< G4double > fractions
void AddElementByAtomCount(G4int Z, G4int)
G4Material * FindOrBuildSimpleMaterial(G4int Z, G4bool warning)