G4tgbMaterialMgr Class Reference

#include <G4tgbMaterialMgr.hh>


Public Member Functions

 ~G4tgbMaterialMgr ()
void CopyIsotopes ()
void CopyElements ()
void CopyMaterials ()
G4IsotopeFindOrBuildG4Isotope (const G4String &name)
G4IsotopeFindBuiltG4Isotope (const G4String &name) const
G4tgbIsotopeFindG4tgbIsotope (const G4String &name, G4bool bMustExist=0) const
G4ElementFindOrBuildG4Element (const G4String &name, G4bool bMustExist=1)
G4ElementFindBuiltG4Element (const G4String &name) const
G4tgbElementFindG4tgbElement (const G4String &name, G4bool bMustExist=0) const
G4MaterialFindOrBuildG4Material (const G4String &name, G4bool bMustExist=1)
G4MaterialFindBuiltG4Material (const G4String &name) const
G4tgbMaterialFindG4tgbMaterial (const G4String &name, G4bool bMustExist=0) const
const G4msg4isot GetG4IsotopeList () const
const G4msg4elem GetG4ElementList () const
const G4msg4mate GetG4MaterialList () const

Static Public Member Functions

static G4tgbMaterialMgrGetInstance ()


Detailed Description

Definition at line 66 of file G4tgbMaterialMgr.hh.


Constructor & Destructor Documentation

G4tgbMaterialMgr::~G4tgbMaterialMgr (  ) 

Definition at line 74 of file G4tgbMaterialMgr.cc.

00075 {
00076   G4mstgbisot::const_iterator isotcite;
00077   for( isotcite = theG4tgbIsotopes.begin();
00078        isotcite != theG4tgbIsotopes.end(); isotcite++)
00079   {
00080     delete (*isotcite).second;
00081   }
00082   theG4tgbIsotopes.clear();
00083 
00084   G4mstgbelem::const_iterator elemcite;
00085   for( elemcite = theG4tgbElements.begin();
00086        elemcite != theG4tgbElements.end(); elemcite++)
00087   {
00088     delete (*elemcite).second;
00089   }
00090   theG4tgbElements.clear();
00091 
00092   G4mstgbmate::const_iterator matcite;
00093   for( matcite = theG4tgbMaterials.begin();
00094        matcite != theG4tgbMaterials.end(); matcite++)
00095   {
00096     delete (*matcite).second;
00097   }
00098   theG4tgbMaterials.clear();
00099 
00100   delete theInstance;
00101 }


Member Function Documentation

void G4tgbMaterialMgr::CopyElements (  ) 

Definition at line 120 of file G4tgbMaterialMgr.cc.

References G4tgrMaterialFactory::GetElementList(), and G4tgrMaterialFactory::GetInstance().

Referenced by GetInstance().

00121 {
00122   const G4mstgrelem tgrElems
00123         = G4tgrMaterialFactory::GetInstance()->GetElementList();
00124   G4mstgrelem::const_iterator cite;
00125   for( cite = tgrElems.begin(); cite != tgrElems.end(); cite++ )
00126   {
00127     G4tgrElement* tgr = (*cite).second;
00128     G4tgbElement* tgb = new G4tgbElement( tgr );
00129     theG4tgbElements[tgb->GetName()] = tgb;
00130   }
00131 }

void G4tgbMaterialMgr::CopyIsotopes (  ) 

Definition at line 105 of file G4tgbMaterialMgr.cc.

References G4tgrMaterialFactory::GetInstance(), and G4tgrMaterialFactory::GetIsotopeList().

Referenced by GetInstance().

00106 {
00107   const G4mstgrisot tgrIsots
00108         = G4tgrMaterialFactory::GetInstance()->GetIsotopeList();
00109   G4mstgrisot::const_iterator cite;
00110   for( cite = tgrIsots.begin(); cite != tgrIsots.end(); cite++ )
00111   {
00112     G4tgrIsotope* tgr = (*cite).second;
00113     G4tgbIsotope* tgb = new G4tgbIsotope( tgr );
00114     theG4tgbIsotopes[tgb->GetName()] = tgb;
00115   }
00116 }

void G4tgbMaterialMgr::CopyMaterials (  ) 

Definition at line 135 of file G4tgbMaterialMgr.cc.

References G4tgrMaterialFactory::GetInstance(), and G4tgrMaterialFactory::GetMaterialList().

