Geant4 11.4.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 (G4int length=99)
 ~G4ElementData ()
G4ElementDataoperator= (const G4ElementData &right)=delete
 G4ElementData (const G4ElementData &)=delete
void Reserve1D (std::size_t)
void Reserve2D (std::size_t)
void InitialiseForElement (G4int Z, G4PhysicsVector *v)
void InitialiseForElement (G4int Z, G4Physics2DVector *v)
void InitialiseForComponent (G4int Z, G4int nComponents=0)
void InitialiseFor2DComponent (G4int Z, G4int nComponents=0)
void AddComponent (G4int Z, G4int id, G4PhysicsVector *v)
void Add2DComponent (G4int Z, G4int id, G4Physics2DVector *v)
G4PhysicsVectorNew1DVector (G4int Z, G4int ne)
G4Physics2DVectorNew2DVector (G4int Z, G4int ny, G4int ne)
void SetName (const G4String &nam)
const G4StringGetName () const
G4PhysicsVectorGetElementData (G4int Z) const
G4Physics2DVectorGetElement2DData (G4int Z) const
G4PhysicsVectorGetComponentDataByID (G4int Z, G4int id) const
G4Physics2DVectorGet2DComponentDataByID (G4int Z, G4int id) const
G4double GetValueForElement (G4int Z, G4double kinEnergy) const
std::size_t GetNumberOfComponents (G4int Z) const
std::size_t GetNumberOf2DComponents (G4int Z) const
G4int GetComponentID (G4int Z, std::size_t idx) const
G4PhysicsVectorGetComponentDataByIndex (G4int Z, std::size_t idx) const
G4Physics2DVectorGet2DComponentDataByIndex (G4int Z, std::size_t idx) const
G4double GetValueForComponent (G4int Z, std::size_t idx, G4double kinEnergy) const

Detailed Description

Definition at line 58 of file G4ElementData.hh.

Constructor & Destructor Documentation

◆ G4ElementData() [1/2]

G4ElementData::G4ElementData ( G4int length = 99)
explicit

Definition at line 43 of file G4ElementData.cc.

44 : maxNumElm(length)
45{
46 elmData.resize((std::size_t)maxNumElm, nullptr);
48 fRegistry->RegisterMe(this);
49}
static G4ElementDataRegistry * Instance()

Referenced by G4ElementData(), and operator=().

◆ ~G4ElementData()

G4ElementData::~G4ElementData ( )

Definition at line 51 of file G4ElementData.cc.

52{
53 for (auto const & p : elmData) { delete p; }
54 elmData.clear();
55
56 for (auto const & p : elm2Data) {
57 delete p;
58 }
59 elm2Data.clear();
60
61 for (auto const & p : compData) {
62 if (nullptr != p ) {
63 for (auto const & q : *p) { delete q.second; }
64 delete p;
65 }
66 }
67 compData.clear();
68
69 for (auto const & p : comp2D) {
70 if (nullptr != p ) {
71 for (auto const & q : *p) { delete q.second; }
72 delete p;
73 }
74 }
75 comp2D.clear();
76 fRegistry->RemoveMe(this);
77}

◆ G4ElementData() [2/2]

G4ElementData::G4ElementData ( const G4ElementData & )
delete

Member Function Documentation

◆ Add2DComponent()

void G4ElementData::Add2DComponent ( G4int Z,
G4int id,
G4Physics2DVector * v )

Definition at line 159 of file G4ElementData.cc.

160{
161 if (Z < 0 || Z >= maxNumElm) {
162 DataError(Z, "Add2DComponent");
163 return;
164 }
165 if (comp2D.empty()) {
166 compData.resize((std::size_t)maxNumElm, nullptr);
167 }
168 if (nullptr == comp2D[Z]) {
169 comp2D[Z] = new std::vector<std::pair<G4int, G4Physics2DVector*> >;
170 }
171 comp2D[Z]->emplace_back(id, v);
172}

◆ AddComponent()

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

Definition at line 144 of file G4ElementData.cc.

145{
146 if (Z < 0 || Z >= maxNumElm) {
147 DataError(Z, "AddComponent");
148 return;
149 }
150 if (compData.empty()) {
151 compData.resize((std::size_t)maxNumElm, nullptr);
152 }
153 if (nullptr == compData[Z]) {
154 compData[Z] = new std::vector<std::pair<G4int, G4PhysicsVector*> >;
155 }
156 compData[Z]->emplace_back(id, v);
157}

◆ Get2DComponentDataByID()

G4Physics2DVector * G4ElementData::Get2DComponentDataByID ( G4int Z,
G4int id ) const
inline

Definition at line 205 of file G4ElementData.hh.

206{
207 G4Physics2DVector* v = nullptr;
208 for (auto const & p : *(comp2D[Z])) {
209 if (id == p.first) {
210 v = p.second;
211 break;
212 }
213 }
214 return v;
215}

◆ Get2DComponentDataByIndex()

G4Physics2DVector * G4ElementData::Get2DComponentDataByIndex ( G4int Z,
std::size_t idx ) const
inline

Definition at line 250 of file G4ElementData.hh.

251{
252 return
253 (idx < GetNumberOf2DComponents(Z)) ? (*(comp2D[Z]))[idx].second : nullptr;
254}
std::size_t GetNumberOf2DComponents(G4int Z) const

◆ GetComponentDataByID()

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

Definition at line 192 of file G4ElementData.hh.

193{
194 G4PhysicsVector* v = nullptr;
195 for (auto const & p : *(compData[Z])) {
196 if (id == p.first) {
197 v = p.second;
198 break;
199 }
200 }
201 return v;
202}

◆ GetComponentDataByIndex()

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

