      IMPLICIT NONE	
      
      INTEGER NPLANES, NTRKMAX, NSNGMAX

      PARAMETER (NSNGMAX=500)    !ncloyz_max*ncloxz_max)
      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
      logical crc,cpu_crc
      integer nev2              !level2 event number
      integer swcode

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               !*
      real dedx_x
      real dedx_y
      real bdl

*     -----------------------------------------------------------
*     Common to store SINGLET info
*     (clusters not associated with any track) 
*     -----------------------------------------------------------
      integer nclsx             !# unassociated clusters per plane X views
      integer planex
      real xs
      real sgnlxs
      integer nclsy             !     "            "      "   "    Y views
      integer planey
      real ys
      real sgnlys
      integer image
      real coval

      common/trklev2/good2,nev2,      
     $     which_calib,
     $     swcode,
     $     crc(12),
     $     pkt_type,pkt_num,obt,cpu_crc,
     $     ntrk
     $     ,image(ntrkmax)
     $     ,xm(nplanes,NTRKMAX)
     $     ,ym(nplanes,NTRKMAX)
     $     ,zm(nplanes,NTRKMAX)
     $     ,resx(nplanes,NTRKMAX)
     $     ,resy(nplanes,NTRKMAX)
     $     ,al(5,NTRKMAX)
     $     ,coval(5,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)
     $     ,dedx_x(ntrkmax)
     $     ,dedx_y(ntrkmax)
     $     ,bdl(ntrkmax)
     $     ,nclsx
     $     ,planex(nsngmax)
     $     ,xs(2,nsngmax)
     $     ,sgnlxs(nsngmax)
     $     ,nclsy
     $     ,planey(nsngmax)
     $     ,ys(2,nsngmax)
     $     ,sgnlys(nsngmax)
      

      SAVE /trklev2/

