85 if(M0projectile < projectile->GetDefinition()->GetPDGMass())
88 M0projectile=projectile->GetDefinition()->GetPDGMass();
91 G4double Mprojectile2 = M0projectile * M0projectile;
93 G4int PDGcode=projectile->GetDefinition()->GetPDGEncoding();
94 G4int absPDGcode=std::abs(PDGcode);
98 if( absPDGcode > 1000 )
100 ProjectileDiffCut = 1.1;
103 else if( absPDGcode == 211 || PDGcode == 111)
105 ProjectileDiffCut = 1.0;
108 else if( absPDGcode == 321 || PDGcode == -311)
110 ProjectileDiffCut = 1.1;
115 ProjectileDiffCut = 1.1;
119 ProjectileDiffCut = ProjectileDiffCut *
GeV;
120 AveragePt2 = AveragePt2 * GeV*
GeV;
127 if(M0target < target->GetDefinition()->GetPDGMass())
130 M0target=
target->GetDefinition()->GetPDGMass();
133 G4double Mtarget2 = M0target * M0target;
137 G4double ProjectileDiffCut2 = ProjectileDiffCut * ProjectileDiffCut;
138 G4double NuclearNucleonDiffCut2 = NuclearNucleonDiffCut * NuclearNucleonDiffCut;
143 Psum=Pprojectile+Ptarget;
149 if ( Ptmp.pz() <= 0. )
157 toCms.
rotateY(-1*Ptmp.theta());
173 if(SqrtS < 2200*
MeV) {
return false;}
176 PZcms2=(S*S+Mprojectile2*Mprojectile2+Mtarget2*Mtarget2-
177 2*S*Mprojectile2-2*S*Mtarget2-2*Mprojectile2*Mtarget2)/4./S;
181 PZcms = std::sqrt(PZcms2);
185 if(Pprojectile.z() > 0.)
187 Pprojectile.setPz( PZcms);
188 Ptarget.setPz( -PZcms);
192 Pprojectile.setPz(-PZcms);
193 Ptarget.setPz( PZcms);
196 Pprojectile.setE(std::sqrt(Mprojectile2+
197 Pprojectile.x()*Pprojectile.x()+
198 Pprojectile.y()*Pprojectile.y()+
200 Ptarget.setE(std::sqrt( Mtarget2 +
201 Ptarget.x()*Ptarget.x()+
202 Ptarget.y()*Ptarget.y()+
225 if (whilecount++ >= 500 && (whilecount%100)==0)
229 if (whilecount > 1000 )
257 ProjMassT2=Mprojectile2+Pt2;
258 ProjMassT =std::sqrt(ProjMassT2);
260 TargMassT2=Mtarget2+Pt2;
261 TargMassT =std::sqrt(TargMassT2);
263 PZcms2=(S*S+ProjMassT2*ProjMassT2+
264 TargMassT2*TargMassT2-
265 2.*S*ProjMassT2-2.*S*TargMassT2-
266 2.*ProjMassT2*TargMassT2)/4./S;
267 if(PZcms2 < 0 ) {PZcms2=0;};
268 PZcms =std::sqrt(PZcms2);
270 G4double PMinusMin=std::sqrt(ProjMassT2+PZcms2)-PZcms;
273 PMinusNew=
ChooseP(PMinusMin,PMinusMax);
274 Qminus=PMinusNew-Pprojectile.minus();
276 G4double TPlusMin=std::sqrt(TargMassT2+PZcms2)-PZcms;
279 TPlusNew=
ChooseP(TPlusMin, TPlusMax);
280 Qplus=-(TPlusNew-Ptarget.plus());
282 Qmomentum.
setPz( (Qplus-Qminus)/2 );
283 Qmomentum.
setE( (Qplus+Qminus)/2 );
297 ( (Pprojectile+Qmomentum).mag2() < Mprojectile2 ||
298 (Ptarget -Qmomentum).mag2() < Mtarget2 ) ||
299 ( (Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2 &&
300 (Ptarget -Qmomentum).mag2() < NuclearNucleonDiffCut2) );
302 if((Ptarget-Qmomentum).mag2() < NuclearNucleonDiffCut2)
305 Qminus=Ptarget.minus()-TMinusNew;
306 TPlusNew=TargMassT2/TMinusNew;
307 Qplus=Ptarget.plus()-TPlusNew;
309 Qmomentum.
setPz( (Qplus-Qminus)/2 );
310 Qmomentum.
setE( (Qplus+Qminus)/2 );
312 else if((Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2)
315 Qplus=PPlusNew-Pprojectile.plus();
316 PMinusNew=ProjMassT2/PPlusNew;
317 Qminus=PMinusNew-Pprojectile.minus();
319 Qmomentum.
setPz( (Qplus-Qminus)/2 );
320 Qmomentum.
setE( (Qplus+Qminus)/2 );
323 Pprojectile += Qmomentum;
324 Ptarget -= Qmomentum;
351 target->Set4Momentum(Ptarget);
355 projectile->Set4Momentum(Pprojectile);
G4double ChooseP(G4double Pmin, G4double Pmax) const
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector GaussianPt(G4double AveragePt2, G4double maxPtSquare) const
HepLorentzVector & rotateZ(double)
HepLorentzRotation & transform(const HepBoost &b)
Hep3Vector boostVector() const
cout<< "-> Edep in the target
HepLorentzVector & rotateY(double)
HepLorentzVector & transform(const HepRotation &)
CLHEP::HepLorentzVector G4LorentzVector