--- DarthVader/TrackerLevel2/src/F77/analysissubroutines.f 2006/11/21 14:00:40 1.14 +++ DarthVader/TrackerLevel2/src/F77/analysissubroutines.f 2006/11/21 17:13:31 1.15 @@ -233,24 +233,53 @@ c$$$ enddo c$$$ if(ibest.eq.0)goto 880 !>> no good candidates - rchi2best=1000000000. +* ------------------------------------------------------- +* order track-candidates according to: +* 1st) decreasing n.points +* 2nd) increasing chi**2 +* ------------------------------------------------------- + rchi2best=1000000000. ndofbest=0 !(1) do i=1,ntracks - if(RCHI2_STORE(i).lt.rchi2best.and. - $ RCHI2_STORE(i).gt.0)then - ndof=0 !(1) - do ii=1,nplanes !(1) - ndof=ndof !(1) - $ +int(xgood_store(ii,i)) !(1) - $ +int(ygood_store(ii,i)) !(1) - enddo !(1) - if(ndof.ge.ndofbest)then !(1) + ndof=0 !(1) + do ii=1,nplanes !(1) + ndof=ndof !(1) + $ +int(xgood_store(ii,i)) !(1) + $ +int(ygood_store(ii,i)) !(1) + enddo !(1) + if(ndof.gt.ndofbest)then !(1) + ibest=i + rchi2best=RCHI2_STORE(i) + ndofbest=ndof !(1) + elseif(ndof.eq.ndofbest)then !(1) + if(RCHI2_STORE(i).lt.rchi2best.and. + $ RCHI2_STORE(i).gt.0)then ibest=i rchi2best=RCHI2_STORE(i) ndofbest=ndof !(1) endif !(1) endif enddo + +c$$$ rchi2best=1000000000. +c$$$ ndofbest=0 !(1) +c$$$ do i=1,ntracks +c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. +c$$$ $ RCHI2_STORE(i).gt.0)then +c$$$ ndof=0 !(1) +c$$$ do ii=1,nplanes !(1) +c$$$ ndof=ndof !(1) +c$$$ $ +int(xgood_store(ii,i)) !(1) +c$$$ $ +int(ygood_store(ii,i)) !(1) +c$$$ enddo !(1) +c$$$ if(ndof.ge.ndofbest)then !(1) +c$$$ ibest=i +c$$$ rchi2best=RCHI2_STORE(i) +c$$$ ndofbest=ndof !(1) +c$$$ endif !(1) +c$$$ endif +c$$$ enddo + if(ibest.eq.0)goto 880 !>> no good candidates *------------------------------------------------------------------------------- * The best track candidate (ibest) is selected and a new fitting is performed. @@ -1467,15 +1496,8 @@ goto 20 !charge not consistent endif endif - -* ------------------> COUPLE <------------------ - ncp_plane(nplx) = ncp_plane(nplx) + 1 - clx(nplx,ncp_plane(nplx))=icx - cly(nply,ncp_plane(nplx))=icy - cl_single(icx)=0 - cl_single(icy)=0 - if(ncp_plane(nplx).eq.ncouplemax)then + if(ncp_plane(nplx).gt.ncouplemax)then if(verbose)print*, $ '** warning ** number of identified '// $ 'couples on plane ',nplx, @@ -1483,7 +1505,15 @@ $ ,'( ',ncouplemax,' ) --> masked!' mask_view(nviewx(nplx)) = 2 mask_view(nviewy(nply)) = 2 + goto 10 endif + +* ------------------> COUPLE <------------------ + ncp_plane(nplx) = ncp_plane(nplx) + 1 + clx(nplx,ncp_plane(nplx))=icx + cly(nply,ncp_plane(nplx))=icy + cl_single(icx)=0 + cl_single(icy)=0 * ---------------------------------------------- endif @@ -2323,7 +2353,8 @@ nplused=nplused+ hit_plane(ip) enddo - if(nplused.lt.nplxz_min)goto 888 !next doublet +c if(nplused.lt.nplxz_min)goto 888 !next doublet + if(nplused.lt.nplyz_min)goto 888 !next doublet if(ncp_ok.lt.ncpok)goto 888 !next cloud if(DEBUG)then