| 10 | 
 *   | 
 *   | 
| 11 | 
 ************************************************************************* | 
 ************************************************************************* | 
| 12 | 
  | 
  | 
| 13 | 
       subroutine reductionflight() | 
       subroutine reductionflight(ierror) | 
| 14 | 
  | 
  | 
| 15 | 
       include 'commontracker.f' | 
       include 'commontracker.f' | 
| 16 | 
       include 'level0.f' | 
       include 'level0.f' | 
| 18 | 
       include 'common_reduction.f' | 
       include 'common_reduction.f' | 
| 19 | 
       include 'calib.f' | 
       include 'calib.f' | 
| 20 | 
        | 
        | 
| 21 | 
  | 
       integer ierror | 
| 22 | 
  | 
       ierror = 0 | 
| 23 | 
  | 
  | 
| 24 | 
 *     ------------------------------------------------------- | 
 *     ------------------------------------------------------- | 
| 25 | 
 *     STRIP MASK | 
 *     STRIP MASK | 
| 28 | 
       call stripmask | 
       call stripmask | 
| 29 | 
       call init_level1 | 
       call init_level1 | 
| 30 | 
  | 
  | 
 | 
 C--------------------------------------------------- | 
  | 
 | 
 C     variables in blocks GENERAL and CPU are anyway filled | 
  | 
 | 
 C     in order to mantain sincronization among  | 
  | 
 | 
 C     events at different levels | 
  | 
 | 
 C--------------------------------------------------- | 
  | 
| 31 | 
       good1=good0 | 
       good1=good0 | 
 | 
 c$$$      do iv=1,12 | 
  | 
 | 
 c$$$        crc1(iv)=crc(iv) | 
  | 
 | 
 c$$$      enddo | 
  | 
 | 
 ccc      print*,'totdatalength(reduction)=',TOTDATAlength | 
  | 
 | 
 ccc      print*,'' | 
  | 
| 32 | 
 c-------------------------------------------------- | 
 c-------------------------------------------------- | 
| 33 | 
 c     read the variable DATATRACKER from LEVEL0 | 
 c     read the variable DATATRACKER from LEVEL0 | 
| 34 | 
 c     and fill the variable ADC (inverting view 11) | 
 c     and fill the variable ADC (inverting view 11) | 
| 36 | 
       call filladc(iflag)  | 
       call filladc(iflag)  | 
| 37 | 
       if(iflag.ne.0)then | 
       if(iflag.ne.0)then | 
| 38 | 
         good1=0 | 
         good1=0 | 
| 39 | 
         print*,'event ',eventn(1),' >>>>>  decode ERROR' | 
 c       if(DEBUG)print*,'event ',eventn(1),' >>>>>  decode ERROR' | 
| 40 | 
  | 
         ierror = -220 | 
| 41 | 
         goto 200 | 
         goto 200 | 
| 42 | 
       endif | 
       endif | 
| 43 | 
  | 
  | 
| 49 | 
       do iv=1,nviews | 
       do iv=1,nviews | 
| 50 | 
         do ik=1,nva1_view | 
         do ik=1,nva1_view | 
| 51 | 
           cn(iv,ik)=0           !initializes cn variable | 
           cn(iv,ik)=0           !initializes cn variable | 
| 52 | 
           if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik)  | 
           iflag=0 | 
| 53 | 
  | 
           if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag) | 
| 54 | 
  | 
           if(iflag.ne.0)good1=0 | 
| 55 | 
         enddo | 
         enddo | 
| 56 | 
       enddo | 
       enddo | 
| 57 | 
  | 
       if(good1.eq.0)then  | 
| 58 | 
  | 
          ierror = 220 | 
| 59 | 
  | 
 c         if(WARNING) | 
| 60 | 
  | 
 c     $     print*,' WARNING - cncomp: CN computation failure ' | 
| 61 | 
  | 
       endif | 
| 62 | 
  | 
  | 
| 63 | 
 c--------------------------------------------- | 
 c--------------------------------------------- | 
| 64 | 
 c     loops on views, VA1 and strips,  | 
 c     loops on views, VA1 and strips,  | 
