[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 | // |
---|
| 26 | // $Id: G4NistManager.hh,v 1.17 2007/12/11 13:32:08 gcosmo Exp $ |
---|
| 27 | // GEANT4 tag $Name: geant4-09-01-patch-02 $ |
---|
| 28 | // |
---|
| 29 | // |
---|
| 30 | // ------------------------------------------------------------------- |
---|
| 31 | // |
---|
| 32 | // GEANT4 Class header file |
---|
| 33 | // |
---|
| 34 | // File name: G4NistManager |
---|
| 35 | // |
---|
| 36 | // Author: Vladimir Ivanchenko |
---|
| 37 | // |
---|
| 38 | // Creation date: 23.12.2004 |
---|
| 39 | // |
---|
| 40 | // Modifications: |
---|
| 41 | // 27.02.06 V.Ivanchneko add GetAtomicMassAmu and ConstructNewGasMaterial |
---|
| 42 | // 11.05.06 V.Ivanchneko add warning flag to FindMaterial method |
---|
| 43 | // 17.10.06 V.Ivanchneko add methods: GetAtomicMass, GetNistElementNames, |
---|
| 44 | // GetNistMaterialNames |
---|
| 45 | // 02.05.07 V.Ivanchneko add GetNistFirstIsotopeN and GetNumberOfNistIsotopes |
---|
| 46 | // 28.07.07 V.Ivanchneko make simple methods inline |
---|
| 47 | // 28.10.07 V.Ivanchneko add state, T, P to maetrial build |
---|
| 48 | // |
---|
| 49 | // Class Description: |
---|
| 50 | // |
---|
| 51 | // A utility static class |
---|
| 52 | // |
---|
| 53 | |
---|
| 54 | // ------------------------------------------------------------------- |
---|
| 55 | // |
---|
| 56 | // Class Description: |
---|
| 57 | // |
---|
| 58 | // Element data from the NIST DB on Atomic Weights and Isotope Compositions |
---|
| 59 | // http://physics.nist.gov/PhysRefData/Compositions/index.html |
---|
| 60 | // |
---|
| 61 | // ------------------------------------------------------------------- |
---|
| 62 | // |
---|
| 63 | |
---|
| 64 | #ifndef G4NistManager_h |
---|
| 65 | #define G4NistManager_h 1 |
---|
| 66 | |
---|
| 67 | #include <vector> |
---|
| 68 | #include "globals.hh" |
---|
| 69 | #include "G4Material.hh" |
---|
| 70 | #include "G4NistElementBuilder.hh" |
---|
| 71 | #include "G4NistMaterialBuilder.hh" |
---|
| 72 | |
---|
| 73 | class G4NistMessenger; |
---|
| 74 | |
---|
| 75 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 76 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 77 | |
---|
| 78 | class G4NistManager |
---|
| 79 | { |
---|
| 80 | |
---|
| 81 | public: |
---|
| 82 | |
---|
| 83 | static G4NistManager* Instance(); |
---|
| 84 | ~G4NistManager(); |
---|
| 85 | |
---|
| 86 | // Elements |
---|
| 87 | // |
---|
| 88 | inline G4Element* GetElement(size_t index); |
---|
| 89 | |
---|
| 90 | // Find or build G4Element by atomic number |
---|
| 91 | inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes=true); |
---|
| 92 | |
---|
| 93 | // Find or build G4Element by symbol |
---|
| 94 | inline G4Element* FindOrBuildElement(const G4String& symb, |
---|
| 95 | G4bool isotopes=true); |
---|
| 96 | |
---|
| 97 | inline size_t GetNumberOfElements() const; |
---|
| 98 | inline G4int GetZ(const G4String& symb) const; |
---|
| 99 | |
---|
| 100 | // Mass in amu |
---|
| 101 | inline G4double GetAtomicMassAmu(G4int Z) const; |
---|
| 102 | |
---|
| 103 | // Mass in Geant4 units |
---|
| 104 | inline G4double GetIsotopeMass(G4int Z, G4int N) const; |
---|
| 105 | inline G4double GetAtomicMass(G4int Z, G4int N) const; |
---|
| 106 | |
---|
| 107 | // Number of isotopes |
---|
| 108 | inline G4int GetNistFirstIsotopeN(G4int Z) const; |
---|
| 109 | inline G4int GetNumberOfNistIsotopes(G4int Z) const; |
---|
| 110 | |
---|
| 111 | inline G4double GetIsotopeAbundance(G4int Z, G4int N) const; |
---|
| 112 | |
---|
| 113 | inline void PrintElement(G4int Z); |
---|
| 114 | |
---|
| 115 | void PrintElement(const G4String&); |
---|
| 116 | void PrintG4Element(const G4String&); |
---|
| 117 | |
---|
| 118 | inline const std::vector<G4String>& GetNistElementNames() const; |
---|
| 119 | |
---|
| 120 | // Materials |
---|
| 121 | // |
---|
| 122 | inline G4Material* GetMaterial(size_t index); |
---|
| 123 | |
---|
| 124 | // Find or build a G4Material by name, from the dataBase |
---|
| 125 | // |
---|
| 126 | inline G4Material* FindOrBuildMaterial(const G4String& name, |
---|
| 127 | G4bool isotopes=true, |
---|
| 128 | G4bool warning=false); |
---|
| 129 | |
---|
| 130 | // construct a G4Material from scratch by atome count |
---|
| 131 | // |
---|
| 132 | inline G4Material* ConstructNewMaterial( |
---|
| 133 | const G4String& name, |
---|
| 134 | const std::vector<G4String>& elm, |
---|
| 135 | const std::vector<G4int>& nbAtoms, |
---|
| 136 | G4double dens, |
---|
| 137 | G4bool isotopes=true, |
---|
| 138 | G4State state = kStateSolid, |
---|
| 139 | G4double temp = STP_Temperature, |
---|
| 140 | G4double pressure = STP_Pressure); |
---|
| 141 | |
---|
| 142 | // construct a G4Material from scratch by fraction mass |
---|
| 143 | // |
---|
| 144 | inline G4Material* ConstructNewMaterial( |
---|
| 145 | const G4String& name, |
---|
| 146 | const std::vector<G4String>& elm, |
---|
| 147 | const std::vector<G4double>& weight, |
---|
| 148 | G4double dens, |
---|
| 149 | G4bool isotopes=true, |
---|
| 150 | G4State state = kStateSolid, |
---|
| 151 | G4double temp = STP_Temperature, |
---|
| 152 | G4double pressure = STP_Pressure); |
---|
| 153 | |
---|
| 154 | // construct a gas G4Material from scratch by atome count |
---|
| 155 | // |
---|
| 156 | inline G4Material* ConstructNewGasMaterial(const G4String& name, |
---|
| 157 | const G4String& nameNist, |
---|
| 158 | G4double temp, |
---|
| 159 | G4double pres, |
---|
| 160 | G4bool isotopes=true); |
---|
| 161 | |
---|
| 162 | inline size_t GetNumberOfMaterials(); |
---|
| 163 | |
---|
| 164 | inline G4int GetVerbose(); |
---|
| 165 | |
---|
| 166 | void SetVerbose(G4int); |
---|
| 167 | |
---|
| 168 | void PrintG4Material(const G4String&); |
---|
| 169 | |
---|
| 170 | inline void ListMaterials(const G4String&); |
---|
| 171 | |
---|
| 172 | inline const std::vector<G4String>& GetNistMaterialNames() const; |
---|
| 173 | |
---|
| 174 | G4double GetZ13(G4double Z); |
---|
| 175 | |
---|
| 176 | G4double GetLOGA(G4double A); |
---|
| 177 | |
---|
| 178 | private: |
---|
| 179 | |
---|
| 180 | G4NistManager(); |
---|
| 181 | static G4NistManager* instance; |
---|
| 182 | |
---|
| 183 | static G4double POWERZ13[256]; |
---|
| 184 | static G4double LOGA[256]; |
---|
| 185 | |
---|
| 186 | std::vector<G4Element*> elements; |
---|
| 187 | std::vector<G4Material*> materials; |
---|
| 188 | |
---|
| 189 | size_t nElements; |
---|
| 190 | size_t nMaterials; |
---|
| 191 | |
---|
| 192 | G4int verbose; |
---|
| 193 | |
---|
| 194 | G4NistElementBuilder* elmBuilder; |
---|
| 195 | G4NistMaterialBuilder* matBuilder; |
---|
| 196 | G4NistMessenger* messenger; |
---|
| 197 | |
---|
| 198 | }; |
---|
| 199 | |
---|
| 200 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 201 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 202 | |
---|
| 203 | inline |
---|
| 204 | size_t G4NistManager::GetNumberOfMaterials() |
---|
| 205 | { |
---|
| 206 | return nMaterials; |
---|
| 207 | } |
---|
| 208 | |
---|
| 209 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 210 | |
---|
| 211 | inline |
---|
| 212 | G4Element* G4NistManager::GetElement(size_t index) |
---|
| 213 | { |
---|
| 214 | G4Element* elm = 0; |
---|
| 215 | const G4ElementTable* theElementTable = G4Element::GetElementTable(); |
---|
| 216 | if(index < theElementTable->size()) elm = (*theElementTable)[index]; |
---|
| 217 | return elm; |
---|
| 218 | } |
---|
| 219 | |
---|
| 220 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 221 | |
---|
| 222 | inline |
---|
| 223 | G4Element* G4NistManager::FindOrBuildElement(G4int Z, G4bool isotopes) |
---|
| 224 | { |
---|
| 225 | return elmBuilder->FindOrBuildElement(Z, isotopes); |
---|
| 226 | } |
---|
| 227 | |
---|
| 228 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 229 | |
---|
| 230 | inline |
---|
| 231 | G4Element* G4NistManager::FindOrBuildElement(const G4String& symb, |
---|
| 232 | G4bool isotopes) |
---|
| 233 | { |
---|
| 234 | return elmBuilder->FindOrBuildElement(symb, isotopes); |
---|
| 235 | } |
---|
| 236 | |
---|
| 237 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 238 | |
---|
| 239 | inline |
---|
| 240 | size_t G4NistManager::GetNumberOfElements() const |
---|
| 241 | { |
---|
| 242 | return nElements; |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 246 | |
---|
| 247 | inline |
---|
| 248 | G4int G4NistManager::GetZ(const G4String& symb) const |
---|
| 249 | { |
---|
| 250 | return elmBuilder->GetZ(symb); |
---|
| 251 | } |
---|
| 252 | |
---|
| 253 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 254 | |
---|
| 255 | inline |
---|
| 256 | G4double G4NistManager::GetAtomicMassAmu(G4int Z) const |
---|
| 257 | { |
---|
| 258 | return elmBuilder->GetA(Z); |
---|
| 259 | } |
---|
| 260 | |
---|
| 261 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 262 | |
---|
| 263 | inline |
---|
| 264 | G4double G4NistManager::GetIsotopeMass(G4int Z, G4int N) const |
---|
| 265 | { |
---|
| 266 | return elmBuilder->GetIsotopeMass(Z, N); |
---|
| 267 | } |
---|
| 268 | |
---|
| 269 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 270 | |
---|
| 271 | inline |
---|
| 272 | G4double G4NistManager::GetAtomicMass(G4int Z, G4int N) const |
---|
| 273 | { |
---|
| 274 | return elmBuilder->GetAtomicMass(Z, N); |
---|
| 275 | } |
---|
| 276 | |
---|
| 277 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 278 | |
---|
| 279 | inline |
---|
| 280 | G4double G4NistManager::GetIsotopeAbundance(G4int Z, G4int N) const |
---|
| 281 | { |
---|
| 282 | return elmBuilder->GetIsotopeAbundance(Z, N); |
---|
| 283 | } |
---|
| 284 | |
---|
| 285 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 286 | |
---|
| 287 | inline |
---|
| 288 | G4int G4NistManager::GetNistFirstIsotopeN(G4int Z) const |
---|
| 289 | { |
---|
| 290 | return elmBuilder->GetNistFirstIsotopeN(Z); |
---|
| 291 | } |
---|
| 292 | |
---|
| 293 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 294 | |
---|
| 295 | inline |
---|
| 296 | G4int G4NistManager::GetNumberOfNistIsotopes(G4int Z) const |
---|
| 297 | { |
---|
| 298 | return elmBuilder->GetNumberOfNistIsotopes(Z); |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 302 | |
---|
| 303 | inline |
---|
| 304 | const std::vector<G4String>& G4NistManager::GetNistElementNames() const |
---|
| 305 | { |
---|
| 306 | return elmBuilder->GetElementNames(); |
---|
| 307 | } |
---|
| 308 | |
---|
| 309 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 310 | |
---|
| 311 | inline |
---|
| 312 | void G4NistManager::PrintElement(G4int Z) |
---|
| 313 | { |
---|
| 314 | elmBuilder->PrintElement(Z); |
---|
| 315 | } |
---|
| 316 | |
---|
| 317 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 318 | |
---|
| 319 | inline |
---|
| 320 | G4Material* G4NistManager::GetMaterial(size_t index) |
---|
| 321 | { |
---|
| 322 | const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); |
---|
| 323 | G4Material* mat = 0; |
---|
| 324 | if(index < theMaterialTable->size()) mat = (*theMaterialTable)[index]; |
---|
| 325 | return mat; |
---|
| 326 | } |
---|
| 327 | |
---|
| 328 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 329 | |
---|
| 330 | inline |
---|
| 331 | G4int G4NistManager::GetVerbose() |
---|
| 332 | { |
---|
| 333 | return verbose; |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 337 | |
---|
| 338 | inline |
---|
| 339 | G4Material* G4NistManager::FindOrBuildMaterial(const G4String& name, |
---|
| 340 | G4bool isotopes, |
---|
| 341 | G4bool warning) |
---|
| 342 | { |
---|
| 343 | return matBuilder->FindOrBuildMaterial(name, isotopes, warning); |
---|
| 344 | } |
---|
| 345 | |
---|
| 346 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 347 | |
---|
| 348 | inline |
---|
| 349 | G4Material* G4NistManager::ConstructNewMaterial( |
---|
| 350 | const G4String& name, |
---|
| 351 | const std::vector<G4String>& elm, |
---|
| 352 | const std::vector<G4int>& nbAtoms, |
---|
| 353 | G4double dens, |
---|
| 354 | G4bool isotopes, |
---|
| 355 | G4State state, |
---|
| 356 | G4double T, |
---|
| 357 | G4double P) |
---|
| 358 | |
---|
| 359 | { |
---|
| 360 | return |
---|
| 361 | matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes,state,T,P); |
---|
| 362 | } |
---|
| 363 | |
---|
| 364 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 365 | |
---|
| 366 | inline |
---|
| 367 | G4Material* G4NistManager::ConstructNewMaterial( |
---|
| 368 | const G4String& name, |
---|
| 369 | const std::vector<G4String>& elm, |
---|
| 370 | const std::vector<G4double>& w, |
---|
| 371 | G4double dens, |
---|
| 372 | G4bool isotopes, |
---|
| 373 | G4State state, |
---|
| 374 | G4double T, |
---|
| 375 | G4double P) |
---|
| 376 | { |
---|
| 377 | return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes,state,T,P); |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 381 | |
---|
| 382 | inline |
---|
| 383 | G4Material* G4NistManager::ConstructNewGasMaterial( |
---|
| 384 | const G4String& name, |
---|
| 385 | const G4String& nameNist, |
---|
| 386 | G4double temp, G4double pres, |
---|
| 387 | G4bool isotopes) |
---|
| 388 | { |
---|
| 389 | return matBuilder->ConstructNewGasMaterial(name,nameNist, |
---|
| 390 | temp,pres,isotopes); |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 394 | |
---|
| 395 | inline |
---|
| 396 | void G4NistManager::ListMaterials(const G4String& list) |
---|
| 397 | { |
---|
| 398 | matBuilder->ListMaterials(list); |
---|
| 399 | } |
---|
| 400 | |
---|
| 401 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 402 | |
---|
| 403 | inline |
---|
| 404 | const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const |
---|
| 405 | { |
---|
| 406 | return matBuilder->GetMaterialNames(); |
---|
| 407 | } |
---|
| 408 | |
---|
| 409 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 410 | |
---|
| 411 | #endif |
---|
| 412 | |
---|