Geant4  10.02.p03
G4ElementData Class Reference

#include <G4ElementData.hh>

Collaboration diagram for G4ElementData:

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)
 

Private Member Functions

G4ElementDataoperator= (const G4ElementData &right)
 
 G4ElementData (const G4ElementData &)
 

Private Attributes

G4PhysicsVectorelmData [maxNumElements]
 
G4Physics2DVectorelm2Data [maxNumElements]
 
std::vector< G4PhysicsVector * > compData [maxNumElements]
 
std::vector< G4intcompID [maxNumElements]
 
size_t compLength [maxNumElements]
 
G4String name
 

Detailed Description

Definition at line 56 of file G4ElementData.hh.

Constructor & Destructor Documentation

◆ G4ElementData() [1/2]

G4ElementData::G4ElementData ( )

Definition at line 48 of file G4ElementData.cc.

49 {
50  name = "";
51  for(G4int i=0; i<maxNumElements; ++i) {
52  elmData[i] = 0;
53  elm2Data[i] = 0;
54  compLength[i] = 0;
55  }
56 }
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
size_t compLength[maxNumElements]
G4PhysicsVector * elmData[maxNumElements]
G4Physics2DVector * elm2Data[maxNumElements]

◆ ~G4ElementData()

G4ElementData::~G4ElementData ( )

Definition at line 60 of file G4ElementData.cc.

61 {
62  for(G4int i=0; i<maxNumElements; ++i) {
63  delete elmData[i];
64  delete elm2Data[i];
65  size_t n = compLength[i];
66  //G4cout << "Z= " << i << " L= " << n << G4endl;
67  if(n > 0) {
68  for(size_t j=0; j<n; ++j) {
69  //G4cout << "j= " << j << " " << (compData[i])[j] << G4endl;
70  delete (compData[i])[j];
71  }
72  }
73  }
74 }
std::vector< G4PhysicsVector * > compData[maxNumElements]
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
Char_t n[5]
size_t compLength[maxNumElements]
G4PhysicsVector * elmData[maxNumElements]
G4Physics2DVector * elm2Data[maxNumElements]

◆ G4ElementData() [2/2]

G4ElementData::G4ElementData ( const G4ElementData )
private

Member Function Documentation

◆ AddComponent()

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

Definition at line 124 of file G4ElementData.cc.

125 {
126  if(Z < 1 || Z >= maxNumElements) {
127  G4cout << "G4ElementData::AddComponent ERROR for " << name
128  << " Z = " << Z << " is out of range!" << G4endl;
129  G4Exception("G4ElementData::AddComponent()", "mat603",
130  FatalException, "Wrong data handling");
131  return;
132  }
133  (compData[Z]).push_back(v);
134  (compID[Z]).push_back(id);
135  ++compLength[Z];
136 }
std::vector< G4PhysicsVector * > compData[maxNumElements]
const G4int maxNumElements
G4GLOB_DLL std::ostream G4cout
size_t compLength[maxNumElements]
Float_t Z
std::vector< G4int > compID[maxNumElements]
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetComponentDataByID()

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

Definition at line 155 of file G4ElementData.hh.

156 {
157  G4PhysicsVector* v = 0;
158  for(size_t i=0; i<compLength[Z]; ++i) {
159  if(id == (compID[Z])[i]) {
160  v = (compData[Z])[i];
161  break;
162  }
163  }
164  return v;
165 }
std::vector< G4PhysicsVector * > compData[maxNumElements]
size_t compLength[maxNumElements]
Float_t Z
std::vector< G4int > compID[maxNumElements]
Here is the caller graph for this function:

◆ GetComponentDataByIndex()

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

Definition at line 149 of file G4ElementData.hh.

150 {
151  return (compData[Z])[idx];
152 }
std::vector< G4PhysicsVector * > compData[maxNumElements]
Float_t Z
Here is the caller graph for this function:

◆ GetComponentID()

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

Definition at line 143 of file G4ElementData.hh.

144 {
145  return (compID[Z])[idx];
146 }
Float_t Z
std::vector< G4int > compID[maxNumElements]
Here is the caller graph for this function:

◆ GetElement2DData()

G4Physics2DVector * G4ElementData::GetElement2DData ( G4int  Z)
inline

Definition at line 132 of file G4ElementData.hh.

133 {
134  return elm2Data[Z];
135 }
Float_t Z
G4Physics2DVector * elm2Data[maxNumElements]
Here is the caller graph for this function:

◆ GetElementData()

G4PhysicsVector * G4ElementData::GetElementData ( G4int  Z)
inline

Definition at line 126 of file G4ElementData.hh.