Referenced by GetInstance().

00136 {
00137   const G4mstgrmate tgrMates
00138         = G4tgrMaterialFactory::GetInstance()->GetMaterialList();
00139   G4mstgrmate::const_iterator cite;
00140   for( cite = tgrMates.begin(); cite != tgrMates.end(); cite++ )
00141   {
00142     G4tgrMaterial* tgr = (*cite).second;
00143     G4tgbMaterial* tgb = 0;
00144     if( tgr->GetType() == "MaterialSimple" ) {
00145       tgb = new G4tgbMaterialSimple( tgr );
00146     } else if( tgr->GetType() == "MaterialMixtureByWeight" ) {
00147       tgb = new G4tgbMaterialMixtureByWeight( tgr );
00148     } else if( tgr->GetType() == "MaterialMixtureByNoAtoms" ) {
00149       tgb = new G4tgbMaterialMixtureByNoAtoms( tgr );
00150     } else if( tgr->GetType() == "MaterialMixtureByVolume" ) {
00151       tgb = new G4tgbMaterialMixtureByVolume( tgr );
00152     } else {
00153       return;
00154     }
00155     theG4tgbMaterials[tgb->GetName()] = tgb;
00156   }
00157 }

G4Element * G4tgbMaterialMgr::FindBuiltG4Element ( const G4String name  )  const

Definition at line 325 of file G4tgbMaterialMgr.cc.

References G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().

Referenced by FindOrBuildG4Element().

00326 {
00327   G4Element* g4elem = 0;
00328  
00329   G4msg4elem::const_iterator cite = theG4Elements.find( name );
00330   if( cite != theG4Elements.end() )
00331   {
00332     g4elem = (*cite).second;
00333 #ifdef G4VERBOSE
00334     if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00335     {
00336       G4cout << " G4tgbMaterialMgr::FindBuiltG4Element() - Element: "
00337              << name << " = " << g4elem << G4endl;
00338     }
00339 #endif
00340   } 
00341 
00342   return g4elem;
00343 }

G4Isotope * G4tgbMaterialMgr::FindBuiltG4Isotope ( const G4String name  )  const

Definition at line 196 of file G4tgbMaterialMgr.cc.

References G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().

Referenced by FindOrBuildG4Isotope().

00197 {
00198   G4Isotope* g4isot = 0;
00199  
00200   G4msg4isot::const_iterator cite = theG4Isotopes.find( name );
00201   if( cite != theG4Isotopes.end() )
00202   {
00203     g4isot = (*cite).second;
00204 #ifdef G4VERBOSE
00205     if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00206       {
00207         G4cout << " G4tgbMaterialMgr::FindBuiltG4Isotope() - Isotope: "
00208                << name << " = " << g4isot << G4endl;
00209       }
00210 #endif
00211 
00212   } 
00213 
00214   return g4isot;
00215 }

G4Material * G4tgbMaterialMgr::FindBuiltG4Material ( const G4String name  )  const

Definition at line 446 of file G4tgbMaterialMgr.cc.

References G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().

Referenced by FindOrBuildG4Material().

00447 {
00448   G4Material* g4mate = 0;
00449   //---------- look for an existing G4Material
00450   G4msg4mate::const_iterator cite = theG4Materials.find( name );
00451   if( cite != theG4Materials.end() )
00452   {
00453     g4mate = (*cite).second;
00454 #ifdef G4VERBOSE
00455     if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00456     {
00457       G4cout << " G4tgbMaterialMgr::FindBuiltG4Material() - Material: "
00458              << name << " = " << g4mate << G4endl;
00459     }
00460 #endif
00461   }
00462 
00463   return g4mate;
00464 }

G4tgbElement * G4tgbMaterialMgr::FindG4tgbElement ( const G4String name,
G4bool  bMustExist = 0 
) const

Definition at line 347 of file G4tgbMaterialMgr.cc.

References FatalException, G4cout, G4endl, G4Exception(), and G4tgrMessenger::GetVerboseLevel().

Referenced by FindOrBuildG4Element().

