Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4PenelopeIonisationCrossSection Class Reference

#include <G4PenelopeIonisationCrossSection.hh>

Inheritance diagram for G4PenelopeIonisationCrossSection:
G4VhShellCrossSection

Public Member Functions

G4double CrossSection (G4int Z, G4AtomicShellEnumerator shell, G4double incidentEnergy, G4double mass, const G4Material *mat) override
 
 G4PenelopeIonisationCrossSection ()
 Constructor. More...
 
 G4PenelopeIonisationCrossSection (const G4PenelopeIonisationCrossSection &)=delete
 
std::vector< G4doubleGetCrossSection (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat) override
 
const G4StringGetName () const
 
G4int GetVerbosityLevel ()
 
G4PenelopeIonisationCrossSectionoperator= (const G4PenelopeIonisationCrossSection &right)=delete
 
std::vector< G4doubleProbabilities (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat) override
 
G4int SelectRandomShell (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
 
virtual void SetTotalCS (G4double)
 
void SetVerbosityLevel (G4int vl)
 Getter/setter for the verbosity level. More...
 
 ~G4PenelopeIonisationCrossSection ()
 Destructor. Clean all tables. More...
 

Private Member Functions

G4int FindShellIDIndex (const G4Material *mat, G4int Z, G4AtomicShellEnumerator shell)
 

Private Attributes

G4PenelopeIonisationXSHandlerfCrossSectionHandler
 
G4double fHighEnergyLimit
 
G4double fLowEnergyLimit
 
G4int fNMaxLevels
 
G4PenelopeOscillatorManagerfOscManager
 
std::map< std::pair< const G4Material *, G4int >, G4DataVector * > * fShellIDTable
 
const G4AtomicTransitionManagerfTransitionManager
 
G4int fVerboseLevel
 
G4String name
 

Detailed Description

Definition at line 57 of file G4PenelopeIonisationCrossSection.hh.

Constructor & Destructor Documentation

◆ G4PenelopeIonisationCrossSection() [1/2]

G4PenelopeIonisationCrossSection::G4PenelopeIonisationCrossSection ( )
explicit

Constructor.

NOTICE: working only for e- at the moment (no interface available for e+)

Definition at line 45 of file G4PenelopeIonisationCrossSection.cc.

45 :
46 G4VhShellCrossSection("Penelope"),fShellIDTable(nullptr),
48{
50 fNMaxLevels = 9;
51
52 // Verbosity scale:
53 // 0 = nothing
54 // 1 = calculation of cross sections, file openings, sampling of atoms
55 // 2 = entering in methods
56 fVerboseLevel = 0;
57
58 fLowEnergyLimit = 10.0*eV;
59 fHighEnergyLimit = 100.0*GeV;
60
62}
static constexpr double eV
Definition: G4SIunits.hh:201
static constexpr double GeV
Definition: G4SIunits.hh:203
static G4AtomicTransitionManager * Instance()
std::map< std::pair< const G4Material *, G4int >, G4DataVector * > * fShellIDTable
const G4AtomicTransitionManager * fTransitionManager
G4PenelopeIonisationXSHandler * fCrossSectionHandler
static G4PenelopeOscillatorManager * GetOscillatorManager()
G4VhShellCrossSection(const G4String &xname="")

References eV, fHighEnergyLimit, fLowEnergyLimit, fNMaxLevels, fOscManager, fTransitionManager, fVerboseLevel, G4PenelopeOscillatorManager::GetOscillatorManager(), GeV, and G4AtomicTransitionManager::Instance().

◆ ~G4PenelopeIonisationCrossSection()

G4PenelopeIonisationCrossSection::~G4PenelopeIonisationCrossSection ( )

Destructor. Clean all tables.

Definition at line 66 of file G4PenelopeIonisationCrossSection.cc.

67{
70}

References fCrossSectionHandler.

◆ G4PenelopeIonisationCrossSection() [2/2]

G4PenelopeIonisationCrossSection::G4PenelopeIonisationCrossSection ( const G4PenelopeIonisationCrossSection )
delete

Member Function Documentation

◆ CrossSection()

G4double G4PenelopeIonisationCrossSection::CrossSection ( G4int  Z,
G4AtomicShellEnumerator  shell,
G4double  incidentEnergy,
G4double  mass,
const G4Material mat 
)
overridevirtual

Purely virtual method from the base interface. Returns the cross section for the given shell in the element Z of material mat at the specified energy

Implements G4VhShellCrossSection.

Definition at line 74 of file G4PenelopeIonisationCrossSection.cc.

79{
80 if (fVerboseLevel > 1)
81 G4cout << "Entering in method G4PenelopeIonisationCrossSection::CrossSection()" << G4endl;
82
83 G4double cross = 0.;
84
85 //Material pointer is not available
86 if (!material)
87 {
88 //CRASH!
90 ed << "The method has been called with a null G4Material pointer" << G4endl;
91 G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2042",
93 return cross;
94 }
95
98
100
102
103 if(G4int(shell) < nmax &&
104 incidentEnergy >= fLowEnergyLimit && incidentEnergy <= fHighEnergyLimit)
105 {
106 //The shells in Penelope are organized per *material*, rather than per
107 //element, so given a material one has to find the proper index for the
108 //given Z and fShellID. An appropriate lookup table is used to avoid
109 //recalculation.
110 G4int index = FindShellIDIndex(material,Z,shell);
111
112 //Index is not available!
113 if (index < 0)
114 return cross;
115
116 const G4PenelopeCrossSection* theXS =
118 material,
119 0.);
120
121 //Cross check that everything is fine:
123 if (theOsc->GetParentZ() != Z || theOsc->GetShellFlag()-1 != G4int(shell))
124 {
125 //something went wrong!
127 ed << "There is something wrong here: it looks like the index is wrong" << G4endl;
128 ed << "Requested: shell " << G4int(shell) << " and Z = " << Z << G4endl;
129 ed << "Retrieved: " << theOsc->GetShellFlag()-1 << " and Z = " << theOsc->GetParentZ() << G4endl;
130 G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2043",
131 JustWarning,ed);
132 return cross;
133 }
134
135 G4double crossPerMolecule = (theXS) ? theXS->GetShellCrossSection(index,incidentEnergy) : 0.;
136
137 //Now it must be converted in cross section per atom. I need the number of
138 //atoms of the given Z per molecule.
140 if (atomsPerMolec)
141 cross = crossPerMolecule/atomsPerMolec;
142
143 if (fVerboseLevel > 0)
144 {
145 G4cout << "Cross section of shell " << G4int(shell) << " and Z= " << Z;
146 G4cout << " of material: " << material->GetName() << " and energy = " << incidentEnergy/keV << " keV" << G4endl;
147 G4cout << "--> " << cross/barn << " barn" << G4endl;
148 G4cout << "Shell binding energy: " << theOsc->GetIonisationEnergy()/eV << " eV;" ;
149 G4cout << " resonance energy: " << theOsc->GetResonanceEnergy()/eV << "eV" << G4endl;
150 if (fVerboseLevel > 2)
151 {
152 G4cout << "Cross section per molecule: " << crossPerMolecule/barn << " barn" << G4endl;
153 G4cout << "Atoms " << Z << " per molecule: " << atomsPerMolec << G4endl;
154 }
155 }
156 }
157
158 return cross;
159}
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static constexpr double barn
Definition: G4SIunits.hh:85
static constexpr double keV
Definition: G4SIunits.hh:202
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4Electron * Electron()
Definition: G4Electron.cc:93
G4double GetShellCrossSection(size_t shellID, G4double energy) const
Returns the hard cross section for the given shell (per molecule)
G4int FindShellIDIndex(const G4Material *mat, G4int Z, G4AtomicShellEnumerator shell)
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
const G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, const G4double cut) const
G4double GetNumberOfZAtomsPerMolecule(const G4Material *, G4int Z)
G4PenelopeOscillator * GetOscillatorIonisation(const G4Material *, G4int)
G4double GetResonanceEnergy() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
string material
Definition: eplot.py:19

