G4tgbElement Class Reference

#include <G4tgbElement.hh>


Public Member Functions

 G4tgbElement ()
 ~G4tgbElement ()
 G4tgbElement (G4tgrElement *hg)
G4ElementBuildG4ElementSimple ()
G4ElementBuildG4ElementFromIsotopes ()
const G4StringGetName () const
const G4StringGetType () const


Detailed Description

Definition at line 53 of file G4tgbElement.hh.


Constructor & Destructor Documentation

G4tgbElement::G4tgbElement (  )  [inline]

Definition at line 58 of file G4tgbElement.hh.

00058 {}

G4tgbElement::~G4tgbElement (  )  [inline]

Definition at line 59 of file G4tgbElement.hh.

00059 {}

G4tgbElement::G4tgbElement ( G4tgrElement hg  ) 

Definition at line 44 of file G4tgbElement.cc.

00045 {
00046   theTgrElem = hg;
00047   theG4Elem = 0;
00048 }


Member Function Documentation

G4Element * G4tgbElement::BuildG4ElementFromIsotopes (  ) 

Definition at line 83 of file G4tgbElement.cc.

References FatalException, G4tgbMaterialMgr::FindOrBuildG4Isotope(), G4cout, G4endl, G4Exception(), G4tgrElementFromIsotopes::GetAbundance(), G4tgrElementFromIsotopes::GetComponent(), G4tgbMaterialMgr::GetInstance(), G4tgrElement::GetName(), G4tgrElementFromIsotopes::GetNumberOfIsotopes(), G4tgrElement::GetSymbol(), and G4tgrMessenger::GetVerboseLevel().

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

00084 {
00085   G4Element* elem = 0;
00086 
00087   //-------- if G4Element not found, construct it 
00088   if( theG4Elem == 0 )
00089   { 
00090     //----- construct new G4Element 
00091     G4tgrElementFromIsotopes* tgrElem
00092       = static_cast<G4tgrElementFromIsotopes*>(theTgrElem);
00093 
00094     elem = new G4Element(tgrElem->GetName(), tgrElem->GetSymbol(),
00095                          tgrElem->GetNumberOfIsotopes() );
00096 
00097     //----- add isotopes
00098     G4Isotope* compIsot;
00099     G4tgbMaterialMgr* mf = G4tgbMaterialMgr::GetInstance();
00100     for( G4int ii = 0; ii < tgrElem->GetNumberOfIsotopes(); ii++)
00101     {
00102       // Look if this component is a material
00103 
00104       compIsot = mf->FindOrBuildG4Isotope( tgrElem->GetComponent(ii) );
00105       if( compIsot != 0 )
00106       { 
00107         elem->AddIsotope( compIsot, tgrElem->GetAbundance(ii) );
00108       }
00109       else
00110       {
00111         G4String ErrMessage = "Component " + tgrElem->GetComponent(ii)
00112                             + " of element " + tgrElem->GetName()
00113                             + " is not an isotope !";
00114         G4Exception("G4tgbElement::BuildG4ElementFromIsotopes()",
00115                     "InvalidSetup", FatalException, ErrMessage );
00116       }
00117     } 
00118     theG4Elem = elem;
00119   }
00120   else
00121   {
00122     elem = theG4Elem; 
00123   }
00124 
00125 
00126 #ifdef G4VERBOSE
00127     if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00128     {
00129       G4cout << " Constructing  new G4Element from isotopes: "
00130              << *elem << G4endl;
00131     }
00132 #endif
00133 
00134   return elem;
00135 }

G4Element * G4tgbElement::BuildG4ElementSimple (  ) 

Definition at line 52 of file G4tgbElement.cc.

References G4cout, G4endl, G4tgrElementSimple::GetA(), G4tgrElement::GetName(), G4tgrElement::GetSymbol(), G4tgrMessenger::GetVerboseLevel(), and G4tgrElementSimple::GetZ().

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

00053 {
00054   G4Element* elem = 0;
00055 
00056   //-------- if G4Element not found, construct it 
00057   if( theG4Elem == 0 )
00058   { 
00059     //----- construct new G4Element 
00060     G4tgrElementSimple* tgrElem = static_cast<G4tgrElementSimple*>(theTgrElem);
00061 
00062     elem = new G4Element(tgrElem->GetName(), tgrElem->GetSymbol(),
00063                          tgrElem->GetZ(), tgrElem->GetA() );
00064 #ifdef G4VERBOSE
00065     if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00066     {
00067       G4cout << " Constructing new G4Element: " 
00068              << *elem << G4endl;
00069     }
00070 #endif
00071     theG4Elem = elem;
00072   }
00073   else
00074   {
00075     elem = theG4Elem; 
00076   }
00077 
00078   return elem;
00079 }

const G4String& G4tgbElement::GetName (  )  const [inline]

Definition at line 68 of file G4tgbElement.hh.

References G4tgrElement::GetName().

00069   {
00070     return theTgrElem->GetName();
00071   }

const G4String& G4tgbElement::GetType ( void   )  const [inline]

Definition at line 72 of file G4tgbElement.hh.

References G4tgrElement::GetType().

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

00073   {
00074     return theTgrElem->GetType();
00075   }


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