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

#include <G4PenelopeIonisationXSHandler.hh>

Public Member Functions

 G4PenelopeIonisationXSHandler (size_t nBins=200)
 
virtual ~G4PenelopeIonisationXSHandler ()
 Destructor. Clean all tables.
 
G4double GetDensityCorrection (const G4Material *, G4double energy)
 Returns the density coeection for the material at the given energy.
 
G4PenelopeCrossSectionGetCrossSectionTableForCouple (const G4ParticleDefinition *, const G4Material *, G4double cut)
 
void SetVerboseLevel (G4int vl)
 Setter for the verbosity level.
 

Detailed Description

Definition at line 60 of file G4PenelopeIonisationXSHandler.hh.

Constructor & Destructor Documentation

◆ G4PenelopeIonisationXSHandler()

G4PenelopeIonisationXSHandler::G4PenelopeIonisationXSHandler ( size_t  nBins = 200)

Constructor. nBins is the number of intervals in the energy grid. By default the energy grid goes from 100 eV to 100 GeV.

Definition at line 47 of file G4PenelopeIonisationXSHandler.cc.

48 :XSTableElectron(0),XSTablePositron(0),
49 theDeltaTable(0),energyGrid(0)
50{
51 nBins = nb;
52 G4double LowEnergyLimit = 100.0*eV;
53 G4double HighEnergyLimit = 100.0*GeV;
55 XSTableElectron = new
56 std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>;
57 XSTablePositron = new
58 std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>;
59
60 theDeltaTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
61 energyGrid = new G4PhysicsLogVector(LowEnergyLimit,
62 HighEnergyLimit,
63 nBins-1); //one hidden bin is added
64
65 verboseLevel = 0;
66}
double G4double
Definition: G4Types.hh:64
static G4PenelopeOscillatorManager * GetOscillatorManager()

◆ ~G4PenelopeIonisationXSHandler()

G4PenelopeIonisationXSHandler::~G4PenelopeIonisationXSHandler ( )
virtual

Destructor. Clean all tables.

Definition at line 70 of file G4PenelopeIonisationXSHandler.cc.

71{
72 std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>::iterator i;
73 if (XSTableElectron)
74 {
75 for (i=XSTableElectron->begin(); i != XSTableElectron->end(); i++)
76 {
77 G4PenelopeCrossSection* tab = i->second;
78 delete tab;
79 }
80 delete XSTableElectron;
81 XSTableElectron = 0;
82 }
83
84 if (XSTablePositron)
85 {
86 for (i=XSTablePositron->begin(); i != XSTablePositron->end(); i++)
87 {
88 G4PenelopeCrossSection* tab = i->second;
89 delete tab;
90 }
91 delete XSTablePositron;
92 XSTablePositron = 0;
93 }
94
95 std::map<const G4Material*,G4PhysicsFreeVector*>::iterator k;
96 if (theDeltaTable)
97 {
98 for (k=theDeltaTable->begin();k!=theDeltaTable->end();k++)
99 delete k->second;
100 delete theDeltaTable;
101 theDeltaTable = 0;
102 }
103
104 if (energyGrid)
105 delete energyGrid;
106
107 if (verboseLevel > 2)
108 G4cout << "G4PenelopeIonisationXSHandler. Tables have been cleared"
109 << G4endl;
110}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout

Member Function Documentation

◆ GetCrossSectionTableForCouple()

G4PenelopeCrossSection * G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple ( const G4ParticleDefinition part,
const G4Material mat,
G4double  cut 
)

Returns the table of cross sections for the given particle, given material and given cut as a G4PenelopeCrossSection* pointer.

Definition at line 115 of file G4PenelopeIonisationXSHandler.cc.

