486{
488 static const G4double pFm2= pFm*pFm;
492 static const G4double mNeut2=mNeut*mNeut;
493 static const G4double dmNeut=mNeut+mNeut;
495 static const G4double mProt2=mProt*mProt;
496 static const G4double dmProt=mProt+mProt;
497 static const G4double maxDM=mProt*12.;
503
505
508 ResHV->push_back(hadron);
509
511 G4int tPDG=90000000+tgZ*1000+tgN;
515 {
516 rPDG=2212;
517 tPDG-=1000;
518 }
519 else tPDG-=1;
530
531
532 if(rPDG==2212)
533 {
534 mT=mProt;
535 mT2=mProt2;
536 dmT=dmProt;
537
538
539 }
541 if(mP2<0.) mP2=0.;
545 if(E<0. || E2<mP2)
546 {
547#ifdef pdebug
548 G4cerr<<
"-Warning-G4DifR::PFra:<NegativeEnergy>E="<<E<<
",E2="<<E2<<
"<M2="<<mP2<<
G4endl;
549#endif
550 return ResHV;
551 }
553 if(mP<.1)mP=mPi0;
557 if(mMax>maxDM) mMax=maxDM;
558 if(mMin>=mMax)
559 {
560#ifdef pdebug
561 G4cerr<<
"-Warning-G4DifR::PFra:ZeroDiffractionMRange, mi="<<mMin<<
",ma="<<mMax<<
G4endl;
562#endif
563 return ResHV;
564 }
566 G4double mDif=std::exp(R*std::log(mMax)+(1.-R)*std::log(mMin));
569
570
571#ifdef debug
572 G4cout<<
"G4QDiffR::PFra: Before XS, P="<<P<<
", Z="<<Z<<
", N="<<N<<
", PDG="<<pPDG<<
G4endl;
573#endif
574
575 if(pPDG>3400 || pPDG<-3400)
G4cout<<
"-Warning-G4QDifR::Fragment: pPDG="<<pPDG<<
G4endl;
578 G4double maxt=(ds*ds-4*mT2*mDif2)/s_value;
579#ifdef pdebug
580 G4cout<<
"G4QDifR::PFra:ph="<<pPDG<<
",P="<<P<<
",t="<<mint<<
"<"<<maxt<<
G4endl;
581#endif
582#ifdef nandebug
583 if(mint>-.0000001);
584 else G4cout<<
"******G4QDiffractionRatio::ProjFragment: -t="<<mint<<
G4endl;
585#endif
588#ifdef ppdebug
589 G4cout<<
"G4QDiffRatio::ProjFragment: -t="<<t<<
", maxt="<<maxt<<
", cost="<<cost<<
G4endl;
590#endif
591 if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
592 {
593 if (cost>1.) cost=1.;
594 else if(cost<-1.) cost=-1.;
595 else
596 {
597 G4cerr<<
"G4QDiffRat::ProjFragm: *NAN* cost="<<cost<<
",t="<<t<<
",tmax="<<maxt<<
G4endl;
598 return ResHV;
599 }
600 }
604 if(!
G4QHadron(tot4M).RelDecayIn2(d4M, r4M, dir4M, cost, cost))
605 {
606 G4cerr<<
"G4QDifR::PFr:M="<<tot4M.
m()<<
",T="<<mT<<
",D="<<mDif<<
",T+D="<<mT+mDif<<
G4endl;
607
608 return ResHV;
609 }
610#ifdef debug
611 G4cout<<
"G4QDiffR::ProjFragm:d4M="<<d4M<<
"+r4M="<<r4M<<
"="<<d4M+r4M<<
"="<<tot4M<<
G4endl;
612#endif
613
614 delete hadron;
615 ResHV->pop_back();
617 ResHV->push_back(hadron);
618#ifdef debug
619 G4cout<<
"G4QDiffractionRatio::ProjFragment: *Filled* RecNucleus="<<t4M<<tPDG<<
G4endl;
620#endif
622 ResHV->push_back(hadron);
623#ifdef debug
624 G4cout<<
"G4QDiffractionRatio::ProjFragment: *Filled* RecNucleon="<<r4M<<rPDG<<
G4endl;
625#endif
627
631 try
632 {
635 }
637 {
638 G4cerr<<
"***G4QDiffractionRatio::ProjFragment: G4Quasmon Exception"<<
G4endl;
639
640 G4Exception(
"G4QDiffractionRatio::ProjFragment()",
"HAD_CHPS_0072",
642 }
643 delete pan;
644 G4int qNH=leadhs->size();
645 if(qNH)
for(
G4int iq=0; iq<qNH; iq++)
646 {
652
653 if(2>3)
654 {
657#ifdef fdebug
658 G4cout<<
"G4QDR::PF:"<<oPDG<<
",M="<<qM<<
",B="<<nB<<
",S="<<nL<<
",C="<<nC<<
G4endl;
659#endif
663 tPDG = 3122;
668
669 if(nC<0)
670 {
671 if(nL&&nB==nL)
672 {
673 sPDG = -211;
674 if(-nC==nL && nL==1)
675 {
676 if(std::fabs(qM-mSigM)<eps)
677 {
679 cont=false;
680 }
681 else if(qM>mLamb+mPi)
682 {
683 fPDG = 3122;
684 fMass= mLamb;
685 }
686 else if(qM>mSigM)
687 {
688 fPDG = 3112;
689 fMass= mSigM;
690 sPDG = 22;
691 sMass= 0.;
692 }
693 else
694 {
695 fPDG = 2112;
696 fMass= mNeut;
697 }
698 qPN = 1;
699 }
700 else if(-nC==nL)
701 {
702 qPN = 1;
703 fPDG = 3112;
704 sPDG = 3112;
705 sMass= mSigM;
706 nB--;
707 fMass= mSigM;
708 }
709 else if(-nC>nL)
710 {
711 qPN = -nC-nL;
712 fPDG = 3112;
713 fMass= mSigM;
714 }
715 else
716 {
717 nB += nC;
718 fPDG = 3122;
719 fMass= mLamb;
720 qPN = -nC;
721 sPDG = 3112;
722 sMass= mSigM;
723 }
724 nL = 0;
725 }
726 else if(nL)
727 {
728 nB -= nL;
729 fPDG = 2112;
730 fMass= mNeut;
732 if(nL==nPin)
733 {
734 qPN = nL;
735 sPDG = 3112;
736 sMass= mSigM;
737 nL = 0;
738 }
739 else if(nL>nPin)
740 {
741 nL-=nPin;
742 qPN = nPin;
743 sPDG = 3112;
744 sMass= mSigM;
745 }
746 else
747 {
748 qPN = nPin-nL;
749 sPDG = -211;
750 tPDG = 3112;
751 tMass= mSigM;
752 }
753 }
754 else
755 {
756 sPDG = -211;
757 qPN = -nC;
758 fPDG = 2112;
759 fMass= mNeut;
760 }
761 }
762 else if(!nC)
763 {
764 if(nL && nL<nB)
765 {
766 qPN = nL;
767 fPDG = 2112;
768 sPDG = 3122;
769 sMass= mLamb;
770 nB -= nL;
771 fMass= mNeut;
772 nL = 0;
773 }
774 else if(nL>1 && nB==nL)
775 {
776 qPN = 1;
777 fPDG = 3122;
778 sPDG = 3122;
779 sMass= mLamb;
780 nB--;
781 fMass= mLamb;
782 }
783 else if(!nL && nB>1)
784 {
785 qPN = 1;
786 fPDG = 2112;
787 sPDG = 2112;
788 sMass= mNeut;
789 nB--;
790 fMass= mNeut;
791 }
792 else G4cout<<
"*?*G4QDiffractionRatio::ProjFragment: (1) oPDG="<<oPDG<<
G4endl;
793 }
794 else if(nC>0)
795 {
796 if(nL && nL+nC==nB)
797 {
798 qPN = nL;
799 nL = 0;
800 fPDG = 2212;
801 sPDG = 3122;
802 sMass= mLamb;
803 nB = nC;
804 fMass= mProt;
805 }
806 else if(nL && nC<nB-nL)
807 {
808 qPN = nC;
809 fPDG = 2112;
810 sPDG = 2212;
811 sMass= mProt;
812 nB -= nL+nC;
813 fMass= mNeut;
814 }
815 else if(nL && nB==nL)
816 {
817 if(nC==nL && nL==1)
818 {
819 if(std::fabs(qM-mSigP)<eps)
820 {
822 cont=false;
823 }
824 else if(qM>mLamb+mPi)
825 {
826 fPDG = 3122;
827 fMass= mLamb;
828 }
829 else if(qM>mNeut+mPi)
830 {
831 fPDG = 2112;
832 fMass= mNeut;
833 }
834 else if(qM>mSigP)
835 {
836 fPDG = 3222;
837 fMass= mSigP;
838 sPDG = 22;
839 sMass= 0.;
840 }
841 else
842 {
843 fPDG = 2212;
844 fMass= mProt;
845 sPDG = 22;
846 sMass= 0.;
847 }
848 qPN = 1;
849 }
850 else if(nC==nL)
851 {
852 qPN = 1;
853 fPDG = 3222;
854 sPDG = 3222;
855 sMass= mSigP;
856 nB--;
857 fMass= mSigP;
858 }
859 else if(nC>nL)
860 {
861 qPN = nC-nL;
862 fPDG = 3222;
863 nB = nL;
864 fMass= mSigP;
865 }
866 else
867 {
868 nB -= nC;
869 fPDG = 3122;
870 fMass= mLamb;
871 qPN = nC;
872 sPDG = 3222;
873 sMass= mSigP;
874 }
875 nL = 0;
876 }
877 else if(nL && nC>nB-nL)
878 {
879 nB -= nL;
881 if(nL==nPip)
882 {
883 qPN = nL;
884 sPDG = 3222;
885 sMass= mSigP;
886 nL = 0;
887 }
888 else if(nL>nPip)
889 {
890 nL -= nPip;
891 qPN = nPip;
892 sPDG = 3222;
893 sMass= mSigP;
894 }
895 else
896 {
897 qPN = nPip-nL;
898 tPDG = 3222;
899 tMass= mSigP;
900 }
901 }
902 if(nC<nB)
903 {
904 fPDG = 2112;
905 fMass= mNeut;
906 qPN = nC;
907 sPDG = 2212;
908 sMass= mProt;
909 }
910 else if(nB==nC && nC>1)
911 {
912 qPN = 1;
913 fPDG = 2212;
914 sPDG = 2212;
915 sMass= mProt;
916 nB--;
917 fMass= mProt;
918 }
919 else if(nC<=nB||!nB)
G4cout<<
"*?*G4QDR::ProjFragm: (2) oPDG="<<oPDG<<
G4endl;
920
921 }
922 if(cont)
923 {
927 if(nL) ttM=nL*tMass;
932 if(std::fabs(qM-sum)<eps)
933 {
934 f4Mom=q4M*(tfM/sum);
935 s4Mom=q4M*(tsM/sum);
936 if(nL) t4Mom=q4M*(ttM/sum);
937 }
939 {
940
941 G4cout<<
"***G4QDR::PrFragm:fPDG="<<fPDG<<
"*"<<nB<<
"(fM="<<fMass<<
")+sPDG="<<sPDG
942 <<
"*"<<qPN<<
"(sM="<<sMass<<
")"<<
"="<<sum<<
" > TM="<<qM<<q4M<<oPDG<<
G4endl;
943
944
946 ed << "***G4QDR::PrFragm:fPDG=" << fPDG << "*" << nB << "(fM="
947 << fMass << ")+sPDG=" << sPDG << "*" << qPN << "(sM=" << sMass
948 <<
")" <<
"=" << sum <<
" > TM=" << qM << q4M << oPDG <<
G4endl;
949 G4Exception(
"G4QDiffractionRatio::ProjFragment()",
"HAD_CHPS_0002",
951 }
952 else if(nL && (qM<sum || !
G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom)))
953 {
954
955 G4cout<<
"***G4DF::PrFrag: "<<fPDG<<
"*"<<nB<<
"("<<fMass<<
")+"<<sPDG<<
"*"<<qPN<<
"("
956 <<sMass<<
")+Lamb*"<<nL<<
"="<<sum<<
" > TotM="<<qM<<q4M<<oPDG<<
G4endl;
957
958
960 ed << "***G4DF::PrFrag: " << fPDG << "*" << nB << "(" << fMass << ")+"
961 << sPDG << "*" << qPN << "(" << sMass << ")+Lamb*" << nL << "="
962 << sum <<
" > TotM=" << qM << q4M << oPDG <<
G4endl;
963 G4Exception(
"G4QDiffractionRatio::ProjFragment()",
"HAD_CHPS_0003",
965 }
966#ifdef fdebug
967 G4cout<<
"G4QDF::ProjFragm: *DONE* n="<<nB<<f4Mom<<fPDG<<
", m="<<qPN<<s4Mom<<sPDG
968 <<
", l="<<nL<<t4Mom<<
G4endl;
969#endif
971 if(nB)
972 {
973 f4Mom/=nB;
976 notused=false;
977 if(nB>1)
for(
G4int ih=1; ih<nB; ih++)
978 {
980 ResHV->push_back(Hi);
981#ifdef fdebug
982 sum4M+=r4M;
983 G4cout<<
"G4QDR::ProjFrag: *additional Nucleon*="<<f4Mom<<fPDG<<
G4endl;
984#endif
985 }
986 }
987 if(qPN)
988 {
989 s4Mom/=qPN;
991 if(notused)
992 {
995 notused=false;
996 min=1;
997 }
998 if(qPN>min)
for(
G4int ip=min; ip<qPN; ip++)
999 {
1001 ResHV->push_back(Hj);
1002#ifdef fdebug
1003 sum4M+=r4M;
1004 G4cout<<
"G4QDR::ProjFragm: *additional Pion*="<<f4Mom<<fPDG<<
G4endl;
1005#endif
1006 }
1007 }
1008 if(nL)
1009 {
1010 t4Mom/=nL;
1012 if(notused)
1013 {
1016 notused=false;
1017 min=1;
1018 }
1019 if(nL>min)
for(
G4int il=min; il<nL; il++)
1020 {
1022 ResHV->push_back(Hk);
1023#ifdef fdebug
1024 sum4M+=r4M;
1025 G4cout<<
"G4QDR::ProjFragm: *additional Hyperon*="<<f4Mom<<fPDG<<
G4endl;
1026#endif
1027 }
1028 }
1029 }
1030 }
1031 else if( (nL > 0 && nB > 1) || (nL < 0 && nB < -1) )
1032 {
1034 if(nB<0)
1035 {
1036 anti=true;
1037 nB=-nB;
1038 nC=-nC;
1039 nL=-nL;
1040 }
1041 G4int hPDG = 90000000+nL*999999+nC*999+nB;
1044 if(nC<0)
1045 {
1046 if(-nC<=nL)
1047 {
1048 nSM=-nC;
1049 nL+=nC;
1050 }
1051 else
1052 {
1053 nSM=nL;
1054 nL=0;
1055 }
1056 }
1057 else if(nC>nB-nL)
1058 {
1059 if(nC<=nB)
1060 {
1062 nSP=nL-dH;
1063 nL=dH;
1064 }
1065 else
1066 {
1067 nSP=nL;
1068 nL=0;
1069 }
1070 }
1073#ifdef fdebug
1074 G4cout<<
"G4QDiffRatio::PrFrag:oPDG=="<<oPDG<<
",hPDG="<<hPDG<<
",M="<<reM<<
G4endl;
1075#endif
1076 G4int rlPDG=hPDG-nL*1000000-nSP*1000999-nSM*999001;
1079#ifdef fdebug
1080 G4cout<<
"G4QDiffRatio::PrFrag:*G4*nS+="<<nSP<<
",nS-="<<nSM<<
",nL="<<nL<<
G4endl;
1081#endif
1082 if(nSP||nSM)
1083 {
1084 if(nL)
1085 {
1086 G4cout<<
"***G4QDR::PFr:HypN="<<hPDG<<
": bothSigm&Lamb -> ImproveIt"<<
G4endl;
1087
1088
1089 if(nSP) nL+=nSP;
1090 else nL+=nSM;
1091 }
1092 if(nSP)
1093 {
1094 nL=nSP;
1095 sPDG=3222;
1096 MLa=mSigP;
1097 }
1098 else
1099 {
1100 nL=nSM;
1101 sPDG=3112;
1102 MLa=mSigM;
1103 }
1104 }
1105#ifdef fdebug
1106 G4cout<<
"G4QDiffRat::ProjFrag:*G4*mS="<<MLa<<
",sPDG="<<sPDG<<
",nL="<<nL<<
G4endl;
1107#endif
1108 if(nL>1) MLa*=nL;
1111 {
1112 sPDG=3212;
1113 MLa=mSigZ;
1114 }
1115 G4int rnPDG = hPDG-nL*999999;
1118
1119 if(rlPDG==90000000)
1120 {
1121 if(nL>1) r4M=r4M/nL;
1122 for(
G4int il=0; il<nL; il++)
1123 {
1124 if(anti) sPDG=-sPDG;
1126 ResHV->push_back(theLam);
1127#ifdef fdebug
1128 sum4M+=r4M;
1129 G4cout<<
"G4QDR::ProjFrag: *additional Lambda*="<<r4M<<sPDG<<
G4endl;
1130#endif
1131 }
1132 }
1133 else if(reM>rlM+MLa-eps)
1134 {
1138 if(std::fabs(reM-sum)<eps)
1139 {
1140 n4M=r4M*(rlM/sum);
1141 h4M=r4M*(MLa/sum);
1142 }
1144 {
1145 G4cerr<<
"***G4QDF::PF:HypN,M="<<reM<<
"<A+n*L="<<sum<<
",d="<<sum-reM<<
G4endl;
1146
1147 G4Exception(
"G4QDiffractionRatio::ProjFragment()",
"HAD_CHPS_0100",
1149 }
1150#ifdef fdebug
1151 G4cout<<
"*G4QDR::PF:HypN="<<r4M<<
"->A="<<rlPDG<<n4M<<
",n*L="<<nL<<h4M<<
G4endl;
1152#endif
1154 if(anti && rlPDG==90000001) rlPDG=-2112;
1155 if(anti && rlPDG==90001000) rlPDG=-2212;
1157 if(rlPDG==90000002)
1158 {
1164 ResHV->push_back(secHadr);
1165#ifdef fdebug
1166 sum4M+=r4M;
1167 G4cout<<
"G4QDR::ProgFrag: *additional Neutron*="<<r4M<<sPDG<<
G4endl;
1168#endif
1169 }
1170 else if(rlPDG==90002000)
1171 {
1177 ResHV->push_back(secHadr);
1178#ifdef fdebug
1179 sum4M+=r4M;
1180 G4cout<<
"G4QDR::ProjFrag: *additional Proton*="<<r4M<<sPDG<<
G4endl;
1181#endif
1182 }
1183
1184#ifdef fdebug
1186#endif
1187 if(nL>1) h4M=h4M/nL;
1188 for(
G4int il=0; il<nL; il++)
1189 {
1190 if(anti) sPDG=-sPDG;
1192 ResHV->push_back(theLamb);
1193#ifdef fdebug
1194 sum4M+=r4M;
1195 G4cout<<
"G4QDR::ProjFrag: *additional Hyperon*="<<r4M<<sPDG<<
G4endl;
1196#endif
1197 }
1198 }
1199 else if(reM>rnM+mPi0-eps&&!nSP&&!nSM)
1200 {
1201 G4int nPi=
static_cast<G4int>((reM-rnM)/mPi0);
1202 if (nPi>nL) nPi=nL;
1207 if(std::fabs(reM-sum)<eps)
1208 {
1209 n4M=r4M*(rnM/sum);
1210 h4M=r4M*(npiM/sum);
1211 }
1213 {
1214 G4cerr<<
"*G4QDR::PF:HypN,M="<<reM<<
"<A+n*Pi0="<<sum<<
",d="<<sum-reM<<
G4endl;
1215
1216 G4Exception(
"G4QDiffractionRatio::ProjFragment()",
"HAD_CHPS_0101",
1218 }
1220 if(anti && rnPDG==90000001) rnPDG=-2112;
1221 if(anti && rnPDG==90001000) rnPDG=-2212;
1223#ifdef fdebug
1224 G4cout<<
"*G4QDR::PF:R="<<r4M<<
"->A="<<rnPDG<<n4M<<
",n*Pi0="<<nPi<<h4M<<
G4endl;
1225#endif
1226 if(nPi>1) h4M=h4M/nPi;
1227 for(
G4int ihn=0; ihn<nPi; ihn++)
1228 {
1230 ResHV->push_back(thePion);
1231#ifdef fdebug
1232 sum4M+=r4M;
1233 G4cout<<
"G4QDR::ProjFrag: *additional Pion*="<<r4M<<sPDG<<
G4endl;
1234#endif
1235 }
1236 if(rnPDG==90000002)
1237 {
1243 ResHV->push_back(secHadr);
1244#ifdef fdebug
1245 sum4M+=r4M;
1246 G4cout<<
"G4QDR::ProjFrag: *additional Neutron*="<<r4M<<sPDG<<
G4endl;
1247#endif
1248 }
1249 else if(rnPDG==90002000)
1250 {
1256 ResHV->push_back(secHadr);
1257#ifdef fdebug
1258 sum4M+=r4M;
1259 G4cout<<
"G4QDR::ProjFrag: *additional Proton*="<<r4M<<sPDG<<
G4endl;
1260#endif
1261 }
1262
1263 }
1264 else
1265 {
1267 G4cerr<<
"G4QDR::PF:R="<<rlM<<
",S+="<<nSP<<
",S-="<<nSM<<
",L="<<nL<<
",d="<<d<<
G4endl;
1268 d=rnM+mPi0-reM;
1269 G4cerr<<
"G4QDR::PF:"<<oPDG<<
","<<hPDG<<
",M="<<reM<<
"<"<<rnM+mPi0<<
",d="<<d<<
G4endl;
1270
1271 G4Exception(
"G4QDiffractionRatio::ProjFragment()",
"HAD_CHPS_0102",
1273 }
1274 }
1275 ResHV->push_back(loh);
1276#ifdef debug
1279#endif
1280 }
1281 leadhs->clear();
1282 delete leadhs;
1283#ifdef debug
1284 G4cout<<
"G4QDiffractionRatio::ProjFragment: *End* Sum="<<sum4M<<
" =?= d4M="<<d4M<<
G4endl;
1285#endif
1286 return ResHV;
1287}
CLHEP::HepLorentzVector G4LorentzVector
std::vector< G4QHadron * > G4QHadronVector
G4ThreeVector G4RandomDirection()
G4LorentzVector Get4Momentum() const
G4int GetBaryonNumber() const
G4bool DecayIn2(G4LorentzVector &f4Mom, G4LorentzVector &s4Mom)
void SetQPDG(const G4QPDGCode &QPDG)
void Set4Momentum(const G4LorentzVector &aMom)
G4int GetStrangeness() const
G4QContent GetQuarkContent() const
G4QHadronVector * Fragment(G4QNucleus &nucEnviron, G4int nQ=1)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription