65{
66 #ifdef debugQuarkExchange
68 #endif
69
71 G4double Mprojectile = projectile->GetDefinition()->GetPDGMass();
73
75 G4double Mtarget = target->GetDefinition()->GetPDGMass();
77
78 #ifdef debugQuarkExchange
79 G4cout<<
"Proj Targ "<<projectile->GetDefinition()->GetPDGEncoding()<<
" "<<target->GetDefinition()->GetPDGEncoding()<<
G4endl;
81 <<
"Targ. 4-Mom "<<Ptarget <<
" "<<Ptarget.
mag() <<
G4endl;
82 #endif
83
87
88 #ifdef debugQuarkExchange
89 G4cout<<
"SS Mpr Mtr SqrtS-Mprojectile-Mtarget "<<SqrtS<<
" "<<Mprojectile<<
" "<<Mtarget
90 <<
" "<<SqrtS-Mprojectile-Mtarget<<
G4endl;
91 #endif
92 if (SqrtS-Mprojectile-Mtarget <= 250.0*MeV) {
93 #ifdef debugQuarkExchange
94 G4cerr<<
"Energy is too small for quark exchange!"<<
G4endl;
95 G4cerr<<
"Projectile: "<<projectile->GetDefinition()->GetPDGEncoding()<<
" "
96 <<Pprojectile<<
" "<<Pprojectile.
mag()<<
G4endl;
97 G4cerr<<
"Target: "<<target->GetDefinition()->GetPDGEncoding()<<
" "
98 <<Ptarget<<
" "<<Ptarget.mag()<<
G4endl;
99 G4cerr<<
"sqrt(S) = "<<SqrtS<<
" Mp + Mt = "<<Pprojectile.
mag()+Ptarget.mag()<<
G4endl;
100 #endif
101 return true;
102 }
103
105
107
108 if ( Ptmp.
pz() <= 0. )
109 {
110
111
112 return false;
113 }
114
117
119
120 Pprojectile.transform(toCms);
121 Ptarget.transform(toCms);
122
123 #ifdef debugQuarkExchange
124 G4cout <<
"Pprojectile in CMS " << Pprojectile <<
G4endl;
126 #endif
128
129 G4double ProjectileMinDiffrMass = Pprojectile.mag()/GeV;
130 G4double TargetMinDiffrMass = Ptarget.mag()/GeV;
131
133
134 G4int PDGcode=projectile->GetDefinition()->GetPDGEncoding();
135 G4int absPDGcode=std::abs(PDGcode);
136
137 G4bool ProjectileDiffraction =
true;
138
139
140 if ( absPDGcode > 1000 ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
141 if ( (absPDGcode == 211) || (absPDGcode == 111) ) { ProjectileDiffraction =
G4UniformRand() <= 0.66; }
142 if ( (absPDGcode == 321) || (absPDGcode == 311) ||
143 ( PDGcode == 130) || ( PDGcode == 310) ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
144 if ( absPDGcode > 400 && absPDGcode < 600 ) { ProjectileDiffraction =
G4UniformRand() <= 0.5; }
145
146
147
148 if ( ProjectileDiffraction ) {
149 if ( absPDGcode > 1000 )
150 {
151 if ( absPDGcode > 4000 && absPDGcode < 6000 )
152 {
153 ProjectileMinDiffrMass = projectile->GetDefinition()->GetPDGMass()/CLHEP::GeV + 0.25;
154 AveragePt2 = 0.3;
155 }
156 else
157 {
158 ProjectileMinDiffrMass = 1.16;
159 AveragePt2 = 0.3;
160 }
161 }
162 else if( absPDGcode == 211 || absPDGcode == 111)
163 {
164 ProjectileMinDiffrMass = 1.0;
165 AveragePt2 = 0.3;
166 }
167 else if( absPDGcode == 321 || absPDGcode == 130 || absPDGcode == 310)
168 {
169 ProjectileMinDiffrMass = 1.1;
170 AveragePt2 = 0.3;
171 }
172 else if( absPDGcode == 22)
173 {
174 ProjectileMinDiffrMass = 0.25;
175 AveragePt2 = 0.36;
176 }
177 else if( absPDGcode > 400 && absPDGcode < 600)
178 {
179 ProjectileMinDiffrMass = projectile->GetDefinition()->GetPDGMass()/CLHEP::GeV + 0.25;
180 AveragePt2 = 0.3;
181 }
182 else
183 {
184 ProjectileMinDiffrMass = 1.1;
185 AveragePt2 = 0.3;
186 };
187
188 ProjectileMinDiffrMass = ProjectileMinDiffrMass * GeV;
189 Mprojectile2=
sqr(ProjectileMinDiffrMass);
190
192 TargetMinDiffrMass *= GeV;
193 Mtarget2 =
sqr( TargetMinDiffrMass) ;
194 }
195 else
196 {
198 ProjectileMinDiffrMass *=GeV;
199 Mprojectile2=
sqr(ProjectileMinDiffrMass);
200
201 TargetMinDiffrMass = 1.16*GeV;
202 Mtarget2 =
sqr( TargetMinDiffrMass) ;
203 AveragePt2 = 0.3;
204 }
205
206 AveragePt2 = AveragePt2 * GeV*GeV;
207
208 if ( SqrtS - (ProjectileMinDiffrMass+TargetMinDiffrMass) < 220.0*MeV ) return false;
209
210
214 G4double PMinusMin, PMinusMax, sqrtPMinusMin, sqrtPMinusMax;
215 G4double TPlusMin, TPlusMax, sqrtTPlusMin, sqrtTPlusMax;
216 G4double PMinusNew, PPlusNew, TPlusNew(0.), TMinusNew;
217
220
223 do {
224 whilecount++;
225
226 if (whilecount > 1000 )
227 {
229 return false;
230 }
231
232
234
236 ProjMassT2 = Mprojectile2 + Pt2;
237 ProjMassT = std::sqrt( ProjMassT2 );
238 TargMassT2 = Mtarget2 + Pt2;
239 TargMassT = std::sqrt( TargMassT2 );
240
241 #ifdef debugQuarkExchange
242 G4cout<<
"whilecount Pt2 ProjMassT TargMassT SqrtS S ProjectileDiffraction"<<
G4endl;
243 G4cout<<whilecount<<
" "<<Pt2<<
" "<<ProjMassT<<
" "<<TargMassT<<
" "<<SqrtS<<
" "<<
S<<
" "<<ProjectileDiffraction<<
G4endl;
244 #endif
245
246 if ( SqrtS < ProjMassT + TargMassT + 220.0*MeV ) continue;
247
248 PZcms2 = (
S*
S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
249 - 2.0*
S*ProjMassT2 - 2.0*
S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 /
S;
250
251 if ( PZcms2 < 0 ) continue;
252
253 PZcms = std::sqrt( PZcms2 );
254
255 if ( ProjectileDiffraction )
256 {
257 PMinusMin = std::sqrt( ProjMassT2 + PZcms2 ) - PZcms;
258 PMinusMax = SqrtS - TargMassT;
259 sqrtPMinusMin = std::sqrt(PMinusMin); sqrtPMinusMax = std::sqrt(PMinusMax);
260
261 if ( absPDGcode > 1000 )
262 {
263 PMinusNew = PMinusMax * (1.0 - (1.0 - PMinusMin/PMinusMax)
265 }
266 else if ( (absPDGcode == 211) || (absPDGcode == 111) )
267 {
268 while (true)
269 {
270 x=sqrtPMinusMax-(sqrtPMinusMax-sqrtPMinusMin)*
G4UniformRand();
272 if ( y < 1.0-0.7 * x/sqrtPMinusMax ) break;
273 }
275 }
276 else if ( (absPDGcode == 321) || (absPDGcode == 311) ||
277 ( PDGcode == 130) || ( PDGcode == 310) )
278 {
279 while (true)
280 {
281 x=sqrtPMinusMax-(sqrtPMinusMax-sqrtPMinusMin)*
G4UniformRand();
283 if ( y < 1.0-0.7 * x/sqrtPMinusMax ) break;
284 }
286 }
287 else
288 {
289 PMinusNew = PMinusMax * (1.0 - (1.0 - PMinusMin/PMinusMax)
291 };
292
293 TMinusNew = SqrtS - PMinusNew;
294
295 Qminus = Ptarget.minus() - TMinusNew;
296 TPlusNew = TargMassT2 / TMinusNew;
297 Qplus = Ptarget.plus() - TPlusNew;
298
299 }
300 else
301 {
302 TPlusMin = std::sqrt( TargMassT2 + PZcms2 ) - PZcms;
303 TPlusMax = SqrtS - ProjMassT;
304 sqrtTPlusMin = std::sqrt(TPlusMin); sqrtTPlusMax = std::sqrt(TPlusMax);
305
306 if ( absPDGcode > 1000 )
307 {
308 TPlusNew = TPlusMax * (1.0 - (1.0 - TPlusMin/TPlusMax)
310 }
311 else if ( (absPDGcode == 211) || (absPDGcode == 111) )
312 {
313 while (true)
314 {
317 if ( y < 1.0-0.7 * x/sqrtTPlusMax ) break;
318 }
320 }
321 else if ( (absPDGcode == 321) || (absPDGcode == 311) ||
322 ( PDGcode == 130) || ( PDGcode == 310) )
323 {
324 while (true)
325 {
328 if ( y < 1.0-0.7 * x/sqrtTPlusMax ) break;
329 }
330 }
331 else
332 {
333 TPlusNew = TPlusMax * (1.0 - (1.0 - TPlusMin/TPlusMax)
335 };
336
337 PPlusNew = SqrtS - TPlusNew;
338
339 Qplus = PPlusNew - Pprojectile.plus();
340 PMinusNew = ProjMassT2 / PPlusNew;
341 Qminus = PMinusNew - Pprojectile.minus();
342 }
343
344 Qmomentum.
setPz( (Qplus - Qminus)/2 );
345 Qmomentum.
setE( (Qplus + Qminus)/2 );
346
347 #ifdef debugQuarkExchange
348 G4cout<<
"ProjectileDiffraction (Pprojectile + Qmomentum).mag2() Mprojectile2"<<
G4endl;
349 G4cout<<ProjectileDiffraction<<
" "<<( Pprojectile + Qmomentum ).mag2()<<
" "<< Mprojectile2<<
G4endl;
350 G4cout<<
"TargetDiffraction (Ptarget - Qmomentum).mag2() Mtarget2"<<
G4endl;
351 G4cout<<!ProjectileDiffraction<<
" "<<( Ptarget - Qmomentum ).mag2()<<
" "<< Mtarget2<<
G4endl;
352 #endif
353
354 } while ( ( ProjectileDiffraction&&( Pprojectile + Qmomentum ).mag2() < Mprojectile2 ) ||
355 (!ProjectileDiffraction&&( Ptarget - Qmomentum ).mag2() < Mtarget2 ) );
356
357
358 Pprojectile += Qmomentum;
359
360 Ptarget -= Qmomentum;
361
362
365
366 #ifdef debugQuarkExchange
367 G4cout <<
"Pprojectile in Lab. " << Pprojectile <<
G4endl;
369 G4cout <<
"G4QuarkExchange: Projectile mass " << Pprojectile.mag() <<
G4endl;
370 G4cout <<
"G4QuarkExchange: Target mass " << Ptarget.mag() <<
G4endl;
371 #endif
372
373 target->Set4Momentum(Ptarget);
374 projectile->Set4Momentum(Pprojectile);
375
376
377 projectile->SplitUp();
378 target->SplitUp();
379
382
383 if( projectile->GetDefinition()->GetBaryonNumber() >= 0 ) {
384
385 PrQuark = projectile->GetNextParton();
386 TrQuark = target->GetNextParton();
390 return true;
391 }
392
393
394
395 PrQuark = projectile->GetNextAntiParton();
396 TrQuark = target->GetNextParton();
401 if( (AQpr != nullptr) && (Qtr != nullptr) ) {
404 }
405 }
406
407 return true;
408}
CLHEP::HepLorentzVector G4LorentzVector
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
Hep3Vector boostVector() const
HepLorentzVector & rotateZ(double)
HepLorentzVector & rotateY(double)
HepLorentzVector & transform(const HepRotation &)
G4int GetPDGEncoding() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * GetDefinition()
void SetDefinition(G4ParticleDefinition *aDefinition)
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const