93 G4bool& isDiffractive )
const {
95 #ifdef debugFTFexcitation
99 CommonVariables common;
103 if ( common.Pprojectile.z() < 0.0 )
return false;
105 common.absProjectilePDGcode = std::abs( common.ProjectilePDGcode );
107 G4double ProjectileRapidity = common.Pprojectile.rapidity();
112 common.absTargetPDGcode = std::abs( common.TargetPDGcode );
114 G4double TargetRapidity = common.Ptarget.rapidity();
118 common.S = Psum.
mag2();
119 common.SqrtS = std::sqrt( common.S );
122 G4bool toBePutOnMassShell =
true;
123 common.MminProjectile = common.BrW.GetMinimumMass( projectile->
GetDefinition() );
132 common.M0projectile2 = common.M0projectile * common.M0projectile;
135 if ( common.M0projectile > common.ProjectileDiffStateMinMass ) {
136 common.ProjectileDiffStateMinMass = common.MminProjectile + 220.0*MeV;
137 common.ProjectileNonDiffStateMinMass = common.MminProjectile + 220.0*MeV;
138 if ( common.absProjectilePDGcode > 3000 ) {
139 common.ProjectileDiffStateMinMass += 140.0*MeV;
140 common.ProjectileNonDiffStateMinMass += 140.0*MeV;
143 common.MminTarget = common.BrW.GetMinimumMass( target->
GetDefinition() );
152 common.M0target2 = common.M0target * common.M0target;
155 if ( common.M0target > common.TargetDiffStateMinMass ) {
156 common.TargetDiffStateMinMass = common.MminTarget + 220.0*MeV;
157 common.TargetNonDiffStateMinMass = common.MminTarget + 220.0*MeV;
158 if ( common.absTargetPDGcode > 3000 ) {
159 common.TargetDiffStateMinMass += 140.0*MeV;
160 common.TargetNonDiffStateMinMass += 140.0*MeV;
163 #ifdef debugFTFexcitation
164 G4cout <<
"Proj Targ PDGcodes " << common.ProjectilePDGcode <<
" " << common.TargetPDGcode <<
G4endl
165 <<
"Mprojectile Y " << common.Pprojectile.mag() <<
" " << ProjectileRapidity <<
G4endl
166 <<
"M0projectile Y " << common.M0projectile <<
" " << ProjectileRapidity <<
G4endl;
167 G4cout <<
"Mtarget Y " << common.Ptarget.mag() <<
" " << TargetRapidity <<
G4endl
168 <<
"M0target Y " << common.M0target <<
" " << TargetRapidity <<
G4endl;
169 G4cout <<
"Pproj " << common.Pprojectile <<
G4endl <<
"Ptarget " << common.Ptarget <<
G4endl;
175 if ( Ptmp.
pz() <= 0.0 )
return false;
176 common.toCms.rotateZ( -1*Ptmp.
phi() );
177 common.toCms.rotateY( -1*Ptmp.
theta() );
178 common.toLab = common.toCms.inverse();
179 common.Pprojectile.transform( common.toCms );
180 common.Ptarget.transform( common.toCms );
182 G4double SumMasses = common.M0projectile + common.M0target;
183 #ifdef debugFTFexcitation
184 G4cout <<
"SqrtS " << common.SqrtS <<
G4endl <<
"M0pr M0tr SumM " << common.M0projectile
185 <<
" " << common.M0target <<
" " << SumMasses <<
G4endl;
187 if ( common.SqrtS < SumMasses )
return false;
189 common.PZcms2 = (
sqr( common.S ) +
sqr( common.M0projectile2 ) +
sqr( common.M0target2 )
190 - 2.0 * ( common.S * ( common.M0projectile2 + common.M0target2 )
191 + common.M0projectile2 * common.M0target2 ) ) / 4.0 / common.S;
192 #ifdef debugFTFexcitation
193 G4cout <<
"PZcms2 after toBePutOnMassShell " << common.PZcms2 <<
G4endl;
195 if ( common.PZcms2 < 0.0 )
return false;
197 common.PZcms = std::sqrt( common.PZcms2 );
198 if ( toBePutOnMassShell ) {
199 if ( common.Pprojectile.z() > 0.0 ) {
200 common.Pprojectile.setPz( common.PZcms );
201 common.Ptarget.setPz( -common.PZcms );
203 common.Pprojectile.setPz( -common.PZcms );
204 common.Ptarget.setPz( common.PZcms );
206 common.Pprojectile.setE( std::sqrt( common.M0projectile2
207 + common.Pprojectile.x() * common.Pprojectile.x()
208 + common.Pprojectile.y() * common.Pprojectile.y()
210 common.Ptarget.setE( std::sqrt( common.M0target2
211 + common.Ptarget.x() * common.Ptarget.x()
212 + common.Ptarget.y() * common.Ptarget.y()
215 #ifdef debugFTFexcitation
216 G4cout <<
"Start --------------------" <<
G4endl <<
"Proj M0 Mdif Mndif " << common.M0projectile
217 <<
" " << common.ProjectileDiffStateMinMass <<
" " << common.ProjectileNonDiffStateMinMass
219 <<
"Targ M0 Mdif Mndif " << common.M0target <<
" " << common.TargetDiffStateMinMass
220 <<
" " << common.TargetNonDiffStateMinMass <<
G4endl <<
"SqrtS " << common.SqrtS <<
G4endl
221 <<
"Proj CMS " << common.Pprojectile <<
G4endl <<
"Targ CMS " << common.Ptarget <<
G4endl;
225 ProjectileRapidity = common.Pprojectile.rapidity();
226 TargetRapidity = common.Ptarget.rapidity();
229 theParameters->
GetProcProb( 4, ProjectileRapidity - TargetRapidity );
230 common.ProbProjectileDiffraction =
231 theParameters->
GetProcProb( 2, ProjectileRapidity - TargetRapidity );
232 common.ProbTargetDiffraction =
233 theParameters->
GetProcProb( 3, ProjectileRapidity - TargetRapidity );
234 common.ProbOfDiffraction = common.ProbProjectileDiffraction + common.ProbTargetDiffraction;
235 #ifdef debugFTFexcitation
236 G4cout <<
"Proc Probs " << QeNoExc <<
" " << QeExc <<
" "
237 << common.ProbProjectileDiffraction <<
" " << common.ProbTargetDiffraction <<
G4endl
238 <<
"ProjectileRapidity " << ProjectileRapidity <<
G4endl;
241 if ( QeNoExc + QeExc + common.ProbProjectileDiffraction + common.ProbTargetDiffraction > 1.0 ) {
242 QeNoExc = 1.0 - QeExc - common.ProbProjectileDiffraction - common.ProbTargetDiffraction;
244 if ( QeExc + QeNoExc != 0.0 ) {
245 common.ProbExc = QeExc / ( QeExc + QeNoExc );
247 if ( 1.0 - QeExc - QeNoExc > 0.0 ) {
248 common.ProbProjectileDiffraction /= ( 1.0 - QeExc - QeNoExc );
249 common.ProbTargetDiffraction /= ( 1.0 - QeExc - QeNoExc );
251 #ifdef debugFTFexcitation
252 G4cout <<
"Proc Probs " << QeNoExc <<
" " << QeExc <<
" "
253 << common.ProbProjectileDiffraction <<
" " << common.ProbTargetDiffraction <<
G4endl
254 <<
"ProjectileRapidity " << ProjectileRapidity <<
G4endl;
258 G4int returnCode = 1;
260 returnCode = ExciteParticipants_doChargeExchange( projectile, target, theParameters,
261 theElastic, common );
264 G4bool returnResult =
false;
265 if ( returnCode == 0 ) {
267 }
else if ( returnCode == 1 ) {
269 common.ProbOfDiffraction = common.ProbProjectileDiffraction + common.ProbTargetDiffraction;
270 #ifdef debugFTFexcitation
272 <<
"Proj M0 MdMin MndMin " << common.M0projectile <<
" "
273 << common.ProjectileDiffStateMinMass <<
" " << common.ProjectileNonDiffStateMinMass
275 <<
"Targ M0 MdMin MndMin " << common.M0target <<
" " << common.TargetDiffStateMinMass
276 <<
" " << common.TargetNonDiffStateMinMass <<
G4endl <<
"SqrtS " << common.SqrtS
278 <<
"Prob: ProjDiff TargDiff + Sum " << common.ProbProjectileDiffraction <<
" "
279 << common.ProbTargetDiffraction <<
" " << common.ProbOfDiffraction <<
G4endl;
281 if ( common.ProbOfDiffraction != 0.0 ) {
282 common.ProbProjectileDiffraction /= common.ProbOfDiffraction;
284 common.ProbProjectileDiffraction = 0.0;
286 #ifdef debugFTFexcitation
287 G4cout <<
"Prob: ProjDiff TargDiff + Sum " << common.ProbProjectileDiffraction <<
" "
288 << common.ProbTargetDiffraction <<
" " << common.ProbOfDiffraction <<
G4endl;
290 common.ProjectileDiffStateMinMass2 =
sqr( common.ProjectileDiffStateMinMass );
291 common.ProjectileNonDiffStateMinMass2 =
sqr( common.ProjectileNonDiffStateMinMass );
292 common.TargetDiffStateMinMass2 =
sqr( common.TargetDiffStateMinMass );
293 common.TargetNonDiffStateMinMass2 =
sqr( common.TargetNonDiffStateMinMass );
297 returnResult = ExciteParticipants_doDiffraction( projectile, target, theParameters, common );
299 if ( returnResult ) isDiffractive =
true;
303 returnResult = ExciteParticipants_doNonDiffraction( projectile, target, theParameters, common );
306 if ( returnResult ) {
307 common.Pprojectile += common.Qmomentum;
308 common.Ptarget -= common.Qmomentum;
310 common.Pprojectile.transform( common.toLab );
311 common.Ptarget.transform( common.toLab );
312 #ifdef debugFTFexcitation
313 G4cout <<
"Mproj " << common.Pprojectile.mag() <<
G4endl <<
"Mtarg " << common.Ptarget.mag()
328G4int G4DiffractiveExcitation::
333 G4DiffractiveExcitation::CommonVariables& common )
const {
340 G4int returnCode = 99;
344 G4double MtestPr = 0.0, MtestTr = 0.0;
346 #ifdef debugFTFexcitation
347 G4cout <<
"Q exchange --------------------------" <<
G4endl;
360 G4int NewProjCode = 0, NewTargCode = 0, ProjQ1 = 0, ProjQ2 = 0, ProjQ3 = 0;
362 if ( common.absProjectilePDGcode < 1000 ) {
363 UnpackMeson( common.ProjectilePDGcode, ProjQ1, ProjQ2 );
365 UnpackBaryon( common.ProjectilePDGcode, ProjQ1, ProjQ2, ProjQ3 );
368 G4int TargQ1 = 0, TargQ2 = 0, TargQ3 = 0;
369 UnpackBaryon( common.TargetPDGcode, TargQ1, TargQ2, TargQ3 );
370 #ifdef debugFTFexcitation
371 G4cout <<
"Proj Quarks " << ProjQ1 <<
" " << ProjQ2 <<
" " << ProjQ3 <<
G4endl
372 <<
"Targ Quarks " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl;
376 G4int ProjExchangeQ = 0, TargExchangeQ = 0;
377 if ( common.absProjectilePDGcode < 1000 ) {
379 G4bool isProjQ1Quark =
false;
380 ProjExchangeQ = ProjQ2;
382 isProjQ1Quark =
true;
383 ProjExchangeQ = ProjQ1;
386 G4int NpossibleStates = 0;
387 if ( ProjExchangeQ != TargQ1 ) NpossibleStates++;
388 if ( ProjExchangeQ != TargQ2 ) NpossibleStates++;
389 if ( ProjExchangeQ != TargQ3 ) NpossibleStates++;
390 G4int Nsampled = (
G4int)G4RandFlat::shootInt(
G4long( NpossibleStates ) )+1;
392 if ( ProjExchangeQ != TargQ1 ) {
393 if ( ++NpossibleStates == Nsampled ) {
394 TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ;
395 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
398 if ( ProjExchangeQ != TargQ2 ) {
399 if ( ++NpossibleStates == Nsampled ) {
400 TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ;
401 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
404 if ( ProjExchangeQ != TargQ3 ) {
405 if ( ++NpossibleStates == Nsampled ) {
406 TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ;
407 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
410 #ifdef debugFTFexcitation
411 G4cout <<
"Exchanged Qs in Pr Tr " << ProjExchangeQ <<
" " << TargExchangeQ <<
G4endl;
414 G4int aProjQ1 = std::abs( ProjQ1 ), aProjQ2 = std::abs( ProjQ2 );
415 G4bool ProjExcited =
false;
416 const G4int maxNumberOfAttempts = 50;
418 while ( attempts++ < maxNumberOfAttempts ) {
423 if ( aProjQ1 == aProjQ2 ) {
433 }
else if ( aProjQ1 == 3 ) {
438 }
else if ( aProjQ1 == 4 ) {
440 }
else if ( aProjQ1 == 5 ) {
449 }
else if ( aProjQ1 == 3 ) {
451 }
else if ( aProjQ1 == 4 ) {
453 }
else if ( aProjQ1 == 5 ) {
458 if ( aProjQ1 > aProjQ2 ) {
459 NewProjCode = aProjQ1*100 + aProjQ2*10 + 1;
461 NewProjCode = aProjQ2*100 + aProjQ1*10 + 1;
464 #ifdef debugFTFexcitation
471 if ( aProjQ1 <= 3 && aProjQ2 <= 3 &&
G4UniformRand() < 0.5 ) {
478 G4int value = ProjQ1, absValue = aProjQ1, Qquarks = 0;
479 for (
G4int iQ = 0; iQ < 2; ++iQ ) {
481 value = ProjQ2; absValue = aProjQ2;
483 if ( absValue == 2 || absValue == 4 ) {
484 Qquarks += 2*value/absValue;
486 Qquarks -= value/absValue;
505 if ( Qquarks < 0 || ( Qquarks == 0 && aProjQ1 != aProjQ2 && aProjQ1%2 == 0 ) ) {
508 #ifdef debugFTFexcitation
509 G4cout <<
"NewProjCode +2 or 0 " << NewProjCode <<
G4endl;
510 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
512 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
517 if ( ! TestParticle )
continue;
518 common.MminProjectile = common.BrW.
GetMinimumMass( TestParticle );
519 if ( common.SqrtS - common.M0target < common.MminProjectile )
continue;
522 #ifdef debugFTFexcitation
525 <<
"MtestPart MtestPart0 "<<MtestPr<<
" "<<TestParticle->
GetPDGMass()<<
G4endl
526 <<
"M0projectile projectile PDGMass " << common.M0projectile <<
" "
531 NewTargCode = NewNucleonId( TargQ1, TargQ2, TargQ3 );
532 #ifdef debugFTFexcitation
533 G4cout <<
"New TrQ " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl
534 <<
"NewTargCode " << NewTargCode <<
G4endl;
539 if ( TargQ1 <= 3 && TargQ2 <= 3 && TargQ3 <= 3 ) {
540 if ( TargQ1 != TargQ2 && TargQ1 != TargQ3 && TargQ2 != TargQ3 ) {
546 }
else if ( TargQ1 == TargQ2 && TargQ1 == TargQ3 ) {
547 NewTargCode += 2; ProjExcited =
true;
550 NewTargCode += 2; ProjExcited =
true;
552 }
else if ( ! ProjExcited &&
554 common.SqrtS > common.M0projectile +
564 if ( NewTargCode == 3124 ||
565 NewTargCode == 3224 ||
566 NewTargCode == 3214 ||
567 NewTargCode == 3114 ||
568 NewTargCode == 3324 ||
569 NewTargCode == 3314 ) {
577 #ifdef debug_heavyHadrons
578 G4int initialNewTargCode = NewTargCode;
580 if ( NewTargCode == 4322 ) NewTargCode = 4232;
581 else if ( NewTargCode == 4312 ) NewTargCode = 4132;
582 else if ( NewTargCode == 5312 ) NewTargCode = 5132;
583 else if ( NewTargCode == 5322 ) NewTargCode = 5232;
584 #ifdef debug_heavyHadrons
585 if ( NewTargCode != initialNewTargCode ) {
586 G4cout <<
"G4DiffractiveExcitation::ExciteParticipants_doChargeExchange : forcing (inexisting in G4)" <<
G4endl
587 <<
"\t target heavy baryon with pdgCode=" << initialNewTargCode
588 <<
" into pdgCode=" << NewTargCode <<
G4endl;
593 if ( ! TestParticle )
continue;
594 #ifdef debugFTFexcitation
598 if ( common.SqrtS - MtestPr < common.MminTarget )
continue;
601 if ( common.SqrtS > MtestPr + MtestTr )
break;
604 if ( attempts >= maxNumberOfAttempts )
return returnCode;
606 if ( MtestPr >= common.Pprojectile.
mag() || projectile->
GetStatus() != 0 ) {
607 common.M0projectile = MtestPr;
609 #ifdef debugFTFexcitation
610 G4cout <<
"M0projectile After check " << common.M0projectile <<
G4endl;
612 common.M0projectile2 = common.M0projectile * common.M0projectile;
613 common.ProjectileDiffStateMinMass = common.M0projectile + 220.0*MeV;
614 common.ProjectileNonDiffStateMinMass = common.M0projectile + 220.0*MeV;
615 if ( MtestTr >= common.Ptarget.
mag() || target->
GetStatus() != 0 ) {
616 common.M0target = MtestTr;
618 common.M0target2 = common.M0target * common.M0target;
619 #ifdef debugFTFexcitation
620 G4cout <<
"New targ M0 M0^2 " << common.M0target <<
" " << common.M0target2 <<
G4endl;
622 common.TargetDiffStateMinMass = common.M0target + 220.0*MeV;
623 common.TargetNonDiffStateMinMass = common.M0target + 220.0*MeV;
630 if ( common.ProjectilePDGcode < 0 )
return 1;
634 G4bool isProjectileExchangedQ =
false;
635 G4int firstQ = TargQ1, secondQ = TargQ2, thirdQ = TargQ3;
636 G4int otherFirstQ = ProjQ1, otherSecondQ = ProjQ2, otherThirdQ = ProjQ3;
638 isProjectileExchangedQ =
true;
639 firstQ = ProjQ1; secondQ = ProjQ2; thirdQ = ProjQ3;
640 otherFirstQ = TargQ1; otherSecondQ = TargQ2; otherThirdQ = TargQ3;
644 G4int exchangedQ = 0;
646 if ( Ksi < 0.333333 ) {
648 }
else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
649 exchangedQ = secondQ;
653 #ifdef debugFTFexcitation
654 G4cout <<
"Exchange Qs isProjectile Q " << isProjectileExchangedQ <<
" " << exchangedQ <<
" ";
660 const G4int MaxCount = 100;
661 G4int count = 0, otherExchangedQ = 0;
663 if ( exchangedQ != otherFirstQ ||
G4UniformRand() < probSame ) {
664 otherExchangedQ = otherFirstQ; otherFirstQ = exchangedQ; exchangedQ = otherExchangedQ;
666 if ( exchangedQ != otherSecondQ ||
G4UniformRand() < probSame ) {
667 otherExchangedQ = otherSecondQ; otherSecondQ = exchangedQ; exchangedQ = otherExchangedQ;
669 if ( exchangedQ != otherThirdQ ||
G4UniformRand() < probSame ) {
670 otherExchangedQ = otherThirdQ; otherThirdQ = exchangedQ; exchangedQ = otherExchangedQ;
674 }
while ( otherExchangedQ == 0 && ++count < MaxCount );
675 if ( count >= MaxCount )
return returnCode;
678 if ( Ksi < 0.333333 ) {
680 }
else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
681 secondQ = exchangedQ;
685 if ( isProjectileExchangedQ ) {
686 ProjQ1 = firstQ; ProjQ2 = secondQ; ProjQ3 = thirdQ;
687 TargQ1 = otherFirstQ; TargQ2 = otherSecondQ; TargQ3 = otherThirdQ;
689 TargQ1 = firstQ; TargQ2 = secondQ; TargQ3 = thirdQ;
690 ProjQ1 = otherFirstQ; ProjQ2 = otherSecondQ; ProjQ3 = otherThirdQ;
692 #ifdef debugFTFexcitation
693 G4cout <<
"Exchange Qs Pr Tr " << ( isProjectileExchangedQ ? exchangedQ : otherExchangedQ )
694 <<
" " << ( isProjectileExchangedQ ? otherExchangedQ : exchangedQ ) <<
G4endl;
697 NewProjCode = NewNucleonId( ProjQ1, ProjQ2, ProjQ3 );
698 NewTargCode = NewNucleonId( TargQ1, TargQ2, TargQ3 );
706 for (
G4int iHadron = 0; iHadron < 2; iHadron++ ) {
708 G4int codeQ1 = ProjQ1, codeQ2 = ProjQ2, codeQ3 = ProjQ3, newHadCode = NewProjCode;
709 G4double massConstraint = common.M0target;
711 if ( iHadron == 1 ) {
712 codeQ1 = TargQ1, codeQ2 = TargQ2, codeQ3 = TargQ3, newHadCode = NewTargCode;
713 massConstraint = common.M0projectile;
714 isHadronADelta = ( target->
GetDefinition()->GetPDGiIsospin() == 3 );
716 if ( codeQ1 > 3 || codeQ2 > 3 || codeQ3 > 3 )
continue;
717 if ( codeQ1 == codeQ2 && codeQ1 == codeQ3 ) {
719 }
else if ( isHadronADelta ) {
734 if ( iHadron == 0 ) {
735 NewProjCode = newHadCode;
737 NewTargCode = newHadCode;
740 #ifdef debugFTFexcitation
741 G4cout <<
"NewProjCode NewTargCode " << NewProjCode <<
" " << NewTargCode <<
G4endl;
748 if ( NewProjCode == 3124 ||
749 NewProjCode == 3224 ||
750 NewProjCode == 3214 ||
751 NewProjCode == 3114 ||
752 NewProjCode == 3324 ||
753 NewProjCode == 3314 ) {
758 if ( NewTargCode == 3124 ||
759 NewTargCode == 3224 ||
760 NewTargCode == 3214 ||
761 NewTargCode == 3114 ||
762 NewTargCode == 3324 ||
763 NewTargCode == 3314 ) {
771 #ifdef debug_heavyHadrons
772 G4int initialNewProjCode = NewProjCode, initialNewTargCode = NewTargCode;
774 if ( NewProjCode == 4322 ) NewProjCode = 4232;
775 else if ( NewProjCode == 4312 ) NewProjCode = 4132;
776 else if ( NewProjCode == 5312 ) NewProjCode = 5132;
777 else if ( NewProjCode == 5322 ) NewProjCode = 5232;
778 if ( NewTargCode == 4322 ) NewTargCode = 4232;
779 else if ( NewTargCode == 4312 ) NewTargCode = 4132;
780 else if ( NewTargCode == 5312 ) NewTargCode = 5132;
781 else if ( NewTargCode == 5322 ) NewTargCode = 5232;
782 #ifdef debug_heavyHadrons
783 if ( NewProjCode != initialNewProjCode || NewTargCode != initialNewTargCode ) {
784 G4cout <<
"G4DiffractiveExcitation::ExciteParticipants_doChargeExchange : forcing (inexisting in G4)" <<
G4endl
785 <<
"\t heavy baryon into an existing one:" <<
G4endl;
786 if ( NewProjCode != initialNewProjCode ) {
787 G4cout <<
"\t \t projectile baryon with pdgCode=" << initialNewProjCode
788 <<
" into pdgCode=" << NewProjCode <<
G4endl;
790 if ( NewTargCode != initialNewTargCode ) {
791 G4cout <<
"\t \t target baryon with pdgCode=" << initialNewTargCode
792 <<
" into pdgCode=" << NewTargCode <<
G4endl;
802 G4VSplitableHadron* firstHadron = target;
803 G4VSplitableHadron* secondHadron = projectile;
804 G4int firstHadronCode = NewTargCode, secondHadronCode = NewProjCode;
805 G4double massConstraint = common.M0projectile;
806 G4bool isFirstTarget =
true;
809 firstHadron = projectile; secondHadron = target;
810 firstHadronCode = NewProjCode; secondHadronCode = NewTargCode;
811 massConstraint = common.M0target;
812 isFirstTarget =
false;
814 G4double Mtest1st = 0.0, Mtest2nd = 0.0, Mmin1st = 0.0, Mmin2nd = 0.0;
815 for (
int iSamplingCase = 0; iSamplingCase < 2; iSamplingCase++ ) {
816 G4VSplitableHadron* aHadron = firstHadron;
817 G4int aHadronCode = firstHadronCode;
818 if ( iSamplingCase == 1 ) {
819 aHadron = secondHadron; aHadronCode = secondHadronCode; massConstraint = Mtest1st;
821 G4double MtestHadron = 0.0, MminHadron = 0.0;
824 if ( ! TestParticle )
return returnCode;
826 if ( common.SqrtS - massConstraint < MminHadron )
return returnCode;
830 const G4int maxNumberOfAttempts = 50;
832 while ( attempts < maxNumberOfAttempts ) {
836 if ( common.SqrtS < MtestHadron + massConstraint ) {
842 if ( attempts >= maxNumberOfAttempts )
return returnCode;
845 if ( iSamplingCase == 0 ) {
846 Mtest1st = MtestHadron; Mmin1st = MminHadron;
848 Mtest2nd = MtestHadron; Mmin2nd = MminHadron;
851 if ( isFirstTarget ) {
852 MtestTr = Mtest1st; MtestPr = Mtest2nd;
853 common.MminTarget = Mmin1st; common.MminProjectile = Mmin2nd;
855 MtestTr = Mtest2nd; MtestPr = Mtest1st;
856 common.MminTarget = Mmin2nd; common.MminProjectile = Mmin1st;
859 if ( MtestPr != 0.0 ) {
860 common.M0projectile = MtestPr;
861 common.M0projectile2 = common.M0projectile * common.M0projectile;
862 common.ProjectileDiffStateMinMass = common.M0projectile + 220.0*MeV;
863 common.ProjectileNonDiffStateMinMass = common.M0projectile + 220.0*MeV;
865 if ( MtestTr != 0.0 ) {
866 common.M0target = MtestTr;
867 common.M0target2 = common.M0target * common.M0target;
868 common.TargetDiffStateMinMass = common.M0target + 220.0*MeV;
869 common.TargetNonDiffStateMinMass = common.M0target + 220.0*MeV;
876 if ( common.SqrtS < common.M0projectile + common.M0target )
return returnCode;
878 common.PZcms2 = (
sqr( common.S ) +
sqr( common.M0projectile2 ) +
sqr( common.M0target2 )
879 - 2.0 * ( common.S * ( common.M0projectile2 + common.M0target2 )
880 + common.M0projectile2 * common.M0target2 ) ) / 4.0 / common.S;
881 #ifdef debugFTFexcitation
882 G4cout <<
"At the end// NewProjCode " << NewProjCode <<
G4endl
883 <<
"At the end// NewTargCode " << NewTargCode <<
G4endl
884 <<
"M0pr M0tr SqS " << common.M0projectile <<
" " << common.M0target <<
" "
886 <<
"M0pr2 M0tr2 SqS " << common.M0projectile2 <<
" " << common.M0target2 <<
" "
888 <<
"PZcms2 after the change " << common.PZcms2 <<
G4endl <<
G4endl;
890 if ( common.PZcms2 < 0.0 )
return returnCode;
894 common.PZcms = std::sqrt( common.PZcms2 );
895 common.Pprojectile.
setPz( common.PZcms );
896 common.Pprojectile.
setE( std::sqrt( common.M0projectile2 + common.PZcms2 ) );
897 common.Ptarget.
setPz( -common.PZcms );
898 common.Ptarget.
setE( std::sqrt( common.M0target2 + common.PZcms2 ) );
899 #ifdef debugFTFexcitation
901 << common.Ptarget <<
G4endl << common.Pprojectile + common.Ptarget <<
G4endl;
908 if ( common.SqrtS < common.M0projectile + common.TargetDiffStateMinMass ||
909 common.SqrtS < common.ProjectileDiffStateMinMass + common.M0target ||
910 common.ProbOfDiffraction == 0.0 ) common.ProbExc = 0.0;
913 #ifdef debugFTFexcitation
914 G4cout <<
"Make elastic scattering of new hadrons" <<
G4endl;
916 common.Pprojectile.
transform( common.toLab );
917 common.Ptarget.
transform( common.toLab );
921 #ifdef debugFTFexcitation
922 G4cout <<
"Result of el. scatt " << Result <<
G4endl <<
"Proj Targ and Proj+Targ in Lab"
927 if ( Result ) returnCode = 0;
931 #ifdef debugFTFexcitation
936 common.ProbOfDiffraction = common.ProbProjectileDiffraction + common.ProbTargetDiffraction;
937 if ( common.ProbOfDiffraction != 0.0 ) {
938 common.ProbProjectileDiffraction /= common.ProbOfDiffraction;
939 common.ProbTargetDiffraction /= common.ProbOfDiffraction;
942 return returnCode = 1;
947G4bool G4DiffractiveExcitation::
950 G4DiffractiveExcitation::CommonVariables& common )
const {
954 G4bool isProjectileDiffraction =
false;
956 isProjectileDiffraction =
true;
957 #ifdef debugFTFexcitation
960 common.ProjMassT2 = common.ProjectileDiffStateMinMass2;
961 common.ProjMassT = common.ProjectileDiffStateMinMass;
962 common.TargMassT2 = common.M0target2;
963 common.TargMassT = common.M0target;
965 #ifdef debugFTFexcitation
968 common.ProjMassT2 = common.M0projectile2;
969 common.ProjMassT = common.M0projectile;
970 common.TargMassT2 = common.TargetDiffStateMinMass2;
971 common.TargMassT = common.TargetDiffStateMinMass;
975 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
return false;
977 common.PZcms2 = (
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
978 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
979 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
980 if ( common.PZcms2 < 0.0 )
return false;
981 common.maxPtSquare = common.PZcms2;
984 G4bool loopCondition =
true;
985 G4int whilecount = 0;
989 if ( whilecount > 1000 ) {
994 common.Qmomentum =
G4LorentzVector( GaussianPt( DiffrAveragePt2, common.maxPtSquare ), 0 );
996 if ( isProjectileDiffraction ) {
997 common.ProjMassT2 = common.ProjectileDiffStateMinMass2 + common.Pt2;
998 common.TargMassT2 = common.M0target2 + common.Pt2;
1000 common.ProjMassT2 = common.M0projectile2 + common.Pt2;
1001 common.TargMassT2 = common.TargetDiffStateMinMass2 + common.Pt2;
1003 common.ProjMassT = std::sqrt( common.ProjMassT2 );
1004 common.TargMassT = std::sqrt( common.TargMassT2 );
1005 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
continue;
1007 common.PZcms2 = (
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
1008 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
1009 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
1010 if ( common.PZcms2 < 0.0 )
continue;
1012 common.PZcms = std::sqrt( common.PZcms2 );
1013 if ( isProjectileDiffraction ) {
1014 common.PMinusMin = std::sqrt( common.ProjMassT2 + common.PZcms2 ) - common.PZcms;
1015 common.PMinusMax = common.SqrtS - common.TargMassT;
1016 common.PMinusNew = ChooseP( common.PMinusMin, common.PMinusMax );
1017 common.TMinusNew = common.SqrtS - common.PMinusNew;
1018 common.Qminus = common.Ptarget.
minus() - common.TMinusNew;
1019 common.TPlusNew = common.TargMassT2 / common.TMinusNew;
1020 common.Qplus = common.Ptarget.
plus() - common.TPlusNew;
1021 common.Qmomentum.
setPz( (common.Qplus - common.Qminus)/2.0 );
1022 common.Qmomentum.
setE( (common.Qplus + common.Qminus)/2.0 );
1023 loopCondition = ( ( common.Pprojectile + common.Qmomentum ).mag2() <
1024 common.ProjectileDiffStateMinMass2 );
1026 common.TPlusMin = std::sqrt( common.TargMassT2 + common.PZcms2 ) - common.PZcms;
1027 common.TPlusMax = common.SqrtS - common.ProjMassT;
1028 common.TPlusNew = ChooseP( common.TPlusMin, common.TPlusMax );
1029 common.PPlusNew = common.SqrtS - common.TPlusNew;
1030 common.Qplus = common.PPlusNew - common.Pprojectile.
plus();
1031 common.PMinusNew = common.ProjMassT2 / common.PPlusNew;
1032 common.Qminus = common.PMinusNew - common.Pprojectile.
minus();
1033 common.Qmomentum.
setPz( (common.Qplus - common.Qminus)/2.0 );
1034 common.Qmomentum.
setE( (common.Qplus + common.Qminus)/2.0 );
1035 loopCondition = ( ( common.Ptarget - common.Qmomentum ).mag2() <
1036 common.TargetDiffStateMinMass2 );
1039 }
while ( loopCondition );
1042 if ( isProjectileDiffraction ) {
1055G4bool G4DiffractiveExcitation::
1059 G4DiffractiveExcitation::CommonVariables& common )
const {
1063 #ifdef debugFTFexcitation
1068 common.ProjMassT2 = common.ProjectileNonDiffStateMinMass2;
1069 common.ProjMassT = common.ProjectileNonDiffStateMinMass;
1070 common.TargMassT2 = common.TargetNonDiffStateMinMass2;
1071 common.TargMassT = common.TargetNonDiffStateMinMass;
1072 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
return false;
1074 common.PZcms2 = (
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
1075 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
1076 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
1077 common.maxPtSquare = common.PZcms2;
1079 G4int whilecount = 0;
1083 if ( whilecount > 1000 ) {
1089 common.maxPtSquare ), 0 );
1091 common.ProjMassT2 = common.ProjectileNonDiffStateMinMass2 + common.Pt2;
1092 common.ProjMassT = std::sqrt( common.ProjMassT2 );
1093 common.TargMassT2 = common.TargetNonDiffStateMinMass2 + common.Pt2;
1094 common.TargMassT = std::sqrt( common.TargMassT2 );
1095 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
continue;
1097 common.PZcms2 =(
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
1098 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
1099 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
1100 if ( common.PZcms2 < 0.0 )
continue;
1102 common.PZcms = std::sqrt( common.PZcms2 );
1103 common.PMinusMin = std::sqrt( common.ProjMassT2 + common.PZcms2 ) - common.PZcms;
1104 common.PMinusMax = common.SqrtS - common.TargMassT;
1105 common.TPlusMin = std::sqrt( common.TargMassT2 + common.PZcms2 ) - common.PZcms;
1106 common.TPlusMax = common.SqrtS - common.ProjMassT;
1110 common.PMinusNew = ChooseP( common.PMinusMin, common.PMinusMax );
1112 common.PMinusNew = ( common.PMinusMax - common.PMinusMin )*
G4UniformRand() + common.PMinusMin;
1115 common.TPlusNew = ChooseP( common.TPlusMin, common.TPlusMax );
1117 common.TPlusNew = ( common.TPlusMax - common.TPlusMin )*
G4UniformRand() + common.TPlusMin;
1121 common.TPlusNew = ChooseP( common.TPlusMin, common.TPlusMax );
1123 common.TPlusNew = ( common.TPlusMax - common.TPlusMin )*
G4UniformRand() + common.TPlusMin;
1126 common.PMinusNew = ChooseP( common.PMinusMin, common.PMinusMax );
1128 common.PMinusNew = ( common.PMinusMax - common.PMinusMin )*
G4UniformRand() + common.PMinusMin;
1132 common.Qminus = common.PMinusNew - common.Pprojectile.
minus();
1133 common.Qplus = -( common.TPlusNew - common.Ptarget.
plus() );
1134 common.Qmomentum.
setPz( (common.Qplus - common.Qminus)/2.0 );
1135 common.Qmomentum.
setE( (common.Qplus + common.Qminus)/2.0 );
1136 #ifdef debugFTFexcitation
1138 << ( common.Pprojectile + common.Qmomentum ).mag() <<
" "
1139 << common.ProjectileNonDiffStateMinMass <<
G4endl
1140 << ( common.Ptarget - common.Qmomentum ).mag() <<
" "
1141 << common.TargetNonDiffStateMinMass <<
G4endl;
1144 }
while ( ( common.Pprojectile + common.Qmomentum ).mag2() <
1145 common.ProjectileNonDiffStateMinMass2 ||
1146 ( common.Ptarget - common.Qmomentum ).mag2() <
1147 common.TargetNonDiffStateMinMass2 );
1168 if( ! HadronIsString ) hadron->
SplitUp();
1171 if ( start ==
nullptr ) {
1172 G4cout <<
" G4FTFModel::String() Error: No start parton found" <<
G4endl;
1173 FirstString = 0; SecondString = 0;
1178 if ( end ==
nullptr ) {
1179 G4cout <<
" G4FTFModel::String() Error: No end parton found" <<
G4endl;
1180 FirstString = 0; SecondString = 0;
1188 if ( HadronIsString ) {
1189 if ( isProjectile ) {
1213 if ( isProjectile ) {
1221 G4double Pt( 0.0 ), x1( 0.0 ), x3( 0.0 );
1244 if ( Pt > 500.0*MeV ) {
1245 G4double Ymax =
G4Log(
W/2.0/Pt + std::sqrt( W2/4.0/Pt/Pt - 1.0 ) );
1252 if ( PDGcode_startQ < 3 ) Mass_startQ = 325.0*MeV;
1253 if ( PDGcode_startQ == 3 ) Mass_startQ = 500.0*MeV;
1254 if ( PDGcode_startQ == 4 ) Mass_startQ = 1600.0*MeV;
1255 if ( PDGcode_startQ == 5 ) Mass_startQ = 4500.0*MeV;
1257 if ( PDGcode_endQ < 3 ) Mass_endQ = 325.0*MeV;
1258 if ( PDGcode_endQ == 3 ) Mass_endQ = 500.0*MeV;
1259 if ( PDGcode_endQ == 4 ) Mass_endQ = 1600.0*MeV;
1260 if ( PDGcode_endQ == 5 ) Mass_endQ = 4500.0*MeV;
1262 G4double P2_1 = W2*x1*x1/4.0 - Mass_endQ*Mass_endQ;
1263 G4double P2_3 = W2*x3*x3/4.0 - Mass_startQ*Mass_startQ;
1265 if ( P2_1 <= 0.0 || P2_3 <= 0.0 ) {
1271 G4double CosT12 = ( P2_3 - P2_1 - P2_2 ) / (2.0*P_1*P_2);
1272 G4double CosT13 = ( P2_2 - P2_1 - P2_3 ) / (2.0*P_1*P_3);
1274 if ( std::abs( CosT12 ) > 1.0 || std::abs( CosT13 ) > 1.0 ) {
1278 Pt = P_2 * std::sqrt( 1.0 - CosT12*CosT12 );
1282 Pstart.
setE( x3*
W/2.0 );
1284 Pend.
setE( x1*
W/2.0 );
1286 G4double XkQ = GetQuarkFractionOfKink( 0.0, 1.0 );
1287 if ( Pkink.
getZ() > 0.0 ) {
1289 PkinkQ1 = XkQ*Pkink;
1291 PkinkQ1 = (1.0 - XkQ)*Pkink;
1295 PkinkQ1 = (1.0 - XkQ)*Pkink;
1297 PkinkQ1 = XkQ*Pkink;
1301 PkinkQ2 = Pkink - PkinkQ1;
1304 std::sqrt(
sqr(
sqr(x1) -
sqr(x3) ) +
sqr( 2.0*x1*x3*CosT13 ) );
1305 G4double Psi = std::acos( Cos2Psi );
1308 if ( isProjectile ) {
1328 std::vector< G4double > QuarkProbabilitiesAtGluonSplitUp =
1332 for (
unsigned int Iq = 0; Iq < 3; Iq++ ) {
1334 if ( Ksi > QuarkProbabilitiesAtGluonSplitUp[Iq] ) QuarkInGluon++;
1359 G4int absPDGcode = 1500;
1366 if ( absPDGcode < 1000 ) {
1367 if ( isProjectile ) {
1393 if ( isProjectile ) {
1429 if ( isProjectile ) {
1445 G4double Exp = std::sqrt(
sqr(Pz) + (
sqr(Mt2) - 4.0*
sqr(Eh)*Pt2/4.0 )/Mt2 )/2.0;
1452 Pstart = Pstart1; Pend = Pend1;
1464 <<
" generated string momenta: Diquark " << end->
Get4Momentum() <<
"mass : "
1466 << Pstart + Pend <<
G4endl <<
" Original "
1480 if ( Pmin <= 0.0 || range <= 0.0 ) {
1481 G4cout <<
" Pmin, range : " << Pmin <<
" , " << range <<
G4endl;
1483 "G4DiffractiveExcitation::ChooseP : Invalid arguments " );
1496 if ( AveragePt2 <= 0.0 ) {
1500 (
G4Exp( -maxPtSquare/AveragePt2 ) - 1.0 ) );
1504 return G4ThreeVector( Pt * std::cos( phi ), Pt * std::sin( phi ), 0.0 );
1512 const G4int maxNumberOfLoops = 10000;
1513 G4int loopCounter = 0;
1516 yf = z*z +
sqr(1.0 - z);
1518 ++loopCounter < maxNumberOfLoops );
1519 if ( loopCounter >= maxNumberOfLoops ) {
1520 z = 0.5*(zmin + zmax);
1528void G4DiffractiveExcitation::UnpackMeson(
const G4int IdPDG,
G4int& Q1,
G4int& Q2 )
const {
1529 G4int absIdPDG = std::abs( IdPDG );
1530 if ( ! ( absIdPDG == 111 || absIdPDG == 221 || absIdPDG == 331 ||
1531 absIdPDG == 441 || absIdPDG == 443 || absIdPDG == 553 ) ) {
1533 Q1 = absIdPDG / 100;
1534 Q2 = (absIdPDG % 100) / 10;
1535 G4int anti = 1 - 2 * ( std::max( Q1, Q2 ) % 2 );
1536 if ( IdPDG < 0 ) anti *= -1;
1540 if ( absIdPDG == 441 || absIdPDG == 443 ) {
1542 }
else if ( absIdPDG == 553 ) {
1558void G4DiffractiveExcitation::UnpackBaryon(
G4int IdPDG,
1561 Q2 = (IdPDG % 1000) / 100;
1562 Q3 = (IdPDG % 100) / 10;
1576 }
else if ( Q3 > Q1 ) {
1587 G4int NewCode = Q1*1000 + Q2*100 + Q3*10 + 2;
1595 throw G4HadronicException( __FILE__, __LINE__,
1596 "G4DiffractiveExcitation copy constructor not meant to be called" );
1603 throw G4HadronicException( __FILE__, __LINE__,
1604 "G4DiffractiveExcitation = operator not meant to be called" );
1612 throw G4HadronicException( __FILE__, __LINE__,
1613 "G4DiffractiveExcitation == operator not meant to be called" );
1620 throw G4HadronicException( __FILE__, __LINE__,
1621 "G4DiffractiveExcitation != operator not meant to be called" );
G4double Y(G4double density)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
CLHEP::HepLorentzRotation G4LorentzRotation
CLHEP::HepLorentzVector G4LorentzVector
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
HepLorentzRotation & rotateY(double delta)
HepLorentzRotation & rotateZ(double delta)
HepLorentzRotation inverse() const
Hep3Vector boostVector() const
HepLorentzVector & transform(const HepRotation &)
virtual G4bool ExciteParticipants(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters, G4ElasticHNScattering *theElastic, G4bool &isDiffractive) const
G4DiffractiveExcitation()
virtual void CreateStrings(G4VSplitableHadron *aHadron, G4bool isProjectile, G4ExcitedString *&FirstString, G4ExcitedString *&SecondString, G4FTFParameters *theParameters) const
virtual ~G4DiffractiveExcitation()
virtual G4bool ElasticScattering(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters) const
void SetPosition(const G4ThreeVector &aPosition)
void SetTimeOfCreation(G4double aTime)
G4double GetProbLogDistrPrD()
G4double GetProbLogDistr()
G4double GetProjMinNonDiffMass()
G4double GetAvaragePt2ofElasticScattering()
G4double GetTarMinDiffMass()
G4double GetTarMinNonDiffMass()
G4double GetProcProb(const G4int ProcN, const G4double y)
G4double GetDeltaProbAtQuarkExchange()
G4double GetProjMinDiffMass()
G4double GetProbOfSameQuarkExchange()
std::vector< G4double > GetQuarkProbabilitiesAtGluonSplitUp()
G4int GetPDGiIsospin() const
const G4String & GetParticleType() const
G4double GetPDGMass() const
G4int GetPDGEncoding() const
G4double GetPDGWidth() const
const G4String & GetParticleName() const
const G4String & GetParticleSubType() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * GetDefinition()
void Set4Momentum(const G4LorentzVector &aMomentum)
const G4LorentzVector & Get4Momentum() const
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const
G4double SampleMass(const G4double poleMass, const G4double gamma, const G4double minMass, const G4double maxMass) const
G4double GetMinimumMass(const G4ParticleDefinition *p) const
void SetStatus(const G4int aStatus)
const G4ParticleDefinition * GetDefinition() const
G4double GetTimeOfCreation()
void Set4Momentum(const G4LorentzVector &a4Momentum)
virtual G4Parton * GetNextParton()=0
void SetDefinition(const G4ParticleDefinition *aDefinition)
const G4LorentzVector & Get4Momentum() const
const G4ThreeVector & GetPosition() const
void IncrementCollisionCount(G4int aCount)
G4int GetSoftCollisionCount()