#include <G4NistMaterialBuilder.hh>
Public Member Functions | |
G4NistMaterialBuilder (G4NistElementBuilder *, G4int verb=0) | |
~G4NistMaterialBuilder () | |
G4Material * | FindOrBuildMaterial (const G4String &name, G4bool isotopes=true, G4bool warning=true) |
G4Material * | ConstructNewMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=CLHEP::STP_Temperature, G4double pressure=CLHEP::STP_Pressure) |
G4Material * | ConstructNewMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4double > &weight, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=CLHEP::STP_Temperature, G4double pressure=CLHEP::STP_Pressure) |
G4Material * | ConstructNewGasMaterial (const G4String &name, const G4String &nameDB, G4double temp, G4double pres, G4bool isotopes=true) |
G4Material * | ConstructNewIdealGasMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4bool isotopes=true, G4double temp=CLHEP::STP_Temperature, G4double pressure=CLHEP::STP_Pressure) |
void | SetVerbose (G4int val) |
void | ListMaterials (const G4String &) |
void | ListNistSimpleMaterials () |
void | ListNistCompoundMaterials () |
void | ListHepMaterials () |
void | ListSpaceMaterials () |
void | ListBioChemicalMaterials () |
const std::vector< G4String > & | GetMaterialNames () const |
G4double | GetMeanIonisationEnergy (G4int index) const |
Definition at line 69 of file G4NistMaterialBuilder.hh.
G4NistMaterialBuilder::G4NistMaterialBuilder | ( | G4NistElementBuilder * | , | |
G4int | verb = 0 | |||
) |
Definition at line 76 of file G4NistMaterialBuilder.cc.
00077 : elmBuilder(eb), 00078 verbose(vb), 00079 nMaterials(0), 00080 nComponents(0), 00081 nCurrent(0), 00082 first(true) 00083 { 00084 Initialise(); 00085 }
G4NistMaterialBuilder::~G4NistMaterialBuilder | ( | ) |
G4Material * G4NistMaterialBuilder::ConstructNewGasMaterial | ( | const G4String & | name, | |
const G4String & | nameDB, | |||
G4double | temp, | |||
G4double | pres, | |||
G4bool | isotopes = true | |||
) |
Definition at line 320 of file G4NistMaterialBuilder.cc.
References FindOrBuildMaterial(), G4cout, G4endl, G4Material::GetDensity(), G4Material::GetState(), and kStateGas.
Referenced by G4NistManager::ConstructNewGasMaterial().
00326 { 00327 // Material name is in DB 00328 G4Material* mat = FindOrBuildMaterial(name); 00329 if(mat) { 00330 G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:" 00331 << " WARNING: the material <" << name 00332 << "> is already exist" << G4endl; 00333 G4cout << " New material will NOT be built!" 00334 << G4endl; 00335 return mat; 00336 } 00337 00338 G4Material* bmat = FindOrBuildMaterial(nameDB); 00339 if(!bmat) { 00340 G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:" 00341 << " WARNING: the Name <" << nameDB 00342 << "> is NOT in the DB: no new gas will be constructed" 00343 << G4endl; 00344 return 0; 00345 } 00346 if(bmat->GetState() != kStateGas) { 00347 G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:" 00348 << " WARNING: <" << nameDB 00349 << "> is NOT a gas - no new gas will be constructed" 00350 << G4endl; 00351 return 0; 00352 } 00353 00354 G4double dens = bmat->GetDensity()*pres*STP_Temperature/(temp*STP_Pressure); 00355 mat = new G4Material(name,dens,bmat,kStateGas,temp,pres); 00356 00357 if (verbose>1) { 00358 G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial: done" << G4endl; 00359 G4cout << &mat << G4endl; 00360 } 00361 return mat; 00362 }
G4Material * G4NistMaterialBuilder::ConstructNewIdealGasMaterial | ( | const G4String & | name, | |
const std::vector< G4String > & | elm, | |||
const std::vector< G4int > & | nbAtoms, | |||
G4bool | isotopes = true , |
|||
G4double | temp = CLHEP::STP_Temperature , |
|||
G4double | pressure = CLHEP::STP_Pressure | |||
) |
Definition at line 366 of file G4NistMaterialBuilder.cc.
References FindOrBuildMaterial(), G4cout, G4endl, G4NistElementBuilder::GetAtomicMassAmu(), G4NistElementBuilder::GetZ(), and kStateGas.
Referenced by G4NistManager::ConstructNewIdealGasMaterial().
00373 { 00374 G4State state = kStateGas; 00375 00376 // Material is in DB 00377 G4Material* mat = FindOrBuildMaterial(name); 00378 if(mat) { 00379 G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:" 00380 << " WARNING: the material <" << name 00381 << "> is already exist" << G4endl; 00382 G4cout << " New material will NOT be built!" 00383 << G4endl; 00384 return mat; 00385 } 00386 00387 // Material not in DB 00388 G4int els = elm.size(); 00389 if(els == 0) { 00390 G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:" 00391 << " WARNING: empty list of elements for " << name 00392 << G4endl; 00393 G4cout << " New material will NOT be built!" 00394 << G4endl; 00395 return 0; 00396 } 00397 00398 // add parameters of material into internal vectors 00399 // density in g/cm3, mean ionisation potential is not defined 00400 G4bool stp = true; 00401 if(temp != STP_Temperature && pres != STP_Pressure) 00402 { stp = false; } 00403 00404 G4double massPerMole = 0; 00405 00406 G4int Z = 0; 00407 for (G4int i=0; i<els; ++i) { 00408 Z = elmBuilder->GetZ(elm[i]); 00409 massPerMole += nbAtoms[i] * elmBuilder->GetAtomicMassAmu(Z) * amu_c2; 00410 } 00411 00412 G4double dens = massPerMole / (Avogadro*k_Boltzmann*temp/pres); 00413 00414 if (els == 1) { AddMaterial(name,dens,Z,0.,els,state,stp); } 00415 else { 00416 AddMaterial(name,dens,0,0.,els,state,stp); 00417 for (G4int i=0; i<els; ++i) { 00418 AddElementByAtomCount(elmBuilder->GetZ(elm[i]), nbAtoms[i]); 00419 } 00420 } 00421 00422 if(!stp) { AddGas(name,temp,pres); } 00423 00424 return BuildMaterial(nMaterials-1, isotopes); 00425 }
G4Material * G4NistMaterialBuilder::ConstructNewMaterial | ( | const G4String & | name, | |
const std::vector< G4String > & | elm, | |||
const std::vector< G4double > & | weight, | |||
G4double | dens, | |||
G4bool | isotopes = true , |
|||
G4State | state = kStateSolid , |
|||
G4double | temp = CLHEP::STP_Temperature , |
|||
G4double | pressure = CLHEP::STP_Pressure | |||
) |
Definition at line 271 of file G4NistMaterialBuilder.cc.
References FindOrBuildMaterial(), G4cout, G4endl, G4NistElementBuilder::GetZ(), and kStateGas.
00280 { 00281 // Material is in DB 00282 G4Material* mat = FindOrBuildMaterial(name); 00283 if(mat) { 00284 G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:" 00285 << " WARNING: the material <" << name 00286 << "> is already exist" << G4endl; 00287 G4cout << " New material will NOT be built!" 00288 << G4endl; 00289 return mat; 00290 } 00291 00292 // Material not in DB 00293 G4int els = elm.size(); 00294 if(els == 0) { 00295 G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:" 00296 << " WARNING: empty list of elements for " << name 00297 << G4endl; 00298 G4cout << " New material will NOT be built!" 00299 << G4endl; 00300 return 0; 00301 } 00302 00303 // add parameters of material into internal vectors 00304 // density in g/cm3, mean ionisation potential is not defined 00305 G4bool stp = true; 00306 if(state == kStateGas && temp != STP_Temperature && pres != STP_Pressure) 00307 { stp = false; } 00308 AddMaterial(name,dens*cm3/g,0,0.,els,state,stp); 00309 if(!stp) { AddGas(name,temp,pres); } 00310 00311 for (G4int i=0; i<els; ++i) { 00312 AddElementByWeightFraction(elmBuilder->GetZ(elm[i]), w[i]); 00313 } 00314 00315 return BuildMaterial(nMaterials-1, isotopes); 00316 }
G4Material * G4NistMaterialBuilder::ConstructNewMaterial | ( | const G4String & | name, | |
const std::vector< G4String > & | elm, | |||
const std::vector< G4int > & | nbAtoms, | |||
G4double | dens, | |||
G4bool | isotopes = true , |
|||
G4State | state = kStateSolid , |
|||
G4double | temp = CLHEP::STP_Temperature , |
|||
G4double | pressure = CLHEP::STP_Pressure | |||
) |
Definition at line 221 of file G4NistMaterialBuilder.cc.
References FindOrBuildMaterial(), G4cout, G4endl, G4NistElementBuilder::GetZ(), and kStateGas.
Referenced by G4NistManager::ConstructNewMaterial().
00230 { 00231 // Material is in DB 00232 G4Material* mat = FindOrBuildMaterial(name); 00233 if(mat) { 00234 G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:" 00235 << " WARNING: the material <" << name 00236 << "> is already exist" << G4endl; 00237 G4cout << " New material will NOT be built!" 00238 << G4endl; 00239 return mat; 00240 } 00241 00242 // Material not in DB 00243 G4int els = elm.size(); 00244 if(els == 0) { 00245 G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:" 00246 << " WARNING: empty list of elements for " << name 00247 << G4endl; 00248 G4cout << " New material will NOT be built!" 00249 << G4endl; 00250 return 0; 00251 } 00252 00253 // add parameters of material into internal vectors 00254 // density in g/cm3, mean ionisation potential is not defined 00255 G4bool stp = true; 00256 if(state == kStateGas && temp != STP_Temperature && pres != STP_Pressure) 00257 { stp = false; } 00258 00259 AddMaterial(name,dens*cm3/g,0,0.,els,state,stp); 00260 if(!stp) { AddGas(name,temp,pres); } 00261 00262 for (G4int i=0; i<els; ++i) { 00263 AddElementByAtomCount(elmBuilder->GetZ(elm[i]), nbAtoms[i]); 00264 } 00265 00266 return BuildMaterial(nMaterials-1, isotopes); 00267 }
G4Material * G4NistMaterialBuilder::FindOrBuildMaterial | ( | const G4String & | name, | |
G4bool | isotopes = true , |
|||
G4bool | warning = true | |||
) |
Definition at line 94 of file G4NistMaterialBuilder.cc.
References G4cout, G4endl, and G4Material::GetMaterialTable().
Referenced by ConstructNewGasMaterial(), ConstructNewIdealGasMaterial(), ConstructNewMaterial(), and G4NistManager::FindOrBuildMaterial().
00097 { 00098 if(first) { 00099 if(verbose > 0) { 00100 G4cout << "### NIST DataBase for Materials is used" << G4endl; 00101 } 00102 first = false; 00103 } 00104 00105 G4String name = matname; 00106 if("G4_NYLON-6/6" == matname) { name = "G4_NYLON-6-6"; } 00107 if("G4_NYLON-6/10" == matname) { name = "G4_NYLON-6-10";} 00108 00109 if (verbose > 1) { 00110 G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial " << name << G4endl; 00111 } 00112 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 00113 G4int nmat = theMaterialTable->size(); 00114 00115 // Check if name inside DB 00116 G4Material* mat = 0; 00117 00118 for (G4int i=0; i<nMaterials; ++i) { 00119 00120 if (name == names[i]) { 00121 // Build new Nist material 00122 if(matIndex[i] == -1) { mat = BuildMaterial(i, isotopes); } 00123 // Nist material was already built 00124 else { mat = (*theMaterialTable)[matIndex[i]]; } 00125 return mat; 00126 } 00127 } 00128 00129 // Check the list of all materials 00130 if (nmat > 0) { 00131 for (G4int i=0; i<nmat; ++i) { 00132 if(name == ((*theMaterialTable)[i])->GetName()) { 00133 mat = (*theMaterialTable)[i]; 00134 return mat; 00135 } 00136 } 00137 } 00138 00139 if( (verbose == 1 && warning) || verbose > 1) { 00140 G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial WARNING:" 00141 << " material <" << name 00142 << "> is not found out" << G4endl; 00143 } 00144 return mat; 00145 }
const std::vector< G4String > & G4NistMaterialBuilder::GetMaterialNames | ( | ) | const [inline] |
Definition at line 218 of file G4NistMaterialBuilder.hh.
Referenced by G4NistManager::GetNistMaterialNames().
Definition at line 224 of file G4NistMaterialBuilder.hh.
Referenced by G4NistManager::GetMeanIonisationEnergy().
00225 { 00226 G4double res = 10*index; 00227 if(index >= 0 && index < nMaterials) { res = ionPotentials[index]; } 00228 return res; 00229 }
void G4NistMaterialBuilder::ListBioChemicalMaterials | ( | ) |
Definition at line 568 of file G4NistMaterialBuilder.cc.
References G4cout, and G4endl.
Referenced by ListMaterials().
00569 { 00570 G4cout << "=======================================================" << G4endl; 00571 G4cout << "### Bio-Chemical Materials ##" << G4endl; 00572 G4cout << "=======================================================" << G4endl; 00573 G4cout << " Ncomp Name ChFormula density(g/cm^3) I(eV) " << G4endl; 00574 G4cout << "=======================================================" << G4endl; 00575 for (G4int i=nSpace; i<nMaterials; ++i) {DumpMix(i);} 00576 G4cout << "=======================================================" << G4endl; 00577 }
void G4NistMaterialBuilder::ListHepMaterials | ( | ) |
Definition at line 542 of file G4NistMaterialBuilder.cc.
References G4cout, and G4endl.
Referenced by ListMaterials().
00543 { 00544 G4cout << "=======================================================" << G4endl; 00545 G4cout << "### HEP & Nuclear Materials ##" << G4endl; 00546 G4cout << "=======================================================" << G4endl; 00547 G4cout << " Ncomp Name ChFormula density(g/cm^3) I(eV) " << G4endl; 00548 G4cout << "=======================================================" << G4endl; 00549 for (G4int i=nNIST; i<nHEP; ++i) {DumpMix(i);} 00550 G4cout << "=======================================================" << G4endl; 00551 }
void G4NistMaterialBuilder::ListMaterials | ( | const G4String & | ) |
Definition at line 494 of file G4NistMaterialBuilder.cc.
References G4cout, G4endl, ListBioChemicalMaterials(), ListHepMaterials(), ListNistCompoundMaterials(), ListNistSimpleMaterials(), and ListSpaceMaterials().
Referenced by G4NistManager::ListMaterials().
00495 { 00496 if (mnam == "simple") { ListNistSimpleMaterials(); } 00497 else if (mnam == "compound") { ListNistCompoundMaterials(); } 00498 else if (mnam == "hep") { ListHepMaterials(); } 00499 else if (mnam == "space") { ListSpaceMaterials(); } 00500 else if (mnam == "biochemical") { ListBioChemicalMaterials(); } 00501 00502 else if (mnam == "all") { 00503 ListNistSimpleMaterials(); 00504 ListNistCompoundMaterials(); 00505 ListHepMaterials(); 00506 ListSpaceMaterials(); 00507 ListBioChemicalMaterials(); 00508 00509 } else { 00510 G4cout << "### G4NistMaterialBuilder::ListMaterials: Warning " 00511 << mnam << " list is not known" << G4endl; 00512 } 00513 }
void G4NistMaterialBuilder::ListNistCompoundMaterials | ( | ) |
Definition at line 530 of file G4NistMaterialBuilder.cc.
References G4cout, and G4endl.
Referenced by ListMaterials().
00531 { 00532 G4cout << "### Compound Materials from the NIST Data Base ##" << G4endl; 00533 G4cout << "=======================================================" << G4endl; 00534 G4cout << " Ncomp Name ChFormula density(g/cm^3) I(eV) " << G4endl; 00535 G4cout << "=======================================================" << G4endl; 00536 for (G4int i=nElementary; i<nNIST; ++i) {DumpMix(i);} 00537 G4cout << "=======================================================" << G4endl; 00538 }
void G4NistMaterialBuilder::ListNistSimpleMaterials | ( | ) |
Definition at line 517 of file G4NistMaterialBuilder.cc.
References G4cout, and G4endl.
Referenced by ListMaterials().
00518 { 00519 G4cout << "=======================================================" << G4endl; 00520 G4cout << "### Simple Materials from the NIST Data Base ###" << G4endl; 00521 G4cout << "=======================================================" << G4endl; 00522 G4cout << " Z Name ChFormula density(g/cm^3) I(eV) " << G4endl; 00523 G4cout << "=======================================================" << G4endl; 00524 for (G4int i=0; i<nElementary; ++i) {DumpElm(i);} 00525 G4cout << "=======================================================" << G4endl; 00526 }
void G4NistMaterialBuilder::ListSpaceMaterials | ( | ) |
Definition at line 555 of file G4NistMaterialBuilder.cc.
References G4cout, and G4endl.
Referenced by ListMaterials().
00556 { 00557 G4cout << "=======================================================" << G4endl; 00558 G4cout << "### Space ISS Materials ##" << G4endl; 00559 G4cout << "=======================================================" << G4endl; 00560 G4cout << " Ncomp Name ChFormula density(g/cm^3) I(eV) " << G4endl; 00561 G4cout << "=======================================================" << G4endl; 00562 for (G4int i=nHEP; i<nSpace; ++i) {DumpMix(i);} 00563 G4cout << "=======================================================" << G4endl; 00564 }
void G4NistMaterialBuilder::SetVerbose | ( | G4int | val | ) |
Definition at line 486 of file G4NistMaterialBuilder.cc.
References G4NistElementBuilder::SetVerbose().
Referenced by G4NistManager::SetVerbose().
00487 { 00488 verbose = val; 00489 elmBuilder->SetVerbose(verbose); 00490 }