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

#include <G4EmDataHandler.hh>

Public Member Functions

 G4EmDataHandler (std::size_t nTable, const G4String &nam="")
 ~G4EmDataHandler ()
void UpdateTable (G4PhysicsTable *, std::size_t idx)
G4PhysicsTableMakeTable (std::size_t idx)
G4PhysicsTableMakeTable (G4PhysicsTable *, std::size_t idx)
void CleanTable (std::size_t idx)
G4bool StorePhysicsTable (std::size_t idx, const G4ParticleDefinition *part, const G4String &fname, G4bool ascii)
G4bool RetrievePhysicsTable (std::size_t idx, const G4ParticleDefinition *part, const G4String &fname, G4bool ascii, G4bool spline)
void SetMasterProcess (const G4VEmProcess *)
const G4VEmProcessGetMasterProcess (size_t idx) const
const G4PhysicsTableGetTable (std::size_t idx) const
G4PhysicsTableTable (std::size_t idx) const
const G4PhysicsVectorGetVector (std::size_t itable, std::size_t ivec) const
const std::vector< G4PhysicsTable * > & GetTables () const
std::vector< G4double > * EnergyOfCrossSectionMax () const
void SetEnergyOfCrossSectionMax (std::vector< G4double > *p)
std::vector< G4TwoPeaksXS * > * TwoPeaksXS () const
void SetTwoPeaksXS (std::vector< G4TwoPeaksXS * > *p)
std::vector< G4EmElementSelector * > * GetElementSelectors (std::size_t i)
void SetElementSelectors (std::vector< G4EmElementSelector * > *, std::size_t)
G4CrossSectionType CrossSectionType () const
void SetCrossSectionType (G4CrossSectionType val)
const G4StringGetName () const
void SetUseBaseParticleTable (G4bool val)
G4EmDataHandleroperator= (const G4EmDataHandler &right)=delete
 G4EmDataHandler (const G4EmDataHandler &)=delete

Detailed Description

Definition at line 66 of file G4EmDataHandler.hh.

Constructor & Destructor Documentation

◆ G4EmDataHandler() [1/2]

G4EmDataHandler::G4EmDataHandler ( std::size_t nTable,
const G4String & nam = "" )
explicit

Definition at line 51 of file G4EmDataHandler.cc.

52 : tLength(n), fName(nam)
53{
54 data.resize(n, nullptr);
55 fMaxXS = new std::vector<G4double>;
56 fXSpeaks = new std::vector<G4TwoPeaksXS*>;
57 fRegistry = G4EmDataRegistry::Instance();
58 fRegistry->Register(this);
59}
static G4EmDataRegistry * Instance()

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

◆ ~G4EmDataHandler()

G4EmDataHandler::~G4EmDataHandler ( )

Definition at line 63 of file G4EmDataHandler.cc.

64{
65 if (!fUseBaseParticleTable && 0 < tLength) {
66 for (std::size_t i=0; i<tLength; ++i) {
67 CleanTable(i);
68 }
69 data.clear();
70 tLength = 0;
71 delete fMaxXS;
72 fMaxXS = nullptr;
73 delete fXSpeaks;
74 fXSpeaks = nullptr;
75 }
76 if (!fElemSelectors.empty()) {
77 for (auto const & ptr : fElemSelectors) {
78 if (nullptr != ptr) {
79 for (auto const & p : *ptr) { delete p; }
80 ptr->clear();
81 delete ptr;
82 }
83 }
84 fElemSelectors.clear();
85 }
86 fRegistry->DeRegister(this);
87}
void CleanTable(std::size_t idx)

◆ G4EmDataHandler() [2/2]

G4EmDataHandler::G4EmDataHandler ( const G4EmDataHandler & )
delete

Member Function Documentation

◆ CleanTable()

void G4EmDataHandler::CleanTable ( std::size_t idx)

Definition at line 133 of file G4EmDataHandler.cc.

134{
135 if (i < tLength && nullptr != data[i]) {
136 auto ptr = data[i];
137 ptr->clearAndDestroy();
138 for (std::size_t j=0; j<tLength; ++j) {
139 if (ptr == data[j]) { data[j] = nullptr; }
140 }
141 delete ptr;
142 }
143}

