69static const G4int nlooplim = 10000;
83 delete crossSectionCalculator;
92 G4double k0 = gammaEnergy / electron_mass_c2 ;
96 asymmetry *= (k0 + 1.)*
sqr(k1)*
G4Log(k1) - 2.*k0*(5.*
sqr(k0) + 4.*k0 + 1.);
97 asymmetry /= ((k0 - 2.)*k0 -2.)*
sqr(k1)*
G4Log(k1) + 2.*k0*(k0*(k0 + 1.)*(k0 + 8.) + 2.);
100 if (asymmetry>1.)
G4cout<<
"ERROR in G4PolarizedComptonModel::ComputeAsymmetryPerAtom"<<
G4endl;
117 G4double polzz = theBeamPolarization.
p3()*theTargetPolarization.
z();
120 xs *= (1.+polzz*asym);
128 std::vector<G4DynamicParticle*>* fvect,
140 if (verboseLevel >= 1) {
141 G4cout<<
"G4PolarizedComptonModel::SampleSecondaries in "
153 theTargetPolarization =
164 if (targetIsPolarized) {
165 theTargetPolarization.
rotateUz(gamDirection0);
174 G4double E0_m = gamEnergy0 / electron_mass_c2 ;
190 G4double alpha2 = alpha1 + 0.5*(1.- epsilon0sq);
193 theBeamPolarization.
p3()*theTargetPolarization.
p3();
205 if(nloop > nlooplim) {
206 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
207 "too many iterations");
214 if ( alpha1 > alpha2*rndm[0]) {
217 epsilon = std::sqrt(epsilon0sq + (1.- epsilon0sq)*rndm[1]);
221 sint2 = onecost*(2.-onecost);
227 greject = gdist/gdiced;
230 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
231 "theta majoranta wrong");
234 }
while (greject < rndm[2]);
242 cosTeta = 1. - onecost;
243 sinTeta = std::sqrt(sint2);
251 Phi = twopi * rndm[0];
252 if(nloop > nlooplim) {
253 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
254 "too many iterations");
259 + std::abs(theBeamPolarization.
p3())*
261 +(1.-
epsilon)*sinTeta*(std::sqrt(
sqr(theTargetPolarization.
p1())
262 +
sqr(theTargetPolarization.
p2()))))
263 +sint2*(std::sqrt(
sqr(theBeamPolarization.
p1()) +
264 sqr(theBeamPolarization.
p2())));
267 + theBeamPolarization.
p3()*
269 +(1.-
epsilon)*sinTeta*(std::cos(Phi)*theTargetPolarization.
p1()+
270 std::sin(Phi)*theTargetPolarization.
p2()))
271 -sint2*(std::cos(2.*Phi)*theBeamPolarization.
p1()
272 +std::sin(2.*Phi)*theBeamPolarization.
p2());
273 greject = gdist/gdiced;
276 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
277 "phi majoranta wrong");
280 if(greject < 1.e-3) {
281 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
282 "phi loop ineffective");
289 }
while (greject < rndm[1]);
291 G4double dirx = sinTeta*std::cos(Phi), diry = sinTeta*std::sin(Phi),
299 gamDirection1.
rotateUz(gamDirection0);
320 if (verboseLevel>=1) {
321 G4cout <<
"========================================\n";
322 G4cout <<
" nInteractionFrame = " <<nInteractionFrame<<
"\n";
323 G4cout <<
" GammaDirection0 = " <<gamDirection0<<
"\n";
324 G4cout <<
" gammaPolarization = " <<theBeamPolarization<<
"\n";
325 G4cout <<
" electronPolarization = " <<theTargetPolarization<<
"\n";
328 theBeamPolarization.
InvRotateAz(nInteractionFrame,gamDirection0);
329 theTargetPolarization.
InvRotateAz(nInteractionFrame,gamDirection0);
331 if (verboseLevel>=1) {
332 G4cout <<
"----------------------------------------\n";
333 G4cout <<
" gammaPolarization = " <<theBeamPolarization<<
"\n";
334 G4cout <<
" electronPolarization = " <<theTargetPolarization<<
"\n";
335 G4cout <<
"----------------------------------------\n";
341 theTargetPolarization,2);
347 finalGammaPolarization = crossSectionCalculator->
GetPol2();
348 if (verboseLevel>=1) {
349 G4cout <<
" gammaPolarization1 = " <<finalGammaPolarization<<
"\n";
354 finalGammaPolarization.
RotateAz(nInteractionFrame,gamDirection1);
355 if (finalGammaPolarization.
mag() > 1.+1.e-8){
356 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
357 G4cout<<
"Polarization of final photon more than 100%"<<
G4endl;
358 G4cout<<finalGammaPolarization<<
" mag = "
363 if (verboseLevel>=1) {
364 G4cout <<
" gammaPolarization1 = " <<finalGammaPolarization<<
"\n";
365 G4cout <<
" GammaDirection1 = " <<gamDirection1<<
"\n";
372 G4double eKinEnergy = gamEnergy0 - gamEnergy1;
377 gamEnergy0*gamDirection0 - gamEnergy1*gamDirection1;
378 eDirection = eDirection.
unit();
380 finalElectronPolarization = crossSectionCalculator->
GetPol3();
381 if (verboseLevel>=1) {
382 G4cout <<
" electronPolarization1 = "
383 <<finalElectronPolarization<<
"\n";
386 finalElectronPolarization.
RotateAz(nInteractionFrame,eDirection);
387 if (verboseLevel>=1) {
388 G4cout <<
" electronPolarization1 = "
389 <<finalElectronPolarization<<
"\n";
390 G4cout <<
" ElecDirection = " <<eDirection<<
"\n";
397 if (finalElectronPolarization.
mag() > 1.+1.e-8){
398 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
399 G4cout<<
"Polarization of final electron more than 100%"<<
G4endl;
400 G4cout<<finalElectronPolarization<<
" mag = "
401 <<finalElectronPolarization.
mag()<<
G4endl;
404 finalElectronPolarization.
p2(),
405 finalElectronPolarization.
p3());
406 fvect->push_back(aElectron);
424 ed <<
"Problem of scattering sampling: " << sss <<
"\n"
425 <<
"Niter= " << nloop <<
" grej= " << grej <<
" cos(theta)= "
426 << 1.0-onecos <<
" phi= " << phi <<
"\n"
430 G4Exception(
"G4PolarizedComptonModel::SampleSecondaries",
"em0044",
double epsilon(double density, double temperature)
double A(double 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
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax) override
G4ParticleChangeForGamma * fParticleChange
G4ParticleDefinition * theElectron
const G4String & GetName() const
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposePolarization(const G4ThreeVector &dir)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
bool IsPolarized(G4LogicalVolume *lVol) const
static G4PolarizationManager * GetInstance()
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
G4StokesVector GetPol2() override
G4StokesVector GetPol3() override
virtual void Initialize(G4double eps, G4double X, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0) override
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4double ComputeAsymmetryPerAtom(G4double gammaEnergy, G4double Z)
virtual ~G4PolarizedComptonModel()
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
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
G4VPhysicalVolume * GetVolume() const
G4double LowEnergyLimit() const
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4LogicalVolume * GetLogicalVolume() const