Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // $Id: G4NistMaterialBuilder.hh,v 1.4 2005/10/31 11:35:25 vnivanch Exp $ >> 24 // GEANT4 tag $Name: geant4-08-00 $ 26 25 27 #ifndef G4NistMaterialBuilder_h 26 #ifndef G4NistMaterialBuilder_h 28 #define G4NistMaterialBuilder_h 1 27 #define G4NistMaterialBuilder_h 1 29 28 30 //-------------------------------------------- 29 //--------------------------------------------------------------------------- 31 // 30 // 32 // ClassName: G4NistMaterialBuilder 31 // ClassName: G4NistMaterialBuilder 33 // 32 // 34 // Description: Utility class to hold and mani 33 // Description: Utility class to hold and manipulate G4Materials 35 // 34 // 36 // Author: V.Ivanchenko 21.11.2004 << 35 // Author: V.Ivanchenko 21-11-2004 37 // 36 // 38 // Modifications: 37 // Modifications: 39 // 31.10.05 Add chemical effect and gas proper << 38 // 31-10-2005 Add chemical effect and gas properties (V.Ivanchenko) 40 // 27.02.06 V.Ivanchneko add ConstructNewGasMa << 39 // 41 // 11.05.06 V.Ivanchneko add warning flag to F << 42 // 27.07.06 V.Ivanchneko set defaul warning=tr << 43 // 27.07.07 V.Ivanchneko add matIndex vector t << 44 // 28.07.07 V.Ivanchneko add BuildMaterial met << 45 // 29.04.10 V.Ivanchneko add GetMeanIonisation << 46 // 09.02.12 P.Gumplinger add ConstructNewIdeal << 47 // 40 // 48 //-------------------------------------------- 41 //---------------------------------------------------------------------------- 49 // 42 // 50 // Class Description: 43 // Class Description: 51 // 44 // 52 // Element data from the NIST DB on Atomic Wei 45 // Element data from the NIST DB on Atomic Weights and Isotope Compositions 53 // http://physics.nist.gov/PhysRefData/Composi 46 // http://physics.nist.gov/PhysRefData/Compositions/index.html 54 // 47 // 55 48 56 #include "G4Material.hh" << 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 #include "globals.hh" << 58 << 59 #include <CLHEP/Units/PhysicalConstants.h> << 60 50 >> 51 #include "globals.hh" >> 52 #include "G4Material.hh" 61 #include <vector> 53 #include <vector> 62 54 >> 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 56 >> 57 class G4NistManager; 63 class G4NistElementBuilder; 58 class G4NistElementBuilder; 64 59 65 class G4NistMaterialBuilder 60 class G4NistMaterialBuilder 66 { 61 { 67 public: << 62 public: 68 G4NistMaterialBuilder(G4NistElementBuilder*, << 69 << 70 ~G4NistMaterialBuilder() = default; << 71 63 >> 64 G4NistMaterialBuilder(G4NistManager* mm=0, G4NistElementBuilder* eb=0, >> 65 G4int verb=0); >> 66 >> 67 ~G4NistMaterialBuilder(); >> 68 72 // Find or build a G4Material by name, from 69 // Find or build a G4Material by name, from dataBase 73 inline G4Material* FindMaterial(const G4Stri << 70 // 74 G4Material* FindOrBuildMaterial(const G4Stri << 71 G4Material* FindOrBuildMaterial (const G4String& name, G4bool isotopes=true); 75 << 72 76 // Find or build a simple material via atomi << 77 inline G4Material* FindSimpleMaterial(G4int << 78 G4Material* FindOrBuildSimpleMaterial(G4int << 79 << 80 // construct a G4Material from scratch by at 73 // construct a G4Material from scratch by atome count 81 G4Material* ConstructNewMaterial(const G4Str << 74 // 82 const std::vector<G4int>& nbAtoms, G4doubl << 75 G4Material* ConstructNewMaterial (const G4String& name, 83 G4double temp = NTP_Temperature, G4double << 76 const std::vector<G4String>& elm, 84 << 77 const std::vector<G4int>& nbAtoms, >> 78 G4double dens, G4bool isotopes=true); >> 79 85 // construct a G4Material from scratch by fr 80 // construct a G4Material from scratch by fraction mass 86 G4Material* ConstructNewMaterial(const G4Str << 81 // 87 const std::vector<G4double>& weight, G4dou << 82 G4Material* ConstructNewMaterial (const G4String& name, 88 G4double temp = NTP_Temperature, G4double << 83 const std::vector<G4String>& elm, 89 << 84 const std::vector<G4double>& weight, 90 // construct a gas G4Material from scratch b << 85 G4double dens, G4bool isotopes=true); 91 G4Material* ConstructNewGasMaterial( << 92 const G4String& name, const G4String& name << 93 << 94 // Construct an ideal gas G4Material from sc << 95 G4Material* ConstructNewIdealGasMaterial(con << 96 const std::vector<G4int>& nbAtoms, G4doubl << 97 G4double pressure = CLHEP::STP_Pressure); << 98 86 99 // verbosity level defined by G4NistManager << 100 void SetVerbose(G4int val); 87 void SetVerbose(G4int val); >> 88 void ListMaterials(const G4String&); >> 89 void ListNistSimpleMaterials(); >> 90 void ListNistCompoundMaterials(); >> 91 void ListHepMaterials(); 101 92 102 // cout predefined materials: << 93 private: 103 // "simple" - only pure materials in basic s << 104 // "compound" - NIST compounds << 105 // "hep" - HEP materials and compounds << 106 // "biochemical" - bio-chemical materials << 107 // "all" - all << 108 void ListMaterials(const G4String&) const; << 109 << 110 // cout lists of predefined materials << 111 void ListNistSimpleMaterials() const; << 112 void ListNistCompoundMaterials() const; << 113 void ListHepMaterials() const; << 114 void ListSpaceMaterials() const; << 115 void ListBioChemicalMaterials() const; << 116 << 117 // access to the list of names of Geant4 pre << 118 const std::vector<G4String>& GetMaterialName << 119 << 120 // access to the NIST mean ionisation potent << 121 inline G4double GetMeanIonisationEnergy(G4in << 122 inline G4double GetNominalDensity(G4int inde << 123 << 124 G4bool operator==(const G4NistMaterialBuilde << 125 G4bool operator!=(const G4NistMaterialBuilde << 126 G4NistMaterialBuilder(const G4NistMaterialBu << 127 const G4NistMaterialBuilder& operator=(const << 128 94 129 private: << 130 void Initialise(); 95 void Initialise(); 131 void NistSimpleMaterials(); 96 void NistSimpleMaterials(); 132 void NistCompoundMaterials(); 97 void NistCompoundMaterials(); 133 void NistCompoundMaterials2(); << 134 void HepAndNuclearMaterials(); 98 void HepAndNuclearMaterials(); 135 void SpaceMaterials(); << 136 void BioChemicalMaterials(); << 137 << 138 // add parameters of material from NIST DB t << 139 // density in g/cm3, mean ionisation potenti << 140 // << 141 void AddMaterial(const G4String& nameMat, G4 << 142 G4int ncomp = 1, G4State = kStateSolid, G4 << 143 99 144 void AddGas(const G4String& nameMat, G4doubl << 100 void AddMaterial(const G4String& nameMat, G4double dens, G4int Z=0, >> 101 G4double pot=0.0, G4int ncomp=1, >> 102 G4State=kStateSolid); >> 103 >> 104 void AddChemicalFormula(const G4String& nameMat, const G4String& ch); >> 105 void AddGas(const G4String& nameMat, G4double t=STP_Temperature, >> 106 G4double p=STP_Pressure); 145 107 146 void AddElementByWeightFraction(G4int Z, G4d 108 void AddElementByWeightFraction(G4int Z, G4double); 147 void AddElementByAtomCount(G4int Z, G4int); << 109 void AddElementByAtomCount (G4int Z, G4int); 148 110 149 void AddElementByWeightFraction(const G4Stri 111 void AddElementByWeightFraction(const G4String& name, G4double); 150 void AddElementByAtomCount(const G4String& n << 112 void AddElementByAtomCount (const G4String& name, G4int); 151 113 152 // build a G4Material from dataBase 114 // build a G4Material from dataBase 153 G4Material* BuildNistMaterial(const G4String << 115 G4Material* BuildMaterial(const G4String& name, G4bool isotopes); 154 G4Material* BuildMaterial(G4int idx); << 155 116 156 void DumpElm(G4int) const; << 117 void DumpElm(G4int); 157 void DumpMix(G4int) const; << 118 void DumpMix(G4int); 158 << 159 private: << 160 G4NistElementBuilder* elmBuilder; << 161 << 162 G4int verbose; << 163 G4int nMaterials{0}; << 164 G4int nComponents{0}; << 165 G4int nCurrent{0}; << 166 G4int nElementary; << 167 G4int nNIST; << 168 G4int nHEP; << 169 G4int nSpace; << 170 << 171 std::vector<G4String> names; << 172 std::vector<G4String> chFormulas; << 173 << 174 std::vector<G4double> densities; << 175 std::vector<G4double> ionPotentials; << 176 std::vector<G4State> states; << 177 std::vector<G4double> fractions; << 178 std::vector<G4bool> atomCount; << 179 std::vector<G4int> components; << 180 std::vector<G4int> indexes; << 181 std::vector<G4int> elements; << 182 std::vector<G4int> matIndex; << 183 std::vector<G4bool> STP; << 184 << 185 std::vector<G4int> idxGas; << 186 std::vector<G4double> gasTemperature; << 187 std::vector<G4double> gasPressure; << 188 }; << 189 119 190 inline const std::vector<G4String>& G4NistMate << 120 private: 191 { << 192 return names; << 193 } << 194 121 195 inline G4double G4NistMaterialBuilder::GetMean << 122 G4NistManager* matManager; 196 { << 123 G4NistElementBuilder* elmBuilder; 197 return (index >= 0 && index < nMaterials) ? << 124 198 } << 125 G4int verbose; >> 126 G4int nMaterials; >> 127 G4int nComponents; >> 128 G4int nCurrent; >> 129 G4int nElementary; >> 130 G4int nNIST; >> 131 >> 132 std::vector<G4String> names; >> 133 std::vector<G4String> chFormulas; >> 134 >> 135 std::vector<G4double> densities; >> 136 std::vector<G4double> ionPotentials; >> 137 std::vector<G4State> states; >> 138 std::vector<G4double> fractions; >> 139 std::vector<G4int> components; >> 140 std::vector<G4int> indexes; >> 141 std::vector<G4int> elements; 199 142 200 inline G4double G4NistMaterialBuilder::GetNomi << 143 std::vector<G4double> temperatures; 201 { << 144 std::vector<G4double> presures; 202 return (index >= 0 && index < nMaterials) ? << 203 } << 204 145 205 inline G4Material* G4NistMaterialBuilder::Find << 146 G4bool first; 206 { << 207 const G4MaterialTable* theMaterialTable = G4 << 208 G4Material* ptr = nullptr; << 209 for (auto& mat : *theMaterialTable) { << 210 if (name == mat->GetName()) { << 211 ptr = mat; << 212 break; << 213 } << 214 } << 215 return ptr; << 216 } << 217 147 218 inline G4Material* G4NistMaterialBuilder::Find << 148 }; 219 { << 220 return (Z > 0 && Z < nElementary) ? FindMate << 221 } << 222 149 223 #endif 150 #endif 224 151