Referenced by ~G4EmDataHandler().

◆ CrossSectionType()

G4CrossSectionType G4EmDataHandler::CrossSectionType ( ) const
inline

Definition at line 144 of file G4EmDataHandler.hh.

144 {
145 return fXSType;
146 }

◆ EnergyOfCrossSectionMax()

std::vector< G4double > * G4EmDataHandler::EnergyOfCrossSectionMax ( ) const
inline

Definition at line 116 of file G4EmDataHandler.hh.

116 {
117 return fMaxXS;
118 }

◆ GetElementSelectors()

std::vector< G4EmElementSelector * > * G4EmDataHandler::GetElementSelectors ( std::size_t i)
inline

Definition at line 138 of file G4EmDataHandler.hh.

138 {
139 return (i < eLength) ? fElemSelectors[i] : nullptr;
140 }

◆ GetMasterProcess()

const G4VEmProcess * G4EmDataHandler::GetMasterProcess ( size_t idx) const

Definition at line 203 of file G4EmDataHandler.cc.

204{
205 return (idx < masterProcess.size()) ? masterProcess[idx] : nullptr;
206}

◆ GetName()

const G4String & G4EmDataHandler::GetName ( ) const
inline

Definition at line 152 of file G4EmDataHandler.hh.

152 {
153 return fName;
154 }

◆ GetTable()

const G4PhysicsTable * G4EmDataHandler::GetTable ( std::size_t idx) const
inline

Definition at line 100 of file G4EmDataHandler.hh.

100 {
101 return (idx < tLength) ? data[idx] : nullptr;
102 }

◆ GetTables()

const std::vector< G4PhysicsTable * > & G4EmDataHandler::GetTables ( ) const
inline

Definition at line 112 of file G4EmDataHandler.hh.

112 {
113 return data;
114 }

◆ GetVector()

const G4PhysicsVector * G4EmDataHandler::GetVector ( std::size_t itable,
std::size_t ivec ) const
inline

Definition at line 108 of file G4EmDataHandler.hh.

108 {
109 return (*(data[itable]))[ivec];
110 }

◆ MakeTable() [1/2]

G4PhysicsTable * G4EmDataHandler::MakeTable ( G4PhysicsTable * ptr,
std::size_t idx )

Definition at line 118 of file G4EmDataHandler.cc.

119{
120 if (idx >= tLength) {
121 for (std::size_t j=tLength; j<=idx; ++j) {
122 data.push_back(nullptr);
123 }
124 tLength = idx + 1;
125 }
127
128 return data[idx];
129}
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)

◆ MakeTable() [2/2]

G4PhysicsTable * G4EmDataHandler::MakeTable ( std::size_t idx)

Definition at line 104 of file G4EmDataHandler.cc.

105{
106 if (idx >= tLength) {
107 for (std::size_t j=tLength; j<=idx; ++j) {
108 data.push_back(nullptr);
109 }
110 tLength = idx + 1;
111 }
112 data[idx] = G4PhysicsTableHelper::PreparePhysicsTable(data[idx]);
113 return data[idx];
114}

◆ operator=()

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

◆ RetrievePhysicsTable()

G4bool G4EmDataHandler::RetrievePhysicsTable ( std::size_t idx,
const G4ParticleDefinition * part,
const G4String & fname,
G4bool ascii,
G4bool spline )

Definition at line 171 of file G4EmDataHandler.cc.

175{
176 G4PhysicsTable* table = Table(idx);
177 G4bool yes = G4PhysicsTableHelper::RetrievePhysicsTable(table, fname, ascii, spline);
178 G4EmParameters* param = G4EmParameters::Instance();
179 if ( yes ) {
180 if (0 < param->Verbose()) {
181 G4cout << "### Physics table " << idx << " for "
182 << part->GetParticleName()
183 << " is retrieved from <" << fname << ">"
184 << G4endl;
185 }
186 } else if (1 < param->Verbose()) {
187 G4cout << "### Fail to retrieve physics table " << idx << " for "
188 << part->GetParticleName() << " from <"
189 << fname << ">" << G4endl;
190 }
191 return yes;
192}
bool G4bool
Definition G4Types.hh:86
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4PhysicsTable * Table(std::size_t idx) const
static G4EmParameters * Instance()
G4int Verbose() const
const G4String & GetParticleName() const
static G4bool RetrievePhysicsTable(G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii, G4bool spline)