00349 {
00350   G4tgbElement* elem = 0;
00351 
00352   G4mstgbelem::const_iterator cite = theG4tgbElements.find( name ); 
00353   if( cite != theG4tgbElements.end() )
00354   {
00355 #ifdef G4VERBOSE
00356     if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00357     {
00358       G4cout << " G4tgbMaterialMgr::FindG4tgbElement() -"
00359              << " G4tgbElement found: " << ( (*cite).second )->GetName()
00360              << G4endl;
00361     }
00362 #endif
00363     elem = (*cite).second;
00364   }
00365   if( (elem == 0) && bMustExist )
00366   {
00367     G4String ErrMessage = "Element " + name + "  not found !";
00368     G4Exception("G4tgbMaterialMgr::FindG4tgbElement()",
00369                 "InvalidSetup", FatalException, ErrMessage);
00370   }
00371 
00372   return elem;
00373 }

G4tgbIsotope * G4tgbMaterialMgr::FindG4tgbIsotope ( const G4String name,
G4bool  bMustExist = 0 
) const

Definition at line 219 of file G4tgbMaterialMgr.cc.

References FatalException, G4cout, G4endl, G4Exception(), and G4tgrMessenger::GetVerboseLevel().

Referenced by FindOrBuildG4Isotope().

00221 {
00222   G4tgbIsotope* isot = 0;
00223 
00224   G4mstgbisot::const_iterator cite = theG4tgbIsotopes.find( name ); 
00225   if( cite != theG4tgbIsotopes.end() )
00226   {
00227 #ifdef G4VERBOSE
00228     if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00229     {
00230       G4cout << " G4tgbMaterialMgr::FindG4tgbIsotope() -"
00231              << " G4tgbIsotope found: " << ( (*cite).second )->GetName()
00232              << G4endl;
00233     }
00234 #endif
00235     isot = (*cite).second;
00236   }
00237   if( (isot == 0) && bMustExist )
00238   {
00239     G4String ErrMessage = "Isotope " + name + " not found !";
00240     G4Exception("G4tgbMaterialMgr::FindG4tgbIsotope()",
00241                 "InvalidSetup", FatalException, ErrMessage);
00242   }
00243 
00244   return isot;
00245 }

G4tgbMaterial * G4tgbMaterialMgr::FindG4tgbMaterial ( const G4String name,
G4bool  bMustExist = 0 
) const

Definition at line 468 of file G4tgbMaterialMgr.cc.

References FatalException, G4cout, G4endl, G4Exception(), and G4tgrMessenger::GetVerboseLevel().

Referenced by FindOrBuildG4Material().

00470 {
00471   G4tgbMaterial* mate = 0;
00472   G4mstgbmate::const_iterator cite = theG4tgbMaterials.find( name );
00473   if( cite != theG4tgbMaterials.end() )
00474   {
00475     mate = (*cite).second;
00476 #ifdef G4VERBOSE
00477     if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00478     {
00479       G4cout << " G4tgbMaterialMgr::FindG4tgbMaterial() -"
00480              << " G4tgbMaterial found: " << ( (*cite).second )->GetName()
00481              << " type " << ( (*cite).second )->GetName() << G4endl;
00482     }
00483 #endif
00484   }
00485 
00486   if( (mate == 0) && bMustExist )
00487   {
00488     G4String ErrMessage = "Material " + name + "  not found !";
00489     G4Exception("G4tgbMaterialMgr::FindG4tgbMaterial()",
00490                 "InvalidSetup", FatalException, ErrMessage);
00491   }
00492 
00493   return mate;
00494 }

G4Element * G4tgbMaterialMgr::FindOrBuildG4Element ( const G4String name,
G4bool  bMustExist = 1 
)

Definition at line 249 of file G4tgbMaterialMgr.cc.

References G4tgbElement::BuildG4ElementFromIsotopes(), G4tgbElement::BuildG4ElementSimple(), FatalException, FindBuiltG4Element(), FindG4tgbElement(), G4NistManager::FindOrBuildElement(), G4cout, G4endl, G4Exception(), G4Element::GetName(), G4tgbElement::GetType(), G4tgrMessenger::GetVerboseLevel(), and G4NistManager::Instance().

Referenced by G4tgbMaterialMixtureByWeight::BuildG4Material(), and G4tgbMaterialMixtureByNoAtoms::BuildG4Material().

