294 G4double g4d_limit = std::pow(10.,-g4d_order);
313 if (verboseLevel > 3) {
314 G4cout <<
"G4LowEPPolarizedComptonModel::SampleSecondaries() E(MeV)= "
334 if (!(photonPolarization0.
isOrthogonal(photonDirection0, 1e-6))||(photonPolarization0.
mag()==0))
336 photonPolarization0 = GetRandomPolarization(photonDirection0);
341 if ((photonPolarization0.
howOrthogonal(photonDirection0) !=0) && (photonPolarization0.
howOrthogonal(photonDirection0) > g4d_limit))
343 photonPolarization0 = GetPerpendicularPolarization(photonDirection0,photonPolarization0);
353 G4double LowEPPCepsilon0 = 1. / (1. + 2. * e0m);
354 G4double LowEPPCepsilon0Sq = LowEPPCepsilon0 * LowEPPCepsilon0;
355 G4double alpha1 = -std::log(LowEPPCepsilon0);
356 G4double alpha2 = 0.5 * (1. - LowEPPCepsilon0Sq);
367 if (verboseLevel > 3) {
368 G4cout <<
"Started loop to sample gamma energy" <<
G4endl;
376 LowEPPCepsilonSq = LowEPPCepsilon * LowEPPCepsilon;
380 LowEPPCepsilonSq = LowEPPCepsilon0Sq + (1. - LowEPPCepsilon0Sq) *
G4UniformRand();
381 LowEPPCepsilon = std::sqrt(LowEPPCepsilonSq);
384 oneCosT = (1. - LowEPPCepsilon) / ( LowEPPCepsilon * e0m);
385 sinT2 = oneCosT * (2. - oneCosT);
386 G4double x = std::sqrt(oneCosT/2.) / (wlPhoton/
cm);
387 G4double scatteringFunction = ComputeScatteringFunction(x, Z);
388 gReject = (1. - LowEPPCepsilon * sinT2 / (1. + LowEPPCepsilonSq)) * scatteringFunction;
393 G4double sinTheta = std::sqrt(sinT2);
394 G4double phi = SetPhi(LowEPPCepsilon,sinT2);
395 G4double dirx = sinTheta * std::cos(phi);
396 G4double diry = sinTheta * std::sin(phi);
401 G4ThreeVector photonPolarization1 = SetNewPolarization(LowEPPCepsilon,
417 const G4int maxDopplerIterations = 1000;
419 G4double pEIncident = photonEnergy0 ;
434 if (verboseLevel > 3) {
435 G4cout <<
"Started loop to sample photon energy and electron direction" <<
G4endl;
464 G4double ePSI = ePAU * momentum_au_to_nat;
467 u_temp = sqrt( ((ePSI*ePSI)*(vel_c*vel_c)) / ((e_mass_kg*e_mass_kg)*(vel_c*vel_c)+(ePSI*ePSI)) )/vel_c;
477 G4double systemE = eEIncident + pEIncident;
480 G4double gamma_temp = 1.0 / sqrt( 1 - (u_temp*u_temp));
482 G4double subdenom1 = u_temp*cosTheta*std::cos(e_alpha);
483 G4double subdenom2 = u_temp*sinTheta*std::sin(e_alpha)*std::cos(e_beta);
485 pERecoil = (numerator/denominator);
486 eERecoil = systemE - pERecoil;
487 CE_emission_flag = pEIncident - pERecoil;
488 }
while ( (iteration <= maxDopplerIterations) && (CE_emission_flag < bindingE));
501 G4double u_p_temp = sqrt(1 - (1 / (a_temp*a_temp)));
505 G4double sinAlpha = std::sin(e_alpha);
506 G4double cosAlpha = std::cos(e_alpha);
507 G4double sinBeta = std::sin(e_beta);
508 G4double cosBeta = std::cos(e_beta);
510 G4double gamma = 1.0 / sqrt(1 - (u_temp*u_temp));
511 G4double gamma_p = 1.0 / sqrt(1 - (u_p_temp*u_p_temp));
513 G4double var_A = pERecoil*u_p_temp*sinTheta;
514 G4double var_B = u_p_temp* (pERecoil*cosTheta-pEIncident);
518 G4double var_D2 = (1 - (u_temp*cosTheta*cosAlpha) - (u_temp*sinTheta*cosBeta*sinAlpha));
520 G4double var_D = var_D1*var_D2 + var_D3;
523 G4double var_E2 = gamma_p*electron_mass_c2*pERecoil*u_p_temp*cosTheta;
526 G4double var_F1 = ((gamma*gamma_p)*(electron_mass_c2*electron_mass_c2)*(u_temp*u_p_temp)*cosBeta*sinAlpha);
527 G4double var_F2 = (gamma_p*electron_mass_c2*pERecoil*u_p_temp*sinTheta);
530 G4double var_G = (gamma*gamma_p)*(electron_mass_c2*electron_mass_c2)*(u_temp*u_p_temp)*sinBeta*sinAlpha;
535 G4double var_W1 = (var_F*var_B - var_E*var_A)*(var_F*var_B - var_E*var_A);
536 G4double var_W2 = (var_G*var_G)*(var_A*var_A) + (var_G*var_G)*(var_B*var_B);
539 G4double var_Y = 2.0*(((var_A*var_D-var_F*var_C)*(var_F*var_B-var_E*var_A)) - ((var_G*var_G)*var_B*var_C));
541 G4double var_Z1 = (var_A*var_D - var_F*var_C)*(var_A*var_D - var_F*var_C);
542 G4double var_Z2 = (var_G*var_G)*(var_C*var_C) - (var_G*var_G)*(var_A*var_A);
554 if ((diff < 0.0) && (abs(diff / diff1) < g4d_limit) && (abs(diff / diff2) < g4d_limit) )
561 G4double X_p = (-var_Y + sqrt (diff))/(2*var_W);
562 G4double X_m = (-var_Y - sqrt (diff))/(2*var_W);
569 if (sol_select < 0.5)
571 ThetaE = std::acos(X_p);
573 if (sol_select > 0.5)
575 ThetaE = std::acos(X_m);
578 cosThetaE = std::cos(ThetaE);
579 sinThetaE = std::sin(ThetaE);
580 G4double Theta = std::acos(cosTheta);
583 G4double iSinThetaE = std::sqrt(1+std::tan((
pi/2.0)-ThetaE)*std::tan((
pi/2.0)-ThetaE));
584 G4double iSinTheta = std::sqrt(1+std::tan((
pi/2.0)-Theta)*std::tan((
pi/2.0)-Theta));
585 G4double ivar_A = iSinTheta/ (pERecoil*u_p_temp);
587 cosPhiE = (var_C - var_B*cosThetaE)*(ivar_A*iSinThetaE);
593 }
while ( (iteration <= maxDopplerIterations) && (abs(cosPhiE) > 1));
596 if (iteration >= maxDopplerIterations)
598 pERecoil = photonEnergy0 ;
608 photonDirection1.rotateUz(photonDirection0);
609 photonPolarization1.
rotateUz(photonDirection0);
618 G4double eDirX = sinThetaE * std::cos(phi+PhiE);
619 G4double eDirY = sinThetaE * std::sin(phi+PhiE);
622 G4double eKineticEnergy = pEIncident - pERecoil - bindingE;
625 eDirection.rotateUz(photonDirection0);
627 eDirection,eKineticEnergy) ;
628 fvect->push_back(dp);
640 if (verboseLevel > 3) {
641 G4cout <<
"Started atomic de-excitation " << fAtomDeexcitation <<
G4endl;
644 if(fAtomDeexcitation && iteration < maxDopplerIterations) {
647 size_t nbefore = fvect->size();
651 size_t nafter = fvect->size();
652 if(nafter > nbefore) {
653 for (
size_t i=nbefore; i<nafter; ++i) {
655 if (bindingE >= ((*fvect)[i])->GetKineticEnergy())
658 bindingE -= ((*fvect)[i])->GetKineticEnergy();
674 G4Exception(
"G4LowEPPolarizedComptonModel::SampleSecondaries()",
G4double LowEnergyLimit() const
static constexpr double h_Planck
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
G4double GetKineticEnergy() const
static constexpr double Bohr_radius
const G4String & GetName() const
G4ParticleDefinition * GetDefinition() const
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4int SelectRandomShell(G4int Z) const
double howOrthogonal(const Hep3Vector &v) const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
static constexpr double twopi
static constexpr double electron_mass_c2
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
G4GLOB_DLL std::ostream G4cout
static constexpr double m
const G4ThreeVector & GetMomentumDirection() const
G4double BindingEnergy(G4int Z, G4int shellIndex) const
static constexpr double cm
Hep3Vector & rotateUz(const Hep3Vector &)
void ProposePolarization(const G4ThreeVector &dir)
static constexpr double kg
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static constexpr double c_squared
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static constexpr double c_light
const G4ThreeVector & GetPolarization() const
static G4Electron * Electron()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
static constexpr double MeV
static constexpr double pi
static constexpr double halfpi
void ProposeTrackStatus(G4TrackStatus status)
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
static constexpr double hbar_Planck
G4double RandomSelectMomentum(G4int Z, G4int shellIndex) const
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
const G4Material * GetMaterial() const