      IMPLICIT NONE	
      
      INTEGER NPLANES, NTRKMAX

      PARAMETER (NTRKMAX=50)    !ncloyz_max*ncloxz_max)
      PARAMETER (NPLANES=6)    !ncloyz_max*ncloxz_max)

c     EVENT block:
*     -----------------------------------------------------------
      logical good2             !flag to mark good or noise events
      integer nev2              !level2 event number

c     CPU block (only for ground data):
*     -----------------------------------------------------------
      integer pkt_type          !CPU packet type identifier. see http://people.roma2.infn.it/~cpu/HB_list.txt
c     0x12 --> calibration board 0                  
c     0x13 --> calibration board 1              
c     0x10 --> event                            
c     0x30 --> full event for calib special     
c     0x83 --> tracker ALARM (control register) 
      integer pkt_num           !CPU packet number
      integer obt               !CPU on-board time
      integer which_calib       !calibration file identifier. see DW_DATE_NUM_calib.txt file


*     -----------------------------------------------------------
*     Common to store TRACK info
*     All the variables have a dimention equal to the number of
*     found tracks
*     -----------------------------------------------------------
c     TRACK PARAMETERS      
      integer ntrk              !# identified tracks
      real al                !track state vector
      integer xgood          !mask of used planes
      integer ygood          !*
      real xm                !measured points
      real ym                !*
      real zm                !*
      real resx              !spatial resolution
      real resy              !*
      real chi2              !chi2
      real xv               !calculated points
      real yv                !*
      real zv                !*
      real axv               !calculated angles (deg)
      real ayv               !*
*     -----------------------------------------------------------
*     Common to store SINGLET info
*     (clusters not associated with any track) 
*     -----------------------------------------------------------
      integer nclsx             !# unassociated clusters per plane X views
      integer nclsy             !     "            "      "   "    Y views


      integer tdcid(12),evcount(12)
      integer tdcmask(12),adc(4,12),tdc(4,12)
      integer temp1(12),temp2(12)
      integer*4 trig_evcount
      integer pmtpl(3), trigrate(6), dltime(2), s4calcount(2)
      integer pmtcount1(24), pmtcount2(24)
      integer*4 patternbusy(3)
      integer patterntrig(6), trigconf
      integer iflag(6), jflag(6)
      real beta(5),xtof(3),ytof(3),adc_c(4,12)
      real xout(3), yout(3)

      
      common/toflev1/good2,nev2,      
     $     pkt_type,pkt_num,obt,which_calib,
     $ tdcid,evcount,tdcmask,adc,tdc,temp1,temp2,
     $ beta, xtof, ytof, adc_c, iflag,jflag,
     $ xout, yout,
     $     trig_evcount, pmtpl, trigrate, dltime,
     &     s4calcount, pmtcount1, pmtcount2,
     &     patternbusy, patterntrig, trigconf,
     $     ntrk
     $     ,xm(nplanes,NTRKMAX)
     $     ,ym(nplanes,NTRKMAX)
     $     ,zm(nplanes,NTRKMAX)
     $     ,resx(nplanes,NTRKMAX)
     $     ,resy(nplanes,NTRKMAX)
     $     ,al(5,NTRKMAX)
     $     ,chi2(NTRKMAX)
     $     ,xgood(nplanes,NTRKMAX)
     $     ,ygood(nplanes,NTRKMAX)
     $     ,xv(nplanes,NTRKMAX)
     $     ,yv(nplanes,NTRKMAX)
     $     ,zv(nplanes,NTRKMAX)
     $     ,axv(nplanes,NTRKMAX)
     $     ,ayv(nplanes,NTRKMAX)
     $     ,nclsx(nplanes),nclsy(nplanes)
      SAVE /toflev1/

