66 crossSectionCalculator(nullptr),
68 gParticleChange(nullptr)
75 delete crossSectionCalculator;
85 if(gParticleChange) {
return; }
95 G4double polzz = theBeamPolarization.
z()*theTargetPolarization.
z();
96 G4double poltt = theBeamPolarization.
x()*theTargetPolarization.
x()
97 + theBeamPolarization.
y()*theTargetPolarization.
y();
98 if (polzz!=0 || poltt!=0) {
101 xs*=(1.+polzz*lasym+poltt*tasym);
113 G4double gam = 1. + ene/electron_mass_c2;
132 if ( (valueA < -1) || (1 < valueA)) {
133 G4cout<<
" ERROR PolarizedAnnihilationPS::ComputeAsymmetries \n";
134 G4cout<<
" something wrong in total cross section calculation (valueA)\n";
135 G4cout<<
" LONG: "<<valueX<<
"\t"<<valueA<<
"\t"<<valueT<<
" energy = "<<gam<<
G4endl;
137 if ( (valueT < -1) || (1 < valueT)) {
138 G4cout<<
" ERROR PolarizedAnnihilationPS::ComputeAsymmetries \n";
139 G4cout<<
" something wrong in total cross section calculation (valueT)\n";
140 G4cout<<
" TRAN: "<<valueX<<
"\t"<<valueA<<
"\t"<<valueT<<
" energy = "<<gam<<
G4endl;
158 if(PositKinEnergy == 0.0) {
161 G4double sinTeta = std::sqrt((1.0 - cosTeta)*(1.0 + cosTeta));
163 G4ThreeVector dir(sinTeta*std::cos(phi), sinTeta*std::sin(phi), cosTeta);
181 if (verboseLevel >= 1) {
182 G4cout <<
"G4PolarizedComptonModel::SampleSecondaries in "
187 if (targetIsPolarized)
193 G4double polarization = theBeamPolarization.
p3()*theTargetPolarization.
p3();
195 G4double gamam1 = PositKinEnergy/electron_mass_c2;
196 G4double gama = gamam1+1. , gamap1 = gamam1+2.;
197 G4double sqgrate = std::sqrt(gamam1/gamap1)/2. , sqg2m1 = std::sqrt(gamam1*gamap1);
200 G4double epsilmin = 0.5 - sqgrate , epsilmax = 0.5 + sqgrate;
201 G4double epsilqot = epsilmax/epsilmin;
209 G4double gmax=1. + std::fabs(polarization);
213 crossSectionCalculator->
Initialize(epsilmin, gama, 0., theBeamPolarization, theTargetPolarization);
215 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
216 <<
"epsilmin DiceRoutine not appropriate ! "<<crossSectionCalculator->
DiceEpsilon()<<
G4endl;
220 crossSectionCalculator->
Initialize(epsilmax, gama, 0., theBeamPolarization, theTargetPolarization);
222 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
223 <<
"epsilmax DiceRoutine not appropriate ! "<<crossSectionCalculator->
DiceEpsilon()<<
G4endl;
236 crossSectionCalculator->
Initialize(epsil, gama, 0., theBeamPolarization, theTargetPolarization,1);
241 if (treject>gmax || treject<0.)
242 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
243 <<
" eps ("<<epsil<<
") rejection does not work properly: "<<treject<<
G4endl;
245 if (treject>trejectmax) trejectmax=treject;
247 G4cout<<
"WARNING in PolarizedAnnihilationPS::PostStepDoIt\n"
248 <<
"eps dicing very inefficient ="<<trejectmax/gmax
249 <<
", "<<treject/gmax<<
". For secondary energy = "<<epsil<<
" "<<ncount<<
G4endl;
260 G4double cost = (epsil*gamap1-1.)/(epsil*sqg2m1);
261 G4double sint = std::sqrt((1.+cost)*(1.-cost));
263 G4double beamTrans = std::sqrt(
sqr(theBeamPolarization.
p1()) +
sqr(theBeamPolarization.
p2()));
264 G4double targetTrans = std::sqrt(
sqr(theTargetPolarization.
p1()) +
sqr(theTargetPolarization.
p2()));
269 crossSectionCalculator->
Initialize(epsil, gama, 0., theBeamPolarization, theTargetPolarization,2);
272 gdiced += crossSectionCalculator->
getVar(3)*theBeamPolarization.
p3()*theTargetPolarization.
p3();
273 gdiced += 1.*(std::fabs(crossSectionCalculator->
getVar(1))
274 + std::fabs(crossSectionCalculator->
getVar(2)))*beamTrans*targetTrans;
275 gdiced += 1.*std::fabs(crossSectionCalculator->
getVar(4))
276 *(std::fabs(theBeamPolarization.
p3())*targetTrans + std::fabs(theTargetPolarization.
p3())*beamTrans);
279 gdist += crossSectionCalculator->
getVar(3)*theBeamPolarization.
p3()*theTargetPolarization.
p3();
280 gdist += crossSectionCalculator->
getVar(1)*(std::cos(phi)*theBeamPolarization.
p1()
281 + std::sin(phi)*theBeamPolarization.
p2())
282 *(std::cos(phi)*theTargetPolarization.
p1()
283 + std::sin(phi)*theTargetPolarization.
p2());
284 gdist += crossSectionCalculator->
getVar(2)*(std::cos(phi)*theBeamPolarization.
p2()
285 - std::sin(phi)*theBeamPolarization.
p1())
286 *(std::cos(phi)*theTargetPolarization.
p2()
287 - std::sin(phi)*theTargetPolarization.
p1());
288 gdist += crossSectionCalculator->
getVar(4)
289 *(std::cos(phi)*theBeamPolarization.
p3()*theTargetPolarization.
p1()
290 + std::cos(phi)*theBeamPolarization.
p1()*theTargetPolarization.
p3()
291 + std::sin(phi)*theBeamPolarization.
p3()*theTargetPolarization.
p2()
292 + std::sin(phi)*theBeamPolarization.
p2()*theTargetPolarization.
p3());
294 treject = gdist/gdiced;
296 if (treject>1.+1.e-10 || treject<0){
297 G4cout<<
"!!!ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
298 <<
" phi rejection does not work properly: "<<treject<<
G4endl;
305 G4cout<<
"!!!ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
306 <<
" phi rejection does not work properly: "<<treject<<
"\n";
307 G4cout<<
" gdiced="<<gdiced<<
" gdist="<<gdist<<
"\n";
315 G4double dirx = sint*std::cos(phi) , diry = sint*std::sin(phi) , dirz = cost;
320 G4double TotalAvailableEnergy = PositKinEnergy + 2*electron_mass_c2;
321 G4double Phot1Energy = epsil*TotalAvailableEnergy;
322 G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
332 theBeamPolarization.
InvRotateAz(nInteractionFrame,PositDirection);
333 theTargetPolarization.
InvRotateAz(nInteractionFrame,PositDirection);
337 crossSectionCalculator->
Initialize(epsil,gama,phi,theBeamPolarization,theTargetPolarization,2);
341 Phot1Direction.
rotateUz(PositDirection);
344 Phot1Direction, Phot1Energy);
345 finalGamma1Polarization=crossSectionCalculator->
GetPol2();
348 G4cout<<
"ERROR: PolarizedAnnihilation Polarization Vector at epsil = "
349 <<epsil<<
" is too large!!! \n"
350 <<
"annihi pol1= "<<finalGamma1Polarization<<
", ("<<n1<<
")\n";
351 finalGamma1Polarization*=1./std::sqrt(n1);
356 finalGamma1Polarization.
RotateAz(nInteractionFrame,Phot1Direction);
358 finalGamma1Polarization.
p2(),
359 finalGamma1Polarization.
p3());
361 fvect->push_back(aParticle1);
366 G4double Eratio= Phot1Energy/Phot2Energy;
367 G4double PositP= std::sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
369 (PositP-dirz*Phot1Energy)/Phot2Energy);
370 Phot2Direction.
rotateUz(PositDirection);
373 Phot2Direction, Phot2Energy);
376 finalGamma2Polarization=crossSectionCalculator->
GetPol3();
379 G4cout<<
"ERROR: PolarizedAnnihilation Polarization Vector at epsil = "<<epsil<<
" is too large!!! \n";
380 G4cout<<
"annihi pol2= "<<finalGamma2Polarization<<
", ("<<n2<<
")\n";
382 finalGamma2Polarization*=1./std::sqrt(n2);
385 finalGamma2Polarization.
RotateAz(nInteractionFrame,Phot2Direction);
387 finalGamma2Polarization.
p2(),
388 finalGamma2Polarization.
p3());
390 fvect->push_back(aParticle2);
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
void SetPolarization(const G4ThreeVector &)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4String & GetName() const
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
bool IsPolarized(G4LogicalVolume *lVol) const
static G4PolarizationManager * GetInstance()
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
virtual G4double TotalXSection(G4double xmin, G4double xmax, G4double y, const G4StokesVector &pol0, const G4StokesVector &pol1) override
G4StokesVector GetPol2() override
virtual void Initialize(G4double eps, G4double gamma, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0) override
G4StokesVector GetPol3() override
virtual G4double ComputeCrossSectionPerElectron(G4double kinEnergy) final
virtual ~G4PolarizedAnnihilationModel()
void ComputeAsymmetriesPerElectron(G4double gammaEnergy, G4double &valueX, G4double &valueA, G4double &valueT)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) final
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) final
G4PolarizedAnnihilationModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="Polarized-Annihilation")
static const G4StokesVector P3
static const G4StokesVector ZERO
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
static const G4StokesVector P2
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
static const G4StokesVector P1
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPolarization() const
G4ParticleChangeForGamma * GetParticleChangeForGamma()
void ProposeTrackStatus(G4TrackStatus status)
G4LogicalVolume * GetLogicalVolume() const
virtual G4double ComputeCrossSectionPerElectron(G4double kinEnergy)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override