--- DarthVader/TrackerLevel2/src/F77/analysissubroutines.f 2007/05/24 13:29:09 1.25 +++ DarthVader/TrackerLevel2/src/F77/analysissubroutines.f 2007/05/24 16:45:48 1.26 @@ -596,10 +596,16 @@ zPAM_B = 0. c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy + if(sensor.lt.1.or.sensor.gt.2)then + print*,'xyz_PAM ***ERROR*** wrong input ' + print*,'sensor ',sensor + icx=0 + icy=0 + endif + * ----------------- * CLUSTER X -* ----------------- - +* ----------------- if(icx.ne.0)then viewx = VIEW(icx) @@ -607,6 +613,21 @@ nplx = npl(VIEW(icx)) resxPAM = RESXAV stripx = float(MAXS(icx)) + + if( + $ viewx.lt.1.or. + $ viewx.gt.12.or. + $ nldx.lt.1.or. + $ nldx.gt.3.or. + $ stripx.lt.1.or. + $ stripx.gt.3072.or. + $ .false.)then + print*,'xyz_PAM ***ERROR*** wrong input ' + print*,'icx ',icx,'view ',viewx,'nld ',nldx,'strip ',stripx + icx = 0 + goto 10 + endif + * -------------------------- * magnetic-field corrections * -------------------------- @@ -719,8 +740,9 @@ c$$$ print*,icx,' *** ',resxPAM endif - endif - + 10 endif + + * ----------------- * CLUSTER Y * ----------------- @@ -733,6 +755,20 @@ resyPAM = RESYAV stripy = float(MAXS(icy)) + if( + $ viewy.lt.1.or. + $ viewy.gt.12.or. + $ nldy.lt.1.or. + $ nldy.gt.3.or. + $ stripy.lt.1.or. + $ stripy.gt.3072.or. + $ .false.)then + print*,'xyz_PAM ***ERROR*** wrong input ' + print*,'icy ',icy,'view ',viewy,'nld ',nldy,'strip ',stripy + icy = 0 + goto 20 + endif + if(icx.ne.0.and.(nply.ne.nplx.or.nldy.ne.nldx))then if(DEBUG) then print*,'xyz_PAM ***ERROR*** invalid cluster couple!!! ' @@ -837,7 +873,7 @@ endif - endif + 20 endif c$$$ print*,'## stripx,stripy ',stripx,stripy @@ -1084,11 +1120,20 @@ c$$$ PFAx = 'COG4'!PFA c$$$ PFAy = 'COG4'!PFA + + if(icx.gt.nclstr1.or.icy.gt.nclstr1)then + print*,'xyzpam: ***WARNING*** clusters ',icx,icy + $ ,' does not exists (nclstr1=',nclstr1,')' + icx = -1*icx + icy = -1*icy + return + + endif call idtoc(pfaid,PFAx) call idtoc(pfaid,PFAy) - call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) +c$$$ call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) c$$$ print*,icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy @@ -1096,9 +1141,24 @@ ipx=npl(VIEW(icx)) ipy=npl(VIEW(icy)) - if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) - $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy - $ ,' does not belong to the correct plane: ',ip,ipx,ipy +c$$$ if( (nplanes-ipx+1).ne.ip.or.(nplanes-ipy+1).ne.ip ) +c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy +c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy + + if( (nplanes-ipx+1).ne.ip )then + print*,'xyzpam: ***WARNING*** cluster ',icx + $ ,' does not belong to plane: ',ip + icx = -1*icx + return + endif + if( (nplanes-ipy+1).ne.ip )then + print*,'xyzpam: ***WARNING*** cluster ',icy + $ ,' does not belong to plane: ',ip + icy = -1*icy + return + endif + + call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) xgood(ip) = 1. ygood(ip) = 1. @@ -1118,10 +1178,18 @@ elseif(icx.eq.0.and.icy.ne.0)then ipy=npl(VIEW(icy)) - if((nplanes-ipy+1).ne.ip) - $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy - $ ,' does not belong to the correct plane: ',ip,ipx,ipy +c$$$ if((nplanes-ipy+1).ne.ip) +c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy +c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy + if( (nplanes-ipy+1).ne.ip )then + print*,'xyzpam: ***WARNING*** cluster ',icy + $ ,' does not belong to plane: ',ip + icy = -1*icy + return + endif + call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) + xgood(ip) = 0. ygood(ip) = 1. resx(ip) = 1000. @@ -1140,10 +1208,19 @@ elseif(icx.ne.0.and.icy.eq.0)then ipx=npl(VIEW(icx)) - if((nplanes-ipx+1).ne.ip) - $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy - $ ,' does not belong to the correct plane: ',ip,ipx,ipy +c$$$ if((nplanes-ipx+1).ne.ip) +c$$$ $ print*,'xyzpam: ***WARNING*** clusters ',icx,icy +c$$$ $ ,' does not belong to the correct plane: ',ip,ipx,ipy + + if( (nplanes-ipx+1).ne.ip )then + print*,'xyzpam: ***WARNING*** cluster ',icx + $ ,' does not belong to plane: ',ip + icx = -1*icx + return + endif + call xyz_PAM(icx,icy,sensor,PFAx,PFAy,ax,ay,bfx,bfy) + xgood(ip) = 1. ygood(ip) = 0. resx(ip) = resxPAM @@ -1665,7 +1742,8 @@ * mask views with too many clusters do iv=1,nviews if( ncl_view(iv).gt. nclusterlimit)then - mask_view(iv) = 1 +c mask_view(iv) = 1 + mask_view(iv) = mask_view(iv) + 2**0 if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' $ ,nclusterlimit,' on view ', iv,' --> masked!' endif @@ -1810,8 +1888,10 @@ $ 'couples on plane ',nplx, $ 'exceeds vector dimention ' $ ,'( ',ncouplemax,' ) --> masked!' - mask_view(nviewx(nplx)) = 2 - mask_view(nviewy(nply)) = 2 +c mask_view(nviewx(nplx)) = 2 +c mask_view(nviewy(nply)) = 2 + mask_view(nviewx(nplx))= mask_view(nviewx(nplx))+ 2**1 + mask_view(nviewy(nply))= mask_view(nviewy(nply))+ 2**1 goto 10 endif @@ -1912,8 +1992,10 @@ * -------------------------------------------- do ip=1,nplanes if(ncp_plane(ip).gt.ncouplelimit)then - mask_view(nviewx(ip)) = 8 - mask_view(nviewy(ip)) = 8 +c mask_view(nviewx(ip)) = 8 +c mask_view(nviewy(ip)) = 8 + mask_view(nviewx(ip)) = mask_view(nviewx(ip)) + 2**7 + mask_view(nviewy(ip)) = mask_view(nviewy(ip)) + 2**7 endif enddo @@ -1966,7 +2048,8 @@ c good2=.false. c goto 880 !fill ntp and go to next event do iv=1,12 - mask_view(iv) = 3 +c mask_view(iv) = 3 + mask_view(iv) = mask_view(iv)+ 2**2 enddo iflag=1 return @@ -2045,7 +2128,8 @@ c good2=.false. c goto 880 !fill ntp and go to next event do iv=1,nviews - mask_view(iv) = 4 +c mask_view(iv) = 4 + mask_view(iv)=mask_view(iv)+ 2**3 enddo iflag=1 return @@ -2279,7 +2363,8 @@ c good2=.false. c goto 880 !fill ntp and go to next event do iv=1,nviews - mask_view(iv) = 5 +c mask_view(iv) = 5 + mask_view(iv) = mask_view(iv) + 2**4 enddo iflag=1 return @@ -2501,7 +2586,8 @@ c good2=.false. c goto 880 !fill ntp and go to next event do iv=1,nviews - mask_view(iv) = 6 +c mask_view(iv) = 6 + mask_view(iv) = mask_view(iv) + 2**5 enddo iflag=1 return @@ -2834,7 +2920,8 @@ c good2=.false. c goto 880 !fill ntp and go to next event do iv=1,nviews - mask_view(iv) = 7 +c mask_view(iv) = 7 + mask_view(iv) = mask_view(iv) + 2**6 enddo iflag=1 return @@ -3668,18 +3755,14 @@ c >>> is a couple cltrx(ip,ntr) = clx(nplanes-ip+1,icp_cp(id)) cltry(ip,ntr) = cly(nplanes-ip+1,icp_cp(id)) + +c$$$ nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) +c$$$ nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) +c$$$ xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) +c$$$ ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) + xbad(ip,ntr)= nbadstrips(4,clx(nplanes-ip+1,icp_cp(id))) + ybad(ip,ntr)= nbadstrips(4,cly(nplanes-ip+1,icp_cp(id))) -c$$$ if(is_cp(id).ne.ssensor) -c$$$ $ print*,'ERROR is sensor assignment (couple)' -c$$$ $ ,is_cp(id),ssensor -c$$$ if(LADDER(clx(nplanes-ip+1,icp_cp(id))).ne.sladder) -c$$$ $ print*,'ERROR is ladder assignment (couple)' -c$$$ $ ,LADDER(clx(nplanes-ip+1,icp_cp(id))),sladder - - nnnnx = npfastrips(clx(nplanes-ip+1,icp_cp(id)),PFA,angx) - nnnny = npfastrips(cly(nplanes-ip+1,icp_cp(id)),PFA,angy) - xbad(ip,ntr)= nbadstrips(nnnnx,clx(nplanes-ip+1,icp_cp(id))) - ybad(ip,ntr)= nbadstrips(nnnny,cly(nplanes-ip+1,icp_cp(id))) if(nsatstrips(clx(nplanes-ip+1,icp_cp(id))).gt.0) $ dedx_x(ip,ntr)=-dedx_x(ip,ntr) @@ -3687,21 +3770,22 @@ $ dedx_y(ip,ntr)=-dedx_y(ip,ntr) elseif(icl.ne.0)then -c >>> is a singlet -c$$$ if(LADDER(icl).ne.sladder) -c$$$ $ print*,'ERROR is ladder assignment (single)' -c$$$ $ ,LADDER(icl),sladder + if(mod(VIEW(icl),2).eq.0)then cltrx(ip,ntr)=icl - nnnnn = npfastrips(icl,PFA,angx) - xbad(ip,ntr) = nbadstrips(nnnnn,icl) +c$$$ nnnnn = npfastrips(icl,PFA,angx) +c$$$ xbad(ip,ntr) = nbadstrips(nnnnn,icl) + xbad(ip,ntr) = nbadstrips(4,icl) + if(nsatstrips(icl).gt.0)dedx_x(ip,ntr)=-dedx_x(ip,ntr) elseif(mod(VIEW(icl),2).eq.1)then cltry(ip,ntr)=icl - nnnnn = npfastrips(icl,PFA,angy) - ybad(ip,ntr) = nbadstrips(nnnnn,icl) +c$$$ nnnnn = npfastrips(icl,PFA,angy) +c$$$ ybad(ip,ntr) = nbadstrips(nnnnn,icl) + ybad(ip,ntr) = nbadstrips(4,icl) if(nsatstrips(icl).gt.0)dedx_y(ip,ntr)=-dedx_y(ip,ntr) endif + endif enddo @@ -3736,7 +3820,8 @@ nclsy = 0 do iv = 1,nviews - if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) +c if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) + good2(iv) = good2(iv) + mask_view(iv)*2**8 enddo do icl=1,nclstr1