References barn, G4PenelopeIonisationXSHandler::BuildXSTable(), G4Electron::Electron(), eV, FatalException, fCrossSectionHandler, fHighEnergyLimit, FindShellIDIndex(), fLowEnergyLimit, fNMaxLevels, fOscManager, fTransitionManager, fVerboseLevel, G4cout, G4endl, G4Exception(), G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(), G4PenelopeOscillator::GetIonisationEnergy(), G4PenelopeOscillatorManager::GetNumberOfZAtomsPerMolecule(), G4PenelopeOscillatorManager::GetOscillatorIonisation(), G4PenelopeOscillator::GetParentZ(), G4PenelopeOscillator::GetResonanceEnergy(), G4PenelopeCrossSection::GetShellCrossSection(), G4PenelopeOscillator::GetShellFlag(), JustWarning, keV, eplot::material, G4INCL::Math::min(), G4AtomicTransitionManager::NumberOfShells(), and Z.

Referenced by GetCrossSection().

◆ FindShellIDIndex()

G4int G4PenelopeIonisationCrossSection::FindShellIDIndex ( const G4Material mat,
G4int  Z,
G4AtomicShellEnumerator  shell 
)
private

The shells in Penelope are organized per material, rather than per element, so given a material one has to find the proper index for the given Z and shellID. An appropriate look-up table is used to avoid recalculation.

