667 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
668 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
669 |
c cog2 = cog(2,icx) |
c cog2 = cog(2,icx) |
670 |
c etacorr = pfa_eta2(cog2,viewx,nldx,angx) |
c etacorr = pfaeta2(cog2,viewx,nldx,angx) |
671 |
c stripx = stripx + etacorr |
c stripx = stripx + etacorr |
672 |
stripx = stripx + pfa_eta2(icx,angx) !(3) |
stripx = stripx + pfaeta2(icx,angx) !(3) |
673 |
resxPAM = risx_eta2(angx) ! (4) |
resxPAM = risx_eta2(angx) ! (4) |
674 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
675 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
676 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
677 |
elseif(PFAx.eq.'ETA3')then !(3) |
elseif(PFAx.eq.'ETA3')then !(3) |
678 |
stripx = stripx + pfa_eta3(icx,angx) !(3) |
stripx = stripx + pfaeta3(icx,angx) !(3) |
679 |
resxPAM = risx_eta3(angx) ! (4) |
resxPAM = risx_eta3(angx) ! (4) |
680 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(3,icx).ne.1) !(3) |
681 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx)!(3) |
682 |
resxPAM = resxPAM*fbad_cog(3,icx) !(3) |
resxPAM = resxPAM*fbad_cog(3,icx) !(3) |
683 |
elseif(PFAx.eq.'ETA4')then !(3) |
elseif(PFAx.eq.'ETA4')then !(3) |
684 |
stripx = stripx + pfa_eta4(icx,angx) !(3) |
stripx = stripx + pfaeta4(icx,angx) !(3) |
685 |
resxPAM = risx_eta4(angx) ! (4) |
resxPAM = risx_eta4(angx) ! (4) |
686 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(4,icx).ne.1) !(3) |
687 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx)!(3) |
688 |
resxPAM = resxPAM*fbad_cog(4,icx) !(3) |
resxPAM = resxPAM*fbad_cog(4,icx) !(3) |
689 |
elseif(PFAx.eq.'ETA')then !(3) |
elseif(PFAx.eq.'ETA')then !(3) |
690 |
stripx = stripx + pfa_eta(icx,angx) !(3) |
stripx = stripx + pfaeta(icx,angx) !(3) |
691 |
resxPAM = ris_eta(icx,angx) ! (4) |
resxPAM = ris_eta(icx,angx) ! (4) |
692 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) !(3) |
693 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx)!(3) |
731 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
732 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
733 |
c cog2 = cog(2,icy) |
c cog2 = cog(2,icy) |
734 |
c etacorr = pfa_eta2(cog2,viewy,nldy,angy) |
c etacorr = pfaeta2(cog2,viewy,nldy,angy) |
735 |
c stripy = stripy + etacorr |
c stripy = stripy + etacorr |
736 |
stripy = stripy + pfa_eta2(icy,angy) !(3) |
stripy = stripy + pfaeta2(icy,angy) !(3) |
737 |
resyPAM = risy_eta2(angy) ! (4) |
resyPAM = risy_eta2(angy) ! (4) |
738 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
739 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
740 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
741 |
elseif(PFAy.eq.'ETA3')then !(3) |
elseif(PFAy.eq.'ETA3')then !(3) |
742 |
stripy = stripy + pfa_eta3(icy,angy) !(3) |
stripy = stripy + pfaeta3(icy,angy) !(3) |
743 |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
744 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
745 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
746 |
elseif(PFAy.eq.'ETA4')then !(3) |
elseif(PFAy.eq.'ETA4')then !(3) |
747 |
stripy = stripy + pfa_eta4(icy,angy) !(3) |
stripy = stripy + pfaeta4(icy,angy) !(3) |
748 |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
749 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
750 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
751 |
elseif(PFAy.eq.'ETA')then !(3) |
elseif(PFAy.eq.'ETA')then !(3) |
752 |
stripy = stripy + pfa_eta(icy,angy) !(3) |
stripy = stripy + pfaeta(icy,angy) !(3) |
753 |
resyPAM = ris_eta(icy,angy) ! (4) |
resyPAM = ris_eta(icy,angy) ! (4) |
754 |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
755 |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
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 |
* * |
* * |