if (eRecoMode==1 && distZ>10) continue; in this reco mode we loop only over segment2 , since InBT and vtx are correlated!!!
1752{
1762
1763 Log(3,
"EdbShowerAlg_GS::FindPairs",
"Starting FindPairs(InBT,eAli_Sub) now....");
1764
1767 Int_t RecoShowerArrayN=0;
1768
1773
1776 Float_t x_av,y_av,z_av,tx_av,ty_av,distZ;
1778 Float_t IP_Pair_To_InBT=0;
1779 Float_t IP_Pair_To_InBT_Seg=0;
1780 Float_t IP_Pair_To_InBT_Seg2=0;
1781 Float_t IP_Pair_To_InBT_SegSum=0;
1782 Float_t IP_Pair_To_InBT_SegSmaller=0;
1783 Float_t IP_InBT_To_Vtx=0;
1784 Float_t IP_Seg1_To_Vtx=0;
1785 Float_t IP_Seg2_To_Vtx=0;
1786
1787 Int_t NPairTriesTotal=0;
1788 Double_t paramsAC[6];
1789 Double_t paramsB[4];
1790
1791
1793 if (
NULL==InitiatorBT) {
1796 InBT->
SetX(pat->
X());
1797 InBT->
SetY(pat->
Y());
1798 InBT->
SetZ(pat->
Z());
1801 InBT->
SetMC(-999,-999);
1802 cout << "WARNING EdbShowerAlg_GS::FindPairs InBT==NULL. Created a dummy InBT:" << endl;
1804 }
1805 else {
1806 InBT=InitiatorBT;
1807 }
1808
1809
1812
1813
1814
1815
1816
1817
1819 if (
gEDBDEBUGLEVEL>2) cout <<
"EdbShowerAlg_GS::FindPairs eRecoMode==1: Propagate InBT half a plate back for the vertex." << endl;
1820 vtx->
SetXYZ(InBT->
X()-650*InBT->
TX(),InBT->
Y()-650*InBT->
TY(),InBT->
Z()-650);
1821 }
1822 else {
1823 if (
gEDBDEBUGLEVEL>2) cout <<
"EdbShowerAlg_GS::FindPairs eRecoMode==0: Take InBT position for the vertex." << endl;
1824
1825 vtx->
SetXYZ(InBT->
X(),InBT->
Y(),InBT->
Z());
1826 }
1827
1828 IP_InBT_To_Vtx=
CalcIP(InBT,vtx);
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1846 Int_t pat_one_bt_cnt_max,pat_two_bt_cnt_max=0;
1849
1850
1851
1852 for (Int_t pat_one_cnt=0; pat_one_cnt<
npat; ++pat_one_cnt) {
1855
1856
1857 distZ=pat_one->
Z()-InBT->
Z();
1859 cout << "EdbShowerAlg_GS::FindPairs Check if dist Z to vtx (BT) is ok: distZ=" << distZ << endl;
1860 }
1862 if (distZ<-1000) continue;
1863
1866
1867 if (
gEDBDEBUGLEVEL>2) cout <<
"EdbShowerAlg_GS::FindPairs pat_one_cnt=" << pat_one_cnt <<
" pat_one->Z() = " << pat_one->
Z() <<
" pat_one_bt_cnt_max= "<< pat_one_bt_cnt_max <<endl;
1868
1869
1870
1871 for (Int_t pat_two_cnt=0; pat_two_cnt<
npat; ++pat_two_cnt) {
1872
1873
1874 if (TMath::Abs(pat_one_cnt-pat_two_cnt)>
eParaValue[5])
continue;
1875
1878
1879 distZ=pat_two->
Z()-InBT->
Z();
1881 if (distZ<-1000) continue;
1882
1883 if (
gEDBDEBUGLEVEL>2) cout <<
"EdbShowerAlg_GS::FindPairs pat_two_cnt=" << pat_two_cnt <<
" pat_two->Z() = " << pat_two->
Z() <<
" pat_two_bt_cnt_max= "<< pat_two_bt_cnt_max <<endl;
1884
1885
1886
1887 for (Int_t pat_one_bt_cnt=0; pat_one_bt_cnt<pat_one_bt_cnt_max; ++pat_one_bt_cnt) {
1889
1890 IP_Pair_To_InBT_Seg =
CalcIP(Segment,vtx);
1891 IP_Pair_To_InBT=IP_Pair_To_InBT_Seg;
1892 IP_Seg1_To_Vtx =
CalcIP(Segment,vtx);
1893
1894
1896
1897
1898
1899 for (Int_t pat_two_bt_cnt=0; pat_two_bt_cnt<pat_two_bt_cnt_max; ++pat_two_bt_cnt) {
1901
1902
1903 ++NPairTriesTotal;
1904
1905 if (Segment2==Segment) continue;
1906 if (Segment2->
ID()==Segment->
ID()&&Segment2->
PID()==Segment->
PID())
continue;
1907
1908
1909
1913
1914
1915
1918 if ((Segment2->
Flag()+Segment->
Flag())!=0)
continue;
1919
1920
1922
1924
1926
1927
1928 distZ=Segment->
Z()-InBT->
Z();
1930
1931
1933
1934
1935
1936 TObjArray *segments = new TObjArray(2);
1937 segments->Add(Segment);
1938 segments->Add(Segment2);
1940 if (vetex ->
Z()> TMath::Min(Segment->
Z(),Segment2->
Z()) )
continue;
1941
1942
1943 x_av=Segment2->
X()+(Segment->
X()-Segment2->
X())/2.0;
1944 y_av=Segment2->
Y()+(Segment->
Y()-Segment2->
Y())/2.0;
1945 z_av=Segment2->
Z()+(Segment->
Z()-Segment2->
Z())/2.0;
1946 tx_av=Segment2->
TX()+(Segment->
TX()-Segment2->
TX())/2.0;
1947 ty_av=Segment2->
TY()+(Segment->
TY()-Segment2->
TY())/2.0;
1948 Segment_Sum->
SetX(x_av);
1949 Segment_Sum->
SetY(y_av);
1950 Segment_Sum->
SetTX(tx_av);
1951 Segment_Sum->
SetTY(ty_av);
1952 Segment_Sum->
SetZ(z_av);
1953
1954
1955 IP_Pair_To_InBT_Seg2 =
CalcIP(Segment2,vtx);
1956 if (IP_Pair_To_InBT_Seg2>
eParaValue[0])
continue;
1957
1958 IP_Seg2_To_Vtx =
CalcIP(Segment2,vtx);
1959 IP_Pair_To_InBT_SegSum=
CalcIP(Segment_Sum, vtx);
1960
1961 Float_t IP_Seg1ToVtxSeg1Seg2=0;
1962 Float_t IP_Seg2ToVtxSeg1Seg2=0;
1963 IP_Seg1ToVtxSeg1Seg2 =
CalcIP(Segment ,vetex);
1964 IP_Seg2ToVtxSeg1Seg2 =
CalcIP(Segment2,vetex);
1965
1967 cout << "EdbShowerAlg_GS::FindPairs IP_Pair_To_InBT_Seg = " << IP_Pair_To_InBT_Seg << endl;
1968 cout << "EdbShowerAlg_GS::FindPairs IP_Pair_To_InBT_Seg2 = " << IP_Pair_To_InBT_Seg2 << endl;
1969 cout << "EdbShowerAlg_GS::FindPairs IP_Pair_To_InBT_SegSum= " << IP_Pair_To_InBT_SegSum << endl;
1970 cout << "EdbShowerAlg_GS::FindPairs IP_Seg1ToVtxSeg1Seg2= " << IP_Seg1ToVtxSeg1Seg2 << endl;
1971 cout << "EdbShowerAlg_GS::FindPairs IP_Seg2ToVtxSeg1Seg2= " << IP_Seg2ToVtxSeg1Seg2 << endl;
1972 }
1973
1974
1975 if ( IP_Pair_To_InBT_Seg>IP_Pair_To_InBT_Seg2 ) {
1976 IP_Pair_To_InBT_SegSmaller=0;
1977 }
1978 else {
1979 IP_Pair_To_InBT_SegSmaller=1;
1980 }
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1994
1995
1996
1997 if (Segment2->
Flag()+Segment->
Flag()==0&&TMath::Abs(Segment2->
Flag())==11&&Segment->
MCEvt()>0) {
1999 }
2000 else if (Segment2->
Flag()+Segment->
Flag()!=0&&TMath::Abs(Segment2->
Flag())==11&&Segment->
MCEvt()>0) {
2002 }
2003 else {
2005 }
2006
2011 }
2012
2013
2019 }
2022 }
2026
2028 cout <<"------------- Print eValueGSNN ------------- " << endl;
2031 cout <<
"------------- Print eValueGSNN_var00= " <<
eValueGSNN_var00 <<
" ---- " << endl;
2032 cout <<
"------------- Print eValueGSNN_var01= " <<
eValueGSNN_var01 <<
" ---- " << endl;
2033 cout <<
"------------- Print eValueGSNN_var02= " <<
eValueGSNN_var02 <<
" ---- " << endl;
2034 cout <<
"------------- Print eValueGSNN_var03= " <<
eValueGSNN_var03 <<
" ---- " << endl;
2035 cout <<
"------------- Print eValueGSNN_var04= " <<
eValueGSNN_var04 <<
" ---- " << endl;
2036 cout <<
"------------- Print eValueGSNN_var05= " <<
eValueGSNN_var05 <<
" ---- " << endl;
2037 }
2038
2039
2040
2041
2042
2043
2044
2045
2046
2054
2055 }
2056 else {
2060
2061
2064 }
2065
2066
2067 Double_t value=0;
2069 int nparams=6;
2071 nparams=4;
2072 cout << "EdbShowerAlg_GS::FindPairs ParamsB: ";
2073 for (int hj=0; hj<nparams; hj++) cout << " " << paramsB[hj];
2075 cout << "EdbShowerAlg_GS::FindPairs value=eANNPair->Evaluate(0,params) = ";
2076 value=
eANNPair->Evaluate(0,paramsB);
2078 cout << value << endl;
2079 cout << "EdbShowerAlg_GS::FindPairs -------- " << endl;
2080 }
2081 else {
2082 nparams=6;
2083 cout << "EdbShowerAlg_GS::FindPairs ParamsAC: ";
2084 for (int hj=0; hj<nparams; hj++) cout << " " << paramsAC[hj];
2086 cout << "EdbShowerAlg_GS::FindPairs value=eANNPair->Evaluate(0,params) = ";
2087 value=
eANNPair->Evaluate(0,paramsAC);
2089 cout << value << endl;
2090 cout << "EdbShowerAlg_GS::FindPairs -------- " << endl;
2091 }
2092 }
2093
2094
2095
2097 value=
eANNPair->Evaluate(0,paramsB);
2098 }
2099 else {
2100 value=
eANNPair->Evaluate(0,paramsAC);
2101 }
2102
2103
2105
2106
2107
2108
2109
2112
2113
2114
2116 cout << "EdbShowerAlg_GS::FindPairs This Pair has passed all cuts w.r.t to InBT:" << endl;
2117 cout << "EdbShowerAlg_GS::FindPairs IP_Pair_To_InBT = " << IP_Pair_To_InBT << endl;
2118 cout <<
"EdbShowerAlg_GS::FindPairs GetMinimumDist(Segment,Segment2) = " <<
GetMinimumDist(Segment,Segment2) << endl;
2119 cout << "EdbShowerAlg_GS::FindPairs CalcIP(Segment_Sum,InBT) = " << IP_Pair_To_InBT << endl;
2120 cout << "EdbShowerAlg_GS::FindPairs IP_Pair_To_InBT_Seg = " << IP_Pair_To_InBT_Seg << endl;
2121 cout << "EdbShowerAlg_GS::FindPairs IP_Pair_To_InBT_Seg2 = " << IP_Pair_To_InBT_Seg2 << endl;
2122 cout <<
"EdbShowerAlg_GS::FindPairs GetSpatialDist(Segment_Sum,InBT) = " <<
GetSpatialDist(Segment_Sum,InBT) << endl;
2123 cout << "EdbShowerAlg_GS::FindPairs IP_InBT_To_Vtx = " << IP_InBT_To_Vtx << endl;
2124 cout << "EdbShowerAlg_GS::FindPairs IP_Seg1_To_Vtx = " << IP_Seg1_To_Vtx << endl;
2125 cout << "EdbShowerAlg_GS::FindPairs IP_Seg2_To_Vtx = " << IP_Seg2_To_Vtx << endl;
2126 cout <<
"InBT: Print InBT: " << InBT ->
X() <<
" " << InBT ->
Y() <<
" " << InBT ->
Z() <<endl;
2127 cout <<
"Vtx: Print MC XYZ: " << vtx ->
MCEvt() <<
" " << vtx ->
X() <<
" " << vtx ->
Y() <<
" " << vtx ->
Z() <<endl;
2128 }
2129
2134
2135
2136
2138 RecoShower -> AddSegment(Segment);
2139 RecoShower -> AddSegment(Segment2);
2140
2141 RecoShower->
SetZ(TMath::Min(Segment->
Z(),Segment2->
Z()));
2142 RecoShower->
SetX(Segment_Sum->
X());
2143 RecoShower->
SetY(Segment_Sum->
Y());
2144 RecoShower->
SetTX(Segment_Sum->
TX());
2145 RecoShower->
SetTY(Segment_Sum->
TY());
2149
2150
2152 ++RecoShowerArrayN;
2153
2155 cout << "Added shower at " << RecoShower << " to reco shower array. Until now: ";
2156 cout << RecoShowerArrayN << " entries in it: Print Shower:" << endl;
2158 }
2159
2160 delete segments;
2161 }
2162 }
2163 }
2164 }
2165
2166
2168 cout << "EdbShowerAlg_GS::FindPairs For the InBT/Vtx at __" << InBT << "__, we have searched " << NPairTriesTotal << " pair combinations in the PVRec volume." << endl;
2169 cout <<
"EdbShowerAlg_GS::FindPairs For the InBT/Vtx at __" << InBT <<
"__, we have found " <<
RecoShowerArray->GetEntries() <<
" compatible pairs in the PVRec volume." << endl;
2170 }
2171
2172
2173
2174 delete vtx;
2175 delete Segment_Sum;
2176
2177 Log(3,
"EdbShowerAlg_GS::FindPairs",
"Starting FindPairs(InBT,eAli_Sub) now....done.");
2179}
Int_t npat
Definition: Xi2HatStartScript.C:33
Definition: EdbPattern.h:273
EdbPattern * GetPatternZLowestHighest(Bool_t lowestZ=kTRUE) const
Definition: EdbPattern.cxx:1816
Int_t Npatterns() const
Definition: EdbPattern.h:366
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1721
void SetPID(int pid)
Definition: EdbSegP.h:129
void SetY(Float_t y)
Definition: EdbSegP.h:178
Float_t TX() const
tangens = deltaX/deltaZ
Definition: EdbSegP.h:175
void SetTX(Float_t tx)
Definition: EdbSegP.h:179
Int_t ID() const
Definition: EdbSegP.h:147
void SetID(int id)
Definition: EdbSegP.h:128
void SetX(Float_t x)
Definition: EdbSegP.h:177
Float_t X() const
Definition: EdbSegP.h:173
void SetTY(Float_t ty)
other functions
Definition: EdbSegP.h:180
Float_t Y() const
Definition: EdbSegP.h:174
Float_t TY() const
tangens = deltaY/deltaZ
Definition: EdbSegP.h:176
Float_t Z() const
Definition: EdbPattern.h:84
Float_t Y() const
Definition: EdbPattern.h:83
Int_t GetN() const
Definition: EdbPattern.h:65
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66
Float_t X() const
Definition: EdbPattern.h:82
Bool_t CheckPairDuplications(Int_t SegPID, Int_t SegID, Int_t Seg2PID, Int_t Seg2ID, TArrayI *SegmentPIDArray, TArrayI *SegmentIDArray, TArrayI *Segment2PIDArray, TArrayI *Segment2IDArray, Int_t RecoShowerArrayN)
Definition: EdbShowerAlg.cxx:1158
Float_t eANNPairCut[3]
Definition: EdbShowerAlg.h:221
Bool_t eCutModeFull
Definition: EdbShowerAlg.h:206
Double_t GetSpatialDist(EdbSegP *s1, EdbSegP *s2)
Definition: EdbShowerAlg.cxx:633
Float_t eParaValue[10]
Definition: EdbShowerAlg.h:41
Double_t Z
Definition: tlg2couples.C:104