| 104 | 
 ccc          print*,"cnev(",iv,",",ik,")(reduction)= ",cnev(iv,ik) | 
 ccc          print*,"cnev(",iv,",",ik,")(reduction)= ",cnev(iv,ik) | 
| 105 | 
         enddo | 
         enddo | 
| 106 | 
       enddo | 
       enddo | 
 | 
 c$$$      nevent_good = nevent_good + 1 | 
  | 
 | 
        | 
  | 
| 107 | 
 C--------------------------------------------- | 
 C--------------------------------------------- | 
| 108 | 
 C     come here if GOOD1=0 | 
 C     come here if GOOD1=0 | 
| 109 | 
 C     or the event has too many clusters | 
 C     or the event has too many clusters | 
| 110 | 
 C--------------------------------------------- | 
 C--------------------------------------------- | 
 | 
  | 
  | 
| 111 | 
  200  continue | 
  200  continue | 
 | 
 ccc      print*,'nclstr1(reduction)=',nclstr1 | 
  | 
| 112 | 
 c------------------------------------------------------------------------ | 
 c------------------------------------------------------------------------ | 
| 113 | 
 c      | 
 c | 
| 114 | 
 c     closes files and exits | 
 c     closes files and exits | 
| 115 | 
 c      | 
 c | 
| 116 | 
 c------------------------------------------------------------------------ | 
 c------------------------------------------------------------------------ | 
| 117 | 
              | 
       RETURN | 
| 118 | 
       RETURN                    | 
       END  | 
 | 
       END                       | 
  | 
| 119 | 
  | 
  | 
| 120 | 
 ***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...*** | 
 ***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...*** | 
| 121 | 
 * | 
 * | 
| 417 | 
                            lmax=rmax-nclstrp+1 | 
                            lmax=rmax-nclstrp+1 | 
| 418 | 
                         endif | 
                         endif | 
| 419 | 
                      endif | 
                      endif | 
 | 
                       | 
  | 
| 420 | 
                   endif | 
                   endif | 
| 421 | 
                elseif(value(iseed+1).gt.value(iseed-1)) then | 
                elseif(value(iseed+1).gt.value(iseed-1)) then | 
| 422 | 
 c     !??? sposto il limite del cluster a destra per includere sempre le strip  | 
 c     !??? sposto il limite del cluster a destra per includere sempre le strip  | 
| 470 | 
                   nclstr1=0 | 
                   nclstr1=0 | 
| 471 | 
                   totCLlength=0 | 
                   totCLlength=0 | 
| 472 | 
                   flag_shower = .true. | 
                   flag_shower = .true. | 
| 473 | 
                   print*,'Event ',eventn(1), | 
                   if(verbose)print*,'Event ',eventn(1), | 
| 474 | 
      $                 ': more than ',nclstrmax,' clusters' | 
      $                 ': more than ',nclstrmax,' clusters' | 
| 475 | 
                   goto 2000 | 
                   goto 2000 | 
| 476 | 
                endif | 
                endif | 
| 495 | 
      $                 dedx(nclstr1)=dedx(nclstr1)+value(j) !cluster charge | 
      $                 dedx(nclstr1)=dedx(nclstr1)+value(j) !cluster charge | 
| 496 | 
                enddo | 
                enddo | 
| 497 | 
 c-------------------------------------------------------- | 
 c-------------------------------------------------------- | 
| 498 | 
 c      | 
 c | 
| 499 | 
 c-------------------------------------------------------- | 
 c-------------------------------------------------------- | 
| 500 | 
             endif               !end possible seed conditio | 
             endif               !end possible seed conditio | 
| 501 | 
  220        continue            !jumps here to skip strips left of last seed | 
  220        continue            !jumps here to skip strips left of last seed | 
| 528 | 
       include 'level1.f' | 
       include 'level1.f' | 
| 529 | 
       include 'calib.f' | 
       include 'calib.f' | 
| 530 | 
  | 
  | 
 | 
 c$$$      character*20 data_file | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$      character*3 aid | 
  | 
 | 
 c$$$      character*6 adate | 
  | 
 | 
 c$$$      integer id | 
  | 
 | 
 c$$$      integer date | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     ---------------------- | 
  | 
 | 
 c$$$*     retrieve date and id | 
  | 
 | 
 c$$$      aid=data_file(8:10) | 
  | 
 | 
 c$$$      adate=data_file(2:6) | 
  | 
 | 
 c$$$      READ (aid, '(I3)'), id | 
  | 
 | 
 c$$$      READ (adate, '(I6)'), date | 
  | 
 | 
 c$$$*     ---------------------- | 
  | 
 | 
     | 
  | 
