Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ElementData Class Reference

#include <G4ElementData.hh>

Public Member Functions

 G4ElementData ()
 
 ~G4ElementData ()
 
void InitialiseForElement (G4int Z, G4PhysicsVector *v)
 
void InitialiseForElement (G4int Z, G4Physics2DVector *v)
 
void InitialiseForComponent (G4int Z, G4int nComponents=0)
 
void AddComponent (G4int Z, G4int id, G4PhysicsVector *v)
 
void SetName (const G4String &nam)
 
G4PhysicsVectorGetElementData (G4int Z)
 
G4Physics2DVectorGetElement2DData (G4int Z)
 
size_t GetNumberOfComponents (G4int Z)
 
G4int GetComponentID (G4int Z, size_t idx)
 
G4PhysicsVectorGetComponentDataByIndex (G4int Z, size_t idx)
 
G4PhysicsVectorGetComponentDataByID (G4int Z, G4int id)
 
G4double GetValueForElement (G4int Z, G4double kinEnergy)
 
G4double GetValueForComponent (G4int Z, size_t idx, G4double kinEnergy)
 

Detailed Description

Definition at line 55 of file G4ElementData.hh.

Constructor & Destructor Documentation

◆ G4ElementData()

G4ElementData::G4ElementData ( )
explicit

Definition at line 47 of file G4ElementData.cc.

48{
49 name = "";
50 for(G4int i=0; i<maxNumElements; ++i) {
51 elmData[i] = nullptr;
52 elm2Data[i] = nullptr;
53 compLength[i] = 0;
54 }
55}
const G4int maxNumElements
int G4int
Definition: G4Types.hh:85

◆ ~G4ElementData()

G4ElementData::~G4ElementData ( )

Definition at line 59 of file G4ElementData.cc.

60{
61 for(G4int i=0; i<maxNumElements; ++i) {
62 delete elmData[i];
63 delete elm2Data[i];
64 size_t n = compLength[i];
65 //G4cout << "Z= " << i << " L= " << n << G4endl;
66 for(size_t j=0; j<n; ++j) {
67 //G4cout << "j= " << j << " " << (compData[i])[j] << G4endl;
68 delete (compData[i])[j];
69 }
70 }
71}

Member Function Documentation

◆ AddComponent()

void G4ElementData::AddComponent ( G4int  Z,
G4int  id,
G4PhysicsVector v 
)

Definition at line 121 of file G4ElementData.cc.

122{
123 if(Z < 1 || Z >= maxNumElements) {
124 G4cout << "G4ElementData::AddComponent ERROR for " << name
125 << " Z = " << Z << " is out of range!" << G4endl;
126 G4Exception("G4ElementData::AddComponent()", "mat603",
127 FatalException, "Wrong data handling");
128 return;
129 }
130 (compData[Z]).push_back(v);
131 (compID[Z]).push_back(id);
132 ++compLength[Z];
133}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

◆ GetComponentDataByID()

G4PhysicsVector * G4ElementData::GetComponentDataByID ( G4int  Z,
G4int  id 
)
inline

Definition at line 154 of file G4ElementData.hh.

155{
156 G4PhysicsVector* v = 0;
157 for(size_t i=0; i<compLength[Z]; ++i) {
158 if(id == (compID[Z])[i]) {
159 v = (compData[Z])[i];
160 break;
161 }
162 }
163 return v;
164}

Referenced by G4NeutronCaptureXS::IsoCrossSection().

◆ GetComponentDataByIndex()

G4PhysicsVector * G4ElementData::GetComponentDataByIndex ( G4int  Z,
size_t  idx 
)
inline

◆ GetComponentID()

G4int G4ElementData::GetComponentID ( G4int  Z,
size_t  idx 
)
inline

◆ GetElement2DData()

G4Physics2DVector * G4ElementData::GetElement2DData ( G4int  Z)
inline

Definition at line 131 of file G4ElementData.hh.

132{
133 return elm2Data[Z];
134}

Referenced by G4ePairProduction::StreamProcessInfo(), and G4MuPairProduction::StreamProcessInfo().

◆ GetElementData()

G4PhysicsVector * G4ElementData::GetElementData ( G4int  Z)
inline

Definition at line 125 of file G4ElementData.hh.

126{
127 return elmData[Z];
128}

Referenced by G4NeutronCaptureXS::BuildPhysicsTable(), and G4NeutronInelasticXS::BuildPhysicsTable().

◆ GetNumberOfComponents()

size_t G4ElementData::GetNumberOfComponents ( G4int  Z)
inline

Definition at line 137 of file G4ElementData.hh.

138{
139 return compLength[Z];
140}

◆ GetValueForComponent()

G4double G4ElementData::GetValueForComponent ( G4int  Z,
size_t  idx,
G4double  kinEnergy 
)
inline

◆ GetValueForElement()

G4double G4ElementData::GetValueForElement ( G4int  Z,
G4double  kinEnergy 
)
inline

Definition at line 167 of file G4ElementData.hh.

168{
169 return elmData[Z]->Value(kinEnergy);
170}
G4double Value(G4double theEnergy, std::size_t &lastidx) const

◆ InitialiseForComponent()

void G4ElementData::InitialiseForComponent ( G4int  Z,
G4int  nComponents = 0 
)

Definition at line 99 of file G4ElementData.cc.

100{
101 if(Z < 1 || Z >= maxNumElements) {
102 G4cout << "G4ElementData::InitialiseForComponent ERROR for " << name
103 << " Z = " << Z << " is out of range!" << G4endl;
104 G4Exception("G4ElementData::InitialiseForComponent()", "mat602",
105 FatalException, "Wrong data handling");
106 return;
107 }
108
109 // reserve a new structure
110 size_t n = compLength[Z];
111 if(0 < n) {
112 for(size_t i=0; i<n; ++i) { delete (compData[Z])[i]; }
113 (compData[Z]).clear();
114 (compID[Z]).clear();
115 }
116 (compData[Z]).reserve(nComponents);
117 (compID[Z]).reserve(nComponents);
118}

◆ InitialiseForElement() [1/2]

void G4ElementData::InitialiseForElement ( G4int  Z,
G4Physics2DVector v 
)

Definition at line 86 of file G4ElementData.cc.

87{
88 if(Z < 1 || Z >= maxNumElements) {
89 G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
90 << " Z = " << Z << " is out of range!" << G4endl;
91 G4Exception("G4ElementData::InitialiseForElement()", "mat601",
92 FatalException, "Wrong data handling");
93 return;
94 }
95 if(elm2Data[Z]) { delete elm2Data[Z]; }
96 elm2Data[Z] = v;
97}

◆ InitialiseForElement() [2/2]

void G4ElementData::InitialiseForElement ( G4int  Z,
G4PhysicsVector v 
)

Definition at line 73 of file G4ElementData.cc.

74{
75 if(Z < 1 || Z >= maxNumElements) {
76 G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
77 << " Z = " << Z << " is out of range!" << G4endl;
78 G4Exception("G4ElementData::InitialiseForElement()", "mat601",
79 FatalException, "Wrong data handling");
80 return;
81 }
82 if(elmData[Z]) { delete elmData[Z]; }
83 elmData[Z] = v;
84}

◆ SetName()

void G4ElementData::SetName ( const G4String nam)
inline

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