45 numberOfEnergyPoints(nPointsE),numberOfShells(nShells),softCrossSections(0),
46 hardCrossSections(0),shellCrossSections(0),shellNormalizedCrossSections(0)
49 if (!numberOfEnergyPoints)
52 ed <<
"G4PenelopeCrossSection: invalid number of energy points " <<
G4endl;
53 G4Exception(
"G4PenelopeCrossSection::G4PenelopeCrossSection()",
67 for (
size_t i=0;i<3;i++)
78 for (
size_t i=0;i<3;i++)
88 for (
size_t i=0;i<numberOfShells;i++)
100 if (shellCrossSections)
103 delete shellCrossSections;
105 if (shellNormalizedCrossSections)
108 delete shellNormalizedCrossSections;
110 if (softCrossSections)
113 delete softCrossSections;
115 if (hardCrossSections)
118 delete hardCrossSections;
129 if (!softCrossSections || !hardCrossSections)
131 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddCrossSectionPoint" <<
133 G4cout <<
"Trying to fill un-initialized tables" <<
G4endl;
140 if (binNumber >= numberOfEnergyPoints)
142 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddCrossSectionPoint" <<
144 G4cout <<
"Trying to register more points than originally declared" <<
G4endl;
150 G4double val = std::log(std::max(XS0,1e-42*cm2));
151 theVector->
PutValue(binNumber,logEne,val);
155 val = std::log(std::max(XS1,1e-42*eV*cm2));
156 theVector->
PutValue(binNumber,logEne,val);
160 val = std::log(std::max(XS2,1e-42*eV*eV*cm2));
161 theVector->
PutValue(binNumber,logEne,val);
165 val = std::log(std::max(XH0,1e-42*cm2));
166 theVector->
PutValue(binNumber,logEne,val);
170 val = std::log(std::max(XH1,1e-42*eV*cm2));
171 theVector->
PutValue(binNumber,logEne,val);
175 val = std::log(std::max(XH2,1e-42*eV*eV*cm2));
176 theVector->
PutValue(binNumber,logEne,val);
188 if (!shellCrossSections)
190 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddShellCrossSectionPoint" <<
192 G4cout <<
"Trying to fill un-initialized table" <<
G4endl;
196 if (shellID >= numberOfShells)
198 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddShellCrossSectionPoint" <<
200 G4cout <<
"Trying to fill shell #" << shellID <<
" while the maximum is "
201 << numberOfShells-1 <<
G4endl;
208 if (binNumber >= numberOfEnergyPoints)
210 G4cout <<
"Something wrong in G4PenelopeCrossSection::AddShellCrossSectionPoint" <<
212 G4cout <<
"Trying to register more points than originally declared" <<
G4endl;
216 G4double val = std::log(std::max(xs,1e-42*cm2));
217 theVector->
PutValue(binNumber,logEne,val);
228 if (!softCrossSections || !hardCrossSections)
230 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetTotalCrossSection" <<
232 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
240 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetTotalCrossSection" <<
242 G4cout <<
"Soft cross section table looks not filled" <<
G4endl;
253 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetTotalCrossSection" <<
255 G4cout <<
"Hard cross section table looks not filled" <<
G4endl;
258 logXS = theVector->
Value(logene);
261 result = hardXS + softXS;
272 if (!hardCrossSections)
274 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetHardCrossSection" <<
276 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
283 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetHardCrossSection" <<
285 G4cout <<
"Hard cross section table looks not filled" <<
G4endl;
290 result = std::exp(logXS);
302 if (!softCrossSections)
304 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetSoftStoppingPower" <<
306 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
313 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetSoftStoppingPower" <<
315 G4cout <<
"Soft cross section table looks not filled" <<
G4endl;
320 result = std::exp(logXS);
330 if (!shellCrossSections)
332 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
334 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
337 if (shellID >= numberOfShells)
339 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
341 G4cout <<
"Trying to retrieve shell #" << shellID <<
" while the maximum is "
342 << numberOfShells-1 <<
G4endl;
350 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
352 G4cout <<
"Shell cross section table looks not filled" <<
G4endl;
357 result = std::exp(logXS);
366 if (!shellNormalizedCrossSections)
368 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
370 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
375 NormalizeShellCrossSections();
377 if (shellID >= numberOfShells)
379 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
381 G4cout <<
"Trying to retrieve shell #" << shellID <<
" while the maximum is "
382 << numberOfShells-1 <<
G4endl;
390 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
392 G4cout <<
"Shell cross section table looks not filled" <<
G4endl;
397 result = std::exp(logXS);
406void G4PenelopeCrossSection::NormalizeShellCrossSections()
410 G4cout <<
"G4PenelopeCrossSection::NormalizeShellCrossSections()" <<
G4endl;
415 if (!shellNormalizedCrossSections)
417 G4cout <<
"Something wrong in G4PenelopeCrossSection::GetShellCrossSection" <<
419 G4cout <<
"Trying to retrieve from un-initialized tables" <<
G4endl;
423 for (
size_t i=0;i<numberOfEnergyPoints;i++)
430 for (
size_t shellID=0;shellID<numberOfShells;shellID++)
435 normFactor += std::exp((*theVec)[i]);
437 G4double logNormFactor = std::log(normFactor);
439 for (
size_t shellID=0;shellID<numberOfShells;shellID++)
445 G4double previousValue = (*theFullVec)[i];
448 theVec->
PutValue(i,logEnergy,previousValue-logNormFactor);
G4DLLIMPORT std::ostream G4cout
void AddShellCrossSectionPoint(size_t binNumber, size_t shellID, G4double energy, G4double xs)
G4double GetSoftStoppingPower(G4double energy)
Returns the total stopping power due to soft collisions.
G4double GetShellCrossSection(size_t shellID, G4double energy)
Returns the hard cross section for the given shell (per molecule)
G4double GetHardCrossSection(G4double energy)
Returns hard cross section at the given energy.
G4double GetTotalCrossSection(G4double energy)
Returns total cross section at the given energy.
G4double GetNormalizedShellCrossSection(size_t shellID, G4double energy)
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 PutValue(size_t binNumber, G4double binValue, G4double dataValue)
void push_back(G4PhysicsVector *)
G4double Value(G4double theEnergy)
size_t GetVectorLength() const
virtual G4double GetLowEdgeEnergy(size_t binNumber) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription