| 1675 |
* -------------- |
* -------------- |
| 1676 |
integer iflag |
integer iflag |
| 1677 |
|
|
| 1678 |
integer badseed,badcl |
integer badseed,badclx,badcly |
| 1679 |
|
|
| 1680 |
* init variables |
* init variables |
| 1681 |
ncp_tot=0 |
ncp_tot=0 |
| 1717 |
else |
else |
| 1718 |
ilast=TOTCLLENGTH |
ilast=TOTCLLENGTH |
| 1719 |
endif |
endif |
| 1720 |
badcl=badseed |
badclx=badseed |
| 1721 |
do igood=-ngoodstr,ngoodstr |
do igood=-ngoodstr,ngoodstr |
| 1722 |
ibad=1 |
ibad=1 |
| 1723 |
if((INDMAX(icx)+igood).gt.ifirst.and. |
if((INDMAX(icx)+igood).gt.ifirst.and. |
| 1727 |
$ nvk(MAXS(icx)+igood), |
$ nvk(MAXS(icx)+igood), |
| 1728 |
$ nst(MAXS(icx)+igood)) |
$ nst(MAXS(icx)+igood)) |
| 1729 |
endif |
endif |
| 1730 |
badcl=badcl*ibad |
badclx=badclx*ibad |
| 1731 |
enddo |
enddo |
| 1732 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1733 |
* >>> eliminato il taglio sulle BAD <<< |
* >>> eliminato il taglio sulle BAD <<< |
| 1762 |
else |
else |
| 1763 |
ilast=TOTCLLENGTH |
ilast=TOTCLLENGTH |
| 1764 |
endif |
endif |
| 1765 |
badcl=badseed |
badcly=badseed |
| 1766 |
do igood=-ngoodstr,ngoodstr |
do igood=-ngoodstr,ngoodstr |
| 1767 |
ibad=1 |
ibad=1 |
| 1768 |
if((INDMAX(icy)+igood).gt.ifirst.and. |
if((INDMAX(icy)+igood).gt.ifirst.and. |
| 1771 |
$ ibad=BAD(VIEW(icy), |
$ ibad=BAD(VIEW(icy), |
| 1772 |
$ nvk(MAXS(icy)+igood), |
$ nvk(MAXS(icy)+igood), |
| 1773 |
$ nst(MAXS(icy)+igood)) |
$ nst(MAXS(icy)+igood)) |
| 1774 |
badcl=badcl*ibad |
badcly=badcly*ibad |
| 1775 |
enddo |
enddo |
| 1776 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
| 1777 |
* >>> eliminato il taglio sulle BAD <<< |
* >>> eliminato il taglio sulle BAD <<< |
| 1797 |
* ------------------------------------------------------------- |
* ------------------------------------------------------------- |
| 1798 |
* >>> eliminata (TEMPORANEAMENTE) la correlazione di carica <<< |
* >>> eliminata (TEMPORANEAMENTE) la correlazione di carica <<< |
| 1799 |
* ------------------------------------------------------------- |
* ------------------------------------------------------------- |
| 1800 |
c$$$ if(dedx(icy).lt.chsaty.or.dedx(icx).lt.chsatx)then |
if( .not.(dedx(icy).gt.chsaty.and.dedx(icx).gt.chsatx) |
| 1801 |
c$$$ ddd=(dedx(icy) |
$ .and. |
| 1802 |
c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
$ .not.(dedx(icy).lt.chmipy.and.dedx(icx).lt.chmipx) |
| 1803 |
c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
$ .and. |
| 1804 |
c$$$ cut=chcut*sch(nplx,nldx) |
$ (badclx.eq.1.and.badcly.eq.1) |
| 1805 |
c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
$ .and. |
| 1806 |
c$$$ endif |
$ .true.)then |
| 1807 |
|
|
| 1808 |
|
ddd=(dedx(icy) |
| 1809 |
|
$ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
| 1810 |
|
ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
| 1811 |
|
|
| 1812 |
|
c cut = chcut * sch(nplx,nldx) |
| 1813 |
|
|
| 1814 |
|
sss=(kch(nplx,nldx)*dedx(icy)+dedx(icx) |
| 1815 |
|
$ -kch(nplx,nldx)*cch(nplx,nldx)) |
| 1816 |
|
sss=sss/sqrt(kch(nplx,nldx)**2+1) |
| 1817 |
|
cut = chcut * (16 + sss/50.) |
| 1818 |
|
|
| 1819 |
|
if(abs(ddd).gt.cut)then |
| 1820 |
|
goto 20 !charge not consistent |
| 1821 |
|
endif |
| 1822 |
|
endif |
| 1823 |
|
|
| 1824 |
* ------------------> COUPLE <------------------ |
* ------------------> COUPLE <------------------ |
| 1825 |
* check to do not overflow vector dimentions |
* check to do not overflow vector dimentions |
| 2117 |
return |
return |
| 2118 |
end |
end |
| 2119 |
|
|
|
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 |
|
| 2120 |
|
|
| 2121 |
*************************************************** |
*************************************************** |
| 2122 |
* * |
* * |