| 531 | 
 *     init mask | 
 *     init mask | 
| 532 | 
       do iv=1,nviews | 
       do iv=1,nviews | 
| 533 | 
          do ivk=1,nva1_view | 
          do ivk=1,nva1_view | 
| 537 | 
          enddo | 
          enddo | 
| 538 | 
       enddo | 
       enddo | 
| 539 | 
  | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 2 - VK 23-24 | 
  | 
 | 
 c$$$*     couple of vk damaged during integration | 
  | 
 | 
 c$$$      if(date.ge.50208)then | 
  | 
 | 
 c$$$cc         print*,'MASK: view 2 - vk 23/24' | 
  | 
 | 
 c$$$         mask_vk(2,23)=0 | 
  | 
 | 
 c$$$         mask_vk(2,24)=0 | 
  | 
 | 
 c$$$         do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(2,23,is)=0 | 
  | 
 | 
 c$$$            mask(2,24,is)=0 | 
  | 
 | 
 c$$$         enddo | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 7 - VK 11-12 | 
  | 
 | 
 c$$$      if(date.ge.50209)then | 
  | 
 | 
 c$$$        if(.not.(date.eq.50209.and.id.le.6)) then | 
  | 
 | 
 c$$$cc          print*,'MASK: view 7 - vk 11/12' | 
  | 
 | 
 c$$$          mask_vk(7,11)=0 | 
  | 
 | 
 c$$$          mask_vk(7,12)=0 | 
  | 
 | 
 c$$$          do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(7,11,is)=0 | 
  | 
 | 
 c$$$            mask(7,12,is)=0 | 
  | 
 | 
 c$$$          enddo | 
  | 
 | 
 c$$$        endif | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 7 - VK 21-22 | 
  | 
 | 
 c$$$      if(date.ge.50316)then | 
  | 
 | 
 c$$$cc         print*,'MASK: view 7 - vk 21/22' | 
  | 
 | 
 c$$$         mask_vk(7,21)=0 | 
  | 
 | 
 c$$$         mask_vk(7,22)=0 | 
  | 
 | 
 c$$$         do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(7,21,is)=0 | 
  | 
 | 
 c$$$            mask(7,22,is)=0 | 
  | 
 | 
 c$$$         enddo | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 12 - VK 1-2-3-4 | 
  | 
 | 
 c$$$      if((date.eq.50317).and.(id.le.3))then | 
  | 
 | 
 c$$$cc        print*,'MASK: view 12 - vk 1/2/3/4' | 
  | 
 | 
 c$$$        mask_vk(12,1)=0 | 
  | 
 | 
 c$$$        mask_vk(12,2)=0 | 
  | 
 | 
 c$$$        mask_vk(12,3)=0 | 
  | 
 | 
 c$$$        mask_vk(12,4)=0 | 
  | 
 | 
 c$$$        do is=1,nstrips_va1 | 
  | 
 | 
 c$$$          mask(12,1,is)=0 | 
  | 
 | 
 c$$$          mask(12,2,is)=0 | 
  | 
 | 
 c$$$          mask(12,3,is)=0 | 
  | 
 | 
 c$$$          mask(12,4,is)=0 | 
  | 
 | 
 c$$$        enddo | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 7 - VK 5-6 | 
  | 
 | 
 c$$$      if(date.ge.50320)then | 
  | 
 | 
 c$$$        if(.not.(date.eq.50320.and.id.le.3)) then | 
  | 
 | 
 c$$$cc          print*,'MASK: view 7 - vk 5/6' | 
  | 
 | 
 c$$$          mask_vk(7,5)=0 | 
  | 
 | 
 c$$$          mask_vk(7,6)=0 | 
  | 
 | 
 c$$$          do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(7,5,is)=0 | 
  | 
 | 
 c$$$            mask(7,6,is)=0 | 
  | 
 | 
 c$$$          enddo | 
  | 
 | 
 c$$$        endif | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 7 - VK 13-14 | 
  | 
 | 
 c$$$      if(date.ge.50320)then | 
  | 
 | 
 c$$$        if(.not.(date.eq.50320.and.id.le.5)) then | 
  | 
 | 
 c$$$cc          print*,'MASK: view 7 - vk 13/14' | 
  | 
 | 
 c$$$          mask_vk(7,13)=0 | 
  | 
 | 
 c$$$          mask_vk(7,14)=0 | 
  | 
 | 
 c$$$          do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(7,13,is)=0 | 
  | 
 | 
 c$$$            mask(7,14,is)=0 | 
  | 
 | 
 c$$$          enddo | 
  | 
 | 
 c$$$        endif | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$***   SAMARA | 
  | 
 | 
 c$$$***   SAMARA | 
  | 
 | 
 c$$$***   SAMARA | 
  | 
 | 
 c$$$*     it needs further checks... | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 7 - VK 9-10 | 
  | 
 | 
 c$$$*     VIEW 12 - VK 1-2-3-4 | 
  | 
 | 
 c$$$      if((date.eq.50516).and.(id.le.8))then | 
  | 
 | 
 c$$$cc        print*,'MASK: view 7 - vk 9/10' | 
  | 
 | 
 c$$$cc        print*,'MASK: view 12 - vk 1/2/3/4' | 
  | 
 | 
 c$$$        mask_vk(7,9)=0 | 
  | 
 | 
 c$$$        mask_vk(7,10)=0 | 
  | 
 | 
 c$$$        mask_vk(12,1)=0 | 
  | 
 | 
 c$$$        mask_vk(12,2)=0 | 
  | 
 | 
 c$$$        mask_vk(12,3)=0 | 
  | 
 | 
 c$$$        mask_vk(12,4)=0 | 
  | 
 | 
 c$$$        do is=1,nstrips_va1 | 
  | 
 | 
 c$$$          mask(7,9,is)=0 | 
  | 
 | 
 c$$$          mask(7,10,is)=0 | 
  | 
 | 
 c$$$          mask(12,1,is)=0 | 
  | 
 | 
 c$$$          mask(12,2,is)=0 | 
  | 
 | 
 c$$$          mask(12,3,is)=0 | 
  | 
 | 
 c$$$          mask(12,4,is)=0 | 
  | 
 | 
 c$$$        enddo | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 7 - VK 9-10 | 
  | 
 | 
 c$$$      if(date.ge.50516)then | 
  | 
 | 
 c$$$        if(.not.(date.eq.50516.and.id.le.8)) then | 
  | 
 | 
 c$$$cc          print*,'MASK: view 7 - vk 9/10' | 
  | 
 | 
 c$$$          mask_vk(7,9)=0 | 
  | 
 | 
 c$$$          mask_vk(7,10)=0 | 
  | 
 | 
 c$$$          do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(7,9,is)=0 | 
  | 
 | 
 c$$$            mask(7,10,is)=0 | 
  | 
 | 
 c$$$          enddo | 
  | 
 | 
 c$$$        endif | 
  | 
 | 
 c$$$      endif | 
  | 
 | 
 c$$$ | 
  | 
 | 
 c$$$*     --------------------- | 
  | 
 | 
 c$$$*     VIEW 12 - VK 7-8 | 
  | 
 | 
 c$$$      if(date.ge.50523)then | 
  | 
 | 
 c$$$        if(.not.(date.eq.50523.and.id.le.3)) then | 
  | 
 | 
 c$$$cc          print*,'MASK: view 12 - vk 7/8' | 
  | 
 | 
 c$$$          mask_vk(12,7)=0 | 
  | 
 | 
 c$$$          mask_vk(12,8)=0 | 
  | 
 | 
 c$$$          do is=1,nstrips_va1 | 
  | 
 | 
 c$$$            mask(12,7,is)=0 | 
  | 
 | 
 c$$$            mask(12,8,is)=0 | 
  | 
 | 
 c$$$          enddo | 
  | 
 | 
 c$$$        endif | 
  | 
 | 
 c$$$      endif | 
  | 
| 540 | 
  | 
  | 
| 541 | 
       return | 
       return | 
| 542 | 
       end  | 
       end  |