| 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,v 1.13 2008/04/28 08:51:29 vnivanch Exp $
|
|---|
| 27 | // GEANT4 tag $Name: materials-V09-02-18 $
|
|---|
| 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
|
|---|
| 47 | //
|
|---|
| 48 | //----------------------------------------------------------------------------
|
|---|
| 49 | //
|
|---|
| 50 | // Class Description:
|
|---|
| 51 | //
|
|---|
| 52 | // Element data from the NIST DB on Atomic Weights and Isotope Compositions
|
|---|
| 53 | // http://physics.nist.gov/PhysRefData/Compositions/index.html
|
|---|
| 54 | //
|
|---|
| 55 |
|
|---|
| 56 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 57 |
|
|---|
| 58 | #include "globals.hh"
|
|---|
| 59 | #include "G4Material.hh"
|
|---|
| 60 | #include <vector>
|
|---|
| 61 |
|
|---|
| 62 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 63 |
|
|---|
| 64 | class G4NistElementBuilder;
|
|---|
| 65 |
|
|---|
| 66 | class G4NistMaterialBuilder
|
|---|
| 67 | {
|
|---|
| 68 | public:
|
|---|
| 69 |
|
|---|
| 70 | G4NistMaterialBuilder(G4NistElementBuilder*, G4int verb=0);
|
|---|
| 71 |
|
|---|
| 72 | ~G4NistMaterialBuilder();
|
|---|
| 73 |
|
|---|
| 74 | // Find or build a G4Material by name, from dataBase
|
|---|
| 75 | //
|
|---|
| 76 | G4Material* FindOrBuildMaterial (const G4String& name,
|
|---|
| 77 | G4bool isotopes=true,
|
|---|
| 78 | G4bool warning=true);
|
|---|
| 79 |
|
|---|
| 80 | // construct a G4Material from scratch by atome count
|
|---|
| 81 | //
|
|---|
| 82 | G4Material* ConstructNewMaterial (const G4String& name,
|
|---|
| 83 | const std::vector<G4String>& elm,
|
|---|
| 84 | const std::vector<G4int>& nbAtoms,
|
|---|
| 85 | G4double dens,
|
|---|
| 86 | G4bool isotopes=true,
|
|---|
| 87 | G4State state = kStateSolid,
|
|---|
| 88 | G4double temp = STP_Temperature,
|
|---|
| 89 | G4double pressure = STP_Pressure);
|
|---|
| 90 |
|
|---|
| 91 | // construct a G4Material from scratch by fraction mass
|
|---|
| 92 | //
|
|---|
| 93 | G4Material* ConstructNewMaterial (const G4String& name,
|
|---|
| 94 | const std::vector<G4String>& elm,
|
|---|
| 95 | const std::vector<G4double>& weight,
|
|---|
| 96 | G4double dens,
|
|---|
| 97 | G4bool isotopes=true,
|
|---|
| 98 | G4State state = kStateSolid,
|
|---|
| 99 | G4double temp = STP_Temperature,
|
|---|
| 100 | G4double pressure = STP_Pressure);
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | // construct a gas G4Material from scratch by atome count
|
|---|
| 104 | //
|
|---|
| 105 | G4Material* ConstructNewGasMaterial(const G4String& name,
|
|---|
| 106 | const G4String& nameNist,
|
|---|
| 107 | G4double temp, G4double pres,
|
|---|
| 108 | G4bool isotopes=true);
|
|---|
| 109 |
|
|---|
| 110 | // verbosity level defined by G4NistManager
|
|---|
| 111 | //
|
|---|
| 112 | void SetVerbose(G4int val);
|
|---|
| 113 |
|
|---|
| 114 | // cout predefined materials:
|
|---|
| 115 | // "simple" - only pure materials in basic state (Z = 1, ..., 98)
|
|---|
| 116 | // "compound" - NIST compounds
|
|---|
| 117 | // "hep" - HEP materials and compounds
|
|---|
| 118 | // "all" - all
|
|---|
| 119 | //
|
|---|
| 120 | void ListMaterials(const G4String&);
|
|---|
| 121 |
|
|---|
| 122 | // cout lists of predefined materials
|
|---|
| 123 | //
|
|---|
| 124 | void ListNistSimpleMaterials();
|
|---|
| 125 | void ListNistCompoundMaterials();
|
|---|
| 126 | void ListHepMaterials();
|
|---|
| 127 |
|
|---|
| 128 | // access to the list of names of Geant4 predefined materials
|
|---|
| 129 | //
|
|---|
| 130 | const std::vector<G4String>& GetMaterialNames() const;
|
|---|
| 131 |
|
|---|
| 132 | private:
|
|---|
| 133 |
|
|---|
| 134 | void Initialise();
|
|---|
| 135 | void NistSimpleMaterials();
|
|---|
| 136 | void NistCompoundMaterials();
|
|---|
| 137 | void HepAndNuclearMaterials();
|
|---|
| 138 |
|
|---|
| 139 | // add parameters of material from NIST DB to internal vectors
|
|---|
| 140 | // density in g/cm3, mean ionisation potential in eV
|
|---|
| 141 | //
|
|---|
| 142 | void AddMaterial(const G4String& nameMat, G4double dens, G4int Z=0,
|
|---|
| 143 | G4double pot=0.0, G4int ncomp=1,
|
|---|
| 144 | G4State=kStateSolid,
|
|---|
| 145 | G4double temp=STP_Temperature,
|
|---|
| 146 | G4double pres=STP_Pressure);
|
|---|
| 147 |
|
|---|
| 148 | void AddChemicalFormula(const G4String& nameMat, const G4String& ch);
|
|---|
| 149 | void AddGas(const G4String& nameMat, G4double t=STP_Temperature,
|
|---|
| 150 | G4double p=STP_Pressure);
|
|---|
| 151 |
|
|---|
| 152 | void AddElementByWeightFraction(G4int Z, G4double);
|
|---|
| 153 | void AddElementByAtomCount (G4int Z, G4int);
|
|---|
| 154 |
|
|---|
| 155 | void AddElementByWeightFraction(const G4String& name, G4double);
|
|---|
| 156 | void AddElementByAtomCount (const G4String& name, G4int);
|
|---|
| 157 |
|
|---|
| 158 | // build a G4Material from dataBase
|
|---|
| 159 | G4Material* BuildMaterial(const G4String& name, G4bool isotopes);
|
|---|
| 160 | G4Material* BuildMaterial(G4int idx, G4bool isotopes);
|
|---|
| 161 |
|
|---|
| 162 | void DumpElm(G4int);
|
|---|
| 163 | void DumpMix(G4int);
|
|---|
| 164 |
|
|---|
| 165 | private:
|
|---|
| 166 |
|
|---|
| 167 | G4NistElementBuilder* elmBuilder;
|
|---|
| 168 |
|
|---|
| 169 | G4int verbose;
|
|---|
| 170 | G4int nMaterials;
|
|---|
| 171 | G4int nComponents;
|
|---|
| 172 | G4int nCurrent;
|
|---|
| 173 | G4int nElementary;
|
|---|
| 174 | G4int nNIST;
|
|---|
| 175 |
|
|---|
| 176 | std::vector<G4String> names;
|
|---|
| 177 | std::vector<G4String> chFormulas;
|
|---|
| 178 |
|
|---|
| 179 | std::vector<G4double> densities;
|
|---|
| 180 | std::vector<G4double> ionPotentials;
|
|---|
| 181 | std::vector<G4State> states;
|
|---|
| 182 | std::vector<G4double> fractions;
|
|---|
| 183 | std::vector<G4int> components;
|
|---|
| 184 | std::vector<G4int> indexes;
|
|---|
| 185 | std::vector<G4int> elements;
|
|---|
| 186 |
|
|---|
| 187 | std::vector<G4int> matIndex;
|
|---|
| 188 |
|
|---|
| 189 | std::vector<G4double> temperatures;
|
|---|
| 190 | std::vector<G4double> presures;
|
|---|
| 191 |
|
|---|
| 192 | G4bool first;
|
|---|
| 193 |
|
|---|
| 194 | };
|
|---|
| 195 |
|
|---|
| 196 | inline const std::vector<G4String>&
|
|---|
| 197 | G4NistMaterialBuilder::GetMaterialNames() const
|
|---|
| 198 | {
|
|---|
| 199 | return names;
|
|---|
| 200 | }
|
|---|
| 201 |
|
|---|
| 202 | #endif
|
|---|