◆ SetCrossSectionType()

void G4EmDataHandler::SetCrossSectionType ( G4CrossSectionType val)
inline

Definition at line 148 of file G4EmDataHandler.hh.

148 {
149 fXSType = val;
150 }

◆ SetElementSelectors()

void G4EmDataHandler::SetElementSelectors ( std::vector< G4EmElementSelector * > * p,
std::size_t i )

Definition at line 210 of file G4EmDataHandler.cc.

212{
213 if (i < eLength) {
214 if (fElemSelectors[i] != p) {
215 delete fElemSelectors[i];
216 }
217 fElemSelectors[i] = p;
218 } else {
219 fElemSelectors.push_back(p);
220 ++eLength;
221 }
222}

◆ SetEnergyOfCrossSectionMax()

void G4EmDataHandler::SetEnergyOfCrossSectionMax ( std::vector< G4double > * p)
inline

Definition at line 120 of file G4EmDataHandler.hh.

120 {
121 if (p != fMaxXS) {
122 delete fMaxXS;
123 fMaxXS = p;
124 }
125 }

◆ SetMasterProcess()

void G4EmDataHandler::SetMasterProcess ( const G4VEmProcess * ptr)

Definition at line 196 of file G4EmDataHandler.cc.

197{
198 masterProcess.push_back(ptr);
199}

◆ SetTwoPeaksXS()

void G4EmDataHandler::SetTwoPeaksXS ( std::vector< G4TwoPeaksXS * > * p)
inline

Definition at line 131 of file G4EmDataHandler.hh.

131 {
132 if (p != fXSpeaks) {
133 delete fXSpeaks;
134 fXSpeaks = p;
135 }
136 }

◆ SetUseBaseParticleTable()

void G4EmDataHandler::SetUseBaseParticleTable ( G4bool val)
inline

Definition at line 156 of file G4EmDataHandler.hh.

156 {
157 fUseBaseParticleTable = val;
158 }

◆ StorePhysicsTable()

G4bool G4EmDataHandler::StorePhysicsTable ( std::size_t idx,
const G4ParticleDefinition * part,
const G4String & fname,
G4bool ascii )

Definition at line 147 of file G4EmDataHandler.cc.

151{
152 G4bool yes = true;
153 if(nullptr != data[idx]) {
154 yes = data[idx]->StorePhysicsTable(fname, ascii);
155
156 if ( yes ) {
157 G4cout << "### Physics table is stored for "
158 << part->GetParticleName()
159 << " <" << fname << "> " << G4endl;
160 } else {
161 G4cout << "### Fail to store Physics Table for "
162 << part->GetParticleName()
163 << " <" << fname << "> " << G4endl;
164 }
165 }
166 return yes;
167}

◆ Table()

G4PhysicsTable * G4EmDataHandler::Table ( std::size_t idx) const
inline

Definition at line 104 of file G4EmDataHandler.hh.

104 {
105 return (idx < tLength) ? data[idx] : nullptr;
106 }

Referenced by RetrievePhysicsTable().

◆ TwoPeaksXS()

std::vector< G4TwoPeaksXS * > * G4EmDataHandler::TwoPeaksXS ( ) const
inline

Definition at line 127 of file G4EmDataHandler.hh.

127 {
128 return fXSpeaks;
129 }

◆ UpdateTable()

void G4EmDataHandler::UpdateTable ( G4PhysicsTable * ptr,
std::size_t idx )

Definition at line 91 of file G4EmDataHandler.cc.

92{
93 // update table pointer but not delete previous
94 if (idx < tLength) {
95 data[idx] = ptr;
96 } else {
97 G4cout << "### G4EmDataHandler::UpdateTable fail for idx=" << idx
98 << " length=" << tLength << G4endl;
99 }
100}

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