Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 26 // ------------------------------------------- 27 // 28 // GEANT4 Class header file 29 // 30 // File name: G4NistManager 31 // 32 // Author: Vladimir Ivanchenko 33 // 34 // Creation date: 23.12.2004 35 // 36 // Modifications: 37 // 27.02.06 V.Ivanchneko add GetAtomicMassAmu 38 // 11.05.06 V.Ivanchneko add warning flag to F 39 // 17.10.06 V.Ivanchneko add methods: GetAtomi 40 // GetNistMaterialNames 41 // 02.05.07 V.Ivanchneko add GetNistFirstIsoto 42 // 28.07.07 V.Ivanchneko make simple methods i 43 // 28.10.07 V.Ivanchneko add state, T, P to ma 44 // 29.04.10 V.Ivanchneko add GetMeanIonisation 45 // 01.11.10 V.Ivanchneko add G4Pow for fast co 46 // 09.02.12 P.Gumplinger add ConstructNewIdeal 47 // 48 // Class Description: 49 // 50 // A utility static class 51 // 52 // Element data from the NIST DB on Atomic Wei 53 // http://physics.nist.gov/PhysRefData/Composi 54 // 55 // ------------------------------------------- 56 57 #ifndef G4NistManager_h 58 #define G4NistManager_h 1 59 60 #include "G4ICRU90StoppingData.hh" 61 #include "G4Material.hh" 62 #include "G4Element.hh" 63 #include "G4Isotope.hh" 64 #include "G4NistElementBuilder.hh" 65 #include "G4NistMaterialBuilder.hh" 66 #include "G4Pow.hh" 67 #include "globals.hh" 68 69 #include <CLHEP/Units/PhysicalConstants.h> 70 71 #include <vector> 72 73 class G4NistMessenger; 74 75 class G4NistManager 76 { 77 public: 78 static G4NistManager* Instance(); 79 ~G4NistManager(); 80 81 // Get G4Element by index 82 // 83 inline G4Element* GetElement(std::size_t ind 84 85 // Find or build G4Element by atomic number 86 // 87 inline G4Element* FindElement(G4int Z) const 88 inline G4Element* FindOrBuildElement(G4int Z 89 90 // Find or build G4Element by symbol 91 // 92 inline G4Element* FindOrBuildElement(const G 93 94 // Get number of elements 95 // 96 inline std::size_t GetNumberOfElements() con 97 98 // Get atomic number by element symbol 99 // 100 inline G4int GetZ(const G4String& symb) cons 101 102 // Get atomic weight by element symbol - mea 103 // an atom with electron shell for the natur 104 // 105 inline G4double GetAtomicMassAmu(const G4Str 106 107 // Get atomic weight in atomic units - mean 108 // with electron shell for the natural isoto 109 // 110 inline G4double GetAtomicMassAmu(G4int Z) co 111 112 // Get mass of isotope without electron shel 113 // 114 inline G4double GetIsotopeMass(G4int Z, G4in 115 116 // Get mass in Geant4 energy units of an ato 117 // with the electron shell 118 // 119 inline G4double GetAtomicMass(G4int Z, G4int 120 121 // Get total ionisation energy of an atom 122 // 123 inline G4double GetTotalElectronBindingEnerg 124 125 // Get N for the first natural isotope 126 // 127 inline G4int GetNistFirstIsotopeN(G4int Z) c 128 129 // Get number of natural isotopes 130 // 131 inline G4int GetNumberOfNistIsotopes(G4int Z 132 133 // Get natural isotope abundance 134 // 135 inline G4double GetIsotopeAbundance(G4int Z, 136 137 // Print element by Z 138 // 139 inline void PrintElement(G4int Z) const; 140 141 // Print element from internal DB by symbol, 142 // 143 void PrintElement(const G4String&) const; 144 145 // Print G4Element by name, if "all" - print 146 // 147 void PrintG4Element(const G4String&) const; 148 149 // Access to the vector of Geant4 predefined 150 // 151 inline const std::vector<G4String>& GetNistE 152 153 // Access mean ionisation energy for atoms ( 154 // 155 inline G4double GetMeanIonisationEnergy(G4in 156 157 // Access nominal density by atomic number f 158 // by the index for other NIST materials 159 // 160 inline G4double GetNominalDensity(G4int Z) c 161 162 // Get G4Material by index 163 // 164 inline G4Material* GetMaterial(std::size_t i 165 166 // Find or build a G4Material by name, from 167 // 168 inline G4Material* FindMaterial(const G4Stri 169 inline G4Material* FindOrBuildMaterial( 170 const G4String& name, G4bool isotopes = tr 171 172 // Find or build a simple material via atomi 173 // 174 inline G4Material* FindSimpleMaterial(G4int 175 inline G4Material* FindOrBuildSimpleMaterial 176 177 // Build G4Material with user defined name a 178 // of a material from Geant4 dataBase 179 // 180 G4Material* BuildMaterialWithNewDensity(cons 181 G4double density = 0.0, G4double temp = NT 182 183 // Construct a G4Material from scratch by at 184 // temperature and pressure should be consis 185 // 186 inline G4Material* ConstructNewMaterial(cons 187 const std::vector<G4int>& nbAtoms, G4doubl 188 G4State state = kStateSolid, G4double temp 189 G4double pressure = CLHEP::STP_Pressure); 190 191 // Construct a G4Material from scratch by fr 192 // temperature and pressure should be consis 193 // 194 inline G4Material* ConstructNewMaterial(cons 195 const std::vector<G4double>& weight, G4dou 196 G4State state = kStateSolid, G4double temp 197 G4double pressure = CLHEP::STP_Pressure); 198 199 // Construct a gas G4Material from scratch b 200 // 201 inline G4Material* ConstructNewGasMaterial(c 202 G4double temp, G4double pres, G4bool isoto 203 204 // Construct an ideal gas G4Material from sc 205 // 206 inline G4Material* ConstructNewIdealGasMater 207 const std::vector<G4String>& elm, const st 208 G4double temp = NTP_Temperature, G4double 209 210 // enable/disable density effect calculator 211 // 212 void SetDensityEffectCalculatorFlag(const G4 213 214 // enable/disable density effect calculator 215 // 216 void SetDensityEffectCalculatorFlag(G4Materi 217 218 // Get number of G4Materials 219 // 220 inline std::size_t GetNumberOfMaterials() co 221 222 inline G4int GetVerbose() const; 223 224 void SetVerbose(G4int); 225 226 // Print G4Material by name 227 // 228 void PrintG4Material(const G4String&) const; 229 230 // Print predefined Geant4 materials: 231 // "simple" - only pure materials in basic s 232 // "compound" - NIST compounds 233 // "hep" - HEP materials and compounds 234 // "bio" - bio-medical materials and compoun 235 // "all" - all 236 // 237 inline void ListMaterials(const G4String&) c 238 239 // Access to the list of names of Geant4 pre 240 // 241 inline const std::vector<G4String>& GetNistM 242 243 // Fast computation of Z^1/3 244 // 245 inline G4double GetZ13(G4double Z) const; 246 inline G4double GetZ13(G4int Z) const; 247 248 // Fast computation of A^0.27 for natuaral a 249 // 250 inline G4double GetA27(G4int Z) const; 251 252 // Fast computation of log(A) 253 // 254 inline G4double GetLOGZ(G4int Z) const; 255 inline G4double GetLOGAMU(G4int Z) const; 256 257 G4ICRU90StoppingData* GetICRU90StoppingData( 258 259 private: 260 G4NistManager(); 261 262 std::vector<G4Element*> elements; 263 std::vector<G4Material*> materials; 264 265 G4ICRU90StoppingData* fICRU90; 266 G4NistElementBuilder* elmBuilder; 267 G4NistMaterialBuilder* matBuilder; 268 G4NistMessenger* messenger; 269 G4Pow* g4pow; 270 const G4MaterialTable* theMaterialTable; 271 const G4ElementTable* theElementTable; 272 const G4IsotopeTable* theIsotopeTable; 273 274 G4double POWERA27[101]; 275 G4double LOGAZ[101]; 276 277 std::size_t nElements; 278 std::size_t nMaterials; 279 G4int verbose; 280 }; 281 282 //....oooOO0OOooo........oooOO0OOooo........oo 283 284 inline std::size_t G4NistManager::GetNumberOfM 285 286 //....oooOO0OOooo........oooOO0OOooo........oo 287 288 inline G4Element* G4NistManager::GetElement(st 289 { 290 return (index < theElementTable->size()) ? ( 291 } 292 293 //....oooOO0OOooo........oooOO0OOooo........oo 294 295 inline G4Element* G4NistManager::FindElement(G 296 297 //....oooOO0OOooo........oooOO0OOooo........oo 298 299 inline G4Element* G4NistManager::FindOrBuildEl 300 { 301 return elmBuilder->FindOrBuildElement(Z, iso 302 } 303 304 //....oooOO0OOooo........oooOO0OOooo........oo 305 306 inline G4Element* G4NistManager::FindOrBuildEl 307 { 308 return elmBuilder->FindOrBuildElement(symb, 309 } 310 311 //....oooOO0OOooo........oooOO0OOooo........oo 312 313 inline std::size_t G4NistManager::GetNumberOfE 314 315 //....oooOO0OOooo........oooOO0OOooo........oo 316 317 inline G4int G4NistManager::GetZ(const G4Strin 318 319 //....oooOO0OOooo........oooOO0OOooo........oo 320 321 inline G4double G4NistManager::GetAtomicMassAm 322 { 323 return elmBuilder->GetAtomicMassAmu(symb); 324 } 325 326 //....oooOO0OOooo........oooOO0OOooo........oo 327 328 inline G4double G4NistManager::GetAtomicMassAm 329 { 330 return elmBuilder->GetAtomicMassAmu(Z); 331 } 332 333 //....oooOO0OOooo........oooOO0OOooo........oo 334 335 inline G4double G4NistManager::GetIsotopeMass( 336 { 337 return elmBuilder->GetIsotopeMass(Z, N); 338 } 339 340 //....oooOO0OOooo........oooOO0OOooo........oo 341 342 inline G4double G4NistManager::GetAtomicMass(G 343 { 344 return elmBuilder->GetAtomicMass(Z, N); 345 } 346 347 //....oooOO0OOooo........oooOO0OOooo........oo 348 349 inline G4double G4NistManager::GetTotalElectro 350 { 351 return elmBuilder->GetTotalElectronBindingEn 352 } 353 354 //....oooOO0OOooo........oooOO0OOooo........oo 355 356 inline G4double G4NistManager::GetIsotopeAbund 357 { 358 return elmBuilder->GetIsotopeAbundance(Z, N) 359 } 360 361 //....oooOO0OOooo........oooOO0OOooo........oo 362 363 inline G4int G4NistManager::GetNistFirstIsotop 364 { 365 return elmBuilder->GetNistFirstIsotopeN(Z); 366 } 367 368 //....oooOO0OOooo........oooOO0OOooo........oo 369 370 inline G4int G4NistManager::GetNumberOfNistIso 371 { 372 return elmBuilder->GetNumberOfNistIsotopes(Z 373 } 374 375 //....oooOO0OOooo........oooOO0OOooo........oo 376 377 inline const std::vector<G4String>& G4NistMana 378 { 379 return elmBuilder->GetElementNames(); 380 } 381 382 //....oooOO0OOooo........oooOO0OOooo........oo 383 384 inline G4double G4NistManager::GetMeanIonisati 385 { 386 return matBuilder->GetMeanIonisationEnergy(Z 387 } 388 389 //....oooOO0OOooo........oooOO0OOooo........oo 390 391 inline G4double G4NistManager::GetNominalDensi 392 { 393 return matBuilder->GetNominalDensity(Z); 394 } 395 396 //....oooOO0OOooo........oooOO0OOooo........oo 397 398 inline void G4NistManager::PrintElement(G4int 399 400 //....oooOO0OOooo........oooOO0OOooo........oo 401 402 inline G4Material* G4NistManager::GetMaterial( 403 { 404 return (index < theMaterialTable->size()) ? 405 } 406 407 //....oooOO0OOooo........oooOO0OOooo........oo 408 409 inline G4int G4NistManager::GetVerbose() const 410 411 //....oooOO0OOooo........oooOO0OOooo........oo 412 413 inline G4Material* G4NistManager::FindMaterial 414 { 415 return matBuilder->FindMaterial(name); 416 } 417 418 //....oooOO0OOooo........oooOO0OOooo........oo 419 420 inline G4Material* G4NistManager::FindOrBuildM 421 { 422 return matBuilder->FindOrBuildMaterial(name, 423 } 424 425 //....oooOO0OOooo........oooOO0OOooo........oo 426 427 inline G4Material* G4NistManager::FindSimpleMa 428 { 429 return matBuilder->FindSimpleMaterial(Z); 430 } 431 432 //....oooOO0OOooo........oooOO0OOooo........oo 433 434 inline G4Material* G4NistManager::FindOrBuildS 435 { 436 return matBuilder->FindOrBuildSimpleMaterial 437 } 438 439 //....oooOO0OOooo........oooOO0OOooo........oo 440 441 inline G4Material* G4NistManager::ConstructNew 442 const std::vector<G4String>& elm, const std: 443 G4State state, G4double T, G4double P) 444 445 { 446 return matBuilder->ConstructNewMaterial(name 447 } 448 449 //....oooOO0OOooo........oooOO0OOooo........oo 450 451 inline G4Material* G4NistManager::ConstructNew 452 const std::vector<G4String>& elm, const std: 453 G4State state, G4double T, G4double P) 454 { 455 return matBuilder->ConstructNewMaterial(name 456 } 457 458 //....oooOO0OOooo........oooOO0OOooo........oo 459 460 inline G4Material* G4NistManager::ConstructNew 461 const G4String& name, const G4String& nameNi 462 { 463 return matBuilder->ConstructNewGasMaterial(n 464 } 465 466 //....oooOO0OOooo........oooOO0OOooo........oo 467 468 inline G4Material* G4NistManager::ConstructNew 469 const std::vector<G4String>& elm, const std: 470 G4double P) 471 { 472 return matBuilder->ConstructNewIdealGasMater 473 } 474 475 //....oooOO0OOooo........oooOO0OOooo........oo 476 477 inline void G4NistManager::ListMaterials(const 478 { 479 matBuilder->ListMaterials(list); 480 } 481 482 //....oooOO0OOooo........oooOO0OOooo........oo 483 484 inline const std::vector<G4String>& G4NistMana 485 { 486 return matBuilder->GetMaterialNames(); 487 } 488 489 //....oooOO0OOooo........oooOO0OOooo........oo 490 491 inline G4double G4NistManager::GetZ13(G4double 492 493 //....oooOO0OOooo........oooOO0OOooo........oo 494 495 inline G4double G4NistManager::GetZ13(G4int Z) 496 497 //....oooOO0OOooo........oooOO0OOooo........oo 498 499 inline G4double G4NistManager::GetA27(G4int Z) 500 { 501 return (0 <= Z && Z < 101) ? POWERA27[Z] : g 502 } 503 504 //....oooOO0OOooo........oooOO0OOooo........oo 505 506 inline G4double G4NistManager::GetLOGZ(G4int Z 507 508 //....oooOO0OOooo........oooOO0OOooo........oo 509 510 inline G4double G4NistManager::GetLOGAMU(G4int 511 { 512 return (0 <= Z && Z < 101) ? LOGAZ[Z] : 0.0; 513 } 514 515 //....oooOO0OOooo........oooOO0OOooo........oo 516 517 #endif 518