[822] | 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 | // |
---|
[1315] | 26 | // $Id: G4NistMaterialBuilder.hh,v 1.16 2010/04/29 11:11:56 vnivanch Exp $ |
---|
| 27 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ |
---|
[822] | 28 | |
---|
| 29 | #ifndef G4NistMaterialBuilder_h |
---|
| 30 | #define G4NistMaterialBuilder_h 1 |
---|
| 31 | |
---|
| 32 | //--------------------------------------------------------------------------- |
---|
| 33 | // |
---|
| 34 | // ClassName: G4NistMaterialBuilder |
---|
| 35 | // |
---|
| 36 | // Description: Utility class to hold and manipulate G4Materials |
---|
| 37 | // |
---|
| 38 | // Author: V.Ivanchenko 21.11.2004 |
---|
| 39 | // |
---|
| 40 | // Modifications: |
---|
| 41 | // 31.10.05 Add chemical effect and gas properties (V.Ivanchenko) |
---|
| 42 | // 27.02.06 V.Ivanchneko add ConstructNewGasMaterial |
---|
| 43 | // 11.05.06 V.Ivanchneko add warning flag to FindOrBuildMaterial method |
---|
| 44 | // 27.07.06 V.Ivanchneko set defaul warning=true for FindOrBuildMaterial |
---|
| 45 | // 27.07.07 V.Ivanchneko add matIndex vector to control built materials |
---|
| 46 | // 28.07.07 V.Ivanchneko add BuildMaterial method using Nist index |
---|
[1315] | 47 | // 29.04.10 V.Ivanchneko add GetMeanIonisationEnergy method using Nist index |
---|
[822] | 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 "globals.hh" |
---|
| 60 | #include "G4Material.hh" |
---|
| 61 | #include <vector> |
---|
| 62 | |
---|
| 63 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 64 | |
---|
| 65 | class G4NistElementBuilder; |
---|
| 66 | |
---|
| 67 | class G4NistMaterialBuilder |
---|
| 68 | { |
---|
| 69 | public: |
---|
| 70 | |
---|
| 71 | G4NistMaterialBuilder(G4NistElementBuilder*, G4int verb=0); |
---|
| 72 | |
---|
| 73 | ~G4NistMaterialBuilder(); |
---|
| 74 | |
---|
| 75 | // Find or build a G4Material by name, from dataBase |
---|
| 76 | // |
---|
| 77 | G4Material* FindOrBuildMaterial (const G4String& name, |
---|
| 78 | G4bool isotopes=true, |
---|
| 79 | G4bool warning=true); |
---|
| 80 | |
---|
| 81 | // construct a G4Material from scratch by atome count |
---|
| 82 | // |
---|
| 83 | G4Material* ConstructNewMaterial (const G4String& name, |
---|
| 84 | const std::vector<G4String>& elm, |
---|
| 85 | const std::vector<G4int>& nbAtoms, |
---|
| 86 | G4double dens, |
---|
| 87 | G4bool isotopes=true, |
---|
| 88 | G4State state = kStateSolid, |
---|
| 89 | G4double temp = STP_Temperature, |
---|
| 90 | G4double pressure = STP_Pressure); |
---|
| 91 | |
---|
| 92 | // construct a G4Material from scratch by fraction mass |
---|
| 93 | // |
---|
| 94 | G4Material* ConstructNewMaterial (const G4String& name, |
---|
| 95 | const std::vector<G4String>& elm, |
---|
| 96 | const std::vector<G4double>& weight, |
---|
| 97 | G4double dens, |
---|
| 98 | G4bool isotopes=true, |
---|
| 99 | G4State state = kStateSolid, |
---|
| 100 | G4double temp = STP_Temperature, |
---|
| 101 | G4double pressure = STP_Pressure); |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | // construct a gas G4Material from scratch by atome count |
---|
| 105 | // |
---|
| 106 | G4Material* ConstructNewGasMaterial(const G4String& name, |
---|
| 107 | const G4String& nameNist, |
---|
| 108 | G4double temp, G4double pres, |
---|
| 109 | G4bool isotopes=true); |
---|
| 110 | |
---|
[850] | 111 | // verbosity level defined by G4NistManager |
---|
| 112 | // |
---|
[822] | 113 | void SetVerbose(G4int val); |
---|
[850] | 114 | |
---|
| 115 | // cout predefined materials: |
---|
| 116 | // "simple" - only pure materials in basic state (Z = 1, ..., 98) |
---|
| 117 | // "compound" - NIST compounds |
---|
| 118 | // "hep" - HEP materials and compounds |
---|
| 119 | // "all" - all |
---|
| 120 | // |
---|
[822] | 121 | void ListMaterials(const G4String&); |
---|
[850] | 122 | |
---|
| 123 | // cout lists of predefined materials |
---|
| 124 | // |
---|
[822] | 125 | void ListNistSimpleMaterials(); |
---|
| 126 | void ListNistCompoundMaterials(); |
---|
| 127 | void ListHepMaterials(); |
---|
[1315] | 128 | void ListSpaceMaterials(); |
---|
[822] | 129 | |
---|
[850] | 130 | // access to the list of names of Geant4 predefined materials |
---|
| 131 | // |
---|
[822] | 132 | const std::vector<G4String>& GetMaterialNames() const; |
---|
| 133 | |
---|
[1315] | 134 | // access to the NIST mean ionisation potentials |
---|
| 135 | // |
---|
| 136 | inline G4double GetMeanIonisationEnergy(G4int index) const; |
---|
| 137 | |
---|
[822] | 138 | private: |
---|
| 139 | |
---|
| 140 | void Initialise(); |
---|
| 141 | void NistSimpleMaterials(); |
---|
| 142 | void NistCompoundMaterials(); |
---|
| 143 | void HepAndNuclearMaterials(); |
---|
[1315] | 144 | void SpaceMaterials(); |
---|
[822] | 145 | |
---|
[850] | 146 | // add parameters of material from NIST DB to internal vectors |
---|
| 147 | // density in g/cm3, mean ionisation potential in eV |
---|
| 148 | // |
---|
[822] | 149 | void AddMaterial(const G4String& nameMat, G4double dens, G4int Z=0, |
---|
| 150 | G4double pot=0.0, G4int ncomp=1, |
---|
| 151 | G4State=kStateSolid, |
---|
| 152 | G4double temp=STP_Temperature, |
---|
| 153 | G4double pres=STP_Pressure); |
---|
| 154 | |
---|
| 155 | void AddChemicalFormula(const G4String& nameMat, const G4String& ch); |
---|
| 156 | void AddGas(const G4String& nameMat, G4double t=STP_Temperature, |
---|
| 157 | G4double p=STP_Pressure); |
---|
| 158 | |
---|
| 159 | void AddElementByWeightFraction(G4int Z, G4double); |
---|
| 160 | void AddElementByAtomCount (G4int Z, G4int); |
---|
| 161 | |
---|
| 162 | void AddElementByWeightFraction(const G4String& name, G4double); |
---|
| 163 | void AddElementByAtomCount (const G4String& name, G4int); |
---|
| 164 | |
---|
| 165 | // build a G4Material from dataBase |
---|
| 166 | G4Material* BuildMaterial(const G4String& name, G4bool isotopes); |
---|
| 167 | G4Material* BuildMaterial(G4int idx, G4bool isotopes); |
---|
| 168 | |
---|
| 169 | void DumpElm(G4int); |
---|
| 170 | void DumpMix(G4int); |
---|
| 171 | |
---|
| 172 | private: |
---|
| 173 | |
---|
| 174 | G4NistElementBuilder* elmBuilder; |
---|
| 175 | |
---|
| 176 | G4int verbose; |
---|
| 177 | G4int nMaterials; |
---|
| 178 | G4int nComponents; |
---|
| 179 | G4int nCurrent; |
---|
| 180 | G4int nElementary; |
---|
| 181 | G4int nNIST; |
---|
[1315] | 182 | G4int nHEP; |
---|
[822] | 183 | |
---|
| 184 | std::vector<G4String> names; |
---|
| 185 | std::vector<G4String> chFormulas; |
---|
| 186 | |
---|
| 187 | std::vector<G4double> densities; |
---|
| 188 | std::vector<G4double> ionPotentials; |
---|
| 189 | std::vector<G4State> states; |
---|
| 190 | std::vector<G4double> fractions; |
---|
| 191 | std::vector<G4int> components; |
---|
| 192 | std::vector<G4int> indexes; |
---|
| 193 | std::vector<G4int> elements; |
---|
| 194 | |
---|
| 195 | std::vector<G4int> matIndex; |
---|
| 196 | |
---|
| 197 | std::vector<G4double> temperatures; |
---|
| 198 | std::vector<G4double> presures; |
---|
| 199 | |
---|
| 200 | G4bool first; |
---|
| 201 | |
---|
| 202 | }; |
---|
| 203 | |
---|
| 204 | inline const std::vector<G4String>& |
---|
| 205 | G4NistMaterialBuilder::GetMaterialNames() const |
---|
| 206 | { |
---|
| 207 | return names; |
---|
| 208 | } |
---|
| 209 | |
---|
[1315] | 210 | inline G4double |
---|
| 211 | G4NistMaterialBuilder::GetMeanIonisationEnergy(G4int index) const |
---|
| 212 | { |
---|
| 213 | G4double res = 10*index; |
---|
| 214 | if(index >= 0 && index < nMaterials) { res = ionPotentials[index]; } |
---|
| 215 | return res; |
---|
| 216 | } |
---|
| 217 | |
---|
[822] | 218 | #endif |
---|