118{
119 if (part != G4Electron::Electron() && part != G4Positron::Positron())
120 {
122 ed << "Invalid particle: " << part->GetParticleName() << G4endl;
123 G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
124 "em0001",FatalException,ed);
125 return NULL;
126 }
127
128 if (part == G4Electron::Electron())
129 {
130 if (!XSTableElectron)
131 {
132 G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
133 "em0028",FatalException,
134 "The Cross Section Table for e- was not initialized correctly!");
135 return NULL;
136 }
137 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
138 if (XSTableElectron->count(theKey)) //table already built
139 return XSTableElectron->find(theKey)->second;
140 else
141 {
142 BuildXSTable(mat,cut,part);
143 if (XSTableElectron->count(theKey)) //now it should be ok!
144 return XSTableElectron->find(theKey)->second;
145 else
146 {
148 ed << "Unable to build e- table for " << mat->GetName() << G4endl;
149 G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
150 "em0029",FatalException,ed);
151 }
152 }
153 }
154
155 if (part == G4Positron::Positron())
156 {
157 if (!XSTablePositron)
158 {
159 G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
160 "em0028",FatalException,
161 "The Cross Section Table for e+ was not initialized correctly!");
162 return NULL;
163 }
164 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
165 if (XSTablePositron->count(theKey)) //table already built
166 return XSTablePositron->find(theKey)->second;
167 else
168 {
169 BuildXSTable(mat,cut,part);
170 if (XSTablePositron->count(theKey)) //now it should be ok!
171 return XSTablePositron->find(theKey)->second;
172 else
173 {
175 ed << "Unable to build e+ table for " << mat->GetName() << G4endl;
176 G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
177 "em0029",FatalException,ed);
178 }
179 }
180 }
181 return NULL;
182}
@ FatalException
static G4Electron * Electron()
Definition: G4Electron.cc:94
const G4String & GetName() const
Definition: G4Material.hh:177
const G4String & GetParticleName() const
static G4Positron * Positron()
Definition: G4Positron.cc:94
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

Referenced by G4PenelopeIonisationModel::ComputeDEDXPerVolume(), G4PenelopeIonisationCrossSection::CrossSection(), and G4PenelopeIonisationModel::CrossSectionPerVolume().

◆ GetDensityCorrection()

G4double G4PenelopeIonisationXSHandler::GetDensityCorrection ( const G4Material mat,
G4double  energy 
)

Returns the density coeection for the material at the given energy.

Definition at line 286 of file G4PenelopeIonisationXSHandler.cc.

288{
289 G4double result = 0;
290 if (!theDeltaTable)
291 {
292 G4Exception("G4PenelopeIonisationXSHandler::GetDensityCorrection()",
293 "em2032",FatalException,
294 "Delta Table not initialized. Was Initialise() run?");
295 return 0;
296 }
297 if (energy <= 0*eV)
298 {
299 G4cout << "G4PenelopeIonisationXSHandler::GetDensityCorrection()" << G4endl;
300 G4cout << "Invalid energy " << energy/eV << " eV " << G4endl;
301 return 0;
302 }
303 G4double logene = std::log(energy);
304
305 //check if the material has been built
306 if (!(theDeltaTable->count(mat)))
307 BuildDeltaTable(mat);
308
309 if (theDeltaTable->count(mat))
310 {
311 G4PhysicsFreeVector* vec = theDeltaTable->find(mat)->second;
312 result = vec->Value(logene); //the table has delta vs. ln(E)
313 }
314 else
315 {
317 ed << "Unable to build table for " << mat->GetName() << G4endl;
318 G4Exception("G4PenelopeIonisationXSHandler::GetDensityCorrection()",
319 "em2033",FatalException,ed);
320 }
321
322 return result;
323}
G4double Value(G4double theEnergy)

◆ SetVerboseLevel()

void G4PenelopeIonisationXSHandler::SetVerboseLevel ( G4int  vl)
inline

Setter for the verbosity level.

Definition at line 80 of file G4PenelopeIonisationXSHandler.hh.

80{verboseLevel = vl;};

Referenced by G4PenelopeIonisationModel::Initialise().


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