00251 {
00252   G4Element* g4elem = FindBuiltG4Element( name );
00253   if( g4elem == 0 )
00254   {
00255     G4tgbElement* tgbelem = FindG4tgbElement( name, false );
00256     if( tgbelem == 0)
00257     {
00258       // If FindG4tgbElement returns 0, look for a G4NISTElement
00259       G4cout << "  G4NistManager::Instance()->FindOrBuildElement( " << G4endl;
00260       g4elem = G4NistManager::Instance()->FindOrBuildElement(name);
00261     }
00262     else
00263     {
00264       if( tgbelem->GetType() == "ElementSimple" )
00265       {
00266         g4elem = tgbelem->BuildG4ElementSimple();
00267       }
00268       else if( tgbelem->GetType() == "ElementFromIsotopes" )
00269       {
00270         g4elem = tgbelem->BuildG4ElementFromIsotopes();
00271       }
00272       else
00273       {
00274         G4String ErrMessage = "Element type " + tgbelem->GetType()
00275           + " does not exist !";
00276         G4Exception("G4tgbMaterialMgr::GetG4Element()",
00277                     "InvalidSetup", FatalException, ErrMessage);
00278       }
00279     }
00280     // Register it
00281     if( (g4elem != 0) )
00282     {
00283       theG4Elements[g4elem->GetName()] = g4elem;
00284 #ifdef G4VERBOSE
00285       if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00286         {
00287           G4cout << " G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
00288                  << name << G4endl;
00289         }
00290 #endif
00291     }
00292     else
00293     {
00294       if( bMustExist )
00295       {
00296         G4String ErrMessage = "Element " + name + " not found !";
00297         G4Exception("G4tgbMaterialMgr::FindOrBuildG4Element()",
00298                     "InvalidSetup", FatalException, ErrMessage);
00299       }
00300 #ifdef G4VERBOSE
00301       if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00302       {
00303         G4cout << " G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
00304                << name << " not found  " << G4endl;
00305       }
00306 #endif
00307     }
00308   }
00309   else
00310   { 
00311 #ifdef G4VERBOSE
00312     if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00313     {
00314       G4cout << " G4tgbMaterialMgr::GetG4Element() -"
00315              << " G4Element already built: " << g4elem->GetName() << G4endl; 
00316     }
00317 #endif
00318   }
00319 
00320   return g4elem;
00321 } 

G4Isotope * G4tgbMaterialMgr::FindOrBuildG4Isotope ( const G4String name  ) 

Definition at line 161 of file G4tgbMaterialMgr.cc.

References G4tgbIsotope::BuildG4Isotope(), FindBuiltG4Isotope(), FindG4tgbIsotope(), G4cout, G4endl, G4Isotope::GetName(), and G4tgrMessenger::GetVerboseLevel().

Referenced by G4tgbElement::BuildG4ElementFromIsotopes().

00162 {
00163   G4Isotope* g4isot = FindBuiltG4Isotope( name );
00164   if( g4isot == 0 )
00165   {
00166     G4tgbIsotope* tgbisot = FindG4tgbIsotope( name );
00167     // FindG4tgbIsotope never returns 0, otherwise if not found, crashes
00168     g4isot = tgbisot->BuildG4Isotope();
00169     // Register it
00170     G4String isotname = g4isot->GetName();
00171     theG4Isotopes[isotname] = g4isot;
00172   }
00173   else
00174   { 
00175 #ifdef G4VERBOSE
00176     if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00177     {
00178       G4cout << " G4tgbMaterialMgr::FindOrBuildG4Isotope() -"
00179              << " G4Isotope already built: " << g4isot->GetName() << G4endl;
00180     }
00181 #endif
00182   }
00183 
00184 #ifdef G4VERBOSE
00185   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00186   {
00187     G4cout << " G4tgbMaterialMgr::FindOrBuildG4Isotope() - Isotope: "
00188            << name << G4endl;
00189   }
00190 #endif
00191   return g4isot;
00192 } 

G4Material * G4tgbMaterialMgr::FindOrBuildG4Material ( const G4String name,
G4bool  bMustExist = 1 
)

Definition at line 377 of file G4tgbMaterialMgr.cc.

References G4tgbMaterial::BuildG4Material(), FatalException, FindBuiltG4Material(), FindG4tgbMaterial(), G4NistManager::FindOrBuildMaterial(), G4cout, G4endl, G4Exception(), G4Material::GetIonisation(), G4tgrMaterial::GetIonisationMeanExcitationEnergy(), G4Material::GetName(), G4tgbMaterial::GetTgrMate(), G4tgrMessenger::GetVerboseLevel(), G4NistManager::Instance(), and G4IonisParamMat::SetMeanExcitationEnergy().

