47 :fXSTableElectron(nullptr),fXSTablePositron(nullptr),
48 fDeltaTable(nullptr),fEnergyGrid(nullptr)
59 fDeltaTable =
new std::map<const G4Material*,G4PhysicsFreeVector*>;
102 G4cout <<
"G4PenelopeIonisationXSHandler. Tables have been cleared"
117 G4Exception(
"G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
126 G4Exception(
"G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
128 "The Cross Section Table for e- was not initialized correctly!");
131 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
142 G4Exception(
"G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
144 "The Cross Section Table for e+ was not initialized correctly!");
147 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
164 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
175 G4cout <<
"G4PenelopeIonisationXSHandler: going to build cross section table " <<
G4endl;
180 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
200 size_t numberOfOscillators = theTable->size();
205 ed <<
"Energy Grid looks not initialized" <<
G4endl;
207 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
214 for (
size_t bin=0;bin<
fNBins;bin++)
221 for (
size_t iosc=0;iosc<numberOfOscillators;iosc++)
235 ed <<
"Problem in calculating the shell XS for shell # "
237 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
242 if (tempStorage->size() != 6)
245 ed <<
"Problem in calculating the shell XS " <<
G4endl;
246 ed <<
"Result has dimension " << tempStorage->size() <<
" instead of 6" <<
G4endl;
247 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
252 XH0 += stre*(*tempStorage)[0];
253 XH1 += stre*(*tempStorage)[1];
254 XH2 += stre*(*tempStorage)[2];
255 XS0 += stre*(*tempStorage)[3];
256 XS1 += stre*(*tempStorage)[4];
257 XS2 += stre*(*tempStorage)[5];
262 tempStorage =
nullptr;
290 G4Exception(
"G4PenelopeIonisationXSHandler::GetDensityCorrection()",
292 "Delta Table not initialized. Was Initialise() run?");
297 G4cout <<
"G4PenelopeIonisationXSHandler::GetDensityCorrection()" <<
G4endl;
306 result = vec->
Value(logene);
311 ed <<
"Unable to build table for " << mat->
GetName() <<
G4endl;
312 G4Exception(
"G4PenelopeIonisationXSHandler::GetDensityCorrection()",
326 size_t numberOfOscillators = theTable->size();
331 ed <<
"Energy Grid for Delta table looks not initialized" <<
G4endl;
333 G4Exception(
"G4PenelopeIonisationXSHandler::BuildDeltaTable()",
340 for (
size_t bin=0;bin<
fNBins;bin++)
349 G4double TST = totalZ/(gamSq*plasmaSq);
354 for (
size_t i=0;i<numberOfOscillators;i++)
373 for (
size_t i=0;i<numberOfOscillators;i++)
389 wl2 = 0.5*(wl2l+wl2u);
391 for (
size_t i=0;i<numberOfOscillators;i++)
401 if ((wl2u-wl2l)>1e-12*wl2)
407 for (
size_t i=0;i<numberOfOscillators;i++)
412 G4Log(1.0+(wl2/(wri*wri)));
414 delta = (delta/totalZ)-wl2/(gamSq*plasmaSq);
419 fDeltaTable->insert(std::make_pair(mat,theVector));
438 for (
size_t i=0;i<6;i++)
439 result->push_back(0.);
509 if (wl < wu-(1e-5*
eV))
511 H0 += (1.0/(ee-wu)) - (1.0/(ee-wl)) - (1.0/wu) + (1.0/wl) +
512 (1.0-amol)*
G4Log(((ee-wu)*wl)/((ee-wl)*wu))/ee +
513 amol*(wu-wl)/(ee*ee);
514 H1 +=
G4Log(wu/wl)+(ee/(ee-wu))-(ee/(ee-wl)) +
515 (2.0-amol)*
G4Log((ee-wu)/(ee-wl)) +
516 amol*(wu*wu-wl*wl)/(2.0*ee*ee);
517 H2 += (2.0-amol)*(wu-wl)+(wu*(2.0*ee-wu)/(ee-wu)) -
518 (wl*(2.0*ee-wl)/(ee-wl)) +
519 (3.0-amol)*ee*
G4Log((ee-wu)/(ee-wl)) +
520 amol*(wu*wu*wu-wl*wl*wl)/(3.0*ee*ee);
525 if (wl > wu-(1e-5*
eV))
527 (*result)[0] = constant*H0;
528 (*result)[1] = constant*H1;
529 (*result)[2] = constant*H2;
530 (*result)[3] = constant*S0;
531 (*result)[4] = constant*S1;
532 (*result)[5] = constant*S2;
536 S0 += (1.0/(ee-wu))-(1.0/(ee-wl)) - (1.0/wu) + (1.0/wl) +
537 (1.0-amol)*
G4Log(((ee-wu)*wl)/((ee-wl)*wu))/ee +
538 amol*(wu-wl)/(ee*ee);
539 S1 +=
G4Log(wu/wl)+(ee/(ee-wu))-(ee/(ee-wl)) +
540 (2.0-amol)*
G4Log((ee-wu)/(ee-wl)) +
541 amol*(wu*wu-wl*wl)/(2.0*ee*ee);
542 S2 += (2.0-amol)*(wu-wl)+(wu*(2.0*ee-wu)/(ee-wu)) -
543 (wl*(2.0*ee-wl)/(ee-wl)) +
544 (3.0-amol)*ee*
G4Log((ee-wu)/(ee-wl)) +
545 amol*(wu*wu*wu-wl*wl*wl)/(3.0*ee*ee);
547 (*result)[0] = constant*H0;
548 (*result)[1] = constant*H1;
549 (*result)[2] = constant*H2;
550 (*result)[3] = constant*S0;
551 (*result)[4] = constant*S1;
552 (*result)[5] = constant*S2;
570 for (
size_t i=0;i<6;i++)
571 result->push_back(0.);
592 G4double g12 = (gamma+1.0)*(gamma+1.0);
594 G4double bha1 = amol*(2.0*g12-1.0)/(gammaSq-1.0);
596 G4double bha3 = amol*2.0*gamma*(gamma-1.0)/g12;
597 G4double bha4 = amol*(gamma-1.0)*(gamma-1.0)/g12;
647 if (wl < wu-(1e-5*
eV))
651 H0 += (1.0/wl) - (1.0/wu)- bha1*
G4Log(wu/wl)/
energy
652 + bha2*(wu-wl)/energySq
653 - bha3*(wuSq-wlSq)/(2.0*energySq*
energy)
654 + bha4*(wuSq*wu-wlSq*wl)/(3.0*energySq*energySq);
656 + bha2*(wuSq-wlSq)/(2.0*energySq)
657 - bha3*(wuSq*wu-wlSq*wl)/(3.0*energySq*
energy)
658 + bha4*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*energySq);
659 H2 += wu - wl - bha1*(wuSq-wlSq)/(2.0*
energy)
660 + bha2*(wuSq*wu-wlSq*wl)/(3.0*energySq)
661 - bha3*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*
energy)
662 + bha4*(wuSq*wuSq*wu-wlSq*wlSq*wl)/(5.0*energySq*energySq);
667 if (wl > wu-(1e-5*
eV))
669 (*result)[0] = constant*H0;
670 (*result)[1] = constant*H1;
671 (*result)[2] = constant*H2;
672 (*result)[3] = constant*S0;
673 (*result)[4] = constant*S1;
674 (*result)[5] = constant*S2;
681 S0 += (1.0/wl) - (1.0/wu) - bha1*
G4Log(wu/wl)/
energy
682 + bha2*(wu-wl)/energySq
683 - bha3*(wuSq-wlSq)/(2.0*energySq*
energy)
684 + bha4*(wuSq*wu-wlSq*wl)/(3.0*energySq*energySq);
687 + bha2*(wuSq-wlSq)/(2.0*energySq)
688 - bha3*(wuSq*wu-wlSq*wl)/(3.0*energySq*
energy)
689 + bha4*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*energySq);
691 S2 += wu - wl - bha1*(wuSq-wlSq)/(2.0*
energy)
692 + bha2*(wuSq*wu-wlSq*wl)/(3.0*energySq)
693 - bha3*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*
energy)
694 + bha4*(wuSq*wuSq*wu-wlSq*wlSq*wl)/(5.0*energySq*energySq);
696 (*result)[0] = constant*H0;
697 (*result)[1] = constant*H1;
698 (*result)[2] = constant*H2;
699 (*result)[3] = constant*S0;
700 (*result)[4] = constant*S1;
701 (*result)[5] = constant*S2;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Log(G4double x)
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
static constexpr double keV
static constexpr double eV
static constexpr double GeV
static constexpr double pi
G4GLOB_DLL std::ostream G4cout
static G4Electron * Electron()
const G4String & GetName() const
const G4String & GetParticleName() const
void AddShellCrossSectionPoint(size_t binNumber, size_t shellID, G4double energy, G4double xs)
void NormalizeShellCrossSections()
void AddCrossSectionPoint(size_t binNumber, G4double energy, G4double XH0, G4double XH1, G4double XH2, G4double XS0, G4double XS1, G4double XS2)
G4double GetDensityCorrection(const G4Material *, const G4double energy) const
Returns the density coeection for the material at the given energy.
G4PenelopeIonisationXSHandler(size_t nBins=200)
virtual ~G4PenelopeIonisationXSHandler()
Destructor. Clean all tables.
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
std::map< std::pair< const G4Material *, G4double >, G4PenelopeCrossSection * > * fXSTablePositron
G4PhysicsLogVector * fEnergyGrid
G4DataVector * ComputeShellCrossSectionsPositron(G4PenelopeOscillator *, G4double energy, G4double cut, G4double delta)
const G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, const G4double cut) const
G4PenelopeOscillatorManager * fOscManager
std::map< std::pair< const G4Material *, G4double >, G4PenelopeCrossSection * > * fXSTableElectron
void BuildDeltaTable(const G4Material *)
std::map< const G4Material *, G4PhysicsFreeVector * > * fDeltaTable
G4DataVector * ComputeShellCrossSectionsElectron(G4PenelopeOscillator *, G4double energy, G4double cut, G4double delta)
static G4PenelopeOscillatorManager * GetOscillatorManager()
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
G4double GetPlasmaEnergySquared(const G4Material *)
Returns the squared plasma energy.
G4double GetTotalZ(const G4Material *)
G4double GetIonisationEnergy()
G4double GetResonanceEnergy() const
G4double GetCutoffRecoilResonantEnergy()
G4double GetOscillatorStrength()
void PutValue(const std::size_t index, const G4double e, const G4double value)
G4double GetLowEdgeEnergy(const std::size_t index) const
G4double Value(const G4double energy, std::size_t &lastidx) const
std::size_t GetVectorLength() const
static G4Positron * Positron()
G4double energy(const ThreeVector &p, const G4double m)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
int classic_electr_radius