| 242 |
IDCAND = icand !fitted track-candidate |
IDCAND = icand !fitted track-candidate |
| 243 |
ifail=0 !error flag in chi2 computation |
ifail=0 !error flag in chi2 computation |
| 244 |
jstep=0 !# minimization steps |
jstep=0 !# minimization steps |
| 245 |
|
iprint=0 |
| 246 |
call mini_2(jstep,ifail) |
if(DEBUG)iprint=1 |
| 247 |
|
call mini2(jstep,ifail,iprint) |
| 248 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
| 249 |
if(DEBUG)then |
if(DEBUG)then |
| 250 |
print *, |
print *, |
| 251 |
$ '*** MINIMIZATION FAILURE *** (mini_2) ' |
$ '*** MINIMIZATION FAILURE *** (mini2) ' |
| 252 |
$ ,iev |
$ ,iev |
| 253 |
endif |
endif |
| 254 |
chi2=-chi2 |
chi2=-chi2 |
| 312 |
c $ ,iimage,fimage,ntrk,image(ntrk) |
c $ ,iimage,fimage,ntrk,image(ntrk) |
| 313 |
|
|
| 314 |
if(ntrk.eq.NTRKMAX)then |
if(ntrk.eq.NTRKMAX)then |
| 315 |
if(DEBUG) |
if(verbose) |
| 316 |
$ print*, |
$ print*, |
| 317 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 318 |
$ 'tracks exceeds vector dimension ' |
$ 'tracks exceeds vector dimension ' |
| 668 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
| 669 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
| 670 |
c cog2 = cog(2,icx) |
c cog2 = cog(2,icx) |
| 671 |
c etacorr = pfa_eta2(cog2,viewx,nldx,angx) |
c etacorr = pfaeta2(cog2,viewx,nldx,angx) |
| 672 |
c stripx = stripx + etacorr |
c stripx = stripx + etacorr |
| 673 |
stripx = stripx + pfa_eta2(icx,angx) !(3) |
stripx = stripx + pfaeta2(icx,angx) !(3) |
| 674 |
resxPAM = risx_eta2(angx) ! (4) |
resxPAM = risx_eta2(angx) ! (4) |
| 675 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
| 676 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
| 677 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
| 678 |
elseif(PFAx.eq.'ETA3')then !(3) |
elseif(PFAx.eq.'ETA3')then !(3) |
| 679 |
stripx = stripx + pfa_eta3(icx,angx) !(3) |
stripx = stripx + pfaeta3(icx,angx) !(3) |
| 680 |
resxPAM = risx_eta3(angx) ! (4) |
resxPAM = risx_eta3(angx) ! (4) |
| 681 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(3,icx).ne.1) !(3) |
| 682 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx)!(3) |
| 683 |
resxPAM = resxPAM*fbad_cog(3,icx) !(3) |
resxPAM = resxPAM*fbad_cog(3,icx) !(3) |
| 684 |
elseif(PFAx.eq.'ETA4')then !(3) |
elseif(PFAx.eq.'ETA4')then !(3) |
| 685 |
stripx = stripx + pfa_eta4(icx,angx) !(3) |
stripx = stripx + pfaeta4(icx,angx) !(3) |
| 686 |
resxPAM = risx_eta4(angx) ! (4) |
resxPAM = risx_eta4(angx) ! (4) |
| 687 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(4,icx).ne.1) !(3) |
| 688 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx)!(3) |
| 689 |
resxPAM = resxPAM*fbad_cog(4,icx) !(3) |
resxPAM = resxPAM*fbad_cog(4,icx) !(3) |
| 690 |
elseif(PFAx.eq.'ETA')then !(3) |
elseif(PFAx.eq.'ETA')then !(3) |
| 691 |
stripx = stripx + pfa_eta(icx,angx) !(3) |
stripx = stripx + pfaeta(icx,angx) !(3) |
| 692 |
resxPAM = ris_eta(icx,angx) ! (4) |
resxPAM = ris_eta(icx,angx) ! (4) |
| 693 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) !(3) |
| 694 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx)!(3) |
| 732 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
| 733 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
| 734 |
c cog2 = cog(2,icy) |
c cog2 = cog(2,icy) |
| 735 |
c etacorr = pfa_eta2(cog2,viewy,nldy,angy) |
c etacorr = pfaeta2(cog2,viewy,nldy,angy) |
| 736 |
c stripy = stripy + etacorr |
c stripy = stripy + etacorr |
| 737 |
stripy = stripy + pfa_eta2(icy,angy) !(3) |
stripy = stripy + pfaeta2(icy,angy) !(3) |
| 738 |
resyPAM = risy_eta2(angy) ! (4) |
resyPAM = risy_eta2(angy) ! (4) |
| 739 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
| 740 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
| 741 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
| 742 |
elseif(PFAy.eq.'ETA3')then !(3) |
elseif(PFAy.eq.'ETA3')then !(3) |
| 743 |
stripy = stripy + pfa_eta3(icy,angy) !(3) |
stripy = stripy + pfaeta3(icy,angy) !(3) |
| 744 |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
| 745 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
| 746 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
| 747 |
elseif(PFAy.eq.'ETA4')then !(3) |
elseif(PFAy.eq.'ETA4')then !(3) |
| 748 |
stripy = stripy + pfa_eta4(icy,angy) !(3) |
stripy = stripy + pfaeta4(icy,angy) !(3) |
| 749 |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
| 750 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
| 751 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
| 752 |
elseif(PFAy.eq.'ETA')then !(3) |
elseif(PFAy.eq.'ETA')then !(3) |
| 753 |
stripy = stripy + pfa_eta(icy,angy) !(3) |
stripy = stripy + pfaeta(icy,angy) !(3) |
| 754 |
resyPAM = ris_eta(icy,angy) ! (4) |
resyPAM = ris_eta(icy,angy) ! (4) |
| 755 |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
| 756 |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
| 1676 |
* -------------- |
* -------------- |
| 1677 |
integer iflag |
integer iflag |
| 1678 |
|
|
| 1679 |
integer badseed,badcl |
integer badseed,badclx,badcly |
| 1680 |
|
|
| 1681 |
* init variables |
* init variables |
| 1682 |
ncp_tot=0 |
ncp_tot=0 |
| 1709 |
goto 10 |
goto 10 |
| 1710 |
endif |
endif |
| 1711 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1712 |
|
* cut on multiplicity (X VIEW) |
| 1713 |
|
* ---------------------------------------------------- |
| 1714 |
|
if(mult(icx).ge.mult_x_max)then |
| 1715 |
|
cl_single(icx)=0 |
| 1716 |
|
goto 10 |
| 1717 |
|
endif |
| 1718 |
|
* ---------------------------------------------------- |
| 1719 |
* cut BAD (X VIEW) |
* cut BAD (X VIEW) |
| 1720 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1721 |
badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
| 1725 |
else |
else |
| 1726 |
ilast=TOTCLLENGTH |
ilast=TOTCLLENGTH |
| 1727 |
endif |
endif |
| 1728 |
badcl=badseed |
badclx=badseed |
| 1729 |
do igood=-ngoodstr,ngoodstr |
do igood=-ngoodstr,ngoodstr |
| 1730 |
ibad=1 |
ibad=1 |
| 1731 |
if((INDMAX(icx)+igood).gt.ifirst.and. |
if((INDMAX(icx)+igood).gt.ifirst.and. |
| 1735 |
$ nvk(MAXS(icx)+igood), |
$ nvk(MAXS(icx)+igood), |
| 1736 |
$ nst(MAXS(icx)+igood)) |
$ nst(MAXS(icx)+igood)) |
| 1737 |
endif |
endif |
| 1738 |
badcl=badcl*ibad |
badclx=badclx*ibad |
| 1739 |
enddo |
enddo |
| 1740 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1741 |
* >>> eliminato il taglio sulle BAD <<< |
* >>> eliminato il taglio sulle BAD <<< |
| 1761 |
goto 20 |
goto 20 |
| 1762 |
endif |
endif |
| 1763 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1764 |
|
* cut on multiplicity (X VIEW) |
| 1765 |
|
* ---------------------------------------------------- |
| 1766 |
|
if(mult(icy).ge.mult_y_max)then |
| 1767 |
|
cl_single(icy)=0 |
| 1768 |
|
goto 20 |
| 1769 |
|
endif |
| 1770 |
|
* ---------------------------------------------------- |
| 1771 |
* cut BAD (Y VIEW) |
* cut BAD (Y VIEW) |
| 1772 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1773 |
badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
| 1777 |
else |
else |
| 1778 |
ilast=TOTCLLENGTH |
ilast=TOTCLLENGTH |
| 1779 |
endif |
endif |
| 1780 |
badcl=badseed |
badcly=badseed |
| 1781 |
do igood=-ngoodstr,ngoodstr |
do igood=-ngoodstr,ngoodstr |
| 1782 |
ibad=1 |
ibad=1 |
| 1783 |
if((INDMAX(icy)+igood).gt.ifirst.and. |
if((INDMAX(icy)+igood).gt.ifirst.and. |
| 1786 |
$ ibad=BAD(VIEW(icy), |
$ ibad=BAD(VIEW(icy), |
| 1787 |
$ nvk(MAXS(icy)+igood), |
$ nvk(MAXS(icy)+igood), |
| 1788 |
$ nst(MAXS(icy)+igood)) |
$ nst(MAXS(icy)+igood)) |
| 1789 |
badcl=badcl*ibad |
badcly=badcly*ibad |
| 1790 |
enddo |
enddo |
| 1791 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1792 |
* >>> eliminato il taglio sulle BAD <<< |
* >>> eliminato il taglio sulle BAD <<< |
| 1812 |
* ------------------------------------------------------------- |
* ------------------------------------------------------------- |
| 1813 |
* >>> eliminata (TEMPORANEAMENTE) la correlazione di carica <<< |
* >>> eliminata (TEMPORANEAMENTE) la correlazione di carica <<< |
| 1814 |
* ------------------------------------------------------------- |
* ------------------------------------------------------------- |
| 1815 |
c$$$ if(dedx(icy).lt.chsaty.or.dedx(icx).lt.chsatx)then |
if( .not.(dedx(icy).gt.chsaty.and.dedx(icx).gt.chsatx) |
| 1816 |
c$$$ ddd=(dedx(icy) |
$ .and. |
| 1817 |
c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
$ .not.(dedx(icy).lt.chmipy.and.dedx(icx).lt.chmipx) |
| 1818 |
c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
$ .and. |
| 1819 |
c$$$ cut=chcut*sch(nplx,nldx) |
$ (badclx.eq.1.and.badcly.eq.1) |
| 1820 |
c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
$ .and. |
| 1821 |
c$$$ endif |
$ .true.)then |
| 1822 |
|
|
| 1823 |
|
ddd=(dedx(icy) |
| 1824 |
|
$ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
| 1825 |
|
ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
| 1826 |
|
|
| 1827 |
|
c cut = chcut * sch(nplx,nldx) |
| 1828 |
|
|
| 1829 |
|
sss=(kch(nplx,nldx)*dedx(icy)+dedx(icx) |
| 1830 |
|
$ -kch(nplx,nldx)*cch(nplx,nldx)) |
| 1831 |
|
sss=sss/sqrt(kch(nplx,nldx)**2+1) |
| 1832 |
|
cut = chcut * (16 + sss/50.) |
| 1833 |
|
|
| 1834 |
|
if(abs(ddd).gt.cut)then |
| 1835 |
|
goto 20 !charge not consistent |
| 1836 |
|
endif |
| 1837 |
|
endif |
| 1838 |
|
|
| 1839 |
* ------------------> COUPLE <------------------ |
* ------------------> COUPLE <------------------ |
| 1840 |
* check to do not overflow vector dimentions |
* check to do not overflow vector dimentions |
| 1841 |
if(ncp_plane(nplx).gt.ncouplemax)then |
c$$$ if(ncp_plane(nplx).gt.ncouplemax)then |
|
if(DEBUG)print*, |
|
|
$ ' ** warning ** number of identified'// |
|
|
$ ' couples on plane ',nplx, |
|
|
$ ' exceeds vector dimention'// |
|
|
$ ' ( ',ncouplemax,' )' |
|
|
c good2=.false. |
|
|
c goto 880 !fill ntp and go to next event |
|
|
iflag=1 |
|
|
return |
|
|
endif |
|
|
|
|
|
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
|
| 1842 |
c$$$ if(DEBUG)print*, |
c$$$ if(DEBUG)print*, |
| 1843 |
c$$$ $ '** warning ** number of identified '// |
c$$$ $ ' ** warning ** number of identified'// |
| 1844 |
c$$$ $ 'couples on plane ',nplx, |
c$$$ $ ' couples on plane ',nplx, |
| 1845 |
c$$$ $ 'exceeds vector dimention ' |
c$$$ $ ' exceeds vector dimention'// |
| 1846 |
c$$$ $ ,'( ',ncouplemax,' )' |
c$$$ $ ' ( ',ncouplemax,' )' |
| 1847 |
c$$$c good2=.false. |
c$$$c good2=.false. |
| 1848 |
c$$$c goto 880 !fill ntp and go to next event |
c$$$c goto 880 !fill ntp and go to next event |
| 1849 |
c$$$ iflag=1 |
c$$$ iflag=1 |
| 1850 |
c$$$ return |
c$$$ return |
| 1851 |
c$$$ endif |
c$$$ endif |
| 1852 |
|
|
| 1853 |
|
if(ncp_plane(nplx).eq.ncouplemax)then |
| 1854 |
|
if(verbose)print*, |
| 1855 |
|
$ '** warning ** number of identified '// |
| 1856 |
|
$ 'couples on plane ',nplx, |
| 1857 |
|
$ 'exceeds vector dimention ' |
| 1858 |
|
$ ,'( ',ncouplemax,' )' |
| 1859 |
|
c good2=.false. |
| 1860 |
|
c goto 880 !fill ntp and go to next event |
| 1861 |
|
iflag=1 |
| 1862 |
|
return |
| 1863 |
|
endif |
| 1864 |
|
|
| 1865 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
| 1866 |
clx(nplx,ncp_plane(nplx))=icx |
clx(nplx,ncp_plane(nplx))=icx |
| 1867 |
cly(nply,ncp_plane(nplx))=icy |
cly(nply,ncp_plane(nplx))=icy |
| 1899 |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
| 1900 |
|
|
| 1901 |
if(ncp_tot.gt.ncp_max)then |
if(ncp_tot.gt.ncp_max)then |
| 1902 |
if(DEBUG)print*, |
if(verbose)print*, |
| 1903 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 1904 |
$ 'couples exceeds upper limit for Hough tr. ' |
$ 'couples exceeds upper limit for Hough tr. ' |
| 1905 |
$ ,'( ',ncp_max,' )' |
$ ,'( ',ncp_max,' )' |
| 2058 |
|
|
| 2059 |
* ------------------> COUPLE <------------------ |
* ------------------> COUPLE <------------------ |
| 2060 |
* check to do not overflow vector dimentions |
* check to do not overflow vector dimentions |
| 2061 |
if(ncp_plane(nplx).gt.ncouplemax)then |
c$$$ if(ncp_plane(nplx).gt.ncouplemax)then |
|
if(DEBUG)print*, |
|
|
$ ' ** warning ** number of identified'// |
|
|
$ ' couples on plane ',nplx, |
|
|
$ ' exceeds vector dimention'// |
|
|
$ ' ( ',ncouplemax,' )' |
|
|
c good2=.false. |
|
|
c goto 880 !fill ntp and go to next event |
|
|
iflag=1 |
|
|
return |
|
|
endif |
|
|
|
|
|
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
|
| 2062 |
c$$$ if(DEBUG)print*, |
c$$$ if(DEBUG)print*, |
| 2063 |
c$$$ $ '** warning ** number of identified '// |
c$$$ $ ' ** warning ** number of identified'// |
| 2064 |
c$$$ $ 'couples on plane ',nplx, |
c$$$ $ ' couples on plane ',nplx, |
| 2065 |
c$$$ $ 'exceeds vector dimention ' |
c$$$ $ ' exceeds vector dimention'// |
| 2066 |
c$$$ $ ,'( ',ncouplemax,' )' |
c$$$ $ ' ( ',ncouplemax,' )' |
| 2067 |
c$$$c good2=.false. |
c$$$c good2=.false. |
| 2068 |
c$$$c goto 880 !fill ntp and go to next event |
c$$$c goto 880 !fill ntp and go to next event |
| 2069 |
c$$$ iflag=1 |
c$$$ iflag=1 |
| 2070 |
c$$$ return |
c$$$ return |
| 2071 |
c$$$ endif |
c$$$ endif |
| 2072 |
|
|
| 2073 |
|
if(ncp_plane(nplx).eq.ncouplemax)then |
| 2074 |
|
if(verbose)print*, |
| 2075 |
|
$ '** warning ** number of identified '// |
| 2076 |
|
$ 'couples on plane ',nplx, |
| 2077 |
|
$ 'exceeds vector dimention ' |
| 2078 |
|
$ ,'( ',ncouplemax,' )' |
| 2079 |
|
c good2=.false. |
| 2080 |
|
c goto 880 !fill ntp and go to next event |
| 2081 |
|
iflag=1 |
| 2082 |
|
return |
| 2083 |
|
endif |
| 2084 |
|
|
| 2085 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
| 2086 |
clx(nplx,ncp_plane(nplx))=icx |
clx(nplx,ncp_plane(nplx))=icx |
| 2087 |
cly(nply,ncp_plane(nplx))=icy |
cly(nply,ncp_plane(nplx))=icy |
| 2119 |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
| 2120 |
|
|
| 2121 |
if(ncp_tot.gt.ncp_max)then |
if(ncp_tot.gt.ncp_max)then |
| 2122 |
if(DEBUG)print*, |
if(verbose)print*, |
| 2123 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2124 |
$ 'couples exceeds upper limit for Hough tr. ' |
$ 'couples exceeds upper limit for Hough tr. ' |
| 2125 |
$ ,'( ',ncp_max,' )' |
$ ,'( ',ncp_max,' )' |
| 2132 |
return |
return |
| 2133 |
end |
end |
| 2134 |
|
|
|
c$$$ subroutine cl_to_couples_2(iflag) |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'common_momanhough.f' |
|
|
c$$$ include 'momanhough_init.f' |
|
|
c$$$ include 'calib.f' |
|
|
c$$$ include 'level1.f' |
|
|
c$$$ |
|
|
c$$$ logical DEBUG |
|
|
c$$$ common/dbg/DEBUG |
|
|
c$$$ |
|
|
c$$$* output flag |
|
|
c$$$* -------------- |
|
|
c$$$* 0 = good event |
|
|
c$$$* 1 = bad event |
|
|
c$$$* -------------- |
|
|
c$$$ integer iflag |
|
|
c$$$ |
|
|
c$$$ integer badseed,badcl |
|
|
c$$$ |
|
|
c$$$* init variables |
|
|
c$$$ ncp_tot=0 |
|
|
c$$$ do ip=1,nplanes |
|
|
c$$$ do ico=1,ncouplemax |
|
|
c$$$ clx(ip,ico)=0 |
|
|
c$$$ cly(ip,ico)=0 |
|
|
c$$$ enddo |
|
|
c$$$ ncp_plane(ip)=0 |
|
|
c$$$ do icl=1,nclstrmax_level2 |
|
|
c$$$ cls(ip,icl)=1 |
|
|
c$$$ enddo |
|
|
c$$$ ncls(ip)=0 |
|
|
c$$$ enddo |
|
|
c$$$ do icl=1,nclstrmax_level2 |
|
|
c$$$ cl_single(icl)=1 |
|
|
c$$$ cl_good(icl)=0 |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$* start association |
|
|
c$$$ ncouples=0 |
|
|
c$$$ do icx=1,nclstr1 !loop on cluster (X) |
|
|
c$$$ if(mod(VIEW(icx),2).eq.1)goto 10 |
|
|
c$$$ |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$* cut on charge (X VIEW) |
|
|
c$$$ if(dedx(icx).lt.dedx_x_min)then |
|
|
c$$$ cl_single(icx)=0 |
|
|
c$$$ goto 10 |
|
|
c$$$ endif |
|
|
c$$$* cut BAD (X VIEW) |
|
|
c$$$ badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
|
|
c$$$ ifirst=INDSTART(icx) |
|
|
c$$$ if(icx.ne.nclstr1) then |
|
|
c$$$ ilast=INDSTART(icx+1)-1 |
|
|
c$$$ else |
|
|
c$$$ ilast=TOTCLLENGTH |
|
|
c$$$ endif |
|
|
c$$$ badcl=badseed |
|
|
c$$$ do igood=-ngoodstr,ngoodstr |
|
|
c$$$ ibad=1 |
|
|
c$$$ if((INDMAX(icx)+igood).gt.ifirst.and. |
|
|
c$$$ $ (INDMAX(icx)+igood).lt.ilast.and. |
|
|
c$$$ $ .true.)then |
|
|
c$$$ ibad=BAD(VIEW(icx), |
|
|
c$$$ $ nvk(MAXS(icx)+igood), |
|
|
c$$$ $ nst(MAXS(icx)+igood)) |
|
|
c$$$ endif |
|
|
c$$$ badcl=badcl*ibad |
|
|
c$$$ enddo |
|
|
c$$$* print*,'icx ',icx,badcl |
|
|
c$$$ if(badcl.eq.0)then |
|
|
c$$$ cl_single(icx)=0 |
|
|
c$$$ goto 10 |
|
|
c$$$ endif |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ cl_good(icx)=1 |
|
|
c$$$ nplx=npl(VIEW(icx)) |
|
|
c$$$ nldx=nld(MAXS(icx),VIEW(icx)) |
|
|
c$$$ |
|
|
c$$$ do icy=1,nclstr1 !loop on cluster (Y) |
|
|
c$$$ if(mod(VIEW(icy),2).eq.0)goto 20 |
|
|
c$$$ |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$* cut on charge (Y VIEW) |
|
|
c$$$ if(dedx(icy).lt.dedx_y_min)then |
|
|
c$$$ cl_single(icy)=0 |
|
|
c$$$ goto 20 |
|
|
c$$$ endif |
|
|
c$$$* cut BAD (Y VIEW) |
|
|
c$$$ badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
|
|
c$$$ ifirst=INDSTART(icy) |
|
|
c$$$ if(icy.ne.nclstr1) then |
|
|
c$$$ ilast=INDSTART(icy+1)-1 |
|
|
c$$$ else |
|
|
c$$$ ilast=TOTCLLENGTH |
|
|
c$$$ endif |
|
|
c$$$ badcl=badseed |
|
|
c$$$ do igood=-ngoodstr,ngoodstr |
|
|
c$$$ ibad=1 |
|
|
c$$$ if((INDMAX(icy)+igood).gt.ifirst.and. |
|
|
c$$$ $ (INDMAX(icy)+igood).lt.ilast.and. |
|
|
c$$$ $ .true.) |
|
|
c$$$ $ ibad=BAD(VIEW(icy), |
|
|
c$$$ $ nvk(MAXS(icy)+igood), |
|
|
c$$$ $ nst(MAXS(icy)+igood)) |
|
|
c$$$ badcl=badcl*ibad |
|
|
c$$$ enddo |
|
|
c$$$* print*,'icy ',icy,badcl |
|
|
c$$$ if(badcl.eq.0)then |
|
|
c$$$ cl_single(icy)=0 |
|
|
c$$$ goto 20 |
|
|
c$$$ endif |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ cl_good(icy)=1 |
|
|
c$$$ nply=npl(VIEW(icy)) |
|
|
c$$$ nldy=nld(MAXS(icy),VIEW(icy)) |
|
|
c$$$ |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* CONDITION TO FORM A COUPLE |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* geometrical consistency (same plane and ladder) |
|
|
c$$$ if(nply.eq.nplx.and.nldy.eq.nldx)then |
|
|
c$$$ |
|
|
c$$$c$$$* charge correlation |
|
|
c$$$c$$$ ddd=(dedx(icy) |
|
|
c$$$c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
|
|
c$$$c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
|
|
c$$$c$$$ cut=chcut*sch(nplx,nldx) |
|
|
c$$$c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
|
|
c$$$ |
|
|
c$$$* ------------------> COUPLE <------------------ |
|
|
c$$$* check to do not overflow vector dimentions |
|
|
c$$$ if(ncp_plane(nplx).gt.ncouplemax)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ ' ** warning ** number of identified'// |
|
|
c$$$ $ ' couples on plane ',nplx, |
|
|
c$$$ $ ' exceeds vector dimention'// |
|
|
c$$$ $ ' ( ',ncouplemax,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ '** warning ** number of identified '// |
|
|
c$$$ $ 'couples on plane ',nplx, |
|
|
c$$$ $ 'exceeds vector dimention ' |
|
|
c$$$ $ ,'( ',ncouplemax,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ ncp_plane(nplx) = ncp_plane(nplx) + 1 |
|
|
c$$$ clx(nplx,ncp_plane(nplx))=icx |
|
|
c$$$ cly(nply,ncp_plane(nplx))=icy |
|
|
c$$$ cl_single(icx)=0 |
|
|
c$$$ cl_single(icy)=0 |
|
|
c$$$c print*,'couple ',nplx,ncp_plane(nplx),' --- ',icx,icy |
|
|
c$$$ endif |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ 20 continue |
|
|
c$$$ enddo !end loop on clusters(Y) |
|
|
c$$$ |
|
|
c$$$ 10 continue |
|
|
c$$$ enddo !end loop on clusters(X) |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ do icl=1,nclstr1 |
|
|
c$$$ if(cl_single(icl).eq.1)then |
|
|
c$$$ ip=npl(VIEW(icl)) |
|
|
c$$$ ncls(ip)=ncls(ip)+1 |
|
|
c$$$ cls(ip,ncls(ip))=icl |
|
|
c$$$ endif |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ if(DEBUG)then |
|
|
c$$$ print*,'clusters ',nclstr1 |
|
|
c$$$ print*,'good ',(cl_good(i),i=1,nclstr1) |
|
|
c$$$ print*,'singles ',(cl_single(i),i=1,nclstr1) |
|
|
c$$$ print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ do ip=1,6 |
|
|
c$$$ ncp_tot=ncp_tot+ncp_plane(ip) |
|
|
c$$$ enddo |
|
|
c$$$c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
|
|
c$$$ |
|
|
c$$$ if(ncp_tot.gt.ncp_max)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ '** warning ** number of identified '// |
|
|
c$$$ $ 'couples exceeds upper limit for Hough tr. ' |
|
|
c$$$ $ ,'( ',ncp_max,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
| 2135 |
|
|
| 2136 |
*************************************************** |
*************************************************** |
| 2137 |
* * |
* * |
| 2224 |
* (2 couples needed) |
* (2 couples needed) |
| 2225 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2226 |
if(ndblt.eq.ndblt_max)then |
if(ndblt.eq.ndblt_max)then |
| 2227 |
if(DEBUG)print*, |
if(verbose)print*, |
| 2228 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2229 |
$ 'doublets exceeds vector dimention ' |
$ 'doublets exceeds vector dimention ' |
| 2230 |
$ ,'( ',ndblt_max,' )' |
$ ,'( ',ndblt_max,' )' |
| 2294 |
* (3 couples needed) |
* (3 couples needed) |
| 2295 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 2296 |
if(ntrpt.eq.ntrpt_max)then |
if(ntrpt.eq.ntrpt_max)then |
| 2297 |
if(DEBUG)print*, |
if(verbose)print*, |
| 2298 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2299 |
$ 'triplets exceeds vector dimention ' |
$ 'triplets exceeds vector dimention ' |
| 2300 |
$ ,'( ',ntrpt_max,' )' |
$ ,'( ',ntrpt_max,' )' |
| 2521 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
| 2522 |
|
|
| 2523 |
if(nclouds_yz.ge.ncloyz_max)then |
if(nclouds_yz.ge.ncloyz_max)then |
| 2524 |
if(DEBUG)print*, |
if(verbose)print*, |
| 2525 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2526 |
$ 'YZ clouds exceeds vector dimention ' |
$ 'YZ clouds exceeds vector dimention ' |
| 2527 |
$ ,'( ',ncloyz_max,' )' |
$ ,'( ',ncloyz_max,' )' |
| 2733 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
| 2734 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
| 2735 |
if(nclouds_xz.ge.ncloxz_max)then |
if(nclouds_xz.ge.ncloxz_max)then |
| 2736 |
if(DEBUG)print*, |
if(verbose)print*, |
| 2737 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
| 2738 |
$ 'XZ clouds exceeds vector dimention ' |
$ 'XZ clouds exceeds vector dimention ' |
| 2739 |
$ ,'( ',ncloxz_max,' )' |
$ ,'( ',ncloxz_max,' )' |
| 3013 |
enddo |
enddo |
| 3014 |
ifail=0 !error flag in chi^2 computation |
ifail=0 !error flag in chi^2 computation |
| 3015 |
jstep=0 !number of minimization steps |
jstep=0 !number of minimization steps |
| 3016 |
call mini_2(jstep,ifail) |
iprint=0 |
| 3017 |
|
if(DEBUG)iprint=1 |
| 3018 |
|
call mini2(jstep,ifail,iprint) |
| 3019 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
| 3020 |
if(DEBUG)then |
if(DEBUG)then |
| 3021 |
print *, |
print *, |
| 3022 |
$ '*** MINIMIZATION FAILURE *** ' |
$ '*** MINIMIZATION FAILURE *** ' |
| 3023 |
$ //'(mini_2 in clouds_to_ctrack)' |
$ //'(mini2 in clouds_to_ctrack)' |
| 3024 |
endif |
endif |
| 3025 |
chi2=-chi2 |
chi2=-chi2 |
| 3026 |
endif |
endif |
| 3035 |
* -------------------------- |
* -------------------------- |
| 3036 |
if(ntracks.eq.NTRACKSMAX)then |
if(ntracks.eq.NTRACKSMAX)then |
| 3037 |
|
|
| 3038 |
if(DEBUG)print*, |
if(verbose)print*, |
| 3039 |
$ '** warning ** number of candidate tracks '// |
$ '** warning ** number of candidate tracks '// |
| 3040 |
$ ' exceeds vector dimension ' |
$ ' exceeds vector dimension ' |
| 3041 |
$ ,'( ',NTRACKSMAX,' )' |
$ ,'( ',NTRACKSMAX,' )' |
| 3769 |
|
|
| 3770 |
c good2=1!.true. |
c good2=1!.true. |
| 3771 |
chi2_nt(ntr) = sngl(chi2) |
chi2_nt(ntr) = sngl(chi2) |
| 3772 |
nstep_nt(ntr) = 0!nstep |
nstep_nt(ntr) = nstep |
| 3773 |
|
|
| 3774 |
phi = al(4) !(4) |
phi = al(4) !(4) |
| 3775 |
sinth = al(3) !(4) |
sinth = al(3) !(4) |