94 #ifdef debugFTFexictation
98 CommonVariables common;
102 if ( common.Pprojectile.z() < 0.0 )
return false;
104 common.absProjectilePDGcode = std::abs( common.ProjectilePDGcode );
106 G4double ProjectileRapidity = common.Pprojectile.rapidity();
111 common.absTargetPDGcode = std::abs( common.TargetPDGcode );
113 G4double TargetRapidity = common.Ptarget.rapidity();
117 common.S = Psum.
mag2();
118 common.SqrtS = std::sqrt( common.S );
121 G4bool toBePutOnMassShell =
true;
122 common.MminProjectile = common.BrW.GetMinimumMass( projectile->
GetDefinition() );
131 common.M0projectile2 = common.M0projectile * common.M0projectile;
134 if ( common.M0projectile > common.ProjectileDiffStateMinMass ) {
135 common.ProjectileDiffStateMinMass = common.MminProjectile + 220.0*MeV;
136 common.ProjectileNonDiffStateMinMass = common.MminProjectile + 220.0*MeV;
137 if ( common.absProjectilePDGcode > 3000 ) {
138 common.ProjectileDiffStateMinMass += 140.0*MeV;
139 common.ProjectileNonDiffStateMinMass += 140.0*MeV;
142 common.MminTarget = common.BrW.GetMinimumMass( target->
GetDefinition() );
151 common.M0target2 = common.M0target * common.M0target;
154 if ( common.M0target > common.TargetDiffStateMinMass ) {
155 common.TargetDiffStateMinMass = common.MminTarget + 220.0*MeV;
156 common.TargetNonDiffStateMinMass = common.MminTarget + 220.0*MeV;
157 if ( common.absTargetPDGcode > 3000 ) {
158 common.TargetDiffStateMinMass += 140.0*MeV;
159 common.TargetNonDiffStateMinMass += 140.0*MeV;
162 #ifdef debugFTFexictation
163 G4cout <<
"Proj Targ PDGcodes " << common.ProjectilePDGcode <<
" " << common.TargetPDGcode <<
G4endl
164 <<
"Mprojectile Y " << common.Pprojectile.mag() <<
" " << ProjectileRapidity <<
G4endl
165 <<
"M0projectile Y " << common.M0projectile <<
" " << ProjectileRapidity <<
G4endl;
166 G4cout <<
"Mtarget Y " << common.Ptarget.mag() <<
" " << TargetRapidity <<
G4endl
167 <<
"M0target Y " << common.M0target <<
" " << TargetRapidity <<
G4endl;
168 G4cout <<
"Pproj " << common.Pprojectile <<
G4endl <<
"Ptarget " << common.Ptarget <<
G4endl;
174 if ( Ptmp.
pz() <= 0.0 )
return false;
177 common.toLab = common.toCms.inverse();
178 common.Pprojectile.
transform( common.toCms );
179 common.Ptarget.
transform( common.toCms );
181 G4double SumMasses = common.M0projectile + common.M0target;
182 #ifdef debugFTFexictation
183 G4cout <<
"SqrtS " << common.SqrtS <<
G4endl <<
"M0pr M0tr SumM " << common.M0projectile
184 <<
" " << common.M0target <<
" " << SumMasses <<
G4endl;
186 if ( common.SqrtS < SumMasses )
return false;
188 common.PZcms2 = (
sqr( common.S ) +
sqr( common.M0projectile2 ) +
sqr( common.M0target2 )
189 - 2.0 * ( common.S * ( common.M0projectile2 + common.M0target2 )
190 + common.M0projectile2 * common.M0target2 ) ) / 4.0 / common.S;
191 #ifdef debugFTFexictation
192 G4cout <<
"PZcms2 after toBePutOnMassShell " << common.PZcms2 <<
G4endl;
194 if ( common.PZcms2 < 0.0 )
return false;
196 common.PZcms = std::sqrt( common.PZcms2 );
197 if ( toBePutOnMassShell ) {
198 if ( common.Pprojectile.z() > 0.0 ) {
199 common.Pprojectile.setPz( common.PZcms );
200 common.Ptarget.setPz( -common.PZcms );
202 common.Pprojectile.setPz( -common.PZcms );
203 common.Ptarget.setPz( common.PZcms );
205 common.Pprojectile.setE( std::sqrt( common.M0projectile2
206 + common.Pprojectile.x() * common.Pprojectile.x()
207 + common.Pprojectile.y() * common.Pprojectile.y()
209 common.Ptarget.setE( std::sqrt( common.M0target2
210 + common.Ptarget.x() * common.Ptarget.x()
211 + common.Ptarget.y() * common.Ptarget.y()
214 #ifdef debugFTFexictation
215 G4cout <<
"Start --------------------" <<
G4endl <<
"Proj M0 Mdif Mndif " << common.M0projectile
216 <<
" " << common.ProjectileDiffStateMinMass <<
" " << common.ProjectileNonDiffStateMinMass
218 <<
"Targ M0 Mdif Mndif " << common.M0target <<
" " << common.TargetDiffStateMinMass
219 <<
" " << common.TargetNonDiffStateMinMass <<
G4endl <<
"SqrtS " << common.SqrtS <<
G4endl
220 <<
"Proj CMS " << common.Pprojectile <<
G4endl <<
"Targ CMS " << common.Ptarget <<
G4endl;
224 ProjectileRapidity = common.Pprojectile.rapidity();
225 TargetRapidity = common.Ptarget.rapidity();
228 theParameters->
GetProcProb( 4, ProjectileRapidity - TargetRapidity );
229 common.ProbProjectileDiffraction =
230 theParameters->
GetProcProb( 2, ProjectileRapidity - TargetRapidity );
231 common.ProbTargetDiffraction =
232 theParameters->
GetProcProb( 3, ProjectileRapidity - TargetRapidity );
233 common.ProbOfDiffraction = common.ProbProjectileDiffraction + common.ProbTargetDiffraction;
234 #ifdef debugFTFexictation
235 G4cout <<
"Proc Probs " << QeNoExc <<
" " << QeExc <<
" "
236 << common.ProbProjectileDiffraction <<
" " << common.ProbTargetDiffraction <<
G4endl
237 <<
"ProjectileRapidity " << ProjectileRapidity <<
G4endl;
240 if ( QeNoExc + QeExc + common.ProbProjectileDiffraction + common.ProbTargetDiffraction > 1.0 ) {
241 QeNoExc = 1.0 - QeExc - common.ProbProjectileDiffraction - common.ProbTargetDiffraction;
243 if ( QeExc + QeNoExc != 0.0 ) {
244 common.ProbExc = QeExc / ( QeExc + QeNoExc );
246 if ( 1.0 - QeExc - QeNoExc > 0.0 ) {
247 common.ProbProjectileDiffraction /= ( 1.0 - QeExc - QeNoExc );
248 common.ProbTargetDiffraction /= ( 1.0 - QeExc - QeNoExc );
250 #ifdef debugFTFexictation
251 G4cout <<
"Proc Probs " << QeNoExc <<
" " << QeExc <<
" "
252 << common.ProbProjectileDiffraction <<
" " << common.ProbTargetDiffraction <<
G4endl
253 <<
"ProjectileRapidity " << ProjectileRapidity <<
G4endl;
257 G4int returnCode = 1;
259 returnCode = ExciteParticipants_doChargeExchange( projectile, target, theParameters,
260 theElastic, common );
263 G4bool returnResult =
false;
264 if ( returnCode == 0 ) {
266 }
else if ( returnCode == 1 ) {
268 common.ProbOfDiffraction = common.ProbProjectileDiffraction + common.ProbTargetDiffraction;
269 #ifdef debugFTFexictation
271 <<
"Proj M0 MdMin MndMin " << common.M0projectile <<
" "
272 << common.ProjectileDiffStateMinMass <<
" " << common.ProjectileNonDiffStateMinMass
274 <<
"Targ M0 MdMin MndMin " << common.M0target <<
" " << common.TargetDiffStateMinMass
275 <<
" " << common.TargetNonDiffStateMinMass <<
G4endl <<
"SqrtS " << common.SqrtS
277 <<
"Prob: ProjDiff TargDiff + Sum " << common.ProbProjectileDiffraction <<
" "
278 << common.ProbTargetDiffraction <<
" " << common.ProbOfDiffraction <<
G4endl;
280 if ( common.ProbOfDiffraction != 0.0 ) {
281 common.ProbProjectileDiffraction /= common.ProbOfDiffraction;
283 common.ProbProjectileDiffraction = 0.0;
285 #ifdef debugFTFexictation
286 G4cout <<
"Prob: ProjDiff TargDiff + Sum " << common.ProbProjectileDiffraction <<
" "
287 << common.ProbTargetDiffraction <<
" " << common.ProbOfDiffraction <<
G4endl;
289 common.ProjectileDiffStateMinMass2 =
sqr( common.ProjectileDiffStateMinMass );
290 common.ProjectileNonDiffStateMinMass2 =
sqr( common.ProjectileNonDiffStateMinMass );
291 common.TargetDiffStateMinMass2 =
sqr( common.TargetDiffStateMinMass );
292 common.TargetNonDiffStateMinMass2 =
sqr( common.TargetNonDiffStateMinMass );
296 returnResult = ExciteParticipants_doDiffraction( projectile, target, theParameters, common );
300 returnResult = ExciteParticipants_doNonDiffraction( projectile, target, theParameters, common );
303 if ( returnResult ) {
304 common.Pprojectile += common.Qmomentum;
305 common.Ptarget -= common.Qmomentum;
307 common.Pprojectile.transform( common.toLab );
308 common.Ptarget.transform( common.toLab );
309 #ifdef debugFTFexictation
310 G4cout <<
"Mproj " << common.Pprojectile.mag() <<
G4endl <<
"Mtarg " << common.Ptarget.mag()
325G4int G4DiffractiveExcitation::
330 G4DiffractiveExcitation::CommonVariables& common )
const {
337 G4int returnCode = 99;
341 G4double MtestPr = 0.0, MtestTr = 0.0;
343 #ifdef debugFTFexictation
344 G4cout <<
"Q exchange --------------------------" <<
G4endl;
357 G4int NewProjCode = 0, NewTargCode = 0, ProjQ1 = 0, ProjQ2 = 0, ProjQ3 = 0;
359 if ( common.absProjectilePDGcode < 1000 ) {
360 UnpackMeson( common.ProjectilePDGcode, ProjQ1, ProjQ2 );
362 UnpackBaryon( common.ProjectilePDGcode, ProjQ1, ProjQ2, ProjQ3 );
365 G4int TargQ1 = 0, TargQ2 = 0, TargQ3 = 0;
366 UnpackBaryon( common.TargetPDGcode, TargQ1, TargQ2, TargQ3 );
367 #ifdef debugFTFexictation
368 G4cout <<
"Proj Quarks " << ProjQ1 <<
" " << ProjQ2 <<
" " << ProjQ3 <<
G4endl
369 <<
"Targ Quarks " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl;
373 G4int ProjExchangeQ = 0, TargExchangeQ = 0;
374 if ( common.absProjectilePDGcode < 1000 ) {
376 G4bool isProjQ1Quark =
false;
377 ProjExchangeQ = ProjQ2;
379 isProjQ1Quark =
true;
380 ProjExchangeQ = ProjQ1;
383 G4int NpossibleStates = 0;
384 if ( ProjExchangeQ != TargQ1 ) NpossibleStates++;
385 if ( ProjExchangeQ != TargQ2 ) NpossibleStates++;
386 if ( ProjExchangeQ != TargQ3 ) NpossibleStates++;
387 G4int Nsampled = G4RandFlat::shootInt(
G4long( NpossibleStates ) ) + 1;
389 if ( ProjExchangeQ != TargQ1 ) {
390 if ( ++NpossibleStates == Nsampled ) {
391 TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ;
392 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
395 if ( ProjExchangeQ != TargQ2 ) {
396 if ( ++NpossibleStates == Nsampled ) {
397 TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ;
398 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
401 if ( ProjExchangeQ != TargQ3 ) {
402 if ( ++NpossibleStates == Nsampled ) {
403 TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ;
404 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
407 #ifdef debugFTFexictation
408 G4cout <<
"Exchanged Qs in Pr Tr " << ProjExchangeQ <<
" " << TargExchangeQ <<
G4endl;
411 G4int aProjQ1 = std::abs( ProjQ1 ), aProjQ2 = std::abs( ProjQ2 );
412 G4bool ProjExcited =
false;
413 const G4int maxNumberOfAttempts = 50;
415 while ( attempts++ < maxNumberOfAttempts ) {
419 if ( aProjQ1 == aProjQ2 ) {
428 }
else if ( aProjQ1 == 3 ) {
433 }
else if ( aProjQ1 == 4 ) {
435 }
else if ( aProjQ1 == 5 ) {
439 if ( aProjQ1 > aProjQ2 ) {
440 NewProjCode = aProjQ1*100 + aProjQ2*10 + 1;
442 NewProjCode = aProjQ2*100 + aProjQ1*10 + 1;
445 #ifdef debugFTFexictation
452 if ( aProjQ1 <= 3 && aProjQ2 <= 3 &&
G4UniformRand() < 0.5 ) {
459 G4int value = ProjQ1, absValue = aProjQ1, Qquarks = 0;
460 for (
G4int iQ = 0; iQ < 2; ++iQ ) {
462 value = ProjQ2; absValue = aProjQ2;
464 if ( absValue == 2 || absValue == 4 ) {
465 Qquarks += 2*value/absValue;
467 Qquarks -= value/absValue;
486 if ( Qquarks < 0 || ( Qquarks == 0 && aProjQ1 != aProjQ2 && aProjQ1%2 == 0 ) ) {
489 #ifdef debugFTFexictation
490 G4cout <<
"NewProjCode +2 or 0 " << NewProjCode <<
G4endl;
491 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
493 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
498 if ( ! TestParticle )
continue;
499 common.MminProjectile = common.BrW.GetMinimumMass( TestParticle );
500 if ( common.SqrtS - common.M0target < common.MminProjectile )
continue;
501 MtestPr = common.BrW.SampleMass( TestParticle, TestParticle->
GetPDGMass()
503 #ifdef debugFTFexictation
506 <<
"MtestPart MtestPart0 "<<MtestPr<<
" "<<TestParticle->
GetPDGMass()<<
G4endl
507 <<
"M0projectile projectile PDGMass " << common.M0projectile <<
" "
512 NewTargCode = NewNucleonId( TargQ1, TargQ2, TargQ3 );
513 #ifdef debugFTFexictation
514 G4cout <<
"New TrQ " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl
515 <<
"NewTargCode " << NewTargCode <<
G4endl;
520 if ( TargQ1 <= 3 && TargQ2 <= 3 && TargQ3 <= 3 ) {
521 if ( TargQ1 != TargQ2 && TargQ1 != TargQ3 && TargQ2 != TargQ3 ) {
527 }
else if ( TargQ1 == TargQ2 && TargQ1 == TargQ3 ) {
528 NewTargCode += 2; ProjExcited =
true;
531 NewTargCode += 2; ProjExcited =
true;
533 }
else if ( ! ProjExcited &&
535 common.SqrtS > common.M0projectile +
545 if ( NewTargCode == 3124 ||
546 NewTargCode == 3224 ||
547 NewTargCode == 3214 ||
548 NewTargCode == 3114 ||
549 NewTargCode == 3324 ||
550 NewTargCode == 3314 ) {
558 #ifdef debug_heavyHadrons
559 G4int initialNewTargCode = NewTargCode;
561 if ( NewTargCode == 4322 ) NewTargCode = 4232;
562 else if ( NewTargCode == 4312 ) NewTargCode = 4132;
563 else if ( NewTargCode == 5312 ) NewTargCode = 5132;
564 else if ( NewTargCode == 5322 ) NewTargCode = 5232;
565 #ifdef debug_heavyHadrons
566 if ( NewTargCode != initialNewTargCode ) {
567 G4cout <<
"G4DiffractiveExcitation::ExciteParticipants_doChargeExchange : forcing (inexisting in G4)" <<
G4endl
568 <<
"\t target heavy baryon with pdgCode=" << initialNewTargCode
569 <<
" into pdgCode=" << NewTargCode <<
G4endl;
574 if ( ! TestParticle )
continue;
575 #ifdef debugFTFexictation
578 common.MminTarget = common.BrW.GetMinimumMass( TestParticle );
579 if ( common.SqrtS - MtestPr < common.MminTarget )
continue;
580 MtestTr = common.BrW.SampleMass( TestParticle, TestParticle->
GetPDGMass()
582 if ( common.SqrtS > MtestPr + MtestTr )
break;
585 if ( attempts >= maxNumberOfAttempts )
return returnCode;
587 if ( MtestPr >= common.Pprojectile.mag() || projectile->
GetStatus() != 0 ) {
588 common.M0projectile = MtestPr;
590 #ifdef debugFTFexictation
591 G4cout <<
"M0projectile After check " << common.M0projectile <<
G4endl;
593 common.M0projectile2 = common.M0projectile * common.M0projectile;
594 common.ProjectileDiffStateMinMass = common.M0projectile + 220.0*MeV;
595 common.ProjectileNonDiffStateMinMass = common.M0projectile + 220.0*MeV;
596 if ( MtestTr >= common.Ptarget.mag() || target->
GetStatus() != 0 ) {
597 common.M0target = MtestTr;
599 common.M0target2 = common.M0target * common.M0target;
600 #ifdef debugFTFexictation
601 G4cout <<
"New targ M0 M0^2 " << common.M0target <<
" " << common.M0target2 <<
G4endl;
603 common.TargetDiffStateMinMass = common.M0target + 220.0*MeV;
604 common.TargetNonDiffStateMinMass = common.M0target + 220.0*MeV;
611 if ( common.ProjectilePDGcode < 0 )
return 1;
615 G4bool isProjectileExchangedQ =
false;
616 G4int firstQ = TargQ1, secondQ = TargQ2, thirdQ = TargQ3;
617 G4int otherFirstQ = ProjQ1, otherSecondQ = ProjQ2, otherThirdQ = ProjQ3;
619 isProjectileExchangedQ =
true;
620 firstQ = ProjQ1; secondQ = ProjQ2; thirdQ = ProjQ3;
621 otherFirstQ = TargQ1; otherSecondQ = TargQ2; otherThirdQ = TargQ3;
625 G4int exchangedQ = 0;
627 if ( Ksi < 0.333333 ) {
629 }
else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
630 exchangedQ = secondQ;
634 #ifdef debugFTFexictation
635 G4cout <<
"Exchange Qs isProjectile Q " << isProjectileExchangedQ <<
" " << exchangedQ <<
" ";
641 const G4int MaxCount = 100;
642 G4int count = 0, otherExchangedQ = 0;
644 if ( exchangedQ != otherFirstQ ||
G4UniformRand() < probSame ) {
645 otherExchangedQ = otherFirstQ; otherFirstQ = exchangedQ; exchangedQ = otherExchangedQ;
647 if ( exchangedQ != otherSecondQ ||
G4UniformRand() < probSame ) {
648 otherExchangedQ = otherSecondQ; otherSecondQ = exchangedQ; exchangedQ = otherExchangedQ;
650 if ( exchangedQ != otherThirdQ ||
G4UniformRand() < probSame ) {
651 otherExchangedQ = otherThirdQ; otherThirdQ = exchangedQ; exchangedQ = otherExchangedQ;
655 }
while ( otherExchangedQ == 0 && ++count < MaxCount );
656 if ( count >= MaxCount )
return returnCode;
659 if ( Ksi < 0.333333 ) {
661 }
else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
662 secondQ = exchangedQ;
666 if ( isProjectileExchangedQ ) {
667 ProjQ1 = firstQ; ProjQ2 = secondQ; ProjQ3 = thirdQ;
668 TargQ1 = otherFirstQ; TargQ2 = otherSecondQ; TargQ3 = otherThirdQ;
670 TargQ1 = firstQ; TargQ2 = secondQ; TargQ3 = thirdQ;
671 ProjQ1 = otherFirstQ; ProjQ2 = otherSecondQ; ProjQ3 = otherThirdQ;
673 #ifdef debugFTFexictation
674 G4cout <<
"Exchange Qs Pr Tr " << ( isProjectileExchangedQ ? exchangedQ : otherExchangedQ )
675 <<
" " << ( isProjectileExchangedQ ? otherExchangedQ : exchangedQ ) <<
G4endl;
678 NewProjCode = NewNucleonId( ProjQ1, ProjQ2, ProjQ3 );
679 NewTargCode = NewNucleonId( TargQ1, TargQ2, TargQ3 );
687 for (
G4int iHadron = 0; iHadron < 2; iHadron++ ) {
689 G4int codeQ1 = ProjQ1, codeQ2 = ProjQ2, codeQ3 = ProjQ3, newHadCode = NewProjCode;
690 G4double massConstraint = common.M0target;
692 if ( iHadron == 1 ) {
693 codeQ1 = TargQ1, codeQ2 = TargQ2, codeQ3 = TargQ3, newHadCode = NewTargCode;
694 massConstraint = common.M0projectile;
697 if ( codeQ1 > 3 || codeQ2 > 3 || codeQ3 > 3 )
continue;
698 if ( codeQ1 == codeQ2 && codeQ1 == codeQ3 ) {
700 }
else if ( isHadronADelta ) {
715 if ( iHadron == 0 ) {
716 NewProjCode = newHadCode;
718 NewTargCode = newHadCode;
721 #ifdef debugFTFexictation
722 G4cout <<
"NewProjCode NewTargCode " << NewProjCode <<
" " << NewTargCode <<
G4endl;
729 if ( NewProjCode == 3124 ||
730 NewProjCode == 3224 ||
731 NewProjCode == 3214 ||
732 NewProjCode == 3114 ||
733 NewProjCode == 3324 ||
734 NewProjCode == 3314 ) {
739 if ( NewTargCode == 3124 ||
740 NewTargCode == 3224 ||
741 NewTargCode == 3214 ||
742 NewTargCode == 3114 ||
743 NewTargCode == 3324 ||
744 NewTargCode == 3314 ) {
752 #ifdef debug_heavyHadrons
753 G4int initialNewProjCode = NewProjCode, initialNewTargCode = NewTargCode;
755 if ( NewProjCode == 4322 ) NewProjCode = 4232;
756 else if ( NewProjCode == 4312 ) NewProjCode = 4132;
757 else if ( NewProjCode == 5312 ) NewProjCode = 5132;
758 else if ( NewProjCode == 5322 ) NewProjCode = 5232;
759 if ( NewTargCode == 4322 ) NewTargCode = 4232;
760 else if ( NewTargCode == 4312 ) NewTargCode = 4132;
761 else if ( NewTargCode == 5312 ) NewTargCode = 5132;
762 else if ( NewTargCode == 5322 ) NewTargCode = 5232;
763 #ifdef debug_heavyHadrons
764 if ( NewProjCode != initialNewProjCode || NewTargCode != initialNewTargCode ) {
765 G4cout <<
"G4DiffractiveExcitation::ExciteParticipants_doChargeExchange : forcing (inexisting in G4)" <<
G4endl
766 <<
"\t heavy baryon into an existing one:" <<
G4endl;
767 if ( NewProjCode != initialNewProjCode ) {
768 G4cout <<
"\t \t projectile baryon with pdgCode=" << initialNewProjCode
769 <<
" into pdgCode=" << NewProjCode <<
G4endl;
771 if ( NewTargCode != initialNewTargCode ) {
772 G4cout <<
"\t \t target baryon with pdgCode=" << initialNewTargCode
773 <<
" into pdgCode=" << NewTargCode <<
G4endl;
785 G4int firstHadronCode = NewTargCode, secondHadronCode = NewProjCode;
786 G4double massConstraint = common.M0projectile;
787 G4bool isFirstTarget =
true;
790 firstHadron = projectile; secondHadron = target;
791 firstHadronCode = NewProjCode; secondHadronCode = NewTargCode;
792 massConstraint = common.M0target;
793 isFirstTarget =
false;
795 G4double Mtest1st = 0.0, Mtest2nd = 0.0, Mmin1st = 0.0, Mmin2nd = 0.0;
796 for (
int iSamplingCase = 0; iSamplingCase < 2; iSamplingCase++ ) {
798 G4int aHadronCode = firstHadronCode;
799 if ( iSamplingCase == 1 ) {
800 aHadron = secondHadron; aHadronCode = secondHadronCode; massConstraint = Mtest1st;
802 G4double MtestHadron = 0.0, MminHadron = 0.0;
805 if ( ! TestParticle )
return returnCode;
806 MminHadron = common.BrW.GetMinimumMass( TestParticle );
807 if ( common.SqrtS - massConstraint < MminHadron )
return returnCode;
809 MtestHadron = common.BrW.SampleMass( TestParticle, TestParticle->
GetPDGMass() );
811 const G4int maxNumberOfAttempts = 50;
813 while ( attempts < maxNumberOfAttempts ) {
815 MtestHadron = common.BrW.SampleMass( TestParticle, TestParticle->
GetPDGMass()
817 if ( common.SqrtS < MtestHadron + massConstraint ) {
823 if ( attempts >= maxNumberOfAttempts )
return returnCode;
826 if ( iSamplingCase == 0 ) {
827 Mtest1st = MtestHadron; Mmin1st = MminHadron;
829 Mtest2nd = MtestHadron; Mmin2nd = MminHadron;
832 if ( isFirstTarget ) {
833 MtestTr = Mtest1st; MtestPr = Mtest2nd;
834 common.MminTarget = Mmin1st; common.MminProjectile = Mmin2nd;
836 MtestTr = Mtest2nd; MtestPr = Mtest1st;
837 common.MminTarget = Mmin2nd; common.MminProjectile = Mmin1st;
840 if ( MtestPr != 0.0 ) {
841 common.M0projectile = MtestPr;
842 common.M0projectile2 = common.M0projectile * common.M0projectile;
843 common.ProjectileDiffStateMinMass = common.M0projectile + 220.0*MeV;
844 common.ProjectileNonDiffStateMinMass = common.M0projectile + 220.0*MeV;
846 if ( MtestTr != 0.0 ) {
847 common.M0target = MtestTr;
848 common.M0target2 = common.M0target * common.M0target;
849 common.TargetDiffStateMinMass = common.M0target + 220.0*MeV;
850 common.TargetNonDiffStateMinMass = common.M0target + 220.0*MeV;
857 if ( common.SqrtS < common.M0projectile + common.M0target )
return returnCode;
859 common.PZcms2 = (
sqr( common.S ) +
sqr( common.M0projectile2 ) +
sqr( common.M0target2 )
860 - 2.0 * ( common.S * ( common.M0projectile2 + common.M0target2 )
861 + common.M0projectile2 * common.M0target2 ) ) / 4.0 / common.S;
862 #ifdef debugFTFexictation
863 G4cout <<
"At the end// NewProjCode " << NewProjCode <<
G4endl
864 <<
"At the end// NewTargCode " << NewTargCode <<
G4endl
865 <<
"M0pr M0tr SqS " << common.M0projectile <<
" " << common.M0target <<
" "
867 <<
"M0pr2 M0tr2 SqS " << common.M0projectile2 <<
" " << common.M0target2 <<
" "
869 <<
"PZcms2 after the change " << common.PZcms2 <<
G4endl <<
G4endl;
871 if ( common.PZcms2 < 0.0 )
return returnCode;
875 common.PZcms = std::sqrt( common.PZcms2 );
876 common.Pprojectile.setPz( common.PZcms );
877 common.Pprojectile.setE( std::sqrt( common.M0projectile2 + common.PZcms2 ) );
878 common.Ptarget.setPz( -common.PZcms );
879 common.Ptarget.setE( std::sqrt( common.M0target2 + common.PZcms2 ) );
880 #ifdef debugFTFexictation
882 << common.Ptarget <<
G4endl << common.Pprojectile + common.Ptarget <<
G4endl;
889 if ( common.SqrtS < common.M0projectile + common.TargetDiffStateMinMass ||
890 common.SqrtS < common.ProjectileDiffStateMinMass + common.M0target ||
891 common.ProbOfDiffraction == 0.0 ) common.ProbExc = 0.0;
894 #ifdef debugFTFexictation
895 G4cout <<
"Make elastic scattering of new hadrons" <<
G4endl;
897 common.Pprojectile.transform( common.toLab );
898 common.Ptarget.transform( common.toLab );
902 #ifdef debugFTFexictation
903 G4cout <<
"Result of el. scatt " << Result <<
G4endl <<
"Proj Targ and Proj+Targ in Lab"
908 if ( Result ) returnCode = 0;
912 #ifdef debugFTFexictation
917 common.ProbOfDiffraction = common.ProbProjectileDiffraction + common.ProbTargetDiffraction;
918 if ( common.ProbOfDiffraction != 0.0 ) {
919 common.ProbProjectileDiffraction /= common.ProbOfDiffraction;
920 common.ProbTargetDiffraction /= common.ProbOfDiffraction;
923 return returnCode = 1;
928G4bool G4DiffractiveExcitation::
931 G4DiffractiveExcitation::CommonVariables& common )
const {
935 G4bool isProjectileDiffraction =
false;
937 isProjectileDiffraction =
true;
938 #ifdef debugFTFexictation
941 common.ProjMassT2 = common.ProjectileDiffStateMinMass2;
942 common.ProjMassT = common.ProjectileDiffStateMinMass;
943 common.TargMassT2 = common.M0target2;
944 common.TargMassT = common.M0target;
946 #ifdef debugFTFexictation
949 common.ProjMassT2 = common.M0projectile2;
950 common.ProjMassT = common.M0projectile;
951 common.TargMassT2 = common.TargetDiffStateMinMass2;
952 common.TargMassT = common.TargetDiffStateMinMass;
956 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
return false;
958 common.PZcms2 = (
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
959 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
960 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
961 if ( common.PZcms2 < 0.0 )
return false;
962 common.maxPtSquare = common.PZcms2;
965 G4bool loopCondition =
true;
966 G4int whilecount = 0;
970 if ( whilecount > 1000 ) {
975 common.Qmomentum =
G4LorentzVector( GaussianPt( DiffrAveragePt2, common.maxPtSquare ), 0 );
977 if ( isProjectileDiffraction ) {
978 common.ProjMassT2 = common.ProjectileDiffStateMinMass2 + common.Pt2;
979 common.TargMassT2 = common.M0target2 + common.Pt2;
981 common.ProjMassT2 = common.M0projectile2 + common.Pt2;
982 common.TargMassT2 = common.TargetDiffStateMinMass2 + common.Pt2;
984 common.ProjMassT = std::sqrt( common.ProjMassT2 );
985 common.TargMassT = std::sqrt( common.TargMassT2 );
986 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
continue;
988 common.PZcms2 = (
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
989 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
990 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
991 if ( common.PZcms2 < 0.0 )
continue;
993 common.PZcms = std::sqrt( common.PZcms2 );
994 if ( isProjectileDiffraction ) {
995 common.PMinusMin = std::sqrt( common.ProjMassT2 + common.PZcms2 ) - common.PZcms;
996 common.PMinusMax = common.SqrtS - common.TargMassT;
997 common.PMinusNew = ChooseP( common.PMinusMin, common.PMinusMax );
998 common.TMinusNew = common.SqrtS - common.PMinusNew;
999 common.Qminus = common.Ptarget.minus() - common.TMinusNew;
1000 common.TPlusNew = common.TargMassT2 / common.TMinusNew;
1001 common.Qplus = common.Ptarget.plus() - common.TPlusNew;
1002 common.Qmomentum.setPz( (common.Qplus - common.Qminus)/2.0 );
1003 common.Qmomentum.setE( (common.Qplus + common.Qminus)/2.0 );
1004 loopCondition = ( ( common.Pprojectile + common.Qmomentum ).mag2() <
1005 common.ProjectileDiffStateMinMass2 );
1007 common.TPlusMin = std::sqrt( common.TargMassT2 + common.PZcms2 ) - common.PZcms;
1008 common.TPlusMax = common.SqrtS - common.ProjMassT;
1009 common.TPlusNew = ChooseP( common.TPlusMin, common.TPlusMax );
1010 common.PPlusNew = common.SqrtS - common.TPlusNew;
1011 common.Qplus = common.PPlusNew - common.Pprojectile.plus();
1012 common.PMinusNew = common.ProjMassT2 / common.PPlusNew;
1013 common.Qminus = common.PMinusNew - common.Pprojectile.minus();
1014 common.Qmomentum.setPz( (common.Qplus - common.Qminus)/2.0 );
1015 common.Qmomentum.setE( (common.Qplus + common.Qminus)/2.0 );
1016 loopCondition = ( ( common.Ptarget - common.Qmomentum ).mag2() <
1017 common.TargetDiffStateMinMass2 );
1020 }
while ( loopCondition );
1023 if ( isProjectileDiffraction ) {
1036G4bool G4DiffractiveExcitation::
1040 G4DiffractiveExcitation::CommonVariables& common )
const {
1044 #ifdef debugFTFexictation
1049 common.ProjMassT2 = common.ProjectileNonDiffStateMinMass2;
1050 common.ProjMassT = common.ProjectileNonDiffStateMinMass;
1051 common.TargMassT2 = common.TargetNonDiffStateMinMass2;
1052 common.TargMassT = common.TargetNonDiffStateMinMass;
1053 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
return false;
1055 common.PZcms2 = (
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
1056 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
1057 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
1058 common.maxPtSquare = common.PZcms2;
1060 G4int whilecount = 0;
1064 if ( whilecount > 1000 ) {
1070 common.maxPtSquare ), 0 );
1072 common.ProjMassT2 = common.ProjectileNonDiffStateMinMass2 + common.Pt2;
1073 common.ProjMassT = std::sqrt( common.ProjMassT2 );
1074 common.TargMassT2 = common.TargetNonDiffStateMinMass2 + common.Pt2;
1075 common.TargMassT = std::sqrt( common.TargMassT2 );
1076 if ( common.SqrtS < common.ProjMassT + common.TargMassT )
continue;
1078 common.PZcms2 =(
sqr( common.S ) +
sqr( common.ProjMassT2 ) +
sqr( common.TargMassT2 )
1079 - 2.0 * ( common.S * ( common.ProjMassT2 + common.TargMassT2 )
1080 + common.ProjMassT2 * common.TargMassT2 ) ) / 4.0 / common.S;
1081 if ( common.PZcms2 < 0.0 )
continue;
1083 common.PZcms = std::sqrt( common.PZcms2 );
1084 common.PMinusMin = std::sqrt( common.ProjMassT2 + common.PZcms2 ) - common.PZcms;
1085 common.PMinusMax = common.SqrtS - common.TargMassT;
1086 common.TPlusMin = std::sqrt( common.TargMassT2 + common.PZcms2 ) - common.PZcms;
1087 common.TPlusMax = common.SqrtS - common.ProjMassT;
1091 common.PMinusNew = ChooseP( common.PMinusMin, common.PMinusMax );
1093 common.PMinusNew = ( common.PMinusMax - common.PMinusMin )*
G4UniformRand() + common.PMinusMin;
1096 common.TPlusNew = ChooseP( common.TPlusMin, common.TPlusMax );
1098 common.TPlusNew = ( common.TPlusMax - common.TPlusMin )*
G4UniformRand() + common.TPlusMin;
1102 common.TPlusNew = ChooseP( common.TPlusMin, common.TPlusMax );
1104 common.TPlusNew = ( common.TPlusMax - common.TPlusMin )*
G4UniformRand() + common.TPlusMin;
1107 common.PMinusNew = ChooseP( common.PMinusMin, common.PMinusMax );
1109 common.PMinusNew = ( common.PMinusMax - common.PMinusMin )*
G4UniformRand() + common.PMinusMin;
1113 common.Qminus = common.PMinusNew - common.Pprojectile.minus();
1114 common.Qplus = -( common.TPlusNew - common.Ptarget.plus() );
1115 common.Qmomentum.setPz( (common.Qplus - common.Qminus)/2.0 );
1116 common.Qmomentum.setE( (common.Qplus + common.Qminus)/2.0 );
1117 #ifdef debugFTFexictation
1119 << ( common.Pprojectile + common.Qmomentum ).mag() <<
" "
1120 << common.ProjectileNonDiffStateMinMass <<
G4endl
1121 << ( common.Ptarget - common.Qmomentum ).mag() <<
" "
1122 << common.TargetNonDiffStateMinMass <<
G4endl;
1125 }
while ( ( common.Pprojectile + common.Qmomentum ).mag2() <
1126 common.ProjectileNonDiffStateMinMass2 ||
1127 ( common.Ptarget - common.Qmomentum ).mag2() <
1128 common.TargetNonDiffStateMinMass2 );
1151 if ( start == NULL ) {
1152 G4cout <<
" G4FTFModel::String() Error: No start parton found" <<
G4endl;
1153 FirstString = 0; SecondString = 0;
1158 if ( end == NULL ) {
1159 G4cout <<
" G4FTFModel::String() Error: No end parton found" <<
G4endl;
1160 FirstString = 0; SecondString = 0;
1181 if ( isProjectile ) {
1189 G4double Pt( 0.0 ), x1( 0.0 ), x3( 0.0 );
1212 if ( Pt > 500.0*MeV ) {
1213 G4double Ymax =
G4Log( W/2.0/Pt + std::sqrt( W2/4.0/Pt/Pt - 1.0 ) );
1215 x1 = 1.0 - Pt/W *
G4Exp(
Y );
1216 x3 = 1.0 - Pt/W *
G4Exp(-
Y );
1220 if ( PDGcode_startQ < 3 ) Mass_startQ = 325.0*MeV;
1221 if ( PDGcode_startQ == 3 ) Mass_startQ = 500.0*MeV;
1222 if ( PDGcode_startQ == 4 ) Mass_startQ = 1600.0*MeV;
1223 if ( PDGcode_startQ == 5 ) Mass_startQ = 4500.0*MeV;
1225 if ( PDGcode_endQ < 3 ) Mass_endQ = 325.0*MeV;
1226 if ( PDGcode_endQ == 3 ) Mass_endQ = 500.0*MeV;
1227 if ( PDGcode_endQ == 4 ) Mass_endQ = 1600.0*MeV;
1228 if ( PDGcode_endQ == 5 ) Mass_endQ = 4500.0*MeV;
1230 G4double P2_1 = W2*x1*x1/4.0 - Mass_endQ*Mass_endQ;
1231 G4double P2_3 = W2*x3*x3/4.0 - Mass_startQ*Mass_startQ;
1233 if ( P2_1 <= 0.0 || P2_3 <= 0.0 ) {
1239 G4double CosT12 = ( P2_3 - P2_1 - P2_2 ) / (2.0*P_1*P_2);
1240 G4double CosT13 = ( P2_2 - P2_1 - P2_3 ) / (2.0*P_1*P_3);
1242 if ( std::abs( CosT12 ) > 1.0 || std::abs( CosT13 ) > 1.0 ) {
1246 Pt = P_2 * std::sqrt( 1.0 - CosT12*CosT12 );
1250 Pstart.
setE( x3*W/2.0 );
1252 Pend.
setE( x1*W/2.0 );
1254 G4double XkQ = GetQuarkFractionOfKink( 0.0, 1.0 );
1255 if ( Pkink.
getZ() > 0.0 ) {
1257 PkinkQ1 = XkQ*Pkink;
1259 PkinkQ1 = (1.0 - XkQ)*Pkink;
1263 PkinkQ1 = (1.0 - XkQ)*Pkink;
1265 PkinkQ1 = XkQ*Pkink;
1269 PkinkQ2 = Pkink - PkinkQ1;
1272 std::sqrt(
sqr(
sqr(x1) -
sqr(x3) ) +
sqr( 2.0*x1*x3*CosT13 ) );
1273 G4double Psi = std::acos( Cos2Psi );
1276 if ( isProjectile ) {
1296 std::vector< G4double > QuarkProbabilitiesAtGluonSplitUp =
1300 for (
unsigned int Iq = 0; Iq < 3; Iq++ ) {
1302 if ( Ksi > QuarkProbabilitiesAtGluonSplitUp[Iq] ) QuarkInGluon++;
1327 G4int absPDGcode = 1500;
1334 if ( absPDGcode < 1000 ) {
1335 if ( isProjectile ) {
1361 if ( isProjectile ) {
1397 if ( isProjectile ) {
1413 G4double Exp = std::sqrt(
sqr(Pz) + (
sqr(Mt2) - 4.0*
sqr(Eh)*Pt2/4.0 )/Mt2 )/2.0;
1420 Pstart = Pstart1; Pend = Pend1;
1432 <<
" generated string momenta: Diquark " << end->
Get4Momentum() <<
"mass : "
1434 << Pstart + Pend <<
G4endl <<
" Original "
1448 if ( Pmin <= 0.0 || range <= 0.0 ) {
1449 G4cout <<
" Pmin, range : " << Pmin <<
" , " << range <<
G4endl;
1451 "G4DiffractiveExcitation::ChooseP : Invalid arguments " );
1464 if ( AveragePt2 <= 0.0 ) {
1468 (
G4Exp( -maxPtSquare/AveragePt2 ) - 1.0 ) );
1472 return G4ThreeVector( Pt * std::cos( phi ), Pt * std::sin( phi ), 0.0 );
1480 const G4int maxNumberOfLoops = 10000;
1481 G4int loopCounter = 0;
1484 yf = z*z +
sqr(1.0 - z);
1486 ++loopCounter < maxNumberOfLoops );
1487 if ( loopCounter >= maxNumberOfLoops ) {
1488 z = 0.5*(zmin + zmax);
1496void G4DiffractiveExcitation::UnpackMeson(
const G4int IdPDG,
G4int& Q1,
G4int& Q2 )
const {
1497 G4int absIdPDG = std::abs( IdPDG );
1498 if ( ! ( absIdPDG == 111 || absIdPDG == 221 || absIdPDG == 331 ||
1499 absIdPDG == 441 || absIdPDG == 443 || absIdPDG == 553 ) ) {
1501 Q1 = absIdPDG / 100;
1502 Q2 = (absIdPDG % 100) / 10;
1503 G4int anti = 1 - 2 * ( std::max( Q1, Q2 ) % 2 );
1504 if ( IdPDG < 0 ) anti *= -1;
1508 if ( absIdPDG == 441 || absIdPDG == 443 ) {
1510 }
else if ( absIdPDG == 553 ) {
1526void G4DiffractiveExcitation::UnpackBaryon(
G4int IdPDG,
1529 Q2 = (IdPDG % 1000) / 100;
1530 Q3 = (IdPDG % 100) / 10;
1544 }
else if ( Q3 > Q1 ) {
1555 G4int NewCode = Q1*1000 + Q2*100 + Q3*10 + 2;
1564 "G4DiffractiveExcitation copy constructor not meant to be called" );
1572 "G4DiffractiveExcitation = operator not meant to be called" );
1581 "G4DiffractiveExcitation == operator not meant to be called" );
1589 "G4DiffractiveExcitation != operator not meant to be called" );
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 & rotateZ(double)
HepLorentzVector & rotateY(double)
HepLorentzVector & transform(const HepRotation &)
G4DiffractiveExcitation()
virtual G4bool ExciteParticipants(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters, G4ElasticHNScattering *theElastic) const
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
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()