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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /materials/include/G4NistMaterialBuilder.hh (Version 11.3.0) and /materials/include/G4NistMaterialBuilder.hh (Version 10.4.p1)


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