47G4tgbMaterialMgr::G4tgbMaterialMgr()
54 if(theInstance ==
nullptr)
67 for(
auto isotcite = theG4tgbIsotopes.cbegin();
68 isotcite != theG4tgbIsotopes.cend(); ++isotcite)
70 delete(*isotcite).second;
72 theG4tgbIsotopes.clear();
74 for(
auto elemcite = theG4tgbElements.cbegin();
75 elemcite != theG4tgbElements.cend(); ++elemcite)
77 delete(*elemcite).second;
79 theG4tgbElements.clear();
81 for(
auto matcite = theG4tgbMaterials.cbegin();
82 matcite != theG4tgbMaterials.cend(); ++matcite)
84 delete(*matcite).second;
86 theG4tgbMaterials.clear();
96 for(
auto cite = tgrIsots.cbegin(); cite != tgrIsots.cend(); ++cite)
100 theG4tgbIsotopes[tgb->
GetName()] = tgb;
109 for(
auto cite = tgrElems.cbegin(); cite != tgrElems.cend(); ++cite)
113 theG4tgbElements[tgb->
GetName()] = tgb;
122 for(
auto cite = tgrMates.cbegin(); cite != tgrMates.cend(); ++cite)
126 if(tgr->
GetType() ==
"MaterialSimple")
130 else if(tgr->
GetType() ==
"MaterialMixtureByWeight")
134 else if(tgr->
GetType() ==
"MaterialMixtureByNoAtoms")
138 else if(tgr->
GetType() ==
"MaterialMixtureByVolume")
146 theG4tgbMaterials[tgb->
GetName()] = tgb;
154 if(g4isot ==
nullptr)
161 theG4Isotopes[isotname] = g4isot;
168 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Isotope() -"
169 <<
" G4Isotope already built: " << g4isot->
GetName() <<
G4endl;
177 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Isotope() - Isotope: " << name
189 G4msg4isot::const_iterator cite = theG4Isotopes.find(name);
190 if(cite != theG4Isotopes.cend())
192 g4isot = (*cite).second;
196 G4cout <<
" G4tgbMaterialMgr::FindBuiltG4Isotope() - Isotope: " << name
197 <<
" = " << g4isot <<
G4endl;
211 G4mstgbisot::const_iterator cite = theG4tgbIsotopes.find(name);
212 if(cite != theG4tgbIsotopes.cend())
217 G4cout <<
" G4tgbMaterialMgr::FindG4tgbIsotope() -"
218 <<
" G4tgbIsotope found: " << ((*cite).second)->GetName()
222 isot = (*cite).second;
224 if((isot ==
nullptr) && bMustExist)
226 G4String ErrMessage =
"Isotope " + name +
" not found !";
227 G4Exception(
"G4tgbMaterialMgr::FindG4tgbIsotope()",
"InvalidSetup",
239 if(g4elem ==
nullptr)
242 if(tgbelem ==
nullptr)
245 G4cout <<
" G4NistManager::Instance()->FindOrBuildElement( " <<
G4endl;
250 if(tgbelem->
GetType() ==
"ElementSimple")
254 else if(tgbelem->
GetType() ==
"ElementFromIsotopes")
261 "Element type " + tgbelem->
GetType() +
" does not exist !";
262 G4Exception(
"G4tgbMaterialMgr::GetG4Element()",
"InvalidSetup",
267 if((g4elem !=
nullptr))
269 theG4Elements[g4elem->
GetName()] = g4elem;
273 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
282 G4String ErrMessage =
"Element " + name +
" not found !";
283 G4Exception(
"G4tgbMaterialMgr::FindOrBuildG4Element()",
"InvalidSetup",
289 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
290 << name <<
" not found " <<
G4endl;
300 G4cout <<
" G4tgbMaterialMgr::GetG4Element() -"
301 <<
" G4Element already built: " << g4elem->
GetName() <<
G4endl;
314 G4msg4elem::const_iterator cite = theG4Elements.find(name);
315 if(cite != theG4Elements.cend())
317 g4elem = (*cite).second;
321 G4cout <<
" G4tgbMaterialMgr::FindBuiltG4Element() - Element: " << name
322 <<
" = " << g4elem <<
G4endl;
336 G4mstgbelem::const_iterator cite = theG4tgbElements.find(name);
337 if(cite != theG4tgbElements.cend())
342 G4cout <<
" G4tgbMaterialMgr::FindG4tgbElement() -"
343 <<
" G4tgbElement found: " << ((*cite).second)->GetName()
347 elem = (*cite).second;
349 if((
elem ==
nullptr) && bMustExist)
351 G4String ErrMessage =
"Element " + name +
" not found !";
352 G4Exception(
"G4tgbMaterialMgr::FindG4tgbElement()",
"InvalidSetup",
364 if(g4mate ==
nullptr)
368 if(tgbmate ==
nullptr)
385 if(g4mate !=
nullptr)
387 theG4Materials[g4mate->
GetName()] = g4mate;
391 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Material() - Material: "
400 G4String ErrMessage =
"Material " + name +
" not found !";
401 G4Exception(
"G4tgbMaterialMgr::FindOrBuildG4Material()",
"InvalidSetup",
407 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Material() - Element: "
408 << name <<
" not found " <<
G4endl;
418 G4cout <<
" G4tgbMaterialMgr::FindOrBuildG4Material() -"
419 <<
" G4Material already built: " << g4mate->
GetName() <<
G4endl;
432 G4msg4mate::const_iterator cite = theG4Materials.find(name);
433 if(cite != theG4Materials.cend())
435 g4mate = (*cite).second;
439 G4cout <<
" G4tgbMaterialMgr::FindBuiltG4Material() - Material: " << name
440 <<
" = " << g4mate <<
G4endl;
453 G4mstgbmate::const_iterator cite = theG4tgbMaterials.find(name);
454 if(cite != theG4tgbMaterials.cend())
456 mate = (*cite).second;
460 G4cout <<
" G4tgbMaterialMgr::FindG4tgbMaterial() -"
461 <<
" G4tgbMaterial found: " << ((*cite).second)->GetName()
462 <<
" type " << ((*cite).second)->GetName() <<
G4endl;
467 if((mate ==
nullptr) && bMustExist)
469 G4String ErrMessage =
"Material " + name +
" not found !";
470 G4Exception(
"G4tgbMaterialMgr::FindG4tgbMaterial()",
"InvalidSetup",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
std::map< G4String, G4tgrElement * > G4mstgrelem
std::map< G4String, G4tgrMaterial * > G4mstgrmate
std::map< G4String, G4tgrIsotope * > G4mstgrisot
const G4String & GetName() const
void SetMeanExcitationEnergy(G4double value)
const G4String & GetName() const
G4IonisParamMat * GetIonisation() const
const G4String & GetName() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
const G4String & GetName() const
G4Element * BuildG4ElementFromIsotopes()
const G4String & GetType() const
G4Element * BuildG4ElementSimple()
G4Isotope * BuildG4Isotope()
const G4String & GetName() const
G4Material * FindBuiltG4Material(const G4String &name) const
G4Isotope * FindOrBuildG4Isotope(const G4String &name)
G4tgbIsotope * FindG4tgbIsotope(const G4String &name, G4bool bMustExist=false) const
G4tgbElement * FindG4tgbElement(const G4String &name, G4bool bMustExist=false) const
G4Element * FindBuiltG4Element(const G4String &name) const
G4Isotope * FindBuiltG4Isotope(const G4String &name) const
G4Element * FindOrBuildG4Element(const G4String &name, G4bool bMustExist=true)
G4Material * FindOrBuildG4Material(const G4String &name, G4bool bMustExist=true)
G4tgbMaterial * FindG4tgbMaterial(const G4String &name, G4bool bMustExist=false) const
static G4tgbMaterialMgr * GetInstance()
const G4String & GetName() const
G4tgrMaterial * GetTgrMate() const
virtual G4Material * BuildG4Material()=0
const G4mstgrelem & GetElementList() const
const G4mstgrmate & GetMaterialList() const
static G4tgrMaterialFactory * GetInstance()
const G4mstgrisot & GetIsotopeList() const
const G4String & GetType() const
G4double GetIonisationMeanExcitationEnergy() const
static G4int GetVerboseLevel()