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