Definition at line 199 of file G4PenelopeIonisationCrossSection.cc.

202{
203 if (fVerboseLevel > 1)
204 G4cout << "Entering in method G4PenelopeIonisationCrossSection::FindShellIDIndex()" << G4endl;
205
206 if (!fShellIDTable)
207 fShellIDTable = new std::map< std::pair<const G4Material*,G4int>, G4DataVector*>;
208
209 std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
210 G4int result = -1;
211 G4int ishell = G4int(shell);
212
213 if (fShellIDTable->count(theKey)) //table already built, and containing the element
214 {
215 if (fVerboseLevel > 2)
216 G4cout << "FindShellIDIndex: Table already built for " << mat->GetName() << G4endl;
217 G4DataVector* theVec = fShellIDTable->find(theKey)->second;
218
219 if (ishell>=0 && ishell < (G4int) theVec->size()) //check we are not off-boundary
220 result = (G4int) (*theVec)[ishell];
221 else
222 {
224 ed << "Shell ID: " << ishell << " not available for material " << mat->GetName() << " and Z = " <<
225 Z << G4endl;
226 G4Exception("G4PenelopeIonisationCrossSection::FindShellIDIndex()","em2041",JustWarning,
227 ed);
228 return -1;
229 }
230 }
231 else
232 {
233 if (fVerboseLevel > 2)
234 G4cout << "FindShellIDIndex: Table to be built for " << mat->GetName() << G4endl;
235 //Not contained: look for it
237 size_t numberOfOscillators = theTable->size();
238
239 //oscillator loop
240 //initialize everything at -1
242 for (size_t iosc=0;iosc<numberOfOscillators;iosc++)
243 {
244 G4PenelopeOscillator* theOsc = (*theTable)[iosc];
245 //level is found!
246 if (theOsc->GetParentZ() == Z)
247 {
248 //individual shells relative to the given material
249 G4int shFlag = theOsc->GetShellFlag();
250 //Notice: GetShellFlag() starts from 1, the G4AtomicShellEnumerator from 0
251 if (shFlag < 30)
252 (*dat)[shFlag-1] = (G4double) iosc; //index of the given shell
253 if ((shFlag-1) == ishell) // this is what we were looking for
254 result = (G4int) iosc;
255 }
256 }
257 fShellIDTable->insert(std::make_pair(theKey,dat));
258 }
259
260 if (fVerboseLevel > 1)
261 G4cout << "Leaving method G4PenelopeIonisationCrossSection::FindShellIDIndex() with index = "
262 << result << G4endl;
263
264 return result;
265}
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
const G4String & GetName() const
Definition: G4Material.hh:173
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)

References fNMaxLevels, fOscManager, fShellIDTable, fVerboseLevel, G4cout, G4endl, G4Exception(), G4Material::GetName(), G4PenelopeOscillatorManager::GetOscillatorTableIonisation(), G4PenelopeOscillator::GetParentZ(), G4PenelopeOscillator::GetShellFlag(), JustWarning, and Z.

Referenced by CrossSection().

◆ GetCrossSection()

std::vector< G4double > G4PenelopeIonisationCrossSection::GetCrossSection ( G4int  Z,
G4double  incidentEnergy,
G4double  mass,
G4double  deltaEnergy,
const G4Material mat 
)
overridevirtual

Purely virtual method from the base interface. Returns the cross section for all levels of element Z in material mat at the given energy

Implements G4VhShellCrossSection.

Definition at line 163 of file G4PenelopeIonisationCrossSection.cc.

167{
169 std::vector<G4double> vec(nmax,0.0);
170 for(G4int i=0; i<nmax; ++i) {
171 vec[i] = CrossSection(Z, G4AtomicShellEnumerator(i), kinEnergy,0.,mat);
172 }
173 return vec;
174}
G4AtomicShellEnumerator
G4double CrossSection(G4int Z, G4AtomicShellEnumerator shell, G4double incidentEnergy, G4double mass, const G4Material *mat) override

References CrossSection(), fNMaxLevels, fTransitionManager, G4INCL::Math::min(), G4AtomicTransitionManager::NumberOfShells(), and Z.

