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