Definition at line 243 of file G4ElementData.hh.

244{
245 return
246 (idx < GetNumberOfComponents(Z)) ? (*(compData[Z]))[idx].second : nullptr;
247}
std::size_t GetNumberOfComponents(G4int Z) const

◆ GetComponentID()

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

Definition at line 237 of file G4ElementData.hh.

238{
239 return (idx < GetNumberOfComponents(Z)) ? (*(compData[Z]))[idx].first : 0;
240}

◆ GetElement2DData()

G4Physics2DVector * G4ElementData::GetElement2DData ( G4int Z) const
inline

Definition at line 186 of file G4ElementData.hh.

187{
188 return elm2Data[Z];
189}

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

◆ GetElementData()

G4PhysicsVector * G4ElementData::GetElementData ( G4int Z) const
inline

Definition at line 181 of file G4ElementData.hh.

182{
183 return elmData[Z];
184}

Referenced by G4MuPairProduction::StreamProcessInfo().

◆ GetName()

const G4String & G4ElementData::GetName ( ) const
inline

Definition at line 176 of file G4ElementData.hh.

177{
178 return name;
179}

◆ GetNumberOf2DComponents()

std::size_t G4ElementData::GetNumberOf2DComponents ( G4int Z) const
inline

Definition at line 232 of file G4ElementData.hh.

233{
234 return (nullptr != comp2D[Z]) ? comp2D[Z]->size() : 0;
235}

Referenced by Get2DComponentDataByIndex().

◆ GetNumberOfComponents()

std::size_t G4ElementData::GetNumberOfComponents ( G4int Z) const
inline

Definition at line 227 of file G4ElementData.hh.

228{
229 return (nullptr != compData[Z]) ? compData[Z]->size() : 0;
230}

Referenced by GetComponentDataByIndex(), GetComponentID(), and GetValueForComponent().

◆ GetValueForComponent()

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

Definition at line 257 of file G4ElementData.hh.

258{
259 return (idx < GetNumberOfComponents(Z)) ?
260 (*(compData[Z]))[idx].second->Value(e) : 0.0;
261}

◆ GetValueForElement()

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

Definition at line 218 of file G4ElementData.hh.

219{
220 return elmData[Z]->Value(kinEnergy);
221}

◆ InitialiseFor2DComponent()

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

Definition at line 130 of file G4ElementData.cc.

131{
132 if (Z < 0 || Z >= maxNumElm) {
133 DataError(Z, "InitialiseFor2DComponent");
134 return;
135 }
136 if (comp2D.empty()) {
137 comp2D.resize((std::size_t)maxNumElm, nullptr);
138 }
139 delete comp2D[Z];
140 comp2D[Z] = new std::vector<std::pair<G4int, G4Physics2DVector*> >;
141 if (0 < nComponents) { comp2D[Z]->reserve((std::size_t)nComponents); }
142}

◆ InitialiseForComponent()

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

Definition at line 116 of file G4ElementData.cc.

117{
118 if (Z < 0 || Z >= maxNumElm) {
119 DataError(Z, "InitialiseForComponent");
120 return;
121 }
122 if (compData.empty()) {
123 compData.resize((std::size_t)maxNumElm, nullptr);
124 }
125 delete compData[Z];
126 compData[Z] = new std::vector<std::pair<G4int, G4PhysicsVector*> >;
127 if (0 < nComponents) { compData[Z]->reserve((std::size_t)nComponents); }
128}

◆ InitialiseForElement() [1/2]

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

Definition at line 103 of file G4ElementData.cc.

104{
105 if (Z < 0 || Z >= maxNumElm) {
106 DataError(Z, "InitialiseFor2DElement");
107 return;
108 }
109 if (elm2Data.empty()) {
110 elm2Data.resize((std::size_t)maxNumElm, nullptr);
111 }
112 delete elm2Data[Z];
113 elm2Data[Z] = v;
114}

◆ InitialiseForElement() [2/2]

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

Definition at line 93 of file G4ElementData.cc.

94{
95 if (Z < 0 || Z >= maxNumElm) {
96 DataError(Z, "InitialiseForElement");
97 return;
98 }
99 delete elmData[Z];
100 elmData[Z] = v;
101}

Referenced by New1DVector(), and New2DVector().

◆ New1DVector()

G4PhysicsVector * G4ElementData::New1DVector ( G4int Z,
G4int ne )

Definition at line 174 of file G4ElementData.cc.

175{
176 auto ptr = new G4PhysicsFreeVector(ne);
177 InitialiseForElement(iz, ptr);
178 return ptr;
179}
void InitialiseForElement(G4int Z, G4PhysicsVector *v)

◆ New2DVector()

G4Physics2DVector * G4ElementData::New2DVector ( G4int Z,
G4int ny,
G4int ne )

Definition at line 181 of file G4ElementData.cc.

182{
183 auto ptr = new G4Physics2DVector(ny, ne);
184 InitialiseForElement(iz, ptr);
185 return ptr;
186}

◆ operator=()

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

◆ Reserve1D()

void G4ElementData::Reserve1D ( std::size_t n)

Definition at line 79 of file G4ElementData.cc.

80{
81 if (!elmData.empty()) { return; }
82 elmData.reserve(n);
83 compData.reserve(n);
84}

◆ Reserve2D()

void G4ElementData::Reserve2D ( std::size_t n)

Definition at line 86 of file G4ElementData.cc.

87{
88 if (!elm2Data.empty()) { return; }
89 elm2Data.reserve(n);
90 comp2D.reserve(n);
91}

◆ SetName()

void G4ElementData::SetName ( const G4String & nam)
inline

Definition at line 171 of file G4ElementData.hh.

172{
173 name = nam;
174}

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