48 :XSTableElectron(0),XSTablePositron(0),
49 theDeltaTable(0),energyGrid(0)
58 std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>;
60 theDeltaTable =
new std::map<const G4Material*,G4PhysicsFreeVector*>;
74 for (
auto& item : (*XSTableElectron))
79 delete XSTableElectron;
80 XSTableElectron =
nullptr;
85 for (
auto& item : (*XSTablePositron))
90 delete XSTablePositron;
91 XSTablePositron =
nullptr;
95 for (
auto& item : (*theDeltaTable))
98 theDeltaTable =
nullptr;
103 if (verboseLevel > 2)
104 G4cout <<
"G4PenelopeIonisationXSHandler. Tables have been cleared"
119 G4Exception(
"G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
126 if (!XSTableElectron)
128 G4Exception(
"G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
130 "The Cross Section Table for e- was not initialized correctly!");
133 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
134 if (XSTableElectron->count(theKey))
135 return XSTableElectron->find(theKey)->second;
142 if (!XSTablePositron)
144 G4Exception(
"G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
146 "The Cross Section Table for e+ was not initialized correctly!");
149 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
150 if (XSTablePositron->count(theKey))
151 return XSTablePositron->find(theKey)->second;
166 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
175 if (verboseLevel > 2)
177 G4cout <<
"G4PenelopeIonisationXSHandler: going to build cross section table " <<
G4endl;
182 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
186 if (XSTableElectron->count(theKey))
191 if (XSTablePositron->count(theKey))
196 if (!(theDeltaTable->count(mat)))
197 BuildDeltaTable(mat);
202 size_t numberOfOscillators = theTable->size();
207 ed <<
"Energy Grid looks not initialized" <<
G4endl;
209 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
223 for (
size_t iosc=0;iosc<numberOfOscillators;iosc++)
230 tempStorage = ComputeShellCrossSectionsElectron(theOsc,energy,cut,delta);
232 tempStorage = ComputeShellCrossSectionsPositron(theOsc,energy,cut,delta);
237 ed <<
"Problem in calculating the shell XS for shell # "
239 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
244 if (tempStorage->size() != 6)
247 ed <<
"Problem in calculating the shell XS " <<
G4endl;
248 ed <<
"Result has dimension " << tempStorage->size() <<
" instead of 6" <<
G4endl;
249 G4Exception(
"G4PenelopeIonisationXSHandler::BuildXSTable()",
254 XH0 += stre*(*tempStorage)[0];
255 XH1 += stre*(*tempStorage)[1];
256 XH2 += stre*(*tempStorage)[2];
257 XS0 += stre*(*tempStorage)[3];
258 XS1 += stre*(*tempStorage)[4];
259 XS2 += stre*(*tempStorage)[5];
274 XSTableElectron->insert(std::make_pair(theKey,XSEntry));
276 XSTablePositron->insert(std::make_pair(theKey,XSEntry));
292 G4Exception(
"G4PenelopeIonisationXSHandler::GetDensityCorrection()",
294 "Delta Table not initialized. Was Initialise() run?");
299 G4cout <<
"G4PenelopeIonisationXSHandler::GetDensityCorrection()" <<
G4endl;
305 if (theDeltaTable->count(mat))
308 result = vec->
Value(logene);
313 ed <<
"Unable to build table for " << mat->
GetName() <<
G4endl;
314 G4Exception(
"G4PenelopeIonisationXSHandler::GetDensityCorrection()",
323 void G4PenelopeIonisationXSHandler::BuildDeltaTable(
const G4Material* mat)
328 size_t numberOfOscillators = theTable->size();
333 ed <<
"Energy Grid for Delta table looks not initialized" <<
G4endl;
335 G4Exception(
"G4PenelopeIonisationXSHandler::BuildDeltaTable()",
351 G4double TST = totalZ/(gamSq*plasmaSq);
356 for (
size_t i=0;i<numberOfOscillators;i++)
375 for (
size_t i=0;i<numberOfOscillators;i++)
391 wl2 = 0.5*(wl2l+wl2u);
393 for (
size_t i=0;i<numberOfOscillators;i++)
403 if ((wl2u-wl2l)>1e-12*wl2)
409 for (
size_t i=0;i<numberOfOscillators;i++)
414 std::log(1.0+(wl2/(wri*wri)));
416 delta = (delta/totalZ)-wl2/(gamSq*plasmaSq);
421 theDeltaTable->insert(std::make_pair(mat,theVector));
440 for (
size_t i=0;i<6;i++)
441 result->push_back(0.);
445 if (energy < ionEnergy)
454 G4double beta = (gammaSq-1.0)/gammaSq;
457 G4double XHDT0 = std::log(gammaSq)-beta;
475 if (resEne > 1e-6*energy)
511 if (wl < wu-(1e-5*
eV))
513 H0 += (1.0/(ee-wu)) - (1.0/(ee-wl)) - (1.0/wu) + (1.0/wl) +
514 (1.0-amol)*std::log(((ee-wu)*wl)/((ee-wl)*wu))/ee +
515 amol*(wu-wl)/(ee*ee);
516 H1 += std::log(wu/wl)+(ee/(ee-wu))-(ee/(ee-wl)) +
517 (2.0-amol)*std::log((ee-wu)/(ee-wl)) +
518 amol*(wu*wu-wl*wl)/(2.0*ee*ee);
519 H2 += (2.0-amol)*(wu-wl)+(wu*(2.0*ee-wu)/(ee-wu)) -
520 (wl*(2.0*ee-wl)/(ee-wl)) +
521 (3.0-amol)*ee*std::log((ee-wu)/(ee-wl)) +
522 amol*(wu*wu*wu-wl*wl*wl)/(3.0*ee*ee);
527 if (wl > wu-(1e-5*
eV))
529 (*result)[0] = constant*H0;
530 (*result)[1] = constant*H1;
531 (*result)[2] = constant*H2;
532 (*result)[3] = constant*S0;
533 (*result)[4] = constant*S1;
534 (*result)[5] = constant*S2;
538 S0 += (1.0/(ee-wu))-(1.0/(ee-wl)) - (1.0/wu) + (1.0/wl) +
539 (1.0-amol)*std::log(((ee-wu)*wl)/((ee-wl)*wu))/ee +
540 amol*(wu-wl)/(ee*ee);
541 S1 += std::log(wu/wl)+(ee/(ee-wu))-(ee/(ee-wl)) +
542 (2.0-amol)*std::log((ee-wu)/(ee-wl)) +
543 amol*(wu*wu-wl*wl)/(2.0*ee*ee);
544 S2 += (2.0-amol)*(wu-wl)+(wu*(2.0*ee-wu)/(ee-wu)) -
545 (wl*(2.0*ee-wl)/(ee-wl)) +
546 (3.0-amol)*ee*std::log((ee-wu)/(ee-wl)) +
547 amol*(wu*wu*wu-wl*wl*wl)/(3.0*ee*ee);
549 (*result)[0] = constant*H0;
550 (*result)[1] = constant*H1;
551 (*result)[2] = constant*H2;
552 (*result)[3] = constant*S0;
553 (*result)[4] = constant*S1;
554 (*result)[5] = constant*S2;
572 for (
size_t i=0;i<6;i++)
573 result->push_back(0.);
577 if (energy < ionEnergy)
586 G4double beta = (gammaSq-1.0)/gammaSq;
589 G4double XHDT0 = std::log(gammaSq)-beta;
594 G4double g12 = (gamma+1.0)*(gamma+1.0);
596 G4double bha1 = amol*(2.0*g12-1.0)/(gammaSq-1.0);
598 G4double bha3 = amol*2.0*gamma*(gamma-1.0)/g12;
599 G4double bha4 = amol*(gamma-1.0)*(gamma-1.0)/g12;
613 if (resEne > 1e-6*energy)
650 if (wl < wu-(1e-5*
eV))
654 H0 += (1.0/wl) - (1.0/wu)- bha1*std::log(wu/wl)/energy
655 + bha2*(wu-wl)/energySq
656 - bha3*(wuSq-wlSq)/(2.0*energySq*
energy)
657 + bha4*(wuSq*wu-wlSq*wl)/(3.0*energySq*energySq);
658 H1 += std::log(wu/wl) - bha1*(wu-wl)/energy
659 + bha2*(wuSq-wlSq)/(2.0*energySq)
660 - bha3*(wuSq*wu-wlSq*wl)/(3.0*energySq*
energy)
661 + bha4*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*energySq);
662 H2 += wu - wl - bha1*(wuSq-wlSq)/(2.0*energy)
663 + bha2*(wuSq*wu-wlSq*wl)/(3.0*energySq)
664 - bha3*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*energy)
665 + bha4*(wuSq*wuSq*wu-wlSq*wlSq*wl)/(5.0*energySq*energySq);
670 if (wl > wu-(1e-5*
eV))
672 (*result)[0] = constant*H0;
673 (*result)[1] = constant*H1;
674 (*result)[2] = constant*H2;
675 (*result)[3] = constant*S0;
676 (*result)[4] = constant*S1;
677 (*result)[5] = constant*S2;
684 S0 += (1.0/wl) - (1.0/wu) - bha1*std::log(wu/wl)/energy
685 + bha2*(wu-wl)/energySq
686 - bha3*(wuSq-wlSq)/(2.0*energySq*
energy)
687 + bha4*(wuSq*wu-wlSq*wl)/(3.0*energySq*energySq);
689 S1 += std::log(wu/wl) - bha1*(wu-wl)/energy
690 + bha2*(wuSq-wlSq)/(2.0*energySq)
691 - bha3*(wuSq*wu-wlSq*wl)/(3.0*energySq*
energy)
692 + bha4*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*energySq);
694 S2 += wu - wl - bha1*(wuSq-wlSq)/(2.0*energy)
695 + bha2*(wuSq*wu-wlSq*wl)/(3.0*energySq)
696 - bha3*(wuSq*wuSq-wlSq*wlSq)/(4.0*energySq*energy)
697 + bha4*(wuSq*wuSq*wu-wlSq*wlSq*wl)/(5.0*energySq*energySq);
699 (*result)[0] = constant*H0;
700 (*result)[1] = constant*H1;
701 (*result)[2] = constant*H2;
702 (*result)[3] = constant*S0;
703 (*result)[4] = constant*S1;
704 (*result)[5] = constant*S2;
G4double G4ParticleHPJENDLHEData::G4double result
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
G4double GetIonisationEnergy()
std::ostringstream G4ExceptionDescription
G4double GetPlasmaEnergySquared(const G4Material *)
Returns the squared plasma energy.
const G4String & GetName() const
void PutValue(size_t index, G4double energy, G4double dataValue)
void AddShellCrossSectionPoint(size_t binNumber, size_t shellID, G4double energy, G4double xs)
const G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, const G4double cut) const
size_t GetVectorLength() const
G4double GetCutoffRecoilResonantEnergy()
G4double GetLowEdgeEnergy(size_t binNumber) const
const G4String & GetParticleName() const
G4double GetOscillatorStrength()
void AddCrossSectionPoint(size_t binNumber, G4double energy, G4double XH0, G4double XH1, G4double XH2, G4double XS0, G4double XS1, G4double XS2)
G4GLOB_DLL std::ostream G4cout
G4PenelopeIonisationXSHandler(size_t nBins=200)
static constexpr double eV
static G4PenelopeOscillatorManager * GetOscillatorManager()
G4double GetResonanceEnergy() const
G4double Value(G4double theEnergy, size_t &lastidx) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4Positron * Positron()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double energy(const ThreeVector &p, const G4double m)
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
G4double GetDensityCorrection(const G4Material *, const G4double energy) const
Returns the density coeection for the material at the given energy.
static constexpr double GeV
static G4Electron * Electron()
static constexpr double pi
void NormalizeShellCrossSections()
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
static constexpr double keV
G4double GetTotalZ(const G4Material *)
virtual ~G4PenelopeIonisationXSHandler()
Destructor. Clean all tables.