1656{
1657#ifdef debug
1658 G4cout<<
"G4QContent::AddParton: This="<<GetThis()<<
", pPDG="<<pPDG<<
G4endl;
1659#endif
1660 if(!pPDG || pPDG==9 || pPDG==21)
1661 {
1662#ifdef debug
1663 G4cout<<
"-Warning-G4QContent::AddParton: ImpossibleToAdd PartonWithPDG="<<pPDG<<
G4endl;
1664#endif
1665 return 0;
1666 }
1667 G4int aPDG = std::abs(pPDG);
1668 if( (aPDG>3 && aPDG<1101) || pPDG>3303)
1669 {
1670#ifdef debug
1671 G4cout<<
"-Warning-G4QContent::AddParton: Impossible Parton with PDG="<<pPDG<<
G4endl;
1672#endif
1673 return 0;
1674 }
1676 if( HBN > 1 || HBN <-1)
1677 {
1678#ifdef debug
1679 G4cout<<
"-Warning-G4QContent::AddParton: Impossible Hadron with BaryonN="<<HBN<<
G4endl;
1680#endif
1681 return 0;
1682 }
1689 if(aPDG>99)
1690 {
1691 G4int rPDG=aPDG/100;
1694#ifdef debug
1695 G4cout<<
"G4QContent::AddParton: DiQuark/AntiDiQuark, P1="<<P1<<
", P2="<<P2<<
G4endl;
1696#endif
1697 if(pPDG>0)
1698 {
1699#ifdef debug
1700 G4cout<<
"G4QContent::AddParton: DiQuark, P1="<<P1<<
", P2="<<P2<<
",HBN="<<HBN<<
G4endl;
1701#endif
1702 if (P1==3 && P2==3)
1703 {
1704 if(HBN<0 && AS>1) AS-=2;
1705 else if(!HBN && AS==1)
1706 {
1707 AS=0;
1708 ++QS;
1709 }
1710 else if(HBN || (!HBN && !AS)) return 0;
1711 }
1712 else if(P1==3 && P2==2)
1713 {
1714 if(HBN<0 && AS && AU)
1715 {
1716 --AS;
1717 --AU;
1718 }
1719 else if(!HBN && (AS || AU))
1720 {
1721 if(AS)
1722 {
1723 --AS;
1724 ++QU;
1725 }
1726 else
1727 {
1728 --AU;
1729 ++QS;
1730 }
1731 }
1732 else if(HBN || (!HBN && !AS && !AU)) return 0;
1733 }
1734 else if(P1==3 && P2==1)
1735 {
1736 if(HBN<0 && AS && AD)
1737 {
1738 --AS;
1739 --AD;
1740 }
1741 else if(!HBN && (AS || AD))
1742 {
1743 if(AS)
1744 {
1745 --AS;
1746 ++QD;
1747 }
1748 else
1749 {
1750 --AD;
1751 ++QS;
1752 }
1753 }
1754 else if(HBN || (!HBN && !AS && !AD)) return 0;
1755 }
1756 else if(P1==2 && P2==2)
1757 {
1758 if(HBN<0 && AU>1) AU-=2;
1759 else if(!HBN && AU==1)
1760 {
1761 AU=0;
1762 ++QU;
1763 }
1764 else if(HBN || (!HBN && !AU)) return 0;
1765 }
1766 else if(P1==2 && P2==1)
1767 {
1768 if(HBN<0 && AD && AU)
1769 {
1770 --AD;
1771 --AU;
1772 }
1773 else if(!HBN && (AD || AU))
1774 {
1775 if(AD)
1776 {
1777 --AD;
1778 ++QU;
1779 }
1780 else
1781 {
1782 --AU;
1783 ++QD;
1784 }
1785 }
1786 else if(HBN || (!HBN && !AU && !AD)) return 0;
1787 }
1788 else
1789 {
1790 if(HBN<0 && AD>1) AD-=2;
1791 else if(!HBN && AD==1)
1792 {
1793 AD=0;
1794 ++QD;
1795 }
1796 else if(HBN || (!HBN && !AD)) return 0;
1797 }
1798#ifdef debug
1799 G4cout<<
"G4QContent::AddParton: DQ, QC="<<QD<<
","<<QU<<
","<<QS<<
","<<AD<<
","<<AU<<
","
1801#endif
1802 if (HBN<0)
1803 {
1804 if (AD) return -1;
1805 else if(AU) return -2;
1806 else return -3;
1807 }
1808 else
1809 {
1810 if (QS)
1811 {
1812 if (QS==2) return 3303;
1813 else if(QU) return 3201;
1814 else return 3101;
1815 }
1816 else if(QU)
1817 {
1818 if (QU==2) return 2203;
1819 else return 2101;
1820 }
1821 else return 1103;
1822 }
1823 }
1824 else
1825 {
1826#ifdef debug
1827 G4cout<<
"G4QContent::AddParton: AntiDiQuark,P1="<<P1<<
",P2="<<P2<<
",B="<<HBN<<
G4endl;
1828#endif
1829 if (P1==3 && P2==3)
1830 {
1831 if(HBN>0 && QS>1) QS-=2;
1832 else if(!HBN && QS==1)
1833 {
1834 QS=0;
1835 ++AS;
1836 }
1837 else if(HBN || (!HBN && !QS)) return 0;
1838 }
1839 else if(P1==3 && P2==2)
1840 {
1841 if(HBN>0 && QS && QU)
1842 {
1843 --QS;
1844 --QU;
1845 }
1846 else if(!HBN && (QS || QU))
1847 {
1848 if(QS)
1849 {
1850 --QS;
1851 ++AU;
1852 }
1853 else
1854 {
1855 --QU;
1856 ++AS;
1857 }
1858 }
1859 else if(HBN || (!HBN && !QS && !QU)) return 0;
1860 }
1861 else if(P1==3 && P2==1)
1862 {
1863 if(HBN>0 && QS && QD)
1864 {
1865 --QS;
1866 --QD;
1867 }
1868 else if(!HBN && (QS || QD))
1869 {
1870 if(QS)
1871 {
1872 --QS;
1873 ++AD;
1874 }
1875 else
1876 {
1877 --QD;
1878 ++AS;
1879 }
1880 }
1881 else if(HBN || (!HBN && !QS && !QD)) return 0;
1882 }
1883 else if(P1==2 && P2==2)
1884 {
1885 if(HBN>0 && QU>1) QU-=2;
1886 else if(!HBN && QU==1)
1887 {
1888 QU=0;
1889 ++AU;
1890 }
1891 else if(HBN || (!HBN && !QU)) return 0;
1892 }
1893 else if(P1==2 && P2==1)
1894 {
1895 if(HBN>0 && QU && QD)
1896 {
1897 --QU;
1898 --QD;
1899 }
1900 else if(!HBN && (QU || QD))
1901 {
1902 if(QU)
1903 {
1904 --QU;
1905 ++AD;
1906 }
1907 else
1908 {
1909 --QD;
1910 ++AU;
1911 }
1912 }
1913 else if(HBN || (!HBN && !QU && !QD)) return 0;
1914 }
1915 else
1916 {
1917 if(HBN>0 && QD>1) QD-=2;
1918 else if(!HBN && QD==1)
1919 {
1920 QD=0;
1921 ++AD;
1922 }
1923 else if(HBN || (!HBN && !QD)) return 0;
1924 }
1925#ifdef debug
1926 G4cout<<
"G4QContent::AddParton:ADQ, QC="<<QD<<
","<<QU<<
","<<QS<<
","<<AD<<
","<<AU<<
","
1928#endif
1929 if (HBN>0)
1930 {
1931 if (QD) return 1;
1932 else if(QU) return 2;
1933 else return 3;
1934 }
1935 else
1936 {
1937 if (AS)
1938 {
1939 if (AS==2) return -3303;
1940 else if(AU) return -3201;
1941 else return -3101;
1942 }
1943 else if(AU)
1944 {
1945 if (AU==2) return -2203;
1946 else return -2101;
1947 }
1948 else return -1103;
1949 }
1950 }
1951 }
1952 else
1953 {
1954 if(pPDG>0)
1955 {
1956#ifdef debug
1957 G4cout<<
"G4QContent::AddParton: Quark, A="<<AD<<
","<<AU<<
","<<AS<<
",B="<<HBN<<
G4endl;
1958#endif
1959 if (aPDG==1)
1960 {
1961 if(HBN<0 && AD) AD--;
1962 else if(HBN || (!HBN && !AD)) return 0;
1963 }
1964 else if(aPDG==2)
1965 {
1966 if(HBN<0 && AU) AU--;
1967 else if(HBN || (!HBN && !AU)) return 0;
1968 }
1969 else
1970 {
1971 if(HBN<0 && AS) AS--;
1972 else if(HBN || (!HBN && !AS)) return 0;
1973 }
1974#ifdef debug
1975 G4cout<<
"G4QContent::AddParton: Q, QC="<<QD<<
","<<QU<<
","<<QS<<
","<<AD<<
","<<AU<<
","
1977#endif
1978 if (!HBN)
1979 {
1980 if (QD) return 1;
1981 else if(QU) return 2;
1982 else return 3;
1983 }
1984 else
1985 {
1986 if (AS)
1987 {
1988 if (AS==2) return -3303;
1989 else if(AU) return -3201;
1990 else return -3101;
1991 }
1992 else if(AU)
1993 {
1994 if (AU==2) return -2203;
1995 else return -2101;
1996 }
1997 else return -1103;
1998 }
1999 }
2000 else
2001 {
2002#ifdef debug
2003 G4cout<<
"G4QContent::AddParton: antiQ, Q="<<QD<<
","<<QU<<
","<<QS<<
",B="<<HBN<<
G4endl;
2004#endif
2005 if (aPDG==1)
2006 {
2007 if(HBN>0 && QD) QD--;
2008 else if(HBN || (!HBN && !QD)) return 0;
2009 }
2010 else if(aPDG==2)
2011 {
2012 if(HBN>0 && QU) QU--;
2013 else if(HBN || (!HBN && !QU)) return 0;
2014 }
2015 else
2016 {
2017 if(HBN>0 && QS) QS--;
2018 else if(HBN || (!HBN && !QS)) return 0;
2019 }
2020#ifdef debug
2021 G4cout<<
"G4QContent::AddParton: AQ, QC="<<QD<<
","<<QU<<
","<<QS<<
","<<AD<<
","<<AU<<
","
2023#endif
2024 if (!HBN)
2025 {
2026 if (AD) return -1;
2027 else if(AU) return -2;
2028 else return -3;
2029 }
2030 else
2031 {
2032 if (QS)
2033 {
2034 if (QS==2) return 3303;
2035 else if(QU) return 3201;
2036 else return 3101;
2037 }
2038 else if(QU)
2039 {
2040 if (QU==2) return 2203;
2041 else return 2101;
2042 }
2043 else return 1103;
2044 }
2045 }
2046 }
2047}
G4int GetBaryonNumber() const