46 fSoftCrossSections(nullptr),
47 fHardCrossSections(nullptr),fShellCrossSections(nullptr),
48 fShellNormalizedCrossSections(nullptr),
49 fNumberOfEnergyPoints(nPointsE),fNumberOfShells(nShells)
52 if (!fNumberOfEnergyPoints)
55 ed <<
"G4PenelopeCrossSection: invalid number of energy points " <<
G4endl;
56 G4Exception(
"G4PenelopeCrossSection::G4PenelopeCrossSection()",
60 fIsNormalized =
false;
70 for (
size_t i=0;i<3;i++)
81 for (
size_t i=0;i<3;i++)
91 for (
size_t i=0;i<fNumberOfShells;i++)
103 if (fShellCrossSections)
106 delete fShellCrossSections;
108 if (fShellNormalizedCrossSections)
111 delete fShellNormalizedCrossSections;
113 if (fSoftCrossSections)
116 delete fSoftCrossSections;
118 if (fHardCrossSections)
121 delete fHardCrossSections;
132 if (!fSoftCrossSections || !fHardCrossSections)
134 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddCrossSectionPoint" <<
136 G4cout <<
"Trying to fill un-initialized tables" <<
G4endl;
143 if (binNumber >= fNumberOfEnergyPoints)
145 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddCrossSectionPoint" <<
147 G4cout <<
"Trying to register more points than originally declared" <<
G4endl;
154 theVector->
PutValues(binNumber,logEne,val);
158 val =
G4Log(std::max(XS1,1e-42*eV*cm2));
159 theVector->
PutValues(binNumber,logEne,val);
163 val =
G4Log(std::max(XS2,1e-42*eV*eV*cm2));
164 theVector->
PutValues(binNumber,logEne,val);
168 val =
G4Log(std::max(XH0,1e-42*cm2));
169 theVector->
PutValues(binNumber,logEne,val);
173 val =
G4Log(std::max(XH1,1e-42*eV*cm2));
174 theVector->
PutValues(binNumber,logEne,val);
178 val =
G4Log(std::max(XH2,1e-42*eV*eV*cm2));
179 theVector->
PutValues(binNumber,logEne,val);
191 if (!fShellCrossSections)
193 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddShellCrossSectionPoint" <<
195 G4cout <<
"Trying to fill un-initialized table" <<
G4endl;
199 if (shellID >= fNumberOfShells)
201 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddShellCrossSectionPoint" <<
203 G4cout <<
"Trying to fill shell #" << shellID <<
" while the maximum is "
204 << fNumberOfShells-1 <<
G4endl;
211 if (binNumber >= fNumberOfEnergyPoints)
213 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddShellCrossSectionPoint" <<
215 G4cout <<
"Trying to register more points than originally declared" <<
G4endl;
220 theVector->
PutValues(binNumber,logEne,val);
231 if (!fSoftCrossSections || !fHardCrossSections)
233 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetTotalCrossSection" <<
235 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
243 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetTotalCrossSection" <<
245 G4cout <<
"Soft cross section table looks not filled" <<
G4endl;
256 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetTotalCrossSection" <<
258 G4cout <<
"Hard cross section table looks not filled" <<
G4endl;
261 logXS = theVector->
Value(logene);
264 result = hardXS + softXS;
274 if (!fHardCrossSections)
276 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetHardCrossSection" <<
278 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
285 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetHardCrossSection" <<
287 G4cout <<
"Hard cross section table looks not filled" <<
G4endl;
292 result =
G4Exp(logXS);
303 if (!fSoftCrossSections)
305 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetSoftStoppingPower" <<
307 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
314 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetSoftStoppingPower" <<
316 G4cout <<
"Soft cross section table looks not filled" <<
G4endl;
321 result =
G4Exp(logXS);
331 if (!fShellCrossSections)
333 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
335 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
338 if (shellID >= fNumberOfShells)
340 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
342 G4cout <<
"Trying to retrieve shell #" << shellID <<
" while the maximum is "
343 << fNumberOfShells-1 <<
G4endl;
351 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
353 G4cout <<
"Shell cross section table looks not filled" <<
G4endl;
358 result =
G4Exp(logXS);
367 if (!fShellNormalizedCrossSections)
369 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
371 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
377 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
G4endl;
378 G4cout <<
"The table of normalized cross section is not initialized" <<
G4endl;
381 if (shellID >= fNumberOfShells)
383 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
385 G4cout <<
"Trying to retrieve shell #" << shellID <<
" while the maximum is "
386 << fNumberOfShells-1 <<
G4endl;
395 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
397 G4cout <<
"Shell cross section table looks not filled" <<
G4endl;
402 result =
G4Exp(logXS);
413 G4cout <<
"G4PenelopeCrossSection::NormalizeShellCrossSections()" <<
G4endl;
418 if (!fShellNormalizedCrossSections)
420 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
422 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
426 for (
size_t i=0;i<fNumberOfEnergyPoints;i++)
433 for (
size_t shellID=0;shellID<fNumberOfShells;shellID++)
438 normFactor +=
G4Exp((*theVec)[i]);
442 for (
size_t shellID=0;shellID<fNumberOfShells;shellID++)
448 G4double previousValue = (*theFullVec)[i];
451 theVec->
PutValues(i,logEnergy,previousValue-logNormFactor);
454 fIsNormalized =
true;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
void AddShellCrossSectionPoint(size_t binNumber, size_t shellID, G4double energy, G4double xs)
G4double GetTotalCrossSection(G4double energy) const
Returns total cross section at the given energy.
G4double GetSoftStoppingPower(G4double energy) const
Returns the total stopping power due to soft collisions.
G4double GetShellCrossSection(size_t shellID, G4double energy) const
Returns the hard cross section for the given shell (per molecule)
G4double GetHardCrossSection(G4double energy) const
Returns hard cross section at the given energy.
void NormalizeShellCrossSections()
G4double GetNormalizedShellCrossSection(size_t shellID, G4double energy) const
Returns the hard cross section for the given shell (normalized to 1)
~G4PenelopeCrossSection()
void AddCrossSectionPoint(size_t binNumber, G4double energy, G4double XH0, G4double XH1, G4double XH2, G4double XS0, G4double XS1, G4double XS2)
G4PenelopeCrossSection(size_t nOfEnergyPoints, size_t nOfShells=0)
void PutValues(const std::size_t index, const G4double energy, const G4double value)
void push_back(G4PhysicsVector *)
G4double GetLowEdgeEnergy(const std::size_t index) const
G4double Value(const G4double energy, std::size_t &lastidx) const
std::size_t GetVectorLength() const