127 {
128  return elmData[Z];
129 }
Float_t Z
G4PhysicsVector * elmData[maxNumElements]
Here is the caller graph for this function:

◆ GetNumberOfComponents()

size_t G4ElementData::GetNumberOfComponents ( G4int  Z)
inline

Definition at line 138 of file G4ElementData.hh.

139 {
140  return compLength[Z];
141 }
size_t compLength[maxNumElements]
Float_t Z

◆ GetValueForComponent()

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

Definition at line 174 of file G4ElementData.hh.

175 {
176  return ((compData[Z])[idx])->Value(kinEnergy);
177 }
std::vector< G4PhysicsVector * > compData[maxNumElements]
Float_t Z
Here is the caller graph for this function:

◆ GetValueForElement()

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

Definition at line 168 of file G4ElementData.hh.

169 {
170  return elmData[Z]->Value(kinEnergy);
171 }
Float_t Z
G4PhysicsVector * elmData[maxNumElements]
G4double Value(G4double theEnergy, size_t &lastidx) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitialiseForComponent()

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

Definition at line 102 of file G4ElementData.cc.

103 {
104  if(Z < 1 || Z >= maxNumElements) {
105  G4cout << "G4ElementData::InitialiseForComponent ERROR for " << name
106  << " Z = " << Z << " is out of range!" << G4endl;
107  G4Exception("G4ElementData::InitialiseForComponent()", "mat602",
108  FatalException, "Wrong data handling");
109  return;
110  }
111 
112  // reserve a new structure
113  size_t n = compLength[Z];
114  if(0 < n) {
115  for(size_t i=0; i<n; ++i) { delete (compData[Z])[i]; }
116  (compData[Z]).clear();
117  (compID[Z]).clear();
118  }
119  (compData[Z]).reserve(nComponents);
120  (compID[Z]).reserve(nComponents);
121 }
std::vector< G4PhysicsVector * > compData[maxNumElements]
G4int nComponents
Definition: TRTMaterials.hh:41
const G4int maxNumElements
Char_t n[5]
G4GLOB_DLL std::ostream G4cout
size_t compLength[maxNumElements]
Float_t Z
std::vector< G4int > compID[maxNumElements]
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
vec_iX clear()
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitialiseForElement() [1/2]

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

Definition at line 76 of file G4ElementData.cc.

77 {
78  if(Z < 1 || Z >= maxNumElements) {
79  G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
80  << " Z = " << Z << " is out of range!" << G4endl;
81  G4Exception("G4ElementData::InitialiseForElement()", "mat601",
82  FatalException, "Wrong data handling");
83  return;
84  }
85  if(elmData[Z]) { delete elmData[Z]; }
86  elmData[Z] = v;
87 }
const G4int maxNumElements
G4GLOB_DLL std::ostream G4cout
Float_t Z
G4PhysicsVector * elmData[maxNumElements]
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitialiseForElement() [2/2]

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

Definition at line 89 of file G4ElementData.cc.

90 {
91  if(Z < 1 || Z >= maxNumElements) {
92  G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
93  << " Z = " << Z << " is out of range!" << G4endl;
94  G4Exception("G4ElementData::InitialiseForElement()", "mat601",
95  FatalException, "Wrong data handling");
96  return;
97  }
98  if(elm2Data[Z]) { delete elm2Data[Z]; }
99  elm2Data[Z] = v;
100 }
const G4int maxNumElements
G4GLOB_DLL std::ostream G4cout
Float_t Z
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4Physics2DVector * elm2Data[maxNumElements]
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ operator=()

G4ElementData& G4ElementData::operator= ( const G4ElementData right)
private

◆ SetName()

void G4ElementData::SetName ( const G4String nam)
inline

Definition at line 120 of file G4ElementData.hh.

121 {
122  name = nam;
123 }
Here is the caller graph for this function:

Member Data Documentation

◆ compData

std::vector<G4PhysicsVector*> G4ElementData::compData[maxNumElements]
private

Definition at line 114 of file G4ElementData.hh.

◆ compID

std::vector<G4int> G4ElementData::compID[maxNumElements]
private

Definition at line 115 of file G4ElementData.hh.

◆ compLength

size_t G4ElementData::compLength[maxNumElements]
private

Definition at line 116 of file G4ElementData.hh.

◆ elm2Data

G4Physics2DVector* G4ElementData::elm2Data[maxNumElements]
private

Definition at line 113 of file G4ElementData.hh.

◆ elmData

G4PhysicsVector* G4ElementData::elmData[maxNumElements]
private

Definition at line 112 of file G4ElementData.hh.

◆ name

G4String G4ElementData::name
private

Definition at line 117 of file G4ElementData.hh.


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