61 #ifdef debugQuarkExchange
73 #ifdef debugQuarkExchange
75 G4cout<<
"Proj. 4-Mom "<<Pprojectile<<
" "<<Pprojectile.
mag()<<G4endl
76 <<
"Targ. 4-Mom "<<Ptarget <<
" "<<Ptarget.
mag() <<
G4endl;
83 #ifdef debugQuarkExchange
84 G4cout<<
"SS Mpr Mtr SqrtS-Mprojectile-Mtarget "<<SqrtS<<
" "<<Mprojectile<<
" "<<Mtarget
85 <<
" "<<SqrtS-Mprojectile-Mtarget<<
G4endl;
87 if(SqrtS-Mprojectile-Mtarget <= 250.0*
MeV) {
88 #ifdef debugQuarkExchange
89 G4cerr<<
"Energy is too small for quark exchange!"<<
G4endl;
91 <<Pprojectile<<
" "<<Pprojectile.
mag()<<
G4endl;
93 <<Ptarget<<
" "<<Ptarget.mag()<<
G4endl;
94 G4cerr<<
"sqrt(S) = "<<SqrtS<<
" Mp + Mt = "<<Pprojectile.
mag()+Ptarget.mag()<<
G4endl;
103 if ( Ptmp.pz() <= 0. )
111 toCms.
rotateY(-1*Ptmp.theta());
118 #ifdef debugQuarkExchange
119 G4cout <<
"Pprojectile in CMS " << Pprojectile <<
G4endl;
125 G4double ProjectileMinDiffrMass = Pprojectile.mag()/
GeV;
131 G4int absPDGcode=std::abs(PDGcode);
133 G4bool ProjectileDiffraction =
true;
135 if( absPDGcode > 1000 ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
136 if( (absPDGcode == 211) || (absPDGcode == 111) ) { ProjectileDiffraction =
G4UniformRand() <= 0.66; }
137 if( (absPDGcode == 321) || (absPDGcode == 311) ||
138 ( PDGcode == 130) || ( PDGcode == 310) ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
140 if ( ProjectileDiffraction ) {
141 if( absPDGcode > 1000 )
143 ProjectileMinDiffrMass = 1.16;
146 else if( absPDGcode == 211 || absPDGcode == 111)
148 ProjectileMinDiffrMass = 1.0;
151 else if( absPDGcode == 321 || absPDGcode == 130 || absPDGcode == 310)
153 ProjectileMinDiffrMass = 1.1;
156 else if( absPDGcode == 22)
158 ProjectileMinDiffrMass = 0.25;
163 ProjectileMinDiffrMass = 1.1;
167 ProjectileMinDiffrMass = ProjectileMinDiffrMass *
GeV;
168 Mprojectile2=
sqr(ProjectileMinDiffrMass);
171 TargetMinDiffrMass *=
GeV;
172 Mtarget2 =
sqr( TargetMinDiffrMass) ;
177 ProjectileMinDiffrMass *=
GeV;
178 Mprojectile2=
sqr(ProjectileMinDiffrMass);
180 TargetMinDiffrMass = 1.16*
GeV;
181 Mtarget2 =
sqr( TargetMinDiffrMass) ;
185 AveragePt2 = AveragePt2 *
GeV*
GeV;
187 if( SqrtS - (ProjectileMinDiffrMass+TargetMinDiffrMass) < 220*
MeV )
return false;
192 G4double PMinusMin, PMinusMax, sqrtPMinusMin, sqrtPMinusMax;
194 G4double TPlusMin, TPlusMax, sqrtTPlusMin, sqrtTPlusMax;
195 G4double PMinusNew, PPlusNew, TPlusNew(0.), TMinusNew;
205 if (whilecount > 1000 )
215 ProjMassT2 = Mprojectile2 + Pt2;
216 ProjMassT = std::sqrt( ProjMassT2 );
217 TargMassT2 = Mtarget2 + Pt2;
218 TargMassT = std::sqrt( TargMassT2 );
220 #ifdef debugQuarkExchange
221 G4cout<<
"whilecount Pt2 ProjMassT TargMassT SqrtS S ProjectileDiffraction"<<
G4endl;
222 G4cout<<whilecount<<
" "<<Pt2<<
" "<<ProjMassT<<
" "<<TargMassT<<
" "<<SqrtS<<
" "<<S<<
" "<<ProjectileDiffraction<<
G4endl;
225 if ( SqrtS < ProjMassT + TargMassT + 220.0*
MeV )
continue;
227 PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
228 - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
230 if ( PZcms2 < 0 )
continue;
232 PZcms = std::sqrt( PZcms2 );
234 if ( ProjectileDiffraction )
236 PMinusMin = std::sqrt( ProjMassT2 + PZcms2 ) - PZcms;
237 PMinusMax = SqrtS - TargMassT;
238 sqrtPMinusMin = std::sqrt(PMinusMin); sqrtPMinusMax = std::sqrt(PMinusMax);
241 if( absPDGcode > 1000 )
253 PMinusNew = PMinusMax * (1.0 - (1.0 - PMinusMin/PMinusMax)
256 }
else if( (absPDGcode == 211) || (absPDGcode == 111) )
262 if( y < 1.0-0.7 *
x/sqrtPMinusMax )
break;
265 }
else if( (absPDGcode == 321) || (absPDGcode == 311) ||
266 ( PDGcode == 130) || ( PDGcode == 310) )
272 if( y < 1.0-0.7 *
x/sqrtPMinusMax )
break;
285 PMinusNew = PMinusMax * (1.0 - (1.0 - PMinusMin/PMinusMax)
290 TMinusNew = SqrtS - PMinusNew;
292 Qminus = Ptarget.minus() - TMinusNew;
293 TPlusNew = TargMassT2 / TMinusNew;
294 Qplus = Ptarget.plus() - TPlusNew;
299 TPlusMin = std::sqrt( TargMassT2 + PZcms2 ) - PZcms;
300 TPlusMax = SqrtS - ProjMassT;
301 sqrtTPlusMin = std::sqrt(TPlusMin); sqrtTPlusMax = std::sqrt(TPlusMax);
303 if( absPDGcode > 1000 )
314 TPlusNew = TPlusMax * (1.0 - (1.0 - TPlusMin/TPlusMax)
318 }
else if( (absPDGcode == 211) || (absPDGcode == 111) )
324 if( y < 1.0-0.7 *
x/sqrtTPlusMax )
break;
327 }
else if( (absPDGcode == 321) || (absPDGcode == 311) ||
328 ( PDGcode == 130) || ( PDGcode == 310) )
334 if( y < 1.0-0.7 *
x/sqrtTPlusMax )
break;
347 TPlusNew = TPlusMax * (1.0 - (1.0 - TPlusMin/TPlusMax)
351 PPlusNew = SqrtS - TPlusNew;
353 Qplus = PPlusNew - Pprojectile.plus();
354 PMinusNew = ProjMassT2 / PPlusNew;
355 Qminus = PMinusNew - Pprojectile.minus();
359 Qmomentum.
setPz( (Qplus - Qminus)/2 );
360 Qmomentum.
setE( (Qplus + Qminus)/2 );
362 #ifdef debugQuarkExchange
363 G4cout<<
"ProjectileDiffraction (Pprojectile + Qmomentum).mag2() Mprojectile2"<<
G4endl;
364 G4cout<<ProjectileDiffraction<<
" "<<( Pprojectile + Qmomentum ).mag2()<<
" "<< Mprojectile2<<
G4endl;
365 G4cout<<
"TargetDiffraction (Ptarget - Qmomentum).mag2() Mtarget2"<<
G4endl;
366 G4cout<<!ProjectileDiffraction<<
" "<<( Ptarget - Qmomentum ).mag2()<<
" "<< Mtarget2<<
G4endl;
369 }
while ( ( ProjectileDiffraction&&( Pprojectile + Qmomentum ).mag2() < Mprojectile2 ) ||
370 (!ProjectileDiffraction&&( Ptarget - Qmomentum ).mag2() < Mtarget2 ) );
374 Pprojectile += Qmomentum;
376 Ptarget -= Qmomentum;
382 #ifdef debugQuarkExchange
383 G4cout <<
"Pprojectile in Lab. " << Pprojectile <<
G4endl;
385 G4cout <<
"G4QuarkExchange: Projectile mass " << Pprojectile.mag() <<
G4endl;
386 G4cout <<
"G4QuarkExchange: Target mass " << Ptarget.mag() <<
G4endl;
419 const G4int maxNumberOfLoops = 1000;
420 G4int loopCounter = 0;
423 }
while ( ( pt2 > maxPtSquare) && ++loopCounter < maxNumberOfLoops );
424 if ( loopCounter >= maxNumberOfLoops ) {
425 pt2 = 0.99*maxPtSquare;
432 return G4ThreeVector (pt2*std::cos(phi), pt2*std::sin(phi), 0.);
const G4ParticleDefinition * GetDefinition() const
HepLorentzVector & transform(const HepRotation &)
CLHEP::Hep3Vector G4ThreeVector
G4ParticleDefinition * GetDefinition()
static constexpr double MeV
void SetDefinition(G4ParticleDefinition *aDefinition)
G4ThreeVector GaussianPt(G4double widthSquare, G4double maxPtSquare) const
virtual G4Parton * GetNextParton()=0
G4double GetPDGMass() const
G4double G4Log(G4double x)
G4bool ExciteParticipants(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner) const
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const
static constexpr double twopi
HepLorentzVector & rotateY(double)
G4GLOB_DLL std::ostream G4cerr
HepLorentzVector & rotateZ(double)
G4int GetPDGEncoding() const
G4GLOB_DLL std::ostream G4cout
Hep3Vector boostVector() const
const G4LorentzVector & Get4Momentum() const
CLHEP::HepLorentzVector G4LorentzVector
static constexpr double GeV
HepLorentzRotation & transform(const HepBoost &b)
void Set4Momentum(const G4LorentzVector &a4Momentum)