330 {
331
332
333
334
335
336
337 G4int returnCode = 99;
338
341 G4double MtestPr = 0.0, MtestTr = 0.0;
342
343 #ifdef debugFTFexictation
344 G4cout <<
"Q exchange --------------------------" <<
G4endl;
345 #endif
346
347
348
349
350
351
352
353
354
355
356
357 G4int NewProjCode = 0, NewTargCode = 0, ProjQ1 = 0, ProjQ2 = 0, ProjQ3 = 0;
358
359 if (
common.absProjectilePDGcode < 1000 ) {
361 } else {
363 }
364
365 G4int TargQ1 = 0, TargQ2 = 0, TargQ3 = 0;
367 #ifdef debugFTFexictation
368 G4cout <<
"Proj Quarks " << ProjQ1 <<
" " << ProjQ2 <<
" " << ProjQ3 <<
G4endl
369 <<
"Targ Quarks " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl;
370 #endif
371
372
373 G4int ProjExchangeQ = 0, TargExchangeQ = 0;
374 if (
common.absProjectilePDGcode < 1000 ) {
375
376 G4bool isProjQ1Quark =
false;
377 ProjExchangeQ = ProjQ2;
378 if ( ProjQ1 > 0 ) {
379 isProjQ1Quark = true;
380 ProjExchangeQ = ProjQ1;
381 }
382
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;
388 NpossibleStates = 0;
389 if ( ProjExchangeQ != TargQ1 ) {
390 if ( ++NpossibleStates == Nsampled ) {
391 TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ;
392 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
393 }
394 }
395 if ( ProjExchangeQ != TargQ2 ) {
396 if ( ++NpossibleStates == Nsampled ) {
397 TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ;
398 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
399 }
400 }
401 if ( ProjExchangeQ != TargQ3 ) {
402 if ( ++NpossibleStates == Nsampled ) {
403 TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ;
404 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
405 }
406 }
407 #ifdef debugFTFexictation
408 G4cout <<
"Exchanged Qs in Pr Tr " << ProjExchangeQ <<
" " << TargExchangeQ <<
G4endl;
409 #endif
410
411 G4int aProjQ1 = std::abs( ProjQ1 ), aProjQ2 = std::abs( ProjQ2 );
412 G4bool ProjExcited =
false;
413 const G4int maxNumberOfAttempts = 50;
415 while ( attempts++ < maxNumberOfAttempts ) {
416
417
419 if ( aProjQ1 == aProjQ2 ) {
420 if ( aProjQ1 < 3 ) {
421 NewProjCode = 111;
422 if ( Ksi < 0.5 ) {
423 NewProjCode = 221;
424 if ( Ksi < 0.25 ) {
425 NewProjCode = 331;
426 }
427 }
428 } else if ( aProjQ1 == 3 ) {
429 NewProjCode = 221;
430 if ( Ksi < 0.5 ) {
431 NewProjCode = 331;
432 }
433 } else if ( aProjQ1 == 4 ) {
434 NewProjCode = 441;
435 } else if ( aProjQ1 == 5 ) {
436 NewProjCode = 553;
437 }
438 } else {
439 if ( aProjQ1 > aProjQ2 ) {
440 NewProjCode = aProjQ1*100 + aProjQ2*10 + 1;
441 } else {
442 NewProjCode = aProjQ2*100 + aProjQ1*10 + 1;
443 }
444 }
445 #ifdef debugFTFexictation
447 #endif
448
449
450
451 ProjExcited = false;
452 if ( aProjQ1 <= 3 && aProjQ2 <= 3 &&
G4UniformRand() < 0.5 ) {
453 NewProjCode += 2;
454 ProjExcited = true;
455 }
456
457
458
459 G4int value = ProjQ1, absValue = aProjQ1, Qquarks = 0;
460 for (
G4int iQ = 0; iQ < 2; ++iQ ) {
461 if ( iQ == 1 ) {
462 value = ProjQ2; absValue = aProjQ2;
463 }
464 if ( absValue == 2 || absValue == 4 ) {
465 Qquarks += 2*value/absValue;
466 } else {
467 Qquarks -= value/absValue;
468 }
469 }
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486 if ( Qquarks < 0 || ( Qquarks == 0 && aProjQ1 != aProjQ2 && aProjQ1%2 == 0 ) ) {
487 NewProjCode *= -1;
488 }
489 #ifdef debugFTFexictation
490 G4cout <<
"NewProjCode +2 or 0 " << NewProjCode <<
G4endl;
491 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
493 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
494 #endif
495
496
498 if ( ! TestParticle ) continue;
499 common.MminProjectile =
common.BrW.GetMinimumMass( TestParticle );
503 #ifdef debugFTFexictation
506 <<
"MtestPart MtestPart0 "<<MtestPr<<
" "<<TestParticle->
GetPDGMass()<<
G4endl
507 <<
"M0projectile projectile PDGMass " <<
common.M0projectile <<
" "
509 #endif
510
511
513 #ifdef debugFTFexictation
514 G4cout <<
"New TrQ " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl
515 <<
"NewTargCode " << NewTargCode <<
G4endl;
516 #endif
517
518
519
520 if ( TargQ1 <= 3 && TargQ2 <= 3 && TargQ3 <= 3 ) {
521 if ( TargQ1 != TargQ2 && TargQ1 != TargQ3 && TargQ2 != TargQ3 ) {
523 NewTargCode += 2;
525 NewTargCode = 3122;
526 }
527 } else if ( TargQ1 == TargQ2 && TargQ1 == TargQ3 ) {
528 NewTargCode += 2; ProjExcited = true;
531 NewTargCode += 2; ProjExcited = true;
532 }
533 } else if ( ! ProjExcited &&
537 NewTargCode += 2;
538 }
539 }
540
541
542
543
544
545 if ( NewTargCode == 3124 ||
546 NewTargCode == 3224 ||
547 NewTargCode == 3214 ||
548 NewTargCode == 3114 ||
549 NewTargCode == 3324 ||
550 NewTargCode == 3314 ) {
551
552
553 NewTargCode -= 2;
554 }
555
556
557
558 #ifdef debug_heavyHadrons
559 G4int initialNewTargCode = NewTargCode;
560 #endif
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;
570 }
571 #endif
572
574 if ( ! TestParticle ) continue;
575 #ifdef debugFTFexictation
577 #endif
578 common.MminTarget =
common.BrW.GetMinimumMass( TestParticle );
579 if (
common.SqrtS - MtestPr <
common.MminTarget )
continue;
582 if (
common.SqrtS > MtestPr + MtestTr )
break;
583
584 }
585 if ( attempts >= maxNumberOfAttempts ) return returnCode;
586
587 if ( MtestPr >=
common.Pprojectile.mag() || projectile->
GetStatus() != 0 ) {
588 common.M0projectile = MtestPr;
589 }
590 #ifdef debugFTFexictation
592 #endif
595 common.ProjectileNonDiffStateMinMass =
common.M0projectile + 220.0*
MeV;
597 common.M0target = MtestTr;
598 }
600 #ifdef debugFTFexictation
602 #endif
605
606 } else {
607
608
609
610
611 if (
common.ProjectilePDGcode < 0 )
return 1;
612
613
614
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;
622 }
623
624
625 G4int exchangedQ = 0;
627 if ( Ksi < 0.333333 ) {
628 exchangedQ = firstQ;
629 } else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
630 exchangedQ = secondQ;
631 } else {
632 exchangedQ = thirdQ;
633 }
634 #ifdef debugFTFexictation
635 G4cout <<
"Exchange Qs isProjectile Q " << isProjectileExchangedQ <<
" " << exchangedQ <<
" ";
636 #endif
637
638
639
641 const G4int MaxCount = 100;
642 G4int count = 0, otherExchangedQ = 0;
643 do {
644 if ( exchangedQ != otherFirstQ ||
G4UniformRand() < probSame ) {
645 otherExchangedQ = otherFirstQ; otherFirstQ = exchangedQ; exchangedQ = otherExchangedQ;
646 } else {
647 if ( exchangedQ != otherSecondQ ||
G4UniformRand() < probSame ) {
648 otherExchangedQ = otherSecondQ; otherSecondQ = exchangedQ; exchangedQ = otherExchangedQ;
649 } else {
650 if ( exchangedQ != otherThirdQ ||
G4UniformRand() < probSame ) {
651 otherExchangedQ = otherThirdQ; otherThirdQ = exchangedQ; exchangedQ = otherExchangedQ;
652 }
653 }
654 }
655 } while ( otherExchangedQ == 0 && ++count < MaxCount );
656 if ( count >= MaxCount ) return returnCode;
657
658
659 if ( Ksi < 0.333333 ) {
660 firstQ = exchangedQ;
661 } else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
662 secondQ = exchangedQ;
663 } else {
664 thirdQ = exchangedQ;
665 }
666 if ( isProjectileExchangedQ ) {
667 ProjQ1 = firstQ; ProjQ2 = secondQ; ProjQ3 = thirdQ;
668 TargQ1 = otherFirstQ; TargQ2 = otherSecondQ; TargQ3 = otherThirdQ;
669 } else {
670 TargQ1 = firstQ; TargQ2 = secondQ; TargQ3 = thirdQ;
671 ProjQ1 = otherFirstQ; ProjQ2 = otherSecondQ; ProjQ3 = otherThirdQ;
672 }
673 #ifdef debugFTFexictation
674 G4cout <<
"Exchange Qs Pr Tr " << ( isProjectileExchangedQ ? exchangedQ : otherExchangedQ )
675 <<
" " << ( isProjectileExchangedQ ? otherExchangedQ : exchangedQ ) <<
G4endl;
676 #endif
677
680
681
682
683
684
685
686
687 for (
G4int iHadron = 0; iHadron < 2; iHadron++ ) {
688
689 G4int codeQ1 = ProjQ1, codeQ2 = ProjQ2, codeQ3 = ProjQ3, newHadCode = NewProjCode;
692 if ( iHadron == 1 ) {
693 codeQ1 = TargQ1, codeQ2 = TargQ2, codeQ3 = TargQ3, newHadCode = NewTargCode;
694 massConstraint =
common.M0projectile;
696 }
697 if ( codeQ1 > 3 || codeQ2 > 3 || codeQ3 > 3 ) continue;
698 if ( codeQ1 == codeQ2 && codeQ1 == codeQ3 ) {
699 newHadCode += 2;
700 } else if ( isHadronADelta ) {
702 newHadCode += 2;
703 } else {
704 newHadCode += 0;
705 }
706 } else {
709 + massConstraint ) {
710 newHadCode += 2;
711 } else {
712 newHadCode += 0;
713 }
714 }
715 if ( iHadron == 0 ) {
716 NewProjCode = newHadCode;
717 } else {
718 NewTargCode = newHadCode;
719 }
720 }
721 #ifdef debugFTFexictation
722 G4cout <<
"NewProjCode NewTargCode " << NewProjCode <<
" " << NewTargCode <<
G4endl;
723 #endif
724
725
726
727
728
729 if ( NewProjCode == 3124 ||
730 NewProjCode == 3224 ||
731 NewProjCode == 3214 ||
732 NewProjCode == 3114 ||
733 NewProjCode == 3324 ||
734 NewProjCode == 3314 ) {
735
736
737 NewProjCode -= 2;
738 }
739 if ( NewTargCode == 3124 ||
740 NewTargCode == 3224 ||
741 NewTargCode == 3214 ||
742 NewTargCode == 3114 ||
743 NewTargCode == 3324 ||
744 NewTargCode == 3314 ) {
745
746
747 NewTargCode -= 2;
748 }
749
750
751
752 #ifdef debug_heavyHadrons
753 G4int initialNewProjCode = NewProjCode, initialNewTargCode = NewTargCode;
754 #endif
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;
770 }
771 if ( NewTargCode != initialNewTargCode ) {
772 G4cout <<
"\t \t target baryon with pdgCode=" << initialNewTargCode
773 <<
" into pdgCode=" << NewTargCode <<
G4endl;
774 }
775 }
776 #endif
777
778
779
780
781
782
785 G4int firstHadronCode = NewTargCode, secondHadronCode = NewProjCode;
787 G4bool isFirstTarget =
true;
789
790 firstHadron = projectile; secondHadron = target;
791 firstHadronCode = NewProjCode; secondHadronCode = NewTargCode;
792 massConstraint =
common.M0target;
793 isFirstTarget = false;
794 }
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;
801 }
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() );
810 } else {
811 const G4int maxNumberOfAttempts = 50;
813 while ( attempts < maxNumberOfAttempts ) {
814 attempts++;
815 MtestHadron =
common.BrW.SampleMass( TestParticle, TestParticle->
GetPDGMass()
817 if (
common.SqrtS < MtestHadron + massConstraint ) {
818 continue;
819 } else {
820 break;
821 }
822 }
823 if ( attempts >= maxNumberOfAttempts ) return returnCode;
824 }
825 }
826 if ( iSamplingCase == 0 ) {
827 Mtest1st = MtestHadron; Mmin1st = MminHadron;
828 } else {
829 Mtest2nd = MtestHadron; Mmin2nd = MminHadron;
830 }
831 }
832 if ( isFirstTarget ) {
833 MtestTr = Mtest1st; MtestPr = Mtest2nd;
834 common.MminTarget = Mmin1st;
common.MminProjectile = Mmin2nd;
835 } else {
836 MtestTr = Mtest2nd; MtestPr = Mtest1st;
837 common.MminTarget = Mmin2nd;
common.MminProjectile = Mmin1st;
838 }
839
840 if ( MtestPr != 0.0 ) {
841 common.M0projectile = MtestPr;
844 common.ProjectileNonDiffStateMinMass =
common.M0projectile + 220.0*
MeV;
845 }
846 if ( MtestTr != 0.0 ) {
847 common.M0target = MtestTr;
851 }
852
853 }
854
855
856
858
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 <<
" "
870 #endif
871 if (
common.PZcms2 < 0.0 )
return returnCode;
872
880 #ifdef debugFTFexictation
883 #endif
884
887
888
892
894 #ifdef debugFTFexictation
895 G4cout <<
"Make elastic scattering of new hadrons" <<
G4endl;
896 #endif
902 #ifdef debugFTFexictation
903 G4cout <<
"Result of el. scatt " << Result <<
G4endl <<
"Proj Targ and Proj+Targ in Lab"
907 #endif
908 if ( Result ) returnCode = 0;
909 return returnCode;
910 }
911
912 #ifdef debugFTFexictation
914 #endif
915
916
917 common.ProbOfDiffraction =
common.ProbProjectileDiffraction +
common.ProbTargetDiffraction;
918 if (
common.ProbOfDiffraction != 0.0 ) {
919 common.ProbProjectileDiffraction /=
common.ProbOfDiffraction;
920 common.ProbTargetDiffraction /=
common.ProbOfDiffraction;
921 }
922
923 return returnCode = 1;
924}
G4int NewNucleonId(G4int Q1, G4int Q2, G4int Q3) const
void UnpackMeson(G4int IdPDG, G4int &Q1, G4int &Q2) const
void UnpackBaryon(G4int IdPDG, G4int &Q1, G4int &Q2, G4int &Q3) const
virtual G4bool ElasticScattering(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters) const
G4double GetDeltaProbAtQuarkExchange()
G4double GetProbOfSameQuarkExchange()
G4int GetPDGiIsospin() const
G4double GetPDGMass() const
G4double GetPDGWidth() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void SetStatus(const G4int aStatus)
const G4ParticleDefinition * GetDefinition() const
void Set4Momentum(const G4LorentzVector &a4Momentum)
void SetDefinition(const G4ParticleDefinition *aDefinition)
const G4LorentzVector & Get4Momentum() const