60 delete fCrossSectionCalculator;
69 G4double k0 = gammaEnergy / electron_mass_c2;
74 (k0 + 1.) *
sqr(k1) *
G4Log(k1) - 2. * k0 * (5. *
sqr(k0) + 4. * k0 + 1.);
75 asymmetry /= ((k0 - 2.) * k0 - 2.) *
sqr(k1) *
G4Log(k1) +
76 2. * k0 * (k0 * (k0 + 1.) * (k0 + 8.) + 2.);
81 ed <<
"ERROR in G4PolarizedComptonModel::ComputeAsymmetryPerAtom.\n"
82 <<
" asymmetry = " << asymmetry <<
"\n";
83 G4Exception(
"G4PolarizedComptonModel::ComputeAsymmetryPerAtom",
"pol035",
96 pd, kinEnergy,
Z,
A, cut, emax);
97 G4double polzz = fBeamPolarization.
p3() * fTargetPolarization.
z();
101 xs *= (1. + polzz * asym);
121 if(fVerboseLevel >= 1)
123 G4cout <<
"G4PolarizedComptonModel::SampleSecondaries in "
144 if(targetIsPolarized)
146 fTargetPolarization.
rotateUz(gamDirection0);
155 G4double E0_m = gamEnergy0 / electron_mass_c2;
165 G4double eps0 = 1. / (1. + 2. * E0_m);
170 G4double polarization = fBeamPolarization.
p3() * fTargetPolarization.
p3();
186 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
187 "too many iterations");
194 if(alpha1 >
alpha2 * rndm[0])
200 epsilon = std::sqrt(epsilon0sq + (1. - epsilon0sq) * rndm[1]);
204 sint2 = onecost * (2. - onecost);
210 greject = gdist / gdiced;
214 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
215 "theta majoranta wrong");
218 }
while(greject < rndm[2]);
224 cosTeta = 1. - onecost;
225 sinTeta = std::sqrt(sint2);
234 Phi = twopi * rndm[0];
237 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
238 "too many iterations");
243 std::abs(fBeamPolarization.
p3()) *
245 fTargetPolarization.
p3()) +
247 (std::sqrt(
sqr(fTargetPolarization.
p1()) +
248 sqr(fTargetPolarization.
p2())))) +
249 sint2 * (std::sqrt(
sqr(fBeamPolarization.
p1()) +
250 sqr(fBeamPolarization.
p2())));
254 fBeamPolarization.
p3() *
257 (std::cos(Phi) * fTargetPolarization.
p1() +
258 std::sin(Phi) * fTargetPolarization.
p2())) -
259 sint2 * (std::cos(2. * Phi) * fBeamPolarization.
p1() +
260 std::sin(2. * Phi) * fBeamPolarization.
p2());
261 greject = gdist / gdiced;
265 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
266 "phi majoranta wrong");
271 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
272 "phi loop ineffective");
279 }
while(greject < rndm[1]);
281 G4double dirx = sinTeta * std::cos(Phi);
282 G4double diry = sinTeta * std::sin(Phi);
287 gamDirection1.
rotateUz(gamDirection0);
309 if(fVerboseLevel >= 1)
311 G4cout <<
"========================================" <<
G4endl;
312 G4cout <<
" nInteractionFrame = " << nInteractionFrame <<
G4endl;
313 G4cout <<
" GammaDirection0 = " << gamDirection0 <<
G4endl;
314 G4cout <<
" gammaPolarization = " << fBeamPolarization <<
G4endl;
315 G4cout <<
" electronPolarization = " << fTargetPolarization <<
G4endl;
318 fBeamPolarization.
InvRotateAz(nInteractionFrame, gamDirection0);
319 fTargetPolarization.
InvRotateAz(nInteractionFrame, gamDirection0);
321 if(fVerboseLevel >= 1)
323 G4cout <<
"----------------------------------------" <<
G4endl;
324 G4cout <<
" gammaPolarization = " << fBeamPolarization <<
G4endl;
325 G4cout <<
" electronPolarization = " << fTargetPolarization <<
G4endl;
326 G4cout <<
"----------------------------------------" <<
G4endl;
331 fTargetPolarization, 2);
337 fFinalGammaPolarization = fCrossSectionCalculator->
GetPol2();
338 if(fVerboseLevel >= 1)
340 G4cout <<
" gammaPolarization1 = " << fFinalGammaPolarization <<
G4endl;
345 fFinalGammaPolarization.
RotateAz(nInteractionFrame, gamDirection1);
346 if(fFinalGammaPolarization.
mag() > 1. + 1.e-8)
349 ed <<
"ERROR in Polarizaed Compton Scattering !\n";
350 ed <<
"Polarization of final photon more than 100%.\n";
351 ed << fFinalGammaPolarization
352 <<
" mag = " << fFinalGammaPolarization.
mag() <<
"\n";
353 G4Exception(
"G4PolarizedComptonModel::SampleSecondaries",
"pol033",
358 if(fVerboseLevel >= 1)
360 G4cout <<
" gammaPolarization1 = " << fFinalGammaPolarization <<
G4endl;
361 G4cout <<
" GammaDirection1 = " << gamDirection1 <<
G4endl;
366 G4double eKinEnergy = gamEnergy0 - gamEnergy1;
371 gamEnergy0 * gamDirection0 - gamEnergy1 * gamDirection1;
372 eDirection = eDirection.
unit();
374 finalElectronPolarization = fCrossSectionCalculator->
GetPol3();
375 if(fVerboseLevel >= 1)
377 G4cout <<
" electronPolarization1 = " << finalElectronPolarization
381 finalElectronPolarization.
RotateAz(nInteractionFrame, eDirection);
382 if(fVerboseLevel >= 1)
384 G4cout <<
" electronPolarization1 = " << finalElectronPolarization
385 <<
G4endl <<
" ElecDirection = " << eDirection <<
G4endl;
392 if(finalElectronPolarization.
mag() > 1. + 1.e-8)
395 ed <<
"ERROR in Polarized Compton Scattering !\n";
396 ed <<
"Polarization of final electron more than 100%.\n";
397 ed << finalElectronPolarization
398 <<
" mag = " << finalElectronPolarization.
mag() <<
G4endl;
399 G4Exception(
"G4PolarizedComptonModel::SampleSecondaries",
"pol034",
403 finalElectronPolarization.
p2(),
404 finalElectronPolarization.
p3());
405 fvect->push_back(aElectron);
425 ed <<
"Problem of scattering sampling: " << sss <<
"\n"
426 <<
"Niter= " << nloop <<
" grej= " << grej
427 <<
" cos(theta)= " << 1.0 - onecos <<
" phi= " << phi <<
"\n"
431 G4Exception(
"G4PolarizedComptonModel::SampleSecondaries",
"em0044",
G4double epsilon(G4double density, G4double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
virtual void flatArray(const int size, double *vect)=0
void SetPolarization(const G4ThreeVector &)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const
G4double lowestSecondaryEnergy
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax) override
G4ParticleChangeForGamma * fParticleChange
G4ParticleDefinition * theElectron
const G4String & GetName() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposePolarization(const G4ThreeVector &dir)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
bool IsPolarized(G4LogicalVolume *lVol) const
const G4StokesVector GetVolumePolarization(G4LogicalVolume *lVol) const
static G4PolarizationManager * GetInstance()
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4double ComputeAsymmetryPerAtom(G4double gammaEnergy, G4double Z)
G4PolarizedComptonModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="Polarized-Compton")
virtual ~G4PolarizedComptonModel() override
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax) override
static const G4StokesVector ZERO
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
G4VPhysicalVolume * GetVolume() const
G4double LowEnergyLimit() const
void ProposeTrackStatus(G4TrackStatus status)
const G4Track * GetCurrentTrack() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4LogicalVolume * GetLogicalVolume() const
virtual void Initialize(G4double, G4double, G4double, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0)=0
virtual G4StokesVector GetPol2()
virtual G4StokesVector GetPol3()