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: G4NistManager.hh,v 1.3 2005/05/12 17:29:08 vnivanch Exp $ >> 24 // GEANT4 tag $Name: geant4-07-01-patch-01 $ >> 25 // >> 26 // 26 // ------------------------------------------- 27 // ------------------------------------------------------------------- 27 // 28 // 28 // GEANT4 Class header file 29 // GEANT4 Class header file 29 // 30 // 30 // File name: G4NistManager 31 // File name: G4NistManager 31 // 32 // 32 // Author: Vladimir Ivanchenko 33 // Author: Vladimir Ivanchenko 33 // 34 // 34 // Creation date: 23.12.2004 35 // Creation date: 23.12.2004 35 // 36 // 36 // Modifications: 37 // Modifications: 37 // 27.02.06 V.Ivanchneko add GetAtomicMassAmu << 38 // 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 // 39 // 48 // Class Description: 40 // Class Description: 49 // 41 // 50 // A utility static class 42 // A utility static class 51 // 43 // >> 44 >> 45 // ------------------------------------------------------------------- >> 46 // >> 47 // Class Description: >> 48 // 52 // Element data from the NIST DB on Atomic Wei 49 // Element data from the NIST DB on Atomic Weights and Isotope Compositions 53 // http://physics.nist.gov/PhysRefData/Composi 50 // http://physics.nist.gov/PhysRefData/Compositions/index.html 54 // 51 // 55 // ------------------------------------------- 52 // ------------------------------------------------------------------- >> 53 // 56 54 57 #ifndef G4NistManager_h 55 #ifndef G4NistManager_h 58 #define G4NistManager_h 1 56 #define G4NistManager_h 1 59 57 60 #include "G4ICRU90StoppingData.hh" << 58 #include <vector> >> 59 #include "globals.hh" 61 #include "G4Material.hh" 60 #include "G4Material.hh" 62 #include "G4Element.hh" << 63 #include "G4Isotope.hh" << 64 #include "G4NistElementBuilder.hh" 61 #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 62 >> 63 class G4NistMaterialBuilder; 73 class G4NistMessenger; 64 class G4NistMessenger; 74 65 >> 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 68 75 class G4NistManager 69 class G4NistManager 76 { 70 { 77 public: << 71 78 static G4NistManager* Instance(); << 72 public: >> 73 >> 74 static G4NistManager* Instance(); 79 ~G4NistManager(); 75 ~G4NistManager(); 80 76 81 // Get G4Element by index << 77 // Elements 82 // << 78 // 83 inline G4Element* GetElement(std::size_t ind << 79 void RegisterElement (G4Element*); >> 80 void DeRegisterElement(G4Element*); 84 81 >> 82 G4Element* GetElement(size_t index); >> 83 85 // Find or build G4Element by atomic number 84 // Find or build G4Element by atomic number 86 // << 85 G4Element* FindOrBuildElement(G4int Z, G4bool isotopes=true); 87 inline G4Element* FindElement(G4int Z) const << 86 88 inline G4Element* FindOrBuildElement(G4int Z << 89 << 90 // Find or build G4Element by symbol 87 // Find or build G4Element by symbol 91 // << 88 G4Element* FindOrBuildElement(const G4String& symb, G4bool isotopes=true); 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 89 218 // Get number of G4Materials << 90 size_t GetNumberOfElements() {return nElements;}; 219 // << 91 G4int GetZ (const G4String& symb); 220 inline std::size_t GetNumberOfMaterials() co << 92 G4double GetIsotopeMass (G4int Z, G4int N); 221 << 93 222 inline G4int GetVerbose() const; << 94 void PrintElement (const G4String&); >> 95 void PrintElement (G4int Z); >> 96 >> 97 void PrintG4Element (const G4String&); >> 98 >> 99 >> 100 // Materials >> 101 // >> 102 void RegisterMaterial (G4Material*); >> 103 void DeRegisterMaterial(G4Material*); >> 104 >> 105 G4Material* GetMaterial(size_t index); >> 106 >> 107 // Find or build a G4Material by name, from the dataBase >> 108 // >> 109 G4Material* FindOrBuildMaterial(const G4String& name, G4bool isotopes=true); >> 110 >> 111 // construct a G4Material from scratch by atome count >> 112 // >> 113 G4Material* ConstructNewMaterial(const G4String& name, >> 114 const std::vector<G4String>& elm, >> 115 const std::vector<G4int>& nbAtoms, >> 116 G4double dens, G4bool isotopes=true); >> 117 >> 118 // construct a G4Material from scratch by fraction mass >> 119 // >> 120 G4Material* ConstructNewMaterial(const G4String& name, >> 121 const std::vector<G4String>& elm, >> 122 const std::vector<G4double>& weight, >> 123 G4double dens, G4bool isotopes=true); 223 124 >> 125 size_t GetNumberOfMaterials() {return nMaterials;}; >> 126 224 void SetVerbose(G4int); 127 void SetVerbose(G4int); >> 128 G4int GetVerbose(); 225 129 226 // Print G4Material by name << 130 void ListMaterials(const G4String&); 227 // << 131 void PrintG4Material(const G4String&); 228 void PrintG4Material(const G4String&) const; << 229 132 230 // Print predefined Geant4 materials: << 133 private: 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 134 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(); 135 G4NistManager(); 261 << 136 static G4NistManager* instance; 262 std::vector<G4Element*> elements; << 137 263 std::vector<G4Material*> materials; << 138 std::vector<G4Element*> elements; 264 << 139 std::vector<G4Material*> materials; 265 G4ICRU90StoppingData* fICRU90; << 140 266 G4NistElementBuilder* elmBuilder; << 141 size_t nElements; 267 G4NistMaterialBuilder* matBuilder; << 142 size_t nMaterials; 268 G4NistMessenger* messenger; << 143 269 G4Pow* g4pow; << 144 G4int verbose; 270 const G4MaterialTable* theMaterialTable; << 145 271 const G4ElementTable* theElementTable; << 146 G4NistElementBuilder* elmBuilder; 272 const G4IsotopeTable* theIsotopeTable; << 147 G4NistMaterialBuilder* matBuilder; 273 << 148 G4NistMessenger* messenger; 274 G4double POWERA27[101]; << 275 G4double LOGAZ[101]; << 276 << 277 std::size_t nElements; << 278 std::size_t nMaterials; << 279 G4int verbose; << 280 }; 149 }; 281 150 282 //....oooOO0OOooo........oooOO0OOooo........oo 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 283 << 284 inline std::size_t G4NistManager::GetNumberOfM << 285 << 286 //....oooOO0OOooo........oooOO0OOooo........oo 152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 287 153 288 inline G4Element* G4NistManager::GetElement(st << 154 inline >> 155 G4Element* G4NistManager::GetElement(size_t index) 289 { 156 { 290 return (index < theElementTable->size()) ? ( << 157 G4Element* elm = 0; >> 158 if(index < nElements) elm = elements[index]; >> 159 return elm; 291 } 160 } 292 161 293 //....oooOO0OOooo........oooOO0OOooo........oo 162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 294 163 295 inline G4Element* G4NistManager::FindElement(G << 164 inline 296 << 165 G4Element* G4NistManager::FindOrBuildElement(G4int Z, G4bool isotopes) 297 //....oooOO0OOooo........oooOO0OOooo........oo << 298 << 299 inline G4Element* G4NistManager::FindOrBuildEl << 300 { 166 { 301 return elmBuilder->FindOrBuildElement(Z, iso 167 return elmBuilder->FindOrBuildElement(Z, isotopes); 302 } 168 } 303 169 304 //....oooOO0OOooo........oooOO0OOooo........oo 170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 305 171 306 inline G4Element* G4NistManager::FindOrBuildEl << 172 inline >> 173 G4Element* G4NistManager::FindOrBuildElement(const G4String& symb, >> 174 G4bool isotopes) 307 { 175 { 308 return elmBuilder->FindOrBuildElement(symb, 176 return elmBuilder->FindOrBuildElement(symb, isotopes); 309 } 177 } 310 178 311 //....oooOO0OOooo........oooOO0OOooo........oo 179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 312 180 313 inline std::size_t G4NistManager::GetNumberOfE << 181 inline 314 << 182 G4int G4NistManager::GetZ(const G4String& symb) 315 //....oooOO0OOooo........oooOO0OOooo........oo << 316 << 317 inline G4int G4NistManager::GetZ(const G4Strin << 318 << 319 //....oooOO0OOooo........oooOO0OOooo........oo << 320 << 321 inline G4double G4NistManager::GetAtomicMassAm << 322 { 183 { 323 return elmBuilder->GetAtomicMassAmu(symb); << 184 return elmBuilder->GetZ(symb); 324 } 185 } 325 186 326 //....oooOO0OOooo........oooOO0OOooo........oo 187 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 327 188 328 inline G4double G4NistManager::GetAtomicMassAm << 189 inline 329 { << 190 G4double G4NistManager::GetIsotopeMass(G4int Z, G4int N) 330 return elmBuilder->GetAtomicMassAmu(Z); << 331 } << 332 << 333 //....oooOO0OOooo........oooOO0OOooo........oo << 334 << 335 inline G4double G4NistManager::GetIsotopeMass( << 336 { 191 { 337 return elmBuilder->GetIsotopeMass(Z, N); 192 return elmBuilder->GetIsotopeMass(Z, N); 338 } 193 } 339 194 340 //....oooOO0OOooo........oooOO0OOooo........oo 195 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 341 196 342 inline G4double G4NistManager::GetAtomicMass(G << 197 inline >> 198 G4Material* G4NistManager::GetMaterial(size_t index) 343 { 199 { 344 return elmBuilder->GetAtomicMass(Z, N); << 200 G4Material* mat = 0; >> 201 if(index < nMaterials) mat = materials[index]; >> 202 return mat; 345 } 203 } 346 204 347 //....oooOO0OOooo........oooOO0OOooo........oo 205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 348 206 349 inline G4double G4NistManager::GetTotalElectro << 207 inline >> 208 G4int G4NistManager::GetVerbose() 350 { 209 { 351 return elmBuilder->GetTotalElectronBindingEn << 210 return verbose; 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 } 211 } 514 212 515 //....oooOO0OOooo........oooOO0OOooo........oo 213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 516 214 517 #endif 215 #endif >> 216 518 217