Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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.

58 {}
G4tgbElement::~G4tgbElement ( )
inline

Definition at line 59 of file G4tgbElement.hh.

59 {}
G4tgbElement::G4tgbElement ( G4tgrElement hg)

Definition at line 44 of file G4tgbElement.cc.

45 {
46  theTgrElem = hg;
47  theG4Elem = 0;
48 }

Member Function Documentation

G4Element * G4tgbElement::BuildG4ElementFromIsotopes ( )

Definition at line 83 of file G4tgbElement.cc.

References G4Element::AddIsotope(), 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().

84 {
85  G4Element* elem = 0;
86 
87  //-------- if G4Element not found, construct it
88  if( theG4Elem == 0 )
89  {
90  //----- construct new G4Element
92  = static_cast<G4tgrElementFromIsotopes*>(theTgrElem);
93 
94  elem = new G4Element(tgrElem->GetName(), tgrElem->GetSymbol(),
95  tgrElem->GetNumberOfIsotopes() );
96 
97  //----- add isotopes
98  G4Isotope* compIsot;
100  for( G4int ii = 0; ii < tgrElem->GetNumberOfIsotopes(); ii++)
101  {
102  // Look if this component is a material
103 
104  compIsot = mf->FindOrBuildG4Isotope( tgrElem->GetComponent(ii) );
105  if( compIsot != 0 )
106  {
107  elem->AddIsotope( compIsot, tgrElem->GetAbundance(ii) );
108  }
109  else
110  {
111  G4String ErrMessage = "Component " + tgrElem->GetComponent(ii)
112  + " of element " + tgrElem->GetName()
113  + " is not an isotope !";
114  G4Exception("G4tgbElement::BuildG4ElementFromIsotopes()",
115  "InvalidSetup", FatalException, ErrMessage );
116  }
117  }
118  theG4Elem = elem;
119  }
120  else
121  {
122  elem = theG4Elem;
123  }
124 
125 
126 #ifdef G4VERBOSE
128  {
129  G4cout << " Constructing new G4Element from isotopes: "
130  << *elem << G4endl;
131  }
132 #endif
133 
134  return elem;
135 }
G4Isotope * FindOrBuildG4Isotope(const G4String &name)
const G4String & GetSymbol() const
Definition: G4tgrElement.hh:53
const G4String & GetComponent(G4int n) const
int G4int
Definition: G4Types.hh:78
G4double GetAbundance(G4int n) const
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:151
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4tgrElement.hh:52
static G4tgbMaterialMgr * GetInstance()
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().

53 {
54  G4Element* elem = 0;
55 
56  //-------- if G4Element not found, construct it
57  if( theG4Elem == 0 )
58  {
59  //----- construct new G4Element
60  G4tgrElementSimple* tgrElem = static_cast<G4tgrElementSimple*>(theTgrElem);
61 
62  elem = new G4Element(tgrElem->GetName(), tgrElem->GetSymbol(),
63  tgrElem->GetZ(), tgrElem->GetA() );
64 #ifdef G4VERBOSE
66  {
67  G4cout << " Constructing new G4Element: "
68  << *elem << G4endl;
69  }
70 #endif
71  theG4Elem = elem;
72  }
73  else
74  {
75  elem = theG4Elem;
76  }
77 
78  return elem;
79 }
const G4String & GetSymbol() const
Definition: G4tgrElement.hh:53
G4double GetZ() const
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
G4double GetA() const
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4tgrElement.hh:52
const G4String& G4tgbElement::GetName ( void  ) const
inline

Definition at line 68 of file G4tgbElement.hh.

References G4tgrElement::GetName().

Referenced by G4tgbMaterialMgr::CopyElements().

69  {
70  return theTgrElem->GetName();
71  }
const G4String & GetName() const
Definition: G4tgrElement.hh:52
const G4String& G4tgbElement::GetType ( ) const
inline

Definition at line 72 of file G4tgbElement.hh.

References G4tgrElement::GetType().

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

73  {
74  return theTgrElem->GetType();
75  }
const G4String & GetType() const
Definition: G4tgrElement.hh:54

The documentation for this class was generated from the following files: