/[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.19 by pam-fi, Mon May 14 11:03:06 2007 UTC revision 1.21 by pam-fi, Tue Aug 7 13:56:29 2007 UTC
# Line 33  c$$$      warning = .true. Line 33  c$$$      warning = .true.
33    
34        call init_level1        call init_level1
35    
36    c      debug=.true.
37    
38        if(debug)print*,'-- check LEVEL0 status'        if(debug)print*,'-- check LEVEL0 status'
39    
40          ievco=-1
41          mismatch=0
42  c      good1 = good0  c      good1 = good0
43  c--------------------------------------------------  c--------------------------------------------------
44  c     check the LEVEL0 event status for missing  c     check the LEVEL0 event status for missing
# Line 51  c           ------------------------ Line 55  c           ------------------------
55  c           CRC error  c           CRC error
56  c           ------------------------  c           ------------------------
57              if(crc(iv).eq.1) then              if(crc(iv).eq.1) then
58                 GOOD1(DSPnumber(iv)) = 2  c               GOOD1(DSPnumber(iv)) = 2
59                 goto 18 !next view  c               GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**1
60                   GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**1)
61     102           format(' * WARNING * Event ',i7,' view',i3
62         $          ,' CRC error')
63                   if(debug)write(*,102)eventn(1),DSPnumber(iv)
64    c               goto 18 !next view
65              endif              endif
66  c           ------------------------  c           ------------------------
67  c           online-software alarm  c           online-software alarm
# Line 67  c           ------------------------ Line 76  c           ------------------------
76       $           fc(iv).ne.0.or.       $           fc(iv).ne.0.or.
77       $           DATAlength(iv).eq.0.or.       $           DATAlength(iv).eq.0.or.
78       $           .false.)then       $           .false.)then
79                 GOOD1(DSPnumber(iv))=3  c               GOOD1(DSPnumber(iv))=3
80                 goto 18  c               GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**2
81                   GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**2)
82     103           format(' * WARNING * Event ',i7,' view',i3
83         $          ,' software alarm')
84                   if(debug)write(*,103)eventn(1),DSPnumber(iv)
85    c               goto 18
86              endif              endif
87  c           ------------------------  c           ------------------------
88  c           DSP-counter jump  c           DSP-counter jump
89  c           ------------------------  c           ------------------------
90              if(  c     commentato perche` non e` un controllo significativo nel caso in cui
91       $           eventn_old(iv).ne.0.and. !first event in this file  c     la subroutine venga chiamata per riprocessare l'evento
92       $           eventn(iv).ne.1.and.     !first event in run  c     sostituito con un check dei contatori dei vari dsp
93       $           good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted  c$$$            if(
94       $           .true.)then  c$$$     $           eventn_old(iv).ne.0.and. !first event in this file
95    c$$$     $           eventn(iv).ne.1.and.     !first event in run
96                 if(eventn(iv).ne.(eventn_old(iv)+1))then  c$$$     $           good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted
97                    GOOD1(DSPnumber(iv))=4  c$$$     $           .true.)then
98                    goto 18  c$$$
99    c$$$               if(eventn(iv).ne.(eventn_old(iv)+1))then
100    c$$$c                  GOOD1(DSPnumber(iv))=4
101    c$$$c                  GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**3
102    c$$$                  GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**3)
103    c$$$ 104              format(' * WARNING * Event ',i7,' view',i3
104    c$$$     $          ,' counter jump ',i10,i10)
105    c$$$                  if(debug)write(*,104)eventn(1),DSPnumber(iv)
106    c$$$     $                 ,eventn_old(iv),eventn(iv))
107    c$$$                  goto 18
108    c$$$               endif
109    c$$$
110    c$$$            endif
111    c           ------------------------
112    c 18         continue
113    c           ------------------------
114    c           DSP-counter
115    c           ------------------------
116                if( DSPnumber(iv).ne.0.and.GOOD1(DSPnumber(iv)).ne.1)then
117                   if(iv.ne.1.and.ievco.ne.-1)then
118                      if( eventn(iv).ne.ievco )then
119                         mismatch=1
120                      endif
121                 endif                 endif
122                   ievco = eventn(iv)
123              endif              endif
 c           ------------------------  
  18         continue  
124           endif           endif
125        enddo        enddo
126    
127    c      print*,'*** ',(eventn(iv),iv=1,12)
128          
129          if(mismatch.eq.1.and.debug)
130         $     print*,' * WARNING * DSP counter mismatch: '
131         $     ,(eventn(iv),iv=1,12)
132    
133        ngood = 0        ngood = 0
134        do iv = 1,nviews        do iv = 1,nviews
135            
136             if(mismatch.eq.1.and.GOOD1(iv).ne.1)
137         $        GOOD1(iv)=ior(GOOD1(iv),2**3)
138    
139           eventn_old(iv) = eventn(iv)           eventn_old(iv) = eventn(iv)
140           good_old(iv)   = good1(iv)           good_old(iv)   = good1(iv)
141           ngood = ngood + good1(iv)           ngood = ngood + good1(iv)
142    
143        enddo        enddo
144        if(debug.and.ngood.ne.0)print*,'* WARNING * LEVEL0 event status: '  c$$$      if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1)
145       $     ,(good1(i),i=1,nviews)  c$$$     $     ,':LEVEL0 event status: '
146    c$$$     $     ,(good1(i),i=1,nviews)
147  c--------------------------------------------------  c--------------------------------------------------
148  c     read the variable DATATRACKER from LEVEL0  c     read the variable DATATRACKER from LEVEL0
149  c     and fill the variable ADC (invertin view 11)  c     and fill the variable ADC (invertin view 11)
# Line 140  c--------------------------------------- Line 186  c---------------------------------------
186              endif              endif
187           enddo           enddo
188   100     format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)   100     format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)
189           if(ima.ne.0.and.debug)write(*,100)eventn(1),iv           if(ima.ne.0.and.verbose)write(*,100)eventn(1),iv
190       $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)       $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)
191  c         if(ima.ne.0)write(*,100)eventn(1),iv  c         if(ima.ne.0)write(*,100)eventn(1),iv
192  c     $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)    c     $        ,(mask_vk_ev(iv,ik),ik=1,nva1_view)  
# Line 161  c--------------------------------------- Line 207  c---------------------------------------
207          do is=1,nstrips_view    !loop on strips (1)          do is=1,nstrips_view    !loop on strips (1)
208            if(mod(iv,2).eq.1) then            if(mod(iv,2).eq.1) then
209  C===  > Y view  C===  > Y view
210    c             print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is))
211    c     $            ,cn(iv,nvk(is))
212    c     $            ,pedestal(iv,nvk(is),nst(is))
213              value(is)= -(DBLE(adc(iv,nvk(is),nst(is)))              value(is)= -(DBLE(adc(iv,nvk(is),nst(is)))
214       $           -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is)))       $           -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is)))
215       $           *mask(iv,nvk(is),nst(is))       $           *mask(iv,nvk(is),nst(is))
# Line 191  C===  > X view Line 240  C===  > X view
240          else          else
241             fshower(iv) = 1             fshower(iv) = 1
242  c           GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!!  c           GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!!
243             GOOD1(iv) = 11  c           GOOD1(iv) = 11
244    c           GOOD1(iv) = GOOD1(iv) + 2**5
245               GOOD1(iv) = ior(GOOD1(iv),2**5)
246   101       format(' * WARNING * Event ',i7,' view',i3   101       format(' * WARNING * Event ',i7,' view',i3
247       $          ,' #clusters > ',i5,' --> MASKED')       $          ,' #clusters > ',i5,' --> MASKED')
248             if(debug)write(*,101)eventn(1),iv,nclstrmax_view             if(verbose)write(*,101)eventn(1),iv,nclstrmax_view
249          endif          endif
250        enddo                     ! end loop on views        enddo                     ! end loop on views
251        do iv=1,nviews        do iv=1,nviews
# Line 214  C--------------------------------------- Line 265  C---------------------------------------
265        do iv = 1,nviews        do iv = 1,nviews
266           ngood = ngood + good1(iv)           ngood = ngood + good1(iv)
267        enddo        enddo
268        if(debug.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1)        if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1)
269       $     ,':LEVEL1 event status: '       $     ,':LEVEL1 event status: '
270       $     ,(good1(i),i=1,nviews)       $     ,(good1(i),i=1,nviews)
271  c------------------------------------------------------------------------  c------------------------------------------------------------------------
# Line 403  c     add strips exceeding inclusion cut Line 454  c     add strips exceeding inclusion cut
454  c------------------------------------------------------------------------  c------------------------------------------------------------------------
455                    if( (rmax-lmax+1).ge.nclstrp )goto 210   !exits inclusion loop                    if( (rmax-lmax+1).ge.nclstrp )goto 210   !exits inclusion loop
456    
457                    if(rstop.eq.0) then !if right cluster morder has not been reached                    if(rstop.eq.0) then !if right cluster border has not been reached
458                       if(value(ir).gt.clinclcut(ir)) then                       if(value(ir).gt.clinclcut(ir)) then
459                          rmax=ir !include a strip on the right                          rmax=ir !include a strip on the right
460                       else                       else
# Line 413  c--------------------------------------- Line 464  c---------------------------------------
464    
465                    if( (rmax-lmax+1).ge.nclstrp )goto 210   !exits inclusion loop                    if( (rmax-lmax+1).ge.nclstrp )goto 210   !exits inclusion loop
466    
467                    if(lstop.eq.0) then !if left cluster morder has not been reached                    if(lstop.eq.0) then !if left cluster border has not been reached
468                       if(value(il).gt.clinclcut(il)) then                       if(value(il).gt.clinclcut(il)) then
469                          lmax=il !include a strip on the left                          lmax=il !include a strip on the left
470                       else                       else
# Line 421  c--------------------------------------- Line 472  c---------------------------------------
472                       endif                       endif
473                    endif                    endif
474    
475    c                  if( (rmax-lmax+1).ge.nclstrp )goto 210   !exits inclusion loop
476    
477                 enddo            !ends strip inclusion loop                 enddo            !ends strip inclusion loop
478                 goto 211                 goto 211
479   210           continue         !jumps here if more than nclstrp have been included   210           continue         !jumps here if more than nclstrp have been included
# Line 441  c--------------------------------------- Line 494  c---------------------------------------
494                    rmax = rmax+1                    rmax = rmax+1
495                    if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1                    if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1
496                 endif                 endif
497    c-------------------------------------------------------------------------------
498    c     adjust the cluster in order to have at least ANOTHER strip around the seed
499    c-------------------------------------------------------------------------------
500    c$$$               if(iseed-1.eq.lmax.and.lmax.ne.first)then
501    c$$$                  lmax = lmax-1
502    c$$$                  if( (rmax-lmax+1).gt.nclstrp )rmax=rmax-1
503    c$$$               endif
504    c$$$               if(iseed+1.eq.rmax.and.rmax.ne.last )then
505    c$$$                  rmax = rmax+1
506    c$$$                  if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1
507    c$$$               endif
508    c---------------------------------------------------
509    c     now we have 5 stored-strips around the maximum
510    c---------------------------------------------------
511    
512  c------------------------------------------------------------------------  c------------------------------------------------------------------------
513  c     adjust the cluster in order to store a minimum number of strips  c     adjust the cluster in order to store a minimum number of strips
# Line 572  c        posizione del cluster seed nell Line 639  c        posizione del cluster seed nell
639           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
640    
641              clsignal(ind) = value(j) ! clsignal array              clsignal(ind) = value(j) ! clsignal array
642    c$$$            print*,ind,clsignal(ind)
643              ivk=nvk(j)              ivk=nvk(j)
644              ist=nst(j)              ist=nst(j)
645    
# Line 587  c     if(value(j).gt.0) Line 654  c     if(value(j).gt.0)
654       $           sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge       $           sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge
655           enddo           enddo
656    
657  c         print*,'view ',iv,' -- save_cluster -- nclstr1: '  c$$$         print*,'view ',iv,' -- save_cluster -- nclstr1: '
658  c     $        ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1)  c$$$     $        ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1)
659            c$$$         print*,'----------------------'
660    
661        enddo        enddo
662                
663        return        return
# Line 661  c$$$      end Line 729  c$$$      end
729  *        - run-based (chip declared bad on the basis of <SIG>)  *        - run-based (chip declared bad on the basis of <SIG>)
730  *        - event-based (failure in CN computation)  *        - event-based (failure in CN computation)
731  *        --------------------------------------------------------  *        --------------------------------------------------------
732    c         print*,iv,ivk
733    c     $        ,mask_vk(iv,ivk),mask_vk_ev(iv,ivk),mask_vk_run(iv,ivk)
734           if( mask_vk(iv,ivk) .ne. -1)then                       if( mask_vk(iv,ivk) .ne. -1)then            
735              mask(iv,ivk,is) = 1              mask(iv,ivk,is) = 1
736       $           * mask_vk(iv,ivk)     !from DB       $           * mask_vk(iv,ivk)     !from DB

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

  ViewVC Help
Powered by ViewVC 1.1.23