Geant4  10.02.p03
G4PenelopeIonisationCrossSection Class Reference

#include <G4PenelopeIonisationCrossSection.hh>

Inheritance diagram for G4PenelopeIonisationCrossSection:
Collaboration diagram for G4PenelopeIonisationCrossSection:

Public Member Functions

 G4PenelopeIonisationCrossSection ()
 Constructor. More...
 
 ~G4PenelopeIonisationCrossSection ()
 Destructor. Clean all tables. More...
 
std::vector< G4doubleGetCrossSection (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
 
G4double CrossSection (G4int Z, G4AtomicShellEnumerator shell, G4double incidentEnergy, G4double mass, const G4Material *mat)
 
std::vector< G4doubleProbabilities (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
 
void SetVerbosityLevel (G4int vl)
 Getter/setter for the verbosity level. More...
 
G4int GetVerbosityLevel ()
 
- Public Member Functions inherited from G4VhShellCrossSection
 G4VhShellCrossSection (const G4String &xname="")
 
virtual ~G4VhShellCrossSection ()
 
G4int SelectRandomShell (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
 
virtual void SetTotalCS (G4double)
 
const G4StringGetName () const
 

Private Member Functions

G4PenelopeIonisationCrossSectionoperator= (const G4PenelopeIonisationCrossSection &right)
 
 G4PenelopeIonisationCrossSection (const G4PenelopeIonisationCrossSection &)
 
G4int FindShellIDIndex (const G4Material *mat, G4int Z, G4AtomicShellEnumerator shell)
 

Private Attributes

G4PenelopeOscillatorManageroscManager
 
G4int verboseLevel
 
std::map< std::pair< const G4Material *, G4int >, G4DataVector * > * shellIDTable
 
G4int nMaxLevels
 
G4double fLowEnergyLimit
 
G4double fHighEnergyLimit
 
G4PenelopeIonisationXSHandler * theCrossSectionHandler
 
const G4AtomicTransitionManagertransitionManager
 

Detailed Description

Definition at line 58 of file G4PenelopeIonisationCrossSection.hh.

Constructor & Destructor Documentation

◆ G4PenelopeIonisationCrossSection() [1/2]

G4PenelopeIonisationCrossSection::G4PenelopeIonisationCrossSection ( )

Constructor.

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

Definition at line 46 of file G4PenelopeIonisationCrossSection.cc.

46  :
47  G4VhShellCrossSection("Penelope"),shellIDTable(0),
49 {
51  nMaxLevels = 9;
52 
53  // Verbosity scale:
54  // 0 = nothing
55  // 1 = calculation of cross sections, file openings, sampling of atoms
56  // 2 = entering in methods
57  verboseLevel = 0;
58 
59  fLowEnergyLimit = 10.0*eV;
60  fHighEnergyLimit = 100.0*GeV;
61 
63 }
G4VhShellCrossSection(const G4String &xname="")
static const double GeV
Definition: G4SIunits.hh:214
static G4PenelopeOscillatorManager * GetOscillatorManager()
static const double eV
Definition: G4SIunits.hh:212
std::map< std::pair< const G4Material *, G4int >, G4DataVector * > * shellIDTable
const G4AtomicTransitionManager * transitionManager
static G4AtomicTransitionManager * Instance()
G4PenelopeIonisationXSHandler * theCrossSectionHandler
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~G4PenelopeIonisationCrossSection()

G4PenelopeIonisationCrossSection::~G4PenelopeIonisationCrossSection ( )

Destructor. Clean all tables.

Definition at line 67 of file G4PenelopeIonisationCrossSection.cc.

68 {
71 }
G4PenelopeIonisationXSHandler * theCrossSectionHandler

◆ G4PenelopeIonisationCrossSection() [2/2]

G4PenelopeIonisationCrossSection::G4PenelopeIonisationCrossSection ( const G4PenelopeIonisationCrossSection )
private

Member Function Documentation

◆ CrossSection()

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

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 75 of file G4PenelopeIonisationCrossSection.cc.

80 {
81  if (verboseLevel > 1)
82  G4cout << "Entering in method G4PenelopeIonisationCrossSection::CrossSection()" << G4endl;
83 
84  G4double cross = 0.;
85 
86  //Material pointer is not available
87  if (!material)
88  {
89  //CRASH!
91  ed << "The method has been called with a NULL G4Material pointer" << G4endl;
92  G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2042",
93  FatalException,ed);
94  return cross;
95  }
96 
98  theCrossSectionHandler = new G4PenelopeIonisationXSHandler();
99 
101 
103 
104  if(G4int(shell) < nmax &&
105  incidentEnergy >= fLowEnergyLimit && incidentEnergy <= fHighEnergyLimit)
106  {
107  //The shells in Penelope are organized per *material*, rather than per
108  //element, so given a material one has to find the proper index for the
109  //given Z and shellID. An appropriate lookup table is used to avoid
110  //recalculation.
112 
113  //Index is not available!
114  if (index < 0)
115  return cross;
116 
117  const G4PenelopeCrossSection* theXS =
118  theCrossSectionHandler->GetCrossSectionTableForCouple(G4Electron::Electron(),
119  material,
120  0.);
121 
122  //Cross check that everything is fine:
124  if (theOsc->GetParentZ() != Z || theOsc->GetShellFlag()-1 != G4int(shell))
125  {
126  //something went wrong!
128  ed << "There is something wrong here: it looks like the index is wrong" << G4endl;
129  ed << "Requested: shell " << G4int(shell) << " and Z = " << Z << G4endl;
130  ed << "Retrieved: " << theOsc->GetShellFlag()-1 << " and Z = " << theOsc->GetParentZ() << G4endl;
131  G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2043",
132  JustWarning,ed);
133  return cross;
134  }
135 
136 
137  G4double crossPerMolecule = (theXS) ? theXS->GetShellCrossSection(index,incidentEnergy) : 0.;
138 
139  //Now it must be converted in cross section per atom. I need the number of
140  //atoms of the given Z per molecule.
142  if (atomsPerMolec)
143  cross = crossPerMolecule/atomsPerMolec;
144 
145 
146  if (verboseLevel > 0)
147  {
148  G4cout << "Cross section of shell " << G4int(shell) << " and Z= " << Z;
149  G4cout << " of material: " << material->GetName() << " and energy = " << incidentEnergy/keV << " keV" << G4endl;
150  G4cout << "--> " << cross/barn << " barn" << G4endl;
151  G4cout << "Shell binding energy: " << theOsc->GetIonisationEnergy()/eV << " eV;" ;
152  G4cout << " resonance energy: " << theOsc->GetResonanceEnergy()/eV << "eV" << G4endl;
153  if (verboseLevel > 2)
154  {
155  G4cout << "Cross section per molecule: " << crossPerMolecule/barn << " barn" << G4endl;
156  G4cout << "Atoms " << Z << " per molecule: " << atomsPerMolec << G4endl;
157  }
158  }
159  }
160 
161  return cross;
162 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
Int_t index
G4double GetShellCrossSection(size_t shellID, G4double energy) const
Returns the hard cross section for the given shell (per molecule)
G4PenelopeOscillator * GetOscillatorIonisation(const G4Material *, G4int)
G4double GetResonanceEnergy() const
int G4int
Definition: G4Types.hh:78
string material
Definition: eplot.py:19
G4GLOB_DLL std::ostream G4cout
Float_t Z
const G4int nmax
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const double eV
Definition: G4SIunits.hh:212
const G4AtomicTransitionManager * transitionManager
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
static const double barn
Definition: G4SIunits.hh:104
static const double keV
Definition: G4SIunits.hh:213
double G4double
Definition: G4Types.hh:76
G4double GetNumberOfZAtomsPerMolecule(const G4Material *, G4int Z)
G4int FindShellIDIndex(const G4Material *mat, G4int Z, G4AtomicShellEnumerator shell)
G4PenelopeIonisationXSHandler * theCrossSectionHandler
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 202 of file G4PenelopeIonisationCrossSection.cc.

205 {
206  if (verboseLevel > 1)
207  G4cout << "Entering in method G4PenelopeIonisationCrossSection::FindShellIDIndex()" << G4endl;
208 
209  if (!shellIDTable)
210  shellIDTable = new std::map< std::pair<const G4Material*,G4int>, G4DataVector*>;
211 
212  std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
213  G4int result = -1;
214  G4int ishell = G4int(shell);
215 
216  if (shellIDTable->count(theKey)) //table already built, and containing the element
217  {
218  if (verboseLevel > 2)
219  G4cout << "FindShellIDIndex: Table already built for " << mat->GetName() << G4endl;
220  G4DataVector* theVec = shellIDTable->find(theKey)->second;
221 
222  if (ishell>=0 && ishell < (G4int) theVec->size()) //check we are not off-boundary
223  result = (G4int) (*theVec)[ishell];
224  else
225  {
227  ed << "Shell ID: " << ishell << " not available for material " << mat->GetName() << " and Z = " <<
228  Z << G4endl;
229  G4Exception("G4PenelopeIonisationCrossSection::FindShellIDIndex()","em2041",JustWarning,
230  ed);
231  return -1;
232  }
233  }
234  else
235  {
236  if (verboseLevel > 2)
237  G4cout << "FindShellIDIndex: Table to be built for " << mat->GetName() << G4endl;
238  //Not contained: look for it
240  size_t numberOfOscillators = theTable->size();
241 
242  //oscillator loop
243  //initialize everything at -1
244  G4DataVector* dat = new G4DataVector(nMaxLevels,-1);
245  for (size_t iosc=0;iosc<numberOfOscillators;iosc++)
246  {
247  G4PenelopeOscillator* theOsc = (*theTable)[iosc];
248  //level is found!
249  if (theOsc->GetParentZ() == Z)
250  {
251  //individual shells relative to the given material
252  G4int shFlag = theOsc->GetShellFlag();
253  //Notice: GetShellFlag() starts from 1, the G4AtomicShellEnumerator from 0
254  if (shFlag < 30)
255  (*dat)[shFlag-1] = (G4double) iosc; //index of the given shell
256  if ((shFlag-1) == ishell) // this is what we were looking for
257  result = (G4int) iosc;
258  }
259  }
260  shellIDTable->insert(std::make_pair(theKey,dat));
261  }
262 
263  if (verboseLevel > 1)
264  G4cout << "Leaving method G4PenelopeIonisationCrossSection::FindShellIDIndex() with index = " << result << G4endl;
265 
266  return result;
267 
268 }
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
Float_t Z
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::map< std::pair< const G4Material *, G4int >, G4DataVector * > * shellIDTable
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Material.hh:178
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCrossSection()

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

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 166 of file G4PenelopeIonisationCrossSection.cc.

170 {
172  std::vector<G4double> vec(nmax,0.0);
173  for(G4int i=0; i<nmax; ++i) {
174  vec[i] = CrossSection(Z, G4AtomicShellEnumerator(i), kinEnergy,0.,mat);
175  }
176  return vec;
177 }
int G4int
Definition: G4Types.hh:78
Float_t Z
const G4int nmax
const G4AtomicTransitionManager * transitionManager
G4double CrossSection(G4int Z, G4AtomicShellEnumerator shell, G4double incidentEnergy, G4double mass, const G4Material *mat)
G4AtomicShellEnumerator
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVerbosityLevel()

G4int G4PenelopeIonisationCrossSection::GetVerbosityLevel ( )
inline

Definition at line 95 of file G4PenelopeIonisationCrossSection.hh.

Here is the call graph for this function:

◆ operator=()

G4PenelopeIonisationCrossSection& G4PenelopeIonisationCrossSection::operator= ( const G4PenelopeIonisationCrossSection right)
private
Here is the caller graph for this function:

◆ Probabilities()

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

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 182 of file G4PenelopeIonisationCrossSection.cc.

187 {
188  std::vector<G4double> vec = GetCrossSection(Z, kinEnergy,0,0,mat);
189  size_t n = vec.size();
190  size_t i=0;
191  G4double sum = 0.0;
192  for(i=0; i<n; ++i) { sum += vec[i]; }
193  if(sum > 0.0) {
194  sum = 1.0/sum;
195  for(i=0; i<n; ++i) { vec[i] = vec[i]*sum; }
196  }
197  return vec;
198 }
Char_t n[5]
Float_t Z
std::vector< G4double > GetCrossSection(G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ SetVerbosityLevel()

void G4PenelopeIonisationCrossSection::SetVerbosityLevel ( G4int  vl)
inline

Getter/setter for the verbosity level.

Definition at line 94 of file G4PenelopeIonisationCrossSection.hh.

Member Data Documentation

◆ fHighEnergyLimit

G4double G4PenelopeIonisationCrossSection::fHighEnergyLimit
private

Definition at line 116 of file G4PenelopeIonisationCrossSection.hh.

◆ fLowEnergyLimit

G4double G4PenelopeIonisationCrossSection::fLowEnergyLimit
private

Definition at line 115 of file G4PenelopeIonisationCrossSection.hh.

◆ nMaxLevels

G4int G4PenelopeIonisationCrossSection::nMaxLevels
private

Definition at line 113 of file G4PenelopeIonisationCrossSection.hh.

◆ oscManager

G4PenelopeOscillatorManager* G4PenelopeIonisationCrossSection::oscManager
private

Definition at line 102 of file G4PenelopeIonisationCrossSection.hh.

◆ shellIDTable

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

Definition at line 111 of file G4PenelopeIonisationCrossSection.hh.

◆ theCrossSectionHandler

G4PenelopeIonisationXSHandler* G4PenelopeIonisationCrossSection::theCrossSectionHandler
private

Definition at line 118 of file G4PenelopeIonisationCrossSection.hh.

◆ transitionManager

const G4AtomicTransitionManager* G4PenelopeIonisationCrossSection::transitionManager
private

Definition at line 119 of file G4PenelopeIonisationCrossSection.hh.

◆ verboseLevel

G4int G4PenelopeIonisationCrossSection::verboseLevel
private

Definition at line 104 of file G4PenelopeIonisationCrossSection.hh.


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