Geant4-11
Public Member Functions | Private Attributes
G4tgbElement Class Reference

#include <G4tgbElement.hh>

Public Member Functions

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

Private Attributes

G4ElementtheG4Elem = nullptr
 
G4tgrElementtheTgrElem = nullptr
 

Detailed Description

Definition at line 44 of file G4tgbElement.hh.

Constructor & Destructor Documentation

◆ G4tgbElement() [1/2]

G4tgbElement::G4tgbElement ( )
inline

Definition at line 48 of file G4tgbElement.hh.

48{}

◆ ~G4tgbElement()

G4tgbElement::~G4tgbElement ( )
inline

Definition at line 49 of file G4tgbElement.hh.

49{}

◆ G4tgbElement() [2/2]

G4tgbElement::G4tgbElement ( G4tgrElement hg)

Definition at line 38 of file G4tgbElement.cc.

39{
40 theTgrElem = hg;
41}
G4tgrElement * theTgrElem
Definition: G4tgbElement.hh:63

References theTgrElem.

Member Function Documentation

◆ BuildG4ElementFromIsotopes()

G4Element * G4tgbElement::BuildG4ElementFromIsotopes ( )

Definition at line 73 of file G4tgbElement.cc.

74{
75 G4Element* elem = nullptr;
76
77 //-------- if G4Element not found, construct it
78 if(theG4Elem == nullptr)
79 {
80 //----- construct new G4Element
83
84 elem = new G4Element(tgrElem->GetName(), tgrElem->GetSymbol(),
85 tgrElem->GetNumberOfIsotopes());
86
87 //----- add isotopes
88 G4Isotope* compIsot;
90 for(G4int ii = 0; ii < tgrElem->GetNumberOfIsotopes(); ++ii)
91 {
92 // Look if this component is a material
93
94 compIsot = mf->FindOrBuildG4Isotope(tgrElem->GetComponent(ii));
95 if(compIsot != nullptr)
96 {
97 elem->AddIsotope(compIsot, tgrElem->GetAbundance(ii));
98 }
99 else
100 {
101 G4String ErrMessage = "Component " + tgrElem->GetComponent(ii) +
102 " of element " + tgrElem->GetName() +
103 " is not an isotope !";
104 G4Exception("G4tgbElement::BuildG4ElementFromIsotopes()",
105 "InvalidSetup", FatalException, ErrMessage);
106 }
107 }
108 theG4Elem = elem;
109 }
110 else
111 {
112 elem = theG4Elem;
113 }
114
115#ifdef G4VERBOSE
117 {
118 G4cout << " Constructing new G4Element from isotopes: " << *elem << G4endl;
119 }
120#endif
121
122 return elem;
123}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define elem(i, j)
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4Element * theG4Elem
Definition: G4tgbElement.hh:64
G4Isotope * FindOrBuildG4Isotope(const G4String &name)
static G4tgbMaterialMgr * GetInstance()
G4double GetAbundance(G4int n) const
const G4String & GetComponent(G4int n) const
const G4String & GetSymbol() const
Definition: G4tgrElement.hh:47
const G4String & GetName() const
Definition: G4tgrElement.hh:46
static G4int GetVerboseLevel()

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

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

◆ BuildG4ElementSimple()

G4Element * G4tgbElement::BuildG4ElementSimple ( )

Definition at line 44 of file G4tgbElement.cc.

45{
46 G4Element* elem = nullptr;
47
48 //-------- if G4Element not found, construct it
49 if(theG4Elem == nullptr)
50 {
51 //----- construct new G4Element
52 G4tgrElementSimple* tgrElem = static_cast<G4tgrElementSimple*>(theTgrElem);
53
54 elem = new G4Element(tgrElem->GetName(), tgrElem->GetSymbol(),
55 tgrElem->GetZ(), tgrElem->GetA());
56#ifdef G4VERBOSE
58 {
59 G4cout << " Constructing new G4Element: " << *elem << G4endl;
60 }
61#endif
63 }
64 else
65 {
67 }
68
69 return elem;
70}
G4double GetZ() const
G4double GetA() const

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

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

◆ GetName()

const G4String & G4tgbElement::GetName ( ) const
inline

Definition at line 58 of file G4tgbElement.hh.

58{ return theTgrElem->GetName(); }

References G4tgrElement::GetName(), and theTgrElem.

Referenced by G4tgbMaterialMgr::CopyElements().

◆ GetType()

const G4String & G4tgbElement::GetType ( ) const
inline

Definition at line 59 of file G4tgbElement.hh.

59{ return theTgrElem->GetType(); }
const G4String & GetType() const
Definition: G4tgrElement.hh:48

References G4tgrElement::GetType(), and theTgrElem.

Referenced by G4tgbMaterialMgr::FindOrBuildG4Element().

Field Documentation

◆ theG4Elem

G4Element* G4tgbElement::theG4Elem = nullptr
private

Definition at line 64 of file G4tgbElement.hh.

Referenced by BuildG4ElementFromIsotopes(), and BuildG4ElementSimple().

◆ theTgrElem

G4tgrElement* G4tgbElement::theTgrElem = nullptr
private

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