308 G4cout <<
"Calling SampleSecondaries() of G4LivermorePolarizedComptonModel" <<
G4endl;
329 if(!(gammaPolarization0.
isOrthogonal(gammaDirection0, 1
e-6))||(gammaPolarization0.
mag()==0))
355 G4double epsilon0Local = 1./(1. + 2*E0_m);
356 G4double epsilon0Sq = epsilon0Local*epsilon0Local;
357 G4double alpha1 = - std::log(epsilon0Local);
358 G4double alpha2 = 0.5*(1.- epsilon0Sq);
373 epsilon = std::sqrt(epsilonSq);
376 onecost = (1.-
epsilon)/(epsilon*E0_m);
377 sinThetaSqr = onecost*(2.-onecost);
380 if (sinThetaSqr > 1.)
383 <<
" -- Warning -- G4LivermorePolarizedComptonModel::SampleSecondaries " 384 <<
"sin(theta)**2 = " 390 if (sinThetaSqr < 0.)
393 <<
" -- Warning -- G4LivermorePolarizedComptonModel::SampleSecondaries " 394 <<
"sin(theta)**2 = " 402 G4double x = std::sqrt(onecost/2.) / (wlGamma/
cm);;
404 greject = (1. - epsilon*sinThetaSqr/(1.+ epsilonSq))*scatteringFunction;
426 <<
" -- Warning -- G4LivermorePolarizedComptonModel::SampleSecondaries " 436 <<
" -- Warning -- G4LivermorePolarizedComptonModel::SampleSecondaries " 446 G4double sinTheta = std::sqrt (sinThetaSqr);
452 <<
" -- Warning -- G4LivermorePolarizedComptonModel::SampleSecondaries " 462 <<
" -- Warning -- G4LivermorePolarizedComptonModel::SampleSecondaries " 472 G4double dirx = sinTheta*std::cos(phi);
473 G4double diry = sinTheta*std::sin(phi);
486 static G4int maxDopplerIterations = 1000;
488 G4double photonEoriginal = epsilon * gammaEnergy0;
507 G4cout <<
"Shell ID= " << shellIdx
508 <<
" Ebind(keV)= " << bindingE/
keV <<
G4endl;
510 eMax = gammaEnergy0 - bindingE;
520 G4double pDoppler2 = pDoppler * pDoppler;
521 G4double var2 = 1. + onecost * E0_m;
522 G4double var3 = var2*var2 - pDoppler2;
523 G4double var4 = var2 - pDoppler2 * cosTheta;
524 G4double var = var4*var4 - var3 + pDoppler2 * var3;
530 if (
G4UniformRand() < 0.5) photonE = (var4 - varSqrt) * scale;
531 else photonE = (var4 + varSqrt) * scale;
537 }
while ( iteration <= maxDopplerIterations &&
538 (photonE < 0. || photonE > eMax || photonE < eMax*
G4UniformRand()) );
544 if (iteration >= maxDopplerIterations)
546 photonE = photonEoriginal;
550 gammaEnergy1 = photonE;
570 gammaDirection1 = tmpDirection1;
575 gammaPolarization0,gammaPolarization1);
577 if (gammaEnergy1 > 0.)
594 G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 -bindingE;
598 if(ElecKineEnergy < 0.0) {
599 fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy0 - gammaEnergy1);
607 G4ThreeVector ElecDirection((gammaEnergy0 * gammaDirection0 -
608 gammaEnergy1 * gammaDirection1) * (1./ElecMomentum));
611 fvect->push_back(dp);
623 size_t nbefore = fvect->size();
627 size_t nafter = fvect->size();
628 if(nafter > nbefore) {
629 for (
size_t i=nbefore; i<nafter; ++i) {
631 if (bindingE >= ((*fvect)[i])->GetKineticEnergy())
634 bindingE -= ((*fvect)[i])->GetKineticEnergy();
649 G4Exception(
"G4LivermoreComptonModel::SampleSecondaries()",
G4double LowEnergyLimit() const
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
double howOrthogonal(const Hep3Vector &v) const
static G4DopplerProfile * profileData
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
G4double RandomSelectMomentum(G4int Z, G4int shellIndex) const
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4double BindingEnergy(G4int Z, G4int shellIndex) const
G4ThreeVector SetNewPolarization(G4double epsilon, G4double sinSqrTheta, G4double phi, G4double cosTheta)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4ParticleChangeForGamma * fParticleChange
G4ThreeVector GetPerpendicularPolarization(const G4ThreeVector &direction0, const G4ThreeVector &polarization0) const
static G4ShellData * shellData
static G4CompositeEMDataSet * scatterFunctionData
const G4ThreeVector & GetMomentumDirection() const
void GenerateParticles(std::vector< G4DynamicParticle *> *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
const G4ThreeVector & GetPolarization() const
void SystemOfRefChange(G4ThreeVector &direction0, G4ThreeVector &direction1, G4ThreeVector &polarization0, G4ThreeVector &polarization1)
G4double SetPhi(G4double, G4double)
static G4Electron * Electron()
G4ParticleDefinition * GetDefinition() const
G4int SelectRandomShell(G4int Z) const
double epsilon(double density, double temperature)
virtual G4double FindValue(G4double x, G4int componentId=0) const
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4VAtomDeexcitation * fAtomDeexcitation
G4ThreeVector GetRandomPolarization(G4ThreeVector &direction0)