84 if(M0projectile < projectile->GetDefinition()->GetPDGMass())
87 M0projectile=projectile->GetDefinition()->GetPDGMass();
90 G4double Mprojectile2 = M0projectile * M0projectile;
92 G4int PDGcode=projectile->GetDefinition()->GetPDGEncoding();
93 G4int absPDGcode=std::abs(PDGcode);
97 if( absPDGcode > 1000 )
99 ProjectileDiffCut = 1.1;
102 else if( absPDGcode == 211 || PDGcode == 111)
104 ProjectileDiffCut = 1.0;
107 else if( absPDGcode == 321 || PDGcode == -311)
109 ProjectileDiffCut = 1.1;
114 ProjectileDiffCut = 1.1;
118 ProjectileDiffCut = ProjectileDiffCut *
GeV;
119 AveragePt2 = AveragePt2 * GeV*
GeV;
126 if(M0target < target->GetDefinition()->GetPDGMass())
129 M0target=
target->GetDefinition()->GetPDGMass();
132 G4double Mtarget2 = M0target * M0target;
136 G4double ProjectileDiffCut2 = ProjectileDiffCut * ProjectileDiffCut;
137 G4double NuclearNucleonDiffCut2 = NuclearNucleonDiffCut * NuclearNucleonDiffCut;
142 Psum=Pprojectile+Ptarget;
148 if ( Ptmp.pz() <= 0. )
156 toCms.
rotateY(-1*Ptmp.theta());
172 if(SqrtS < 2200*
MeV) {
return false;}
175 PZcms2=(S*S+Mprojectile2*Mprojectile2+Mtarget2*Mtarget2-
176 2*S*Mprojectile2-2*S*Mtarget2-2*Mprojectile2*Mtarget2)/4./S;
180 PZcms = std::sqrt(PZcms2);
184 if(Pprojectile.z() > 0.)
186 Pprojectile.setPz( PZcms);
187 Ptarget.setPz( -PZcms);
190 Pprojectile.setPz(-PZcms);
191 Ptarget.setPz( PZcms);
194 Pprojectile.setE(std::sqrt(Mprojectile2+
195 Pprojectile.x()*Pprojectile.x()+
196 Pprojectile.y()*Pprojectile.y()+
198 Ptarget.setE(std::sqrt( Mtarget2 +
199 Ptarget.x()*Ptarget.x()+
200 Ptarget.y()*Ptarget.y()+
221 if (whilecount++ >= 500 && (whilecount%100)==0)
226 if (whilecount > 1000 )
254 ProjMassT2=Mprojectile2+Pt2;
255 ProjMassT =std::sqrt(ProjMassT2);
257 TargMassT2=Mtarget2+Pt2;
258 TargMassT =std::sqrt(TargMassT2);
260 PZcms2=(S*S+ProjMassT2*ProjMassT2+
261 TargMassT2*TargMassT2-
262 2.*S*ProjMassT2-2.*S*TargMassT2-
263 2.*ProjMassT2*TargMassT2)/4./S;
264 if(PZcms2 < 0 ) {PZcms2=0;};
265 PZcms =std::sqrt(PZcms2);
267 G4double PMinusMin=std::sqrt(ProjMassT2+PZcms2)-PZcms;
270 PMinusNew=ChooseP(PMinusMin,PMinusMax);
271 Qminus=PMinusNew-Pprojectile.minus();
273 G4double TPlusMin=std::sqrt(TargMassT2+PZcms2)-PZcms;
276 TPlusNew=ChooseP(TPlusMin, TPlusMax);
277 Qplus=-(TPlusNew-Ptarget.plus());
279 Qmomentum.
setPz( (Qplus-Qminus)/2 );
280 Qmomentum.
setE( (Qplus+Qminus)/2 );
292 ( (Pprojectile+Qmomentum).mag2() < Mprojectile2 ||
293 (Ptarget -Qmomentum).mag2() < Mtarget2 ) ||
294 ( (Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2 &&
295 (Ptarget -Qmomentum).mag2() < NuclearNucleonDiffCut2) );
297 if((Ptarget-Qmomentum).mag2() < NuclearNucleonDiffCut2)
300 Qminus=Ptarget.minus()-TMinusNew;
301 TPlusNew=TargMassT2/TMinusNew;
302 Qplus=Ptarget.plus()-TPlusNew;
304 Qmomentum.
setPz( (Qplus-Qminus)/2 );
305 Qmomentum.
setE( (Qplus+Qminus)/2 );
307 else if((Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2)
310 Qplus=PPlusNew-Pprojectile.plus();
311 PMinusNew=ProjMassT2/PPlusNew;
312 Qminus=PMinusNew-Pprojectile.minus();
314 Qmomentum.
setPz( (Qplus-Qminus)/2 );
315 Qmomentum.
setE( (Qplus+Qminus)/2 );
318 Pprojectile += Qmomentum;
319 Ptarget -= Qmomentum;
343 target->Set4Momentum(Ptarget);
347 projectile->Set4Momentum(Pprojectile);
Hep3Vector boostVector() const
CLHEP::Hep3Vector G4ThreeVector
HepLorentzVector & rotateZ(double)
HepLorentzRotation & transform(const HepBoost &b)
HepLorentzVector & rotateY(double)
static constexpr double GeV
static constexpr double MeV
HepLorentzVector & transform(const HepRotation &)
CLHEP::HepLorentzVector G4LorentzVector