Referenced by G4tgbMaterialMixtureByWeight::BuildG4Material(), G4tgbMaterialMixtureByVolume::BuildG4Material(), G4tgbVolume::ConstructG4LogVol(), G4tgbVolume::ConstructG4PhysVol(), and G4tgbMaterialMixtureByVolume::TransformToFractionsByWeight().

00379 {
00380   G4Material* g4mate = FindBuiltG4Material( name );
00381   if( g4mate == 0)
00382   {
00383     G4tgbMaterial* tgbmate = FindG4tgbMaterial( name, false );
00384    
00385     if( tgbmate == 0)
00386     {
00387       // if FindG4tgbMaterial() returns 0, look for a G4NISTMaterial
00388       g4mate = G4NistManager::Instance()->FindOrBuildMaterial(name);
00389     }
00390     else
00391     {
00392       g4mate = tgbmate->BuildG4Material();
00393 
00394       if( tgbmate->GetTgrMate()->GetIonisationMeanExcitationEnergy() != -1. )
00395       {
00396         g4mate->GetIonisation()->SetMeanExcitationEnergy(tgbmate->
00397                 GetTgrMate()->GetIonisationMeanExcitationEnergy());
00398       }
00399     }
00400 
00401     // Register it
00402     if( g4mate != 0 )
00403     {
00404       theG4Materials[g4mate->GetName()] = g4mate;
00405 #ifdef G4VERBOSE
00406       if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00407       {
00408         G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() - Material: "
00409                << name << G4endl;
00410       }
00411 #endif
00412     }
00413     else
00414     {
00415       if( bMustExist )
00416       {
00417         G4String ErrMessage = "Material " + name + "  not found !";
00418         G4Exception("G4tgbMaterialMgr::FindOrBuildG4Material()",
00419                     "InvalidSetup", FatalException, ErrMessage);
00420       }  
00421 #ifdef G4VERBOSE
00422       if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00423       {
00424         G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() - Element: "
00425                << name << " not found  " << G4endl;
00426       }
00427 #endif
00428     }
00429   }
00430   else
00431   { 
00432 #ifdef G4VERBOSE
00433     if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00434     {
00435       G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() -"
00436              << " G4Material already built: " << g4mate->GetName() << G4endl;
00437     }
00438 #endif
00439   }
00440 
00441   return g4mate;
00442 }

const G4msg4elem G4tgbMaterialMgr::GetG4ElementList (  )  const [inline]

Definition at line 112 of file G4tgbMaterialMgr.hh.

Referenced by G4tgbVolumeMgr::DumpSummary().

00112 { return theG4Elements;  }

const G4msg4isot G4tgbMaterialMgr::GetG4IsotopeList (  )  const [inline]

Definition at line 111 of file G4tgbMaterialMgr.hh.

Referenced by G4tgbVolumeMgr::DumpSummary().

00111 { return theG4Isotopes;  }

const G4msg4mate G4tgbMaterialMgr::GetG4MaterialList (  )  const [inline]

Definition at line 113 of file G4tgbMaterialMgr.hh.

Referenced by G4tgbVolumeMgr::DumpSummary().

00113 { return theG4Materials; }

G4tgbMaterialMgr * G4tgbMaterialMgr::GetInstance (  )  [static]

Definition at line 60 of file G4tgbMaterialMgr.cc.

References CopyElements(), CopyIsotopes(), and CopyMaterials().

Referenced by G4tgbElement::BuildG4ElementFromIsotopes(), G4tgbMaterialMixtureByWeight::BuildG4Material(), G4tgbMaterialMixtureByVolume::BuildG4Material(), G4tgbMaterialMixtureByNoAtoms::BuildG4Material(), G4tgbVolume::ConstructG4LogVol(), G4tgbVolume::ConstructG4PhysVol(), G4tgbVolumeMgr::DumpSummary(), and G4tgbMaterialMixtureByVolume::TransformToFractionsByWeight().

00061 {
00062   if( !theInstance )
00063   {
00064     theInstance = new G4tgbMaterialMgr;
00065     theInstance->CopyIsotopes();
00066     theInstance->CopyElements();
00067     theInstance->CopyMaterials();
00068   }
00069   return theInstance;
00070 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:29 2013 for Geant4 by  doxygen 1.4.7