/[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.11 by pam-fi, Fri Oct 27 16:08:19 2006 UTC revision 1.19 by pam-fi, Mon May 14 11:03:06 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    
30    *     //////////////////////////
31    *     initialize some parameters
32    *     //////////////////////////
33    
 c      call stripmask   !called later, after CN computation  
34        call init_level1        call init_level1
35    
36          if(debug)print*,'-- check LEVEL0 status'
37    
38  c      good1 = good0  c      good1 = good0
39  c--------------------------------------------------  c--------------------------------------------------
40  c     check the LEVEL0 event status for missing  c     check the LEVEL0 event status for missing
# Line 91  c           ------------------------ Line 96  c           ------------------------
96           good_old(iv)   = good1(iv)           good_old(iv)   = good1(iv)
97           ngood = ngood + good1(iv)           ngood = ngood + good1(iv)
98        enddo        enddo
99  c      if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: '        if(debug.and.ngood.ne.0)print*,'* WARNING * LEVEL0 event status: '
100  c     $     ,(good1(i),i=1,nviews)       $     ,(good1(i),i=1,nviews)
101  c--------------------------------------------------  c--------------------------------------------------
102  c     read the variable DATATRACKER from LEVEL0  c     read the variable DATATRACKER from LEVEL0
103  c     and fill the variable ADC (invertin view 11)  c     and fill the variable ADC (invertin view 11)
104  c--------------------------------------------------  c--------------------------------------------------
105          
106          if(debug)print*,'-- fill ADC vectors'
107    
108        call filladc(iflag)        call filladc(iflag)
109        if(iflag.ne.0)then        if(iflag.ne.0)then
110           ierror = 220           ierror = 220
# Line 107  c     computes common noise for each VA1 Line 115  c     computes common noise for each VA1
115  c     (excluding strips with signal,  c     (excluding strips with signal,
116  c     tagged with the flag CLSTR)  c     tagged with the flag CLSTR)
117  c--------------------------------------------------  c--------------------------------------------------
118          if(debug)print*,'-- compute CN'
119    
120        do iv=1,nviews        do iv=1,nviews
121           ima=0           ima=0
122           do ik=1,nva1_view           do ik=1,nva1_view
123              cn(iv,ik)  = 0              cn(iv,ik)    = 0
124              cnrms(iv,ik)  = 0              cnrms(iv,ik) = 0
125              cnn(iv,ik) = -1              cnn(iv,ik)   = -1
126              mask_vk_ev(iv,ik)=1              iflag = 0
127              iflag=0              mask_vk_ev(iv,ik) = 1
128              if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag)              call stripmask(iv,ik)      !compute mask(i,j,k), combining VA1-masks
129              if(iflag.ne.0)then  *           --------------------------------------
130                 ima=ima+1  *           if chip is not masked ---> evaluate CN
131                 mask_vk_ev(iv,ik)=0  *           --------------------------------------
132                 ierror = 220              if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!!
133                   call cncomp(iv,ik,iflag)
134                   if(iflag.ne.0)then
135                      ima=ima+1
136                      mask_vk_ev(iv,ik)=0
137                      ierror = 220
138                   endif
139                   call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks
140              endif              endif
141           enddo           enddo
142   100     format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)   100     format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)
143           if(ima.ne.0.and.debug)write(*,100)eventn(1),iv           if(ima.ne.0.and.debug)write(*,100)eventn(1),iv
144       $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)       $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)
145    c         if(ima.ne.0)write(*,100)eventn(1),iv
146    c     $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)  
147        enddo        enddo
148    
149        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
150    
151  c---------------------------------------------  c---------------------------------------------
152  c     loops on views, VA1 and strips,  c     loops on views, VA1 and strips,
# Line 137  c     sigma informations from histograms Line 156  c     sigma informations from histograms
156  c---------------------------------------------  c---------------------------------------------
157        ind=1                     !clsignal array index        ind=1                     !clsignal array index
158    
159          if(debug)print*,'-- search clusters'
160        do iv=1,nviews            !loop on views        do iv=1,nviews            !loop on views
161          do is=1,nstrips_view    !loop on strips (1)          do is=1,nstrips_view    !loop on strips (1)
162            if(mod(iv,2).eq.1) then            if(mod(iv,2).eq.1) then
# Line 167  C===  > X view Line 187  C===  > X view
187    
188          if(.not.flag_shower)then          if(.not.flag_shower)then
189             call save_cluster(iv)             call save_cluster(iv)
190               if(debug)print*,'view ',iv,' #clusters ', nclstr_view
191          else          else
192             fshower(iv) = 1             fshower(iv) = 1
193             GOOD1(DSPnumber(iv)) = 11  c           GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!!
194               GOOD1(iv) = 11
195     101       format(' * WARNING * Event ',i7,' view',i3
196         $          ,' #clusters > ',i5,' --> MASKED')
197               if(debug)write(*,101)eventn(1),iv,nclstrmax_view
198          endif          endif
199        enddo                     ! end loop on views        enddo                     ! end loop on views
200        do iv=1,nviews        do iv=1,nviews
# Line 189  C--------------------------------------- Line 214  C---------------------------------------
214        do iv = 1,nviews        do iv = 1,nviews
215           ngood = ngood + good1(iv)           ngood = ngood + good1(iv)
216        enddo        enddo
217        if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1)        if(debug.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1)
218       $     ,':LEVEL1 event status: '       $     ,':LEVEL1 event status: '
219       $     ,(good1(i),i=1,nviews)       $     ,(good1(i),i=1,nviews)
220  c------------------------------------------------------------------------  c------------------------------------------------------------------------
# Line 232  c      good1 = 0 Line 257  c      good1 = 0
257           indmax(ic) = 0           indmax(ic) = 0
258           maxs(ic) = 0           maxs(ic) = 0
259           mult(ic) = 0                     mult(ic) = 0          
260           dedx(ic) = 0           sgnl(ic) = 0
261           whichtrack(ic) = 0           whichtrack(ic) = 0     !assigned @ level2
262    
263        enddo        enddo
264        do id=1,maxlength         !???        do id=1,maxlength         !???
# Line 543  c        posizione del cluster seed nell Line 568  c        posizione del cluster seed nell
568                    
569           CLlength      = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate           CLlength      = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate
570           totCLlength   = totCLlength + CLlength           totCLlength   = totCLlength + CLlength
571           dedx(nclstr1) = 0           sgnl(nclstr1) = 0
572           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
573    
574              clsignal(ind) = value(j) ! clsignal array              clsignal(ind) = value(j) ! clsignal array
# Line 559  c            clped(ind)   = pedestal(iv, Line 584  c            clped(ind)   = pedestal(iv,
584              ind=ind+1              ind=ind+1
585  c     if(value(j).gt.0)  c     if(value(j).gt.0)
586              if(value(j).gt.clinclcut(j))              if(value(j).gt.clinclcut(j))
587       $           dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge       $           sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge
588           enddo           enddo
589    
590  c         print*,'view ',iv,' -- save_cluster -- nclstr1: '  c         print*,'view ',iv,' -- save_cluster -- nclstr1: '
591  c     $        ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1)  c     $        ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1)
592                    
593        enddo        enddo
594                
# Line 578  c     $        ,nclstr1,maxs(nclstr1),mu Line 603  c     $        ,nclstr1,maxs(nclstr1),mu
603  *---***---***---***---***---***---***---***---***  *---***---***---***---***---***---***---***---***
604    
605    
606        subroutine stripmask  c$$$      subroutine stripmask
607    c$$$
608    c$$$*     this routine set va1 and single-strip masks,
609    c$$$*     on the basis of the VA1 mask saved in the DB
610    c$$$*
611    c$$$*     mask(nviews,nva1_view,nstrips_va1) !strip mask
612    c$$$*     mask_vk(nviews,nva1_view)          !VA1 mask
613    c$$$*
614    c$$$      include 'commontracker.f'
615    c$$$      include 'level1.f'
616    c$$$      include 'common_reduction.f'
617    c$$$      include 'calib.f'
618    c$$$
619    c$$$*     init mask
620    c$$$      do iv=1,nviews
621    c$$$         do ivk=1,nva1_view
622    c$$$            do is=1,nstrips_va1
623    c$$$c               mask(iv,ivk,is) = mask_vk(iv,ivk)
624    c$$$               if( mask_vk(iv,ivk) .ne. -1)then
625    c$$$                  mask(iv,ivk,is) = 1
626    c$$$     $                 * mask_vk(iv,ivk)     !from DB
627    c$$$     $                 * mask_vk_ev(iv,ivk)  !from <SIG>
628    c$$$     $                 * mask_vk_run(iv,ivk) !from CN
629    c$$$               else
630    c$$$                  mask(iv,ivk,is) = -1
631    c$$$     $                 * mask_vk(iv,ivk)     !from DB
632    c$$$     $                 * mask_vk_ev(iv,ivk)  !from CN
633    c$$$               endif
634    c$$$            enddo
635    c$$$         enddo
636    c$$$      enddo
637    c$$$
638    c$$$
639    c$$$      return
640    c$$$      end
641    
642          subroutine stripmask(iv,ivk)
643    
644    *     -----------------------------------------------
645  *     this routine set va1 and single-strip masks,  *     this routine set va1 and single-strip masks,
646  *     on the basis of the VA1 mask saved in the DB  *     on the basis of the VA1 mask saved in the DB
647  *  *
648  *     mask(nviews,nva1_view,nstrips_va1) !strip mask  *     mask(nviews,nva1_view,nstrips_va1) !strip mask
649  *     mask_vk(nviews,nva1_view)          !VA1 mask  *     mask_vk(nviews,nva1_view)          !VA1 mask
650  *  *     -----------------------------------------------
651        include 'commontracker.f'        include 'commontracker.f'
652        include 'level1.f'        include 'level1.f'
653        include 'common_reduction.f'        include 'common_reduction.f'
654        include 'calib.f'        include 'calib.f'
655    
656  *     init mask  *     init mask
657        do iv=1,nviews        do is=1,nstrips_va1
658           do ivk=1,nva1_view  *        --------------------------------------------------------
659              do is=1,nstrips_va1  *        if VA1-mask from DB is 0 or 1, three masks are combined:
660  c               mask(iv,ivk,is) = mask_vk(iv,ivk)  *        - from DB (a-priori mask)
661                 mask(iv,ivk,is) = mask_vk(iv,ivk) * mask_vk_ev(iv,ivk)                *        - run-based (chip declared bad on the basis of <SIG>)
662              enddo  *        - event-based (failure in CN computation)
663           enddo  *        --------------------------------------------------------
664             if( mask_vk(iv,ivk) .ne. -1)then            
665                mask(iv,ivk,is) = 1
666         $           * mask_vk(iv,ivk)     !from DB
667         $           * mask_vk_ev(iv,ivk)  !from <SIG>
668         $           * mask_vk_run(iv,ivk) !from CN
669    *        -----------------------------------------------------------
670    *        if VA1-mask from DB is -1 only event-based mask is applied
671    *        -----------------------------------------------------------
672             else
673                mask(iv,ivk,is) = -1
674         $           * mask_vk(iv,ivk)     !from DB
675         $           * mask_vk_ev(iv,ivk)  !from CN
676             endif
677        enddo        enddo
678          
679          
680        return        return
681        end        end
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.23