File indexing completed on 2025-01-18 09:58:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 #ifndef G4NistManager_h
0058 #define G4NistManager_h 1
0059
0060 #include "G4ICRU90StoppingData.hh"
0061 #include "G4Material.hh"
0062 #include "G4NistElementBuilder.hh"
0063 #include "G4NistMaterialBuilder.hh"
0064 #include "G4Pow.hh"
0065 #include "globals.hh"
0066
0067 #include <CLHEP/Units/PhysicalConstants.h>
0068
0069 #include <vector>
0070
0071 class G4NistMessenger;
0072
0073 class G4NistManager
0074 {
0075 public:
0076 static G4NistManager* Instance();
0077 ~G4NistManager();
0078
0079
0080
0081 inline G4Element* GetElement(size_t index) const;
0082
0083
0084
0085 inline G4Element* FindElement(G4int Z) const;
0086 inline G4Element* FindOrBuildElement(G4int Z, G4bool isotopes = true);
0087
0088
0089
0090 inline G4Element* FindOrBuildElement(const G4String& symb, G4bool isotopes = true);
0091
0092
0093
0094 inline size_t GetNumberOfElements() const;
0095
0096
0097
0098 inline G4int GetZ(const G4String& symb) const;
0099
0100
0101
0102
0103 inline G4double GetAtomicMassAmu(const G4String& symb) const;
0104
0105
0106
0107
0108 inline G4double GetAtomicMassAmu(G4int Z) const;
0109
0110
0111
0112 inline G4double GetIsotopeMass(G4int Z, G4int N) const;
0113
0114
0115
0116
0117 inline G4double GetAtomicMass(G4int Z, G4int N) const;
0118
0119
0120
0121 inline G4double GetTotalElectronBindingEnergy(G4int Z) const;
0122
0123
0124
0125 inline G4int GetNistFirstIsotopeN(G4int Z) const;
0126
0127
0128
0129 inline G4int GetNumberOfNistIsotopes(G4int Z) const;
0130
0131
0132
0133 inline G4double GetIsotopeAbundance(G4int Z, G4int N) const;
0134
0135
0136
0137 inline void PrintElement(G4int Z) const;
0138
0139
0140
0141 void PrintElement(const G4String&) const;
0142
0143
0144
0145 void PrintG4Element(const G4String&) const;
0146
0147
0148
0149 inline const std::vector<G4String>& GetNistElementNames() const;
0150
0151
0152
0153 inline G4double GetMeanIonisationEnergy(G4int Z) const;
0154
0155
0156
0157
0158 inline G4double GetNominalDensity(G4int Z) const;
0159
0160
0161
0162 inline G4Material* GetMaterial(size_t index) const;
0163
0164
0165
0166 inline G4Material* FindMaterial(const G4String& name) const;
0167 inline G4Material* FindOrBuildMaterial(
0168 const G4String& name, G4bool isotopes = true, G4bool warning = false);
0169
0170
0171
0172 inline G4Material* FindSimpleMaterial(G4int Z) const;
0173 inline G4Material* FindOrBuildSimpleMaterial(G4int Z, G4bool warning = false);
0174
0175
0176
0177
0178 G4Material* BuildMaterialWithNewDensity(const G4String& name, const G4String& basename,
0179 G4double density = 0.0, G4double temp = NTP_Temperature, G4double pres = CLHEP::STP_Pressure);
0180
0181
0182
0183
0184 inline G4Material* ConstructNewMaterial(const G4String& name, const std::vector<G4String>& elm,
0185 const std::vector<G4int>& nbAtoms, G4double dens, G4bool isotopes = true,
0186 G4State state = kStateSolid, G4double temp = NTP_Temperature,
0187 G4double pressure = CLHEP::STP_Pressure);
0188
0189
0190
0191
0192 inline G4Material* ConstructNewMaterial(const G4String& name, const std::vector<G4String>& elm,
0193 const std::vector<G4double>& weight, G4double dens, G4bool isotopes = true,
0194 G4State state = kStateSolid, G4double temp = NTP_Temperature,
0195 G4double pressure = CLHEP::STP_Pressure);
0196
0197
0198
0199 inline G4Material* ConstructNewGasMaterial(const G4String& name, const G4String& nameNist,
0200 G4double temp, G4double pres, G4bool isotopes = true);
0201
0202
0203
0204 inline G4Material* ConstructNewIdealGasMaterial(const G4String& name,
0205 const std::vector<G4String>& elm, const std::vector<G4int>& nbAtoms, G4bool isotopes = true,
0206 G4double temp = NTP_Temperature, G4double pressure = CLHEP::STP_Pressure);
0207
0208
0209
0210 void SetDensityEffectCalculatorFlag(const G4String&, G4bool);
0211
0212
0213
0214 void SetDensityEffectCalculatorFlag(G4Material*, G4bool);
0215
0216
0217
0218 inline size_t GetNumberOfMaterials() const;
0219
0220 inline G4int GetVerbose() const;
0221
0222 void SetVerbose(G4int);
0223
0224
0225
0226 void PrintG4Material(const G4String&) const;
0227
0228
0229
0230
0231
0232
0233
0234
0235 inline void ListMaterials(const G4String&) const;
0236
0237
0238
0239 inline const std::vector<G4String>& GetNistMaterialNames() const;
0240
0241
0242
0243 inline G4double GetZ13(G4double Z) const;
0244 inline G4double GetZ13(G4int Z) const;
0245
0246
0247
0248 inline G4double GetA27(G4int Z) const;
0249
0250
0251
0252 inline G4double GetLOGZ(G4int Z) const;
0253 inline G4double GetLOGAMU(G4int Z) const;
0254
0255 G4ICRU90StoppingData* GetICRU90StoppingData();
0256
0257 private:
0258 G4NistManager();
0259
0260 static G4NistManager* instance;
0261
0262 std::vector<G4Element*> elements;
0263 std::vector<G4Material*> materials;
0264
0265 G4ICRU90StoppingData* fICRU90;
0266 G4NistElementBuilder* elmBuilder;
0267 G4NistMaterialBuilder* matBuilder;
0268 G4NistMessenger* messenger;
0269 G4Pow* g4pow;
0270
0271 G4double POWERA27[101];
0272 G4double LOGAZ[101];
0273
0274 size_t nElements;
0275 size_t nMaterials;
0276 G4int verbose;
0277 };
0278
0279
0280
0281 inline size_t G4NistManager::GetNumberOfMaterials() const { return nMaterials; }
0282
0283
0284
0285 inline G4Element* G4NistManager::GetElement(size_t index) const
0286 {
0287 const G4ElementTable* theElementTable = G4Element::GetElementTable();
0288 return (index < theElementTable->size()) ? (*theElementTable)[index] : nullptr;
0289 }
0290
0291
0292
0293 inline G4Element* G4NistManager::FindElement(G4int Z) const { return elmBuilder->FindElement(Z); }
0294
0295
0296
0297 inline G4Element* G4NistManager::FindOrBuildElement(G4int Z, G4bool isotopes)
0298 {
0299 return elmBuilder->FindOrBuildElement(Z, isotopes);
0300 }
0301
0302
0303
0304 inline G4Element* G4NistManager::FindOrBuildElement(const G4String& symb, G4bool isotopes)
0305 {
0306 return elmBuilder->FindOrBuildElement(symb, isotopes);
0307 }
0308
0309
0310
0311 inline size_t G4NistManager::GetNumberOfElements() const { return nElements; }
0312
0313
0314
0315 inline G4int G4NistManager::GetZ(const G4String& symb) const { return elmBuilder->GetZ(symb); }
0316
0317
0318
0319 inline G4double G4NistManager::GetAtomicMassAmu(const G4String& symb) const
0320 {
0321 return elmBuilder->GetAtomicMassAmu(symb);
0322 }
0323
0324
0325
0326 inline G4double G4NistManager::GetAtomicMassAmu(G4int Z) const
0327 {
0328 return elmBuilder->GetAtomicMassAmu(Z);
0329 }
0330
0331
0332
0333 inline G4double G4NistManager::GetIsotopeMass(G4int Z, G4int N) const
0334 {
0335 return elmBuilder->GetIsotopeMass(Z, N);
0336 }
0337
0338
0339
0340 inline G4double G4NistManager::GetAtomicMass(G4int Z, G4int N) const
0341 {
0342 return elmBuilder->GetAtomicMass(Z, N);
0343 }
0344
0345
0346
0347 inline G4double G4NistManager::GetTotalElectronBindingEnergy(G4int Z) const
0348 {
0349 return elmBuilder->GetTotalElectronBindingEnergy(Z);
0350 }
0351
0352
0353
0354 inline G4double G4NistManager::GetIsotopeAbundance(G4int Z, G4int N) const
0355 {
0356 return elmBuilder->GetIsotopeAbundance(Z, N);
0357 }
0358
0359
0360
0361 inline G4int G4NistManager::GetNistFirstIsotopeN(G4int Z) const
0362 {
0363 return elmBuilder->GetNistFirstIsotopeN(Z);
0364 }
0365
0366
0367
0368 inline G4int G4NistManager::GetNumberOfNistIsotopes(G4int Z) const
0369 {
0370 return elmBuilder->GetNumberOfNistIsotopes(Z);
0371 }
0372
0373
0374
0375 inline const std::vector<G4String>& G4NistManager::GetNistElementNames() const
0376 {
0377 return elmBuilder->GetElementNames();
0378 }
0379
0380
0381
0382 inline G4double G4NistManager::GetMeanIonisationEnergy(G4int Z) const
0383 {
0384 return matBuilder->GetMeanIonisationEnergy(Z);
0385 }
0386
0387
0388
0389 inline G4double G4NistManager::GetNominalDensity(G4int Z) const
0390 {
0391 return matBuilder->GetNominalDensity(Z);
0392 }
0393
0394
0395
0396 inline void G4NistManager::PrintElement(G4int Z) const { elmBuilder->PrintElement(Z); }
0397
0398
0399
0400 inline G4Material* G4NistManager::GetMaterial(size_t index) const
0401 {
0402 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
0403 return (index < theMaterialTable->size()) ? (*theMaterialTable)[index] : nullptr;
0404 }
0405
0406
0407
0408 inline G4int G4NistManager::GetVerbose() const { return verbose; }
0409
0410
0411
0412 inline G4Material* G4NistManager::FindMaterial(const G4String& name) const
0413 {
0414 return matBuilder->FindMaterial(name);
0415 }
0416
0417
0418
0419 inline G4Material* G4NistManager::FindOrBuildMaterial(const G4String& name, G4bool, G4bool warning)
0420 {
0421 return matBuilder->FindOrBuildMaterial(name, warning);
0422 }
0423
0424
0425
0426 inline G4Material* G4NistManager::FindSimpleMaterial(G4int Z) const
0427 {
0428 return matBuilder->FindSimpleMaterial(Z);
0429 }
0430
0431
0432
0433 inline G4Material* G4NistManager::FindOrBuildSimpleMaterial(G4int Z, G4bool warning)
0434 {
0435 return matBuilder->FindOrBuildSimpleMaterial(Z, warning);
0436 }
0437
0438
0439
0440 inline G4Material* G4NistManager::ConstructNewMaterial(const G4String& name,
0441 const std::vector<G4String>& elm, const std::vector<G4int>& nbAtoms, G4double dens, G4bool,
0442 G4State state, G4double T, G4double P)
0443
0444 {
0445 return matBuilder->ConstructNewMaterial(name, elm, nbAtoms, dens, state, T, P);
0446 }
0447
0448
0449
0450 inline G4Material* G4NistManager::ConstructNewMaterial(const G4String& name,
0451 const std::vector<G4String>& elm, const std::vector<G4double>& w, G4double dens, G4bool,
0452 G4State state, G4double T, G4double P)
0453 {
0454 return matBuilder->ConstructNewMaterial(name, elm, w, dens, state, T, P);
0455 }
0456
0457
0458
0459 inline G4Material* G4NistManager::ConstructNewGasMaterial(
0460 const G4String& name, const G4String& nameNist, G4double temp, G4double pres, G4bool)
0461 {
0462 return matBuilder->ConstructNewGasMaterial(name, nameNist, temp, pres);
0463 }
0464
0465
0466
0467 inline G4Material* G4NistManager::ConstructNewIdealGasMaterial(const G4String& name,
0468 const std::vector<G4String>& elm, const std::vector<G4int>& nbAtoms, G4bool, G4double T,
0469 G4double P)
0470 {
0471 return matBuilder->ConstructNewIdealGasMaterial(name, elm, nbAtoms, T, P);
0472 }
0473
0474
0475
0476 inline void G4NistManager::ListMaterials(const G4String& list) const
0477 {
0478 matBuilder->ListMaterials(list);
0479 }
0480
0481
0482
0483 inline const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
0484 {
0485 return matBuilder->GetMaterialNames();
0486 }
0487
0488
0489
0490 inline G4double G4NistManager::GetZ13(G4double A) const { return g4pow->A13(A); }
0491
0492
0493
0494 inline G4double G4NistManager::GetZ13(G4int Z) const { return g4pow->Z13(Z); }
0495
0496
0497
0498 inline G4double G4NistManager::GetA27(G4int Z) const
0499 {
0500 return (0 <= Z && Z < 101) ? POWERA27[Z] : g4pow->powZ(Z, 0.27);
0501 }
0502
0503
0504
0505 inline G4double G4NistManager::GetLOGZ(G4int Z) const { return g4pow->logZ(Z); }
0506
0507
0508
0509 inline G4double G4NistManager::GetLOGAMU(G4int Z) const
0510 {
0511 return (0 <= Z && Z < 101) ? LOGAZ[Z] : 0.0;
0512 }
0513
0514
0515
0516 #endif