Referenced by Probabilities().

◆ GetName()

const G4String & G4VhShellCrossSection::GetName ( ) const
inlineinherited

Definition at line 102 of file G4VhShellCrossSection.hh.

103{
104 return name;
105}

References G4VhShellCrossSection::name.

Referenced by G4UAtomicDeexcitation::InitialiseForNewRun().

◆ GetVerbosityLevel()

G4int G4PenelopeIonisationCrossSection::GetVerbosityLevel ( )
inline

Definition at line 94 of file G4PenelopeIonisationCrossSection.hh.

94{return fVerboseLevel;};

References fVerboseLevel.

◆ operator=()

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

◆ Probabilities()

std::vector< G4double > G4PenelopeIonisationCrossSection::Probabilities ( G4int  Z,
G4double  incidentEnergy,
G4double  mass,
G4double  deltaEnergy,
const G4Material mat 
)
overridevirtual

Purely virtual method from the base interface. Returns the shell ionisation probabilities for the given Z in the material mat at the specified energy.

Implements G4VhShellCrossSection.

Definition at line 179 of file G4PenelopeIonisationCrossSection.cc.

184{
185 std::vector<G4double> vec = GetCrossSection(Z, kinEnergy,0,0,mat);
186 size_t n = vec.size();
187 size_t i=0;
188 G4double sum = 0.0;
189 for(i=0; i<n; ++i) { sum += vec[i]; }
190 if(sum > 0.0) {
191 sum = 1.0/sum;
192 for(i=0; i<n; ++i) { vec[i] = vec[i]*sum; }
193 }
194 return vec;
195}
std::vector< G4double > GetCrossSection(G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat) override

References GetCrossSection(), CLHEP::detail::n, and Z.

◆ SelectRandomShell()

G4int G4VhShellCrossSection::SelectRandomShell ( G4int  Z,
G4double  incidentEnergy,
G4double  mass,
G4double  deltaEnergy,
const G4Material mat 
)
inherited

Definition at line 63 of file G4VhShellCrossSection.cc.

70{
71 std::vector<G4double> p =
72 Probabilities(Z,incidentEnergy,mass,deltaEnergy,mat);
73 G4int shell = -1;
74 size_t nShells = p.size();
76 for (size_t i=0; i<nShells; i++) {
77
78 if (p[i] >= q) {
79 shell = i;
80 break;
81 }
82 q -= p[i];
83 }
84 return shell;
85}
#define G4UniformRand()
Definition: Randomize.hh:52
virtual std::vector< G4double > Probabilities(G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)=0

References G4UniformRand, G4VhShellCrossSection::Probabilities(), and Z.

◆ SetTotalCS()

void G4VhShellCrossSection::SetTotalCS ( G4double  )
virtualinherited

Reimplemented in G4empCrossSection, and G4teoCrossSection.

Definition at line 58 of file G4VhShellCrossSection.cc.

59{}

◆ SetVerbosityLevel()

void G4PenelopeIonisationCrossSection::SetVerbosityLevel ( G4int  vl)
inline

Getter/setter for the verbosity level.

Definition at line 93 of file G4PenelopeIonisationCrossSection.hh.

93{fVerboseLevel = vl;};

References fVerboseLevel.

Field Documentation

◆ fCrossSectionHandler

G4PenelopeIonisationXSHandler* G4PenelopeIonisationCrossSection::fCrossSectionHandler
private

◆ fHighEnergyLimit

G4double G4PenelopeIonisationCrossSection::fHighEnergyLimit
private

◆ fLowEnergyLimit

G4double G4PenelopeIonisationCrossSection::fLowEnergyLimit
private

◆ fNMaxLevels

G4int G4PenelopeIonisationCrossSection::fNMaxLevels
private

◆ fOscManager

G4PenelopeOscillatorManager* G4PenelopeIonisationCrossSection::fOscManager
private

◆ fShellIDTable

std::map< std::pair<const G4Material*,G4int>, G4DataVector*>* G4PenelopeIonisationCrossSection::fShellIDTable
private

Definition at line 107 of file G4PenelopeIonisationCrossSection.hh.

Referenced by FindShellIDIndex().

◆ fTransitionManager

const G4AtomicTransitionManager* G4PenelopeIonisationCrossSection::fTransitionManager
private

◆ fVerboseLevel

G4int G4PenelopeIonisationCrossSection::fVerboseLevel
private

◆ name

G4String G4VhShellCrossSection::name
privateinherited

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