171 G4double sinTeta = std::sqrt((1.0 - cosTeta)*(1.0 + cosTeta));
173 G4ThreeVector dir(sinTeta*std::cos(phi), sinTeta*std::sin(phi), cosTeta);
191 if (verboseLevel >= 1) {
192 G4cout <<
"G4PolarizedComptonModel::SampleSecondaries in "
197 if (targetIsPolarized)
203 G4double polarization = theBeamPolarization.
p3()*theTargetPolarization.
p3();
206 G4double gama = gamam1+1. , gamap1 = gamam1+2.;
207 G4double sqgrate = std::sqrt(gamam1/gamap1)/2. , sqg2m1 = std::sqrt(gamam1*gamap1);
210 G4double epsilmin = 0.5 - sqgrate , epsilmax = 0.5 + sqgrate;
211 G4double epsilqot = epsilmax/epsilmin;
219 G4double gmax=1. + std::fabs(polarization);
223 crossSectionCalculator->
Initialize(epsilmin, gama, 0., theBeamPolarization, theTargetPolarization);
225 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
226 <<
"epsilmin DiceRoutine not appropriate ! "<<crossSectionCalculator->
DiceEpsilon()<<
G4endl;
230 crossSectionCalculator->
Initialize(epsilmax, gama, 0., theBeamPolarization, theTargetPolarization);
232 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
233 <<
"epsilmax DiceRoutine not appropriate ! "<<crossSectionCalculator->
DiceEpsilon()<<
G4endl;
246 crossSectionCalculator->
Initialize(epsil, gama, 0., theBeamPolarization, theTargetPolarization,1);
251 if (treject>gmax || treject<0.)
252 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
253 <<
" eps ("<<epsil<<
") rejection does not work properly: "<<treject<<
G4endl;
255 if (treject>trejectmax) trejectmax=treject;
257 G4cout<<
"WARNING in PolarizedAnnihilationPS::PostStepDoIt\n"
258 <<
"eps dicing very inefficient ="<<trejectmax/gmax
259 <<
", "<<treject/gmax<<
". For secondary energy = "<<epsil<<
" "<<ncount<<
G4endl;
270 G4double cost = (epsil*gamap1-1.)/(epsil*sqg2m1);
271 G4double sint = std::sqrt((1.+cost)*(1.-cost));
273 G4double beamTrans = std::sqrt(
sqr(theBeamPolarization.
p1()) +
sqr(theBeamPolarization.
p2()));
274 G4double targetTrans = std::sqrt(
sqr(theTargetPolarization.
p1()) +
sqr(theTargetPolarization.
p2()));
279 crossSectionCalculator->
Initialize(epsil, gama, 0., theBeamPolarization, theTargetPolarization,2);
282 gdiced += crossSectionCalculator->
getVar(3)*theBeamPolarization.
p3()*theTargetPolarization.
p3();
283 gdiced += 1.*(std::fabs(crossSectionCalculator->
getVar(1))
284 + std::fabs(crossSectionCalculator->
getVar(2)))*beamTrans*targetTrans;
285 gdiced += 1.*std::fabs(crossSectionCalculator->
getVar(4))
286 *(std::fabs(theBeamPolarization.
p3())*targetTrans + std::fabs(theTargetPolarization.
p3())*beamTrans);
289 gdist += crossSectionCalculator->
getVar(3)*theBeamPolarization.
p3()*theTargetPolarization.
p3();
290 gdist += crossSectionCalculator->
getVar(1)*(std::cos(phi)*theBeamPolarization.
p1()
291 + std::sin(phi)*theBeamPolarization.
p2())
292 *(std::cos(phi)*theTargetPolarization.
p1()
293 + std::sin(phi)*theTargetPolarization.
p2());
294 gdist += crossSectionCalculator->
getVar(2)*(std::cos(phi)*theBeamPolarization.
p2()
295 - std::sin(phi)*theBeamPolarization.
p1())
296 *(std::cos(phi)*theTargetPolarization.
p2()
297 - std::sin(phi)*theTargetPolarization.
p1());
298 gdist += crossSectionCalculator->
getVar(4)
299 *(std::cos(phi)*theBeamPolarization.
p3()*theTargetPolarization.
p1()
300 + std::cos(phi)*theBeamPolarization.
p1()*theTargetPolarization.
p3()
301 + std::sin(phi)*theBeamPolarization.
p3()*theTargetPolarization.
p2()
302 + std::sin(phi)*theBeamPolarization.
p2()*theTargetPolarization.
p3());
304 treject = gdist/gdiced;
306 if (treject>1.+1.e-10 || treject<0){
307 G4cout<<
"!!!ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
308 <<
" phi rejection does not work properly: "<<treject<<
G4endl;
315 G4cout<<
"!!!ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
316 <<
" phi rejection does not work properly: "<<treject<<
"\n";
317 G4cout<<
" gdiced="<<gdiced<<
" gdist="<<gdist<<
"\n";
325 G4double dirx = sint*std::cos(phi) , diry = sint*std::sin(phi) , dirz = cost;
331 G4double Phot1Energy = epsil*TotalAvailableEnergy;
332 G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
342 theBeamPolarization.
InvRotateAz(nInteractionFrame,PositDirection);
343 theTargetPolarization.
InvRotateAz(nInteractionFrame,PositDirection);
347 crossSectionCalculator->
Initialize(epsil,gama,phi,theBeamPolarization,theTargetPolarization,2);
351 Phot1Direction.rotateUz(PositDirection);
354 Phot1Direction, Phot1Energy);
355 finalGamma1Polarization=crossSectionCalculator->
GetPol2();
358 G4cout<<
"ERROR: PolarizedAnnihilation Polarization Vector at epsil = "
359 <<epsil<<
" is too large!!! \n"
360 <<
"annihi pol1= "<<finalGamma1Polarization<<
", ("<<n1<<
")\n";
361 finalGamma1Polarization*=1./std::sqrt(n1);
366 finalGamma1Polarization.
RotateAz(nInteractionFrame,Phot1Direction);
368 finalGamma1Polarization.
p2(),
369 finalGamma1Polarization.
p3());
371 fvect->push_back(aParticle1);
376 G4double Eratio= Phot1Energy/Phot2Energy;
377 G4double PositP= std::sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
379 (PositP-dirz*Phot1Energy)/Phot2Energy);
380 Phot2Direction.rotateUz(PositDirection);
383 Phot2Direction, Phot2Energy);
386 finalGamma2Polarization=crossSectionCalculator->
GetPol3();
389 G4cout<<
"ERROR: PolarizedAnnihilation Polarization Vector at epsil = "<<epsil<<
" is too large!!! \n";
390 G4cout<<
"annihi pol2= "<<finalGamma2Polarization<<
", ("<<n2<<
")\n";
392 finalGamma2Polarization*=1./std::sqrt(n2);
395 finalGamma2Polarization.
RotateAz(nInteractionFrame,Phot2Direction);
397 finalGamma2Polarization.
p2(),
398 finalGamma2Polarization.
p3());
400 fvect->push_back(aParticle2);
const G4ThreeVector & GetPolarization() const
G4StokesVector GetPol2() override
G4double GetKineticEnergy() const
static G4PolarizationManager * GetInstance()
static constexpr double twopi
static constexpr double electron_mass_c2
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
void SetPolarization(G4double polX, G4double polY, G4double polZ)
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
G4LogicalVolume * GetLogicalVolume() const
G4StokesVector GetPol3() override
bool IsPolarized(G4LogicalVolume *lVol) const
G4VPhysicalVolume * GetVolume() const
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
const G4String & GetName() const
void ProposeTrackStatus(G4TrackStatus status)
virtual void Initialize(G4double eps, G4double gamma, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0) override
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)