Geant4 11.2.2
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 (size_t nTable)
 
 ~G4EmDataHandler ()
 
size_t SetTable (G4PhysicsTable *)
 
void UpdateTable (G4PhysicsTable *, size_t idx)
 
G4PhysicsTableMakeTable (size_t idx)
 
G4PhysicsTableMakeTable (G4PhysicsTable *, size_t idx)
 
void CleanTable (size_t idx)
 
G4bool StorePhysicsTable (size_t idx, const G4ParticleDefinition *part, const G4String &fname, G4bool ascii)
 
G4bool RetrievePhysicsTable (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 (size_t idx) const
 
G4PhysicsTableTable (size_t idx) const
 
const G4PhysicsVectorGetVector (size_t itable, size_t ivec) const
 
const std::vector< G4PhysicsTable * > & GetTables () const
 
G4EmDataHandleroperator= (const G4EmDataHandler &right)=delete
 
 G4EmDataHandler (const G4EmDataHandler &)=delete
 

Detailed Description

Definition at line 62 of file G4EmDataHandler.hh.

Constructor & Destructor Documentation

◆ G4EmDataHandler() [1/2]

G4EmDataHandler::G4EmDataHandler ( size_t nTable)
explicit

Definition at line 52 of file G4EmDataHandler.cc.

52 : tLength(n)
53{
54 data.resize(n, nullptr);
55}

◆ ~G4EmDataHandler()

G4EmDataHandler::~G4EmDataHandler ( )

Definition at line 59 of file G4EmDataHandler.cc.

60{
61 for(size_t i=0; i<tLength; ++i) {
62 for(size_t j = i+1; j<tLength; ++j) {
63 if(data[j] == data[i]) { data[j] = nullptr; }
64 }
65 CleanTable(i);
66 }
67}
void CleanTable(size_t idx)

◆ G4EmDataHandler() [2/2]

G4EmDataHandler::G4EmDataHandler ( const G4EmDataHandler & )
delete

Member Function Documentation

◆ CleanTable()

void G4EmDataHandler::CleanTable ( size_t idx)

Definition at line 128 of file G4EmDataHandler.cc.

129{
130 if(i < tLength && nullptr != data[i]) {
131 data[i]->clearAndDestroy();
132 delete data[i];
133 data[i] = nullptr;
134 }
135}

Referenced by MakeTable(), G4VEnergyLossProcess::PreparePhysicsTable(), and ~G4EmDataHandler().

◆ GetMasterProcess()

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

Definition at line 195 of file G4EmDataHandler.cc.

196{
197 return (idx < masterProcess.size()) ? masterProcess[idx] : nullptr;
198}

Referenced by G4GammaGeneralProcess::BuildPhysicsTable().

◆ GetTable()

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

Definition at line 99 of file G4EmDataHandler.hh.

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

◆ GetTables()

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

Definition at line 110 of file G4EmDataHandler.hh.

110{ return data; }

Referenced by G4GammaGeneralProcess::BuildPhysicsTable().

◆ GetVector()

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

Definition at line 107 of file G4EmDataHandler.hh.

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

Referenced by G4GammaGeneralProcess::ComputeGeneralLambda(), and G4GammaGeneralProcess::GetProbability().

◆ MakeTable() [1/2]

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

Definition at line 107 of file G4EmDataHandler.cc.

108{
109 size_t idx = i;
110 // create new table only if index corresponds to the
111 // position in the vector
112 if(idx < tLength) {
113 if(ptr != data[idx]) {
114 CleanTable(idx);
115 data[idx] = ptr;
116 }
117 } else {
118 data.push_back(ptr);
119 idx = tLength;
120 ++tLength;
121 }
123 return data[idx];
124}
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)

◆ MakeTable() [2/2]

G4PhysicsTable * G4EmDataHandler::MakeTable ( size_t idx)

Definition at line 93 of file G4EmDataHandler.cc.

94{
95 size_t idx = i;
96 if(idx >= tLength) {
97 data.push_back(nullptr);
98 idx = tLength;
99 ++tLength;
100 }
101 data[idx] = G4PhysicsTableHelper::PreparePhysicsTable(data[idx]);
102 return data[idx];
103}

Referenced by G4GammaGeneralProcess::InitialiseProcess(), G4TransportationWithMsc::PreparePhysicsTable(), G4VEmProcess::PreparePhysicsTable(), and G4VEnergyLossProcess::PreparePhysicsTable().

◆ operator=()

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

◆ RetrievePhysicsTable()

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

Definition at line 163 of file G4EmDataHandler.cc.

167{
168 G4PhysicsTable* table = Table(idx);
169 G4bool yes = G4PhysicsTableHelper::RetrievePhysicsTable(table, fname, ascii, spline);
171 if ( yes ) {
172 if (0 < param->Verbose()) {
173 G4cout << "### Physics table " << idx << " for "
174 << part->GetParticleName()
175 << " is retrieved from <" << fname << ">"
176 << G4endl;
177 }
178 } else if (1 < param->Verbose()) {
179 G4cout << "### Fail to retrieve physics table " << idx << " for "
180 << part->GetParticleName() << " from <"
181 << fname << ">" << G4endl;
182 }
183 return yes;
184}
bool G4bool
Definition G4Types.hh:86
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4PhysicsTable * Table(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)

Referenced by G4GammaGeneralProcess::RetrievePhysicsTable().

◆ SetMasterProcess()

void G4EmDataHandler::SetMasterProcess ( const G4VEmProcess * ptr)

Definition at line 188 of file G4EmDataHandler.cc.

189{
190 masterProcess.push_back(ptr);
191}

Referenced by G4GammaGeneralProcess::InitialiseProcess().

◆ SetTable()

size_t G4EmDataHandler::SetTable ( G4PhysicsTable * ptr)

Definition at line 71 of file G4EmDataHandler.cc.

72{
73 data.push_back(ptr);
74 ++tLength;
75 return tLength-1;
76}

◆ StorePhysicsTable()

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

Definition at line 139 of file G4EmDataHandler.cc.

143{
144 G4bool yes = true;
145 if(nullptr != data[idx]) {
146 yes = data[idx]->StorePhysicsTable(fname, ascii);
147
148 if ( yes ) {
149 G4cout << "### Physics table is stored for "
150 << part->GetParticleName()
151 << " <" << fname << "> " << G4endl;
152 } else {
153 G4cout << "### Fail to store Physics Table for "
154 << part->GetParticleName()
155 << " <" << fname << "> " << G4endl;
156 }
157 }
158 return yes;
159}

Referenced by G4GammaGeneralProcess::StorePhysicsTable().

◆ Table()

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

Definition at line 103 of file G4EmDataHandler.hh.

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

Referenced by RetrievePhysicsTable(), G4VEnergyLossProcess::RetrievePhysicsTable(), and G4VEnergyLossProcess::StorePhysicsTable().

◆ UpdateTable()

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

Definition at line 80 of file G4EmDataHandler.cc.

81{
82 // update table pointer but not delete previous
83 if(idx < tLength) {
84 if(ptr != data[idx]) { data[idx] = ptr; }
85 } else {
86 G4cout << "### G4EmDataHandler::UpdateTable fail for idx=" << idx
87 << " length=" << tLength << G4endl;
88 }
89}

Referenced by G4VEnergyLossProcess::PreparePhysicsTable(), and G4VEnergyLossProcess::SetDEDXTable().


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