97 asymmetry *= (k0 + 1.)*
sqr(k1)*
G4Log(k1) - 2.*k0*(5.*
sqr(k0) + 4.*k0 + 1.);
98 asymmetry /= ((k0 - 2.)*k0 -2.)*
sqr(k1)*
G4Log(k1) + 2.*k0*(k0*(k0 + 1.)*(k0 + 8.) + 2.);
101 if (asymmetry>1.)
G4cout<<
"ERROR in G4PolarizedComptonModel::ComputeAsymmetryPerAtom"<<
G4endl;
121 xs *= (1.+polzz*asym);
129 std::vector<G4DynamicParticle*>* fvect,
142 G4cout<<
"G4PolarizedComptonModel::SampleSecondaries in "
165 if (targetIsPolarized) {
191 G4double alpha2 = alpha1 + 0.5*(1.- epsilon0sq);
207 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
208 "too many iterations");
215 if ( alpha1 > alpha2*rndm[0]) {
216 epsilon =
G4Exp(-alpha1*rndm[1]);
218 epsilon = std::sqrt(epsilon0sq + (1.- epsilon0sq)*rndm[1]);
221 onecost = (1.-
epsilon)/(epsilon*E0_m);
222 sint2 = onecost*(2.-onecost);
225 G4double gdist = 1./epsilon + epsilon - sint2
226 - polarization*(1./epsilon-
epsilon)*(1.-onecost);
228 greject = gdist/gdiced;
231 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
232 "theta majoranta wrong");
235 }
while (greject < rndm[2]);
243 cosTeta = 1. - onecost;
244 sinTeta = std::sqrt(sint2);
252 Phi =
twopi * rndm[0];
254 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
255 "too many iterations");
259 G4double gdiced = 1./epsilon + epsilon - sint2
267 G4double gdist = 1./epsilon + epsilon - sint2
274 greject = gdist/gdiced;
277 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
278 "phi majoranta wrong");
281 if(greject < 1.
e-3) {
282 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
283 "phi loop ineffective");
290 }
while (greject < rndm[1]);
292 G4double dirx = sinTeta*std::cos(Phi), diry = sinTeta*std::sin(Phi),
300 gamDirection1.
rotateUz(gamDirection0);
301 G4double gamEnergy1 = epsilon*gamEnergy0;
322 G4cout <<
"========================================\n";
323 G4cout <<
" nInteractionFrame = " <<nInteractionFrame<<
"\n";
324 G4cout <<
" GammaDirection0 = " <<gamDirection0<<
"\n";
333 G4cout <<
"----------------------------------------\n";
336 G4cout <<
"----------------------------------------\n";
357 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
358 G4cout<<
"Polarization of final photon more than 100%"<<
G4endl;
366 G4cout <<
" GammaDirection1 = " <<gamDirection1<<
"\n";
373 G4double eKinEnergy = gamEnergy0 - gamEnergy1;
378 gamEnergy0*gamDirection0 - gamEnergy1*gamDirection1;
379 eDirection = eDirection.
unit();
383 G4cout <<
" electronPolarization1 = "
389 G4cout <<
" electronPolarization1 = "
391 G4cout <<
" ElecDirection = " <<eDirection<<
"\n";
399 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
400 G4cout<<
"Polarization of final electron more than 100%"<<
G4endl;
407 fvect->push_back(aElectron);
425 ed <<
"Problem of scattering sampling: " << sss <<
"\n"
426 <<
"Niter= " << nloop <<
" grej= " << grej <<
" cos(theta)= "
427 << 1.0-onecos <<
" phi= " << phi <<
"\n"
431 G4Exception(
"G4PolarizedComptonModel::SampleSecondaries",
"em0044",
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
G4StokesVector finalElectronPolarization
void SetPolarization(G4double polX, G4double polY, G4double polZ)
std::ostringstream G4ExceptionDescription
virtual void Initialize(G4double eps, G4double X, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0) override
G4LogicalVolume * GetLogicalVolume() const
static constexpr double MeV
G4double lowestSecondaryEnergy
const G4ThreeVector & GetMomentumDirection() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
virtual void flatArray(const int size, double *vect)=0
Hep3Vector & rotateUz(const Hep3Vector &)
static const G4double emax
void ProposePolarization(const G4ThreeVector &dir)
virtual ~G4PolarizedComptonModel()
G4StokesVector GetPol2() override
G4StokesVector theTargetPolarization
G4double G4Log(G4double x)
G4double LowEnergyLimit() const
G4double ComputeAsymmetryPerAtom(G4double gammaEnergy, G4double Z)
static const char sss[MAX_N_PAR+2]
G4StokesVector theBeamPolarization
static constexpr double electron_mass_c2
void PrintWarning(const G4DynamicParticle *, G4int, G4double grej, G4double onecos, G4double phi, const G4String) const
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
static constexpr double twopi
double A(double temperature)
G4ParticleDefinition * theElectron
static const G4int nlooplim
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
const G4Track * GetCurrentTrack() const
G4StokesVector GetPol3() override
G4ParticleChangeForGamma * fParticleChange
G4PolarizedComptonModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="Polarized-Compton")
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax) override
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax) override
G4PolarizedComptonCrossSection * crossSectionCalculator
double epsilon(double density, double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const G4ThreeVector & GetPolarization() const
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
static G4PolarizationManager * GetInstance()
void ProposeTrackStatus(G4TrackStatus status)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4StokesVector finalGammaPolarization
const G4String & GetName() const
G4VPhysicalVolume * GetVolume() const
bool IsPolarized(G4LogicalVolume *lVol) const