/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/reductionflight.f
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/F77/reductionflight.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by pam-fi, Wed Nov 8 10:12:01 2006 UTC revision 1.18 by pam-fi, Fri Apr 27 10:39:58 2007 UTC
# Line 23  Line 23 
23        integer ierror        integer ierror
24        ierror = 0        ierror = 0
25    
26  *     -------------------------------------------------------  c$$$      debug = .true.
27  *     STRIP MASK  c$$$      verbose = .true.
28  *     -------------------------------------------------------  c$$$      warning = .true.
29    
 c      call stripmask   !called later, after CN computation  
30        call init_level1        call init_level1
31    
32          if(debug)print*,'-- check LEVEL0 status'
33    
34  c      good1 = good0  c      good1 = good0
35  c--------------------------------------------------  c--------------------------------------------------
36  c     check the LEVEL0 event status for missing  c     check the LEVEL0 event status for missing
# Line 91  c           ------------------------ Line 92  c           ------------------------
92           good_old(iv)   = good1(iv)           good_old(iv)   = good1(iv)
93           ngood = ngood + good1(iv)           ngood = ngood + good1(iv)
94        enddo        enddo
95  c      if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: '        if(debug.and.ngood.ne.0)print*,'* WARNING * LEVEL0 event status: '
96  c     $     ,(good1(i),i=1,nviews)       $     ,(good1(i),i=1,nviews)
97  c--------------------------------------------------  c--------------------------------------------------
98  c     read the variable DATATRACKER from LEVEL0  c     read the variable DATATRACKER from LEVEL0
99  c     and fill the variable ADC (invertin view 11)  c     and fill the variable ADC (invertin view 11)
100  c--------------------------------------------------  c--------------------------------------------------
101          
102          if(debug)print*,'-- fill ADC vectors'
103    
104        call filladc(iflag)        call filladc(iflag)
105        if(iflag.ne.0)then        if(iflag.ne.0)then
106           ierror = 220           ierror = 220
# Line 107  c     computes common noise for each VA1 Line 111  c     computes common noise for each VA1
111  c     (excluding strips with signal,  c     (excluding strips with signal,
112  c     tagged with the flag CLSTR)  c     tagged with the flag CLSTR)
113  c--------------------------------------------------  c--------------------------------------------------
114          if(debug)print*,'-- compute CN'
115    
116        do iv=1,nviews        do iv=1,nviews
117           ima=0           ima=0
118           do ik=1,nva1_view           do ik=1,nva1_view
119              cn(iv,ik)  = 0              cn(iv,ik)    = 0
120              cnrms(iv,ik)  = 0              cnrms(iv,ik) = 0
121              cnn(iv,ik) = -1              cnn(iv,ik)   = -1
122              mask_vk_ev(iv,ik)=1              iflag = 0
123              iflag=0              mask_vk_ev(iv,ik) = 1
124              if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag)              call stripmask(iv,ik)      !compute mask(i,j,k), combining VA1-masks
125              if(iflag.ne.0)then  *           --------------------------------------
126                 ima=ima+1  *           if chip is not masked ---> evaluate CN
127                 mask_vk_ev(iv,ik)=0  *           --------------------------------------
128                 ierror = 220              if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!!
129                   call cncomp(iv,ik,iflag)
130                   if(iflag.ne.0)then
131                      ima=ima+1
132                      mask_vk_ev(iv,ik)=0
133                      ierror = 220
134                   endif
135                   call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks
136              endif              endif
137           enddo           enddo
138   100     format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)   100     format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)
139           if(ima.ne.0.and.debug)write(*,100)eventn(1),iv           if(ima.ne.0.and.debug)write(*,100)eventn(1),iv
140       $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)       $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)
141    c         if(ima.ne.0)write(*,100)eventn(1),iv
142    c     $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)  
143        enddo        enddo
144    
145        call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk  cc      call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk
146    
147  c---------------------------------------------  c---------------------------------------------
148  c     loops on views, VA1 and strips,  c     loops on views, VA1 and strips,
# Line 137  c     sigma informations from histograms Line 152  c     sigma informations from histograms
152  c---------------------------------------------  c---------------------------------------------
153        ind=1                     !clsignal array index        ind=1                     !clsignal array index
154    
155          if(debug)print*,'-- search clusters'
156        do iv=1,nviews            !loop on views        do iv=1,nviews            !loop on views
157          do is=1,nstrips_view    !loop on strips (1)          do is=1,nstrips_view    !loop on strips (1)
158            if(mod(iv,2).eq.1) then            if(mod(iv,2).eq.1) then
# Line 167  C===  > X view Line 183  C===  > X view
183    
184          if(.not.flag_shower)then          if(.not.flag_shower)then
185             call save_cluster(iv)             call save_cluster(iv)
186               if(debug)print*,'view ',iv,' #clusters ', nclstr_view
187          else          else
188             fshower(iv) = 1             fshower(iv) = 1
189             GOOD1(DSPnumber(iv)) = 11  c           GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!!
190               GOOD1(iv) = 11
191     101       format(' * WARNING * Event ',i7,' view',i3
192         $          ,' #clusters > ',i5,' --> MASKED')
193               if(debug)write(*,101)eventn(1),iv,nclstrmax_view
194          endif          endif
195        enddo                     ! end loop on views        enddo                     ! end loop on views
196        do iv=1,nviews        do iv=1,nviews
# Line 189  C--------------------------------------- Line 210  C---------------------------------------
210        do iv = 1,nviews        do iv = 1,nviews
211           ngood = ngood + good1(iv)           ngood = ngood + good1(iv)
212        enddo        enddo
213  c$$$      if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1)        if(debug.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1)
214  c$$$     $     ,':LEVEL1 event status: '       $     ,':LEVEL1 event status: '
215  c$$$     $     ,(good1(i),i=1,nviews)       $     ,(good1(i),i=1,nviews)
216  c------------------------------------------------------------------------  c------------------------------------------------------------------------
217  c  c
218  c     closes files and exits  c     closes files and exits
# Line 232  c      good1 = 0 Line 253  c      good1 = 0
253           indmax(ic) = 0           indmax(ic) = 0
254           maxs(ic) = 0           maxs(ic) = 0
255           mult(ic) = 0                     mult(ic) = 0          
256           dedx(ic) = 0           sgnl(ic) = 0
257           whichtrack(ic) = 0           whichtrack(ic) = 0     !assigned @ level2
258    
259        enddo        enddo
260        do id=1,maxlength         !???        do id=1,maxlength         !???
# Line 543  c        posizione del cluster seed nell Line 564  c        posizione del cluster seed nell
564                    
565           CLlength      = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate           CLlength      = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate
566           totCLlength   = totCLlength + CLlength           totCLlength   = totCLlength + CLlength
567           dedx(nclstr1) = 0           sgnl(nclstr1) = 0
568           do j=lmax_view(ic),rmax_view(ic)         !stores sequentially cluter strip values in           do j=lmax_view(ic),rmax_view(ic)         !stores sequentially cluter strip values in
569    
570              clsignal(ind) = value(j) ! clsignal array              clsignal(ind) = value(j) ! clsignal array
# Line 559  c            clped(ind)   = pedestal(iv, Line 580  c            clped(ind)   = pedestal(iv,
580              ind=ind+1              ind=ind+1
581  c     if(value(j).gt.0)  c     if(value(j).gt.0)
582              if(value(j).gt.clinclcut(j))              if(value(j).gt.clinclcut(j))
583       $           dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge       $           sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge
584           enddo           enddo
585    
586  c         print*,'view ',iv,' -- save_cluster -- nclstr1: '  c         print*,'view ',iv,' -- save_cluster -- nclstr1: '
587  c     $        ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1)  c     $        ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1)
588                    
589        enddo        enddo
590                
# Line 578  c     $        ,nclstr1,maxs(nclstr1),mu Line 599  c     $        ,nclstr1,maxs(nclstr1),mu
599  *---***---***---***---***---***---***---***---***  *---***---***---***---***---***---***---***---***
600    
601    
602        subroutine stripmask  c$$$      subroutine stripmask
603    c$$$
604    c$$$*     this routine set va1 and single-strip masks,
605    c$$$*     on the basis of the VA1 mask saved in the DB
606    c$$$*
607    c$$$*     mask(nviews,nva1_view,nstrips_va1) !strip mask
608    c$$$*     mask_vk(nviews,nva1_view)          !VA1 mask
609    c$$$*
610    c$$$      include 'commontracker.f'
611    c$$$      include 'level1.f'
612    c$$$      include 'common_reduction.f'
613    c$$$      include 'calib.f'
614    c$$$
615    c$$$*     init mask
616    c$$$      do iv=1,nviews
617    c$$$         do ivk=1,nva1_view
618    c$$$            do is=1,nstrips_va1
619    c$$$c               mask(iv,ivk,is) = mask_vk(iv,ivk)
620    c$$$               if( mask_vk(iv,ivk) .ne. -1)then
621    c$$$                  mask(iv,ivk,is) = 1
622    c$$$     $                 * mask_vk(iv,ivk)     !from DB
623    c$$$     $                 * mask_vk_ev(iv,ivk)  !from <SIG>
624    c$$$     $                 * mask_vk_run(iv,ivk) !from CN
625    c$$$               else
626    c$$$                  mask(iv,ivk,is) = -1
627    c$$$     $                 * mask_vk(iv,ivk)     !from DB
628    c$$$     $                 * mask_vk_ev(iv,ivk)  !from CN
629    c$$$               endif
630    c$$$            enddo
631    c$$$         enddo
632    c$$$      enddo
633    c$$$
634    c$$$
635    c$$$      return
636    c$$$      end
637    
638          subroutine stripmask(iv,ivk)
639    
640    *     -----------------------------------------------
641  *     this routine set va1 and single-strip masks,  *     this routine set va1 and single-strip masks,
642  *     on the basis of the VA1 mask saved in the DB  *     on the basis of the VA1 mask saved in the DB
643  *  *
644  *     mask(nviews,nva1_view,nstrips_va1) !strip mask  *     mask(nviews,nva1_view,nstrips_va1) !strip mask
645  *     mask_vk(nviews,nva1_view)          !VA1 mask  *     mask_vk(nviews,nva1_view)          !VA1 mask
646  *  *     -----------------------------------------------
647        include 'commontracker.f'        include 'commontracker.f'
648        include 'level1.f'        include 'level1.f'
649        include 'common_reduction.f'        include 'common_reduction.f'
650        include 'calib.f'        include 'calib.f'
651    
652  *     init mask  *     init mask
653        do iv=1,nviews        do is=1,nstrips_va1
654           do ivk=1,nva1_view  *        --------------------------------------------------------
655              do is=1,nstrips_va1  *        if VA1-mask from DB is 0 or 1, three masks are combined:
656  c               mask(iv,ivk,is) = mask_vk(iv,ivk)  *        - from DB (a-priori mask)
657                 mask(iv,ivk,is) = mask_vk(iv,ivk) * mask_vk_ev(iv,ivk)                *        - run-based (chip declared bad on the basis of <SIG>)
658              enddo  *        - event-based (failure in CN computation)
659           enddo  *        --------------------------------------------------------
660             if( mask_vk(iv,ivk) .ne. -1)then            
661                mask(iv,ivk,is) = 1
662         $           * mask_vk(iv,ivk)     !from DB
663         $           * mask_vk_ev(iv,ivk)  !from <SIG>
664         $           * mask_vk_run(iv,ivk) !from CN
665    *        -----------------------------------------------------------
666    *        if VA1-mask from DB is -1 only event-based mask is applied
667    *        -----------------------------------------------------------
668             else
669                mask(iv,ivk,is) = -1
670         $           * mask_vk(iv,ivk)     !from DB
671         $           * mask_vk_ev(iv,ivk)  !from CN
672             endif
673        enddo        enddo
674          
675          
676        return        return
677        end        end
   

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.23