60 #ifdef debugQuarkExchange
72 #ifdef debugQuarkExchange
74 G4cout<<
"Proj. 4-Mom "<<Pprojectile<<
" "<<Pprojectile.
mag()<<G4endl
75 <<
"Targ. 4-Mom "<<Ptarget <<
" "<<Ptarget.
mag() <<
G4endl;
82 #ifdef debugQuarkExchange
83 G4cout<<
"SS Mpr Mtr SqrtS-Mprojectile-Mtarget "<<SqrtS<<
" "<<Mprojectile<<
" "<<Mtarget
84 <<
" "<<SqrtS-Mprojectile-Mtarget<<
G4endl;
86 if (SqrtS-Mprojectile-Mtarget <= 250.0*
MeV) {
87 #ifdef debugQuarkExchange
88 G4cerr<<
"Energy is too small for quark exchange!"<<
G4endl;
90 <<Pprojectile<<
" "<<Pprojectile.
mag()<<
G4endl;
92 <<Ptarget<<
" "<<Ptarget.mag()<<
G4endl;
93 G4cerr<<
"sqrt(S) = "<<SqrtS<<
" Mp + Mt = "<<Pprojectile.
mag()+Ptarget.mag()<<
G4endl;
102 if ( Ptmp.pz() <= 0. )
110 toCms.
rotateY(-1*Ptmp.theta());
117 #ifdef debugQuarkExchange
118 G4cout <<
"Pprojectile in CMS " << Pprojectile <<
G4endl;
123 G4double ProjectileMinDiffrMass = Pprojectile.mag()/
GeV;
131 G4bool ProjectileDiffraction =
true;
133 if ( absPDGcode > 1000 ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
134 if ( (absPDGcode == 211) || (absPDGcode == 111) ) { ProjectileDiffraction =
G4UniformRand() <= 0.66; }
135 if ( (absPDGcode == 321) || (absPDGcode == 311) ||
136 ( PDGcode == 130) || ( PDGcode == 310) ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
138 if ( ProjectileDiffraction ) {
139 if ( absPDGcode > 1000 )
141 ProjectileMinDiffrMass = 1.16;
144 else if( absPDGcode == 211 || absPDGcode == 111)
146 ProjectileMinDiffrMass = 1.0;
149 else if( absPDGcode == 321 || absPDGcode == 130 || absPDGcode == 310)
151 ProjectileMinDiffrMass = 1.1;
154 else if( absPDGcode == 22)
156 ProjectileMinDiffrMass = 0.25;
161 ProjectileMinDiffrMass = 1.1;
165 ProjectileMinDiffrMass = ProjectileMinDiffrMass *
GeV;
166 Mprojectile2=
sqr(ProjectileMinDiffrMass);
169 TargetMinDiffrMass *=
GeV;
170 Mtarget2 =
sqr( TargetMinDiffrMass) ;
175 ProjectileMinDiffrMass *=
GeV;
176 Mprojectile2=
sqr(ProjectileMinDiffrMass);
178 TargetMinDiffrMass = 1.16*
GeV;
179 Mtarget2 =
sqr( TargetMinDiffrMass) ;
183 AveragePt2 = AveragePt2 *
GeV*
GeV;
185 if ( SqrtS - (ProjectileMinDiffrMass+TargetMinDiffrMass) < 220*
MeV )
return false;
191 G4double PMinusMin, PMinusMax, sqrtPMinusMin, sqrtPMinusMax;
192 G4double TPlusMin, TPlusMax, sqrtTPlusMin, sqrtTPlusMax;
193 G4double PMinusNew, PPlusNew, TPlusNew(0.), TMinusNew;
203 if (whilecount > 1000 )
213 ProjMassT2 = Mprojectile2 + Pt2;
214 ProjMassT = std::sqrt( ProjMassT2 );
215 TargMassT2 = Mtarget2 + Pt2;
216 TargMassT = std::sqrt( TargMassT2 );
218 #ifdef debugQuarkExchange
219 G4cout<<
"whilecount Pt2 ProjMassT TargMassT SqrtS S ProjectileDiffraction"<<
G4endl;
220 G4cout<<whilecount<<
" "<<Pt2<<
" "<<ProjMassT<<
" "<<TargMassT<<
" "<<SqrtS<<
" "<<S<<
" "<<ProjectileDiffraction<<
G4endl;
223 if ( SqrtS < ProjMassT + TargMassT + 220.0*
MeV )
continue;
225 PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
226 - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
228 if ( PZcms2 < 0 )
continue;
230 PZcms = std::sqrt( PZcms2 );
232 if ( ProjectileDiffraction )
234 PMinusMin = std::sqrt( ProjMassT2 + PZcms2 ) - PZcms;
235 PMinusMax = SqrtS - TargMassT;
236 sqrtPMinusMin = std::sqrt(PMinusMin); sqrtPMinusMax = std::sqrt(PMinusMax);
238 if ( absPDGcode > 1000 )
240 PMinusNew = PMinusMax * (1.0 - (1.0 - PMinusMin/PMinusMax)
243 else if ( (absPDGcode == 211) || (absPDGcode == 111) )
249 if ( y < 1.0-0.7 *
x/sqrtPMinusMax )
break;
253 else if ( (absPDGcode == 321) || (absPDGcode == 311) ||
254 ( PDGcode == 130) || ( PDGcode == 310) )
260 if ( y < 1.0-0.7 *
x/sqrtPMinusMax )
break;
266 PMinusNew = PMinusMax * (1.0 - (1.0 - PMinusMin/PMinusMax)
270 TMinusNew = SqrtS - PMinusNew;
272 Qminus = Ptarget.minus() - TMinusNew;
273 TPlusNew = TargMassT2 / TMinusNew;
274 Qplus = Ptarget.plus() - TPlusNew;
279 TPlusMin = std::sqrt( TargMassT2 + PZcms2 ) - PZcms;
280 TPlusMax = SqrtS - ProjMassT;
281 sqrtTPlusMin = std::sqrt(TPlusMin); sqrtTPlusMax = std::sqrt(TPlusMax);
283 if ( absPDGcode > 1000 )
285 TPlusNew = TPlusMax * (1.0 - (1.0 - TPlusMin/TPlusMax)
288 else if ( (absPDGcode == 211) || (absPDGcode == 111) )
294 if ( y < 1.0-0.7 *
x/sqrtTPlusMax )
break;
298 else if ( (absPDGcode == 321) || (absPDGcode == 311) ||
299 ( PDGcode == 130) || ( PDGcode == 310) )
305 if ( y < 1.0-0.7 *
x/sqrtTPlusMax )
break;
310 TPlusNew = TPlusMax * (1.0 - (1.0 - TPlusMin/TPlusMax)
314 PPlusNew = SqrtS - TPlusNew;
316 Qplus = PPlusNew - Pprojectile.plus();
317 PMinusNew = ProjMassT2 / PPlusNew;
318 Qminus = PMinusNew - Pprojectile.minus();
321 Qmomentum.
setPz( (Qplus - Qminus)/2 );
322 Qmomentum.
setE( (Qplus + Qminus)/2 );
324 #ifdef debugQuarkExchange
325 G4cout<<
"ProjectileDiffraction (Pprojectile + Qmomentum).mag2() Mprojectile2"<<
G4endl;
326 G4cout<<ProjectileDiffraction<<
" "<<( Pprojectile + Qmomentum ).mag2()<<
" "<< Mprojectile2<<
G4endl;
327 G4cout<<
"TargetDiffraction (Ptarget - Qmomentum).mag2() Mtarget2"<<
G4endl;
328 G4cout<<!ProjectileDiffraction<<
" "<<( Ptarget - Qmomentum ).mag2()<<
" "<< Mtarget2<<
G4endl;
331 }
while ( ( ProjectileDiffraction&&( Pprojectile + Qmomentum ).mag2() < Mprojectile2 ) ||
332 (!ProjectileDiffraction&&( Ptarget - Qmomentum ).mag2() < Mtarget2 ) );
335 Pprojectile += Qmomentum;
337 Ptarget -= Qmomentum;
343 #ifdef debugQuarkExchange
344 G4cout <<
"Pprojectile in Lab. " << Pprojectile <<
G4endl;
346 G4cout <<
"G4QuarkExchange: Projectile mass " << Pprojectile.mag() <<
G4endl;
347 G4cout <<
"G4QuarkExchange: Target mass " << Ptarget.mag() <<
G4endl;
375 const G4int maxNumberOfLoops = 1000;
376 G4int loopCounter = 0;
379 }
while ( ( pt2 > maxPtSquare) && ++loopCounter < maxNumberOfLoops );
380 if ( loopCounter >= maxNumberOfLoops ) {
381 pt2 = 0.99*maxPtSquare;
388 return G4ThreeVector (pt2*std::cos(phi), pt2*std::sin(phi), 0.);