--- DarthVader/TrackerLevel2/src/F77/reductionflight.f 2007/11/27 15:28:58 1.24 +++ DarthVader/TrackerLevel2/src/F77/reductionflight.f 2008/10/22 15:17:40 1.25 @@ -169,32 +169,33 @@ if(debug.eq.1)print*,'-- compute CN' do iv=1,nviews - ima=0 - do ik=1,nva1_view - cn(iv,ik) = 0 - cnrms(iv,ik) = 0 - cnn(iv,ik) = -1 - iflag = 0 - mask_vk_ev(iv,ik) = 1 - call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks -* -------------------------------------- -* if chip is not masked ---> evaluate CN -* -------------------------------------- - if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!! - call cncomp(iv,ik,iflag) - if(iflag.ne.0)then - ima=ima+1 - mask_vk_ev(iv,ik)=0 - ierror = 220 - endif - call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks - endif - enddo - 100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) - if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv - $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) -c if(ima.ne.0)write(*,100)eventn(1),iv -c $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) + + call evaluatecn(iv) +c$$$ ima=0 +c$$$ do ik=1,nva1_view +c$$$ cn(iv,ik) = 0 +c$$$ cnrms(iv,ik) = 0 +c$$$ cnn(iv,ik) = -1 +c$$$ iflag = 0 +c$$$ mask_vk_ev(iv,ik) = 1 +c$$$ call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks +c$$$* -------------------------------------- +c$$$* if chip is not masked ---> evaluate CN +c$$$* -------------------------------------- +c$$$ if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!! +c$$$ call cncomp(iv,ik,iflag) +c$$$ if(iflag.ne.0)then +c$$$ ima=ima+1 +c$$$ mask_vk_ev(iv,ik)=0 +c$$$ ierror = 220 +c$$$ endif +c$$$ call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks +c$$$ endif +c$$$ enddo +c$$$ 100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) +c$$$ if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv +c$$$ $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) + enddo cc call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk @@ -209,56 +210,57 @@ if(debug.eq.1)print*,'-- search clusters' do iv=1,nviews !loop on views - do is=1,nstrips_view !loop on strips (1) - if(mod(iv,2).eq.1) then -C=== > Y view -c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is)) -c $ ,cn(iv,nvk(is)) -c $ ,pedestal(iv,nvk(is),nst(is)) - value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) - $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) - $ *mask(iv,nvk(is),nst(is)) - clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is)) - $ *mask(iv,nvk(is),nst(is)) - clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is)) - $ *mask(iv,nvk(is),nst(is)) - sat(is)=0 - if( adc(iv,nvk(is),nst(is)).lt.adc_saty )sat(is)=1 - else -C=== > X view - value(is)= (DBLE(adc(iv,nvk(is),nst(is))) - $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) - $ *mask(iv,nvk(is),nst(is)) - clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is)) - $ *mask(iv,nvk(is),nst(is)) - clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is)) - $ *mask(iv,nvk(is),nst(is)) - sat(is)=0 - if( adc(iv,nvk(is),nst(is)).gt.adc_satx )sat(is)=1 - endif - enddo !end loop on strips (1) - call search_cluster(iv) - - if(.not.flag_shower)then - call save_cluster(iv) - if(debug.eq.1)print*,'view ',iv,' #clusters ', nclstr_view - else - fshower(iv) = 1 -c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! -c GOOD1(iv) = 11 -c GOOD1(iv) = GOOD1(iv) + 2**5 - GOOD1(iv) = ior(GOOD1(iv),2**5) - 101 format(' * WARNING * Event ',i7,' view',i3 - $ ,' #clusters > ',i5,' --> MASKED') - if(verbose.eq.1)write(*,101)eventn(1),iv,nclstrmax_view - endif +c$$$ do is=1,nstrips_view !loop on strips (1) +c$$$ if(mod(iv,2).eq.1) then +c$$$C=== > Y view +c$$$c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is)) +c$$$c $ ,cn(iv,nvk(is)) +c$$$c $ ,pedestal(iv,nvk(is),nst(is)) +c$$$ value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) +c$$$ $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) +c$$$ $ *mask(iv,nvk(is),nst(is)) +c$$$ clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is)) +c$$$ $ *mask(iv,nvk(is),nst(is)) +c$$$ clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is)) +c$$$ $ *mask(iv,nvk(is),nst(is)) +c$$$ sat(is)=0 +c$$$ if( adc(iv,nvk(is),nst(is)).lt.adc_saty )sat(is)=1 +c$$$ else +c$$$C=== > X view +c$$$ value(is)= (DBLE(adc(iv,nvk(is),nst(is))) +c$$$ $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) +c$$$ $ *mask(iv,nvk(is),nst(is)) +c$$$ clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is)) +c$$$ $ *mask(iv,nvk(is),nst(is)) +c$$$ clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is)) +c$$$ $ *mask(iv,nvk(is),nst(is)) +c$$$ sat(is)=0 +c$$$ if( adc(iv,nvk(is),nst(is)).gt.adc_satx )sat(is)=1 +c$$$ endif +c$$$ enddo !end loop on strips (1) + call subtractped(iv) + call searchcluster(iv) + + if(.not.flag_shower)then + call savecluster(iv) + if(debug.eq.1)print*,'view ',iv,' #clusters ', nclstr_view + else + fshower(iv) = 1 +c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! +c GOOD1(iv) = 11 +c GOOD1(iv) = GOOD1(iv) + 2**5 + GOOD1(iv) = ior(GOOD1(iv),2**5) + 101 format(' * WARNING * Event ',i7,' view',i3 + $ ,' #clusters > ',i5,' --> MASKED') + if(verbose.eq.1)write(*,101)eventn(1),iv,nclstrmax_view + endif enddo ! end loop on views do iv=1,nviews - do ik=1,nva1_view - cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables - cnrmsev(iv,ik) = cnrms(iv,ik) !assigns computed CN to ntuple variables - cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables - enddo + do ik=1,nva1_view + cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables + cnrmsev(iv,ik) = cnrms(iv,ik) !assigns computed CN to ntuple variables + cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables + enddo enddo C--------------------------------------------- C come here if GOOD1=0 @@ -344,7 +346,7 @@ * *---***---***---***---***---***---***---***---*** - subroutine search_cluster(iv) + subroutine searchcluster(iv) include 'commontracker.f' include 'level0.f' @@ -619,7 +621,7 @@ * *---***---***---***---***---***---***---***---*** - subroutine save_cluster(iv) + subroutine savecluster(iv) * * (080/2006 Elena Vannuccini) * Save the clusters view by view @@ -666,7 +668,7 @@ $ sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge enddo -c$$$ print*,'view ',iv,' -- save_cluster -- nclstr1: ' +c$$$ print*,'view ',iv,' -- savecluster -- nclstr1: ' c$$$ $ ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1) c$$$ print*,'----------------------' @@ -682,7 +684,95 @@ * *---***---***---***---***---***---***---***---*** + subroutine evaluatecn(iv) + + include 'commontracker.f' + include 'level0.f' + include 'level1.f' + include 'common_reduction.f' + include 'calib.f' + + ima=0 + do ik=1,nva1_view + cn(iv,ik) = 0 + cnrms(iv,ik) = 0 + cnn(iv,ik) = -1 + iflag = 0 + mask_vk_ev(iv,ik) = 1 + call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks +* -------------------------------------- +* if chip is not masked ---> evaluate CN +* -------------------------------------- + if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!! + call cncomp(iv,ik,iflag) + if(iflag.ne.0)then + ima=ima+1 + mask_vk_ev(iv,ik)=0 + ierror = 220 + endif + call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks + endif + enddo + 100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) + if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv + $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) + + return + end + +*---***---***---***---***---***---***---***---*** +* +* +* +* +* +*---***---***---***---***---***---***---***---*** + subroutine subtractped(iv) + + include 'commontracker.f' + include 'level1.f' + include 'calib.f' + include 'common_reduction.f' + do is=1,nstrips_view !loop on strips (1) + if(mod(iv,2).eq.1) then +C=== > Y view +c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is)) +c $ ,cn(iv,nvk(is)) +c $ ,pedestal(iv,nvk(is),nst(is)) + value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) + $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) + $ *mask(iv,nvk(is),nst(is)) + clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is)) + $ *mask(iv,nvk(is),nst(is)) + clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is)) + $ *mask(iv,nvk(is),nst(is)) + sat(is)=0 + if( adc(iv,nvk(is),nst(is)).lt.adc_saty )sat(is)=1 + else +C=== > X view + value(is)= (DBLE(adc(iv,nvk(is),nst(is))) + $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) + $ *mask(iv,nvk(is),nst(is)) + clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is)) + $ *mask(iv,nvk(is),nst(is)) + clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is)) + $ *mask(iv,nvk(is),nst(is)) + sat(is)=0 + if( adc(iv,nvk(is),nst(is)).gt.adc_satx )sat(is)=1 + endif + enddo !end loop on strips (1) + + + return + end +*---***---***---***---***---***---***---***---*** +* +* +* +* +* +*---***---***---***---***---***---***---***---*** c$$$ subroutine stripmask c$$$ c$$$* this routine set va1 and single-strip masks,