*************************************************************************
*     
*     Common level0_2003.f
*     
*     contains LEVEL0 ntuple variables definitions for 2003 test
*     
*     to be included in:
*     - ../readraw/readraw.F
*     - ../reduction/reduction.f
*     - !???
*     
*     10/9/2005 modified by david fedele to include general variables
*************************************************************************


c*****************************************************
cccccc 10/9/2005 modified by david fedele
ccc   EVENT block*********
c     GENERAL block:
c***************************************************
      logical good0             !flag to mark good or noise events
      integer nev0              !level0 event number
c*****************************************************
cccccc 10/9/2005 modified by david fedele
      integer which_calib       !calibration file identifier. see DW_DATE_NUM_calib.txt file
      integer swcode            !version of the software
c*****************************************************
      
c     CPU block:
      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
c*****************************************************
cccccc 10/9/2005 modified by david fedele
c      integer which_calib       !calibration file identifier. see DW_DATE_NUM_calib.txt file
      logical cpu_crc           !CPU crc controll
c*****************************************************


c     HEADER block:
c     header variables for each view:
      integer DAQmode(12)       !9  = full acquisition mode
                                !10 = compressed acquisition mode
                                !11 = compressed+full acquisition mode
      integer DSPnumber(12)     !view number
      integer DATAlength(12)    !data buffer length
      integer eventn(12)        !DSP event number
      integer nclust(12)        !nclust*2+1 = number of strips to be 
                                ! included in cluster
      integer cutc(12)          !cut to include strips in a cluster
      integer cutcl(12)         !cut to search for clusters
      integer addrcluster(12,3) !address of the greatest cluster(view,ladder)
      integer signcluster(12,3) !signal of the greatest cluster(view,ladder)
      integer fc(12)            !compression flag
      integer compressiontime(12) !DSP program compression time
      integer fl5(12)           !flag
      integer fl4(12)           !flag
      integer fl3(12)           !flag
      integer fl2(12)           !flag
      integer fl1(12)           !flag
      integer fl6(12)           !flag
      integer checksum(12)      !DSP header checksum
      integer pnum(12)          !peripheral number
      integer cmdnum(12)        !command number
      integer bid(12)           !board identifier
      integer alarm(12)         !alarm
      integer aswr(12)          !response length
c*****************************************************
cccccc 10/9/2005 modified by david fedele
      logical crc(12)           !DSP crc controll
c*****************************************************

      

c     DATA block:
      integer TOTDATAlength     !sum of all views datalength (to assign 
                                ! dimension to datatracker array)
      integer datatracker(49152) !data tracker buffer (.DAT raw data)


c*****************************************************
cccccc 10/9/2005 modified by david fedele
c      common/level0_event/good0,nev0
c     $     ,pkt_type,pkt_num,obt,which_calib
c     $     ,DAQmode,DSPnumber,DATAlength,eventn,nclust,cutc,cutcl
c     $     ,addrcluster,signcluster,fc,compressiontime
c     $     ,fl5,fl4,fl3,fl2,fl1,fl6,checksum
c     $     ,TOTDATAlength,datatracker,pnum,cmdnum,bid,alarm,aswr
      common/level0_event/good0,nev0,which_calib,swcode
     $     ,pkt_type,pkt_num,obt,cpu_crc
     $     ,DAQmode,DSPnumber,DATAlength,eventn,nclust,cutc,cutcl
     $     ,addrcluster,signcluster,fc,compressiontime
     $     ,fl5,fl4,fl3,fl2,fl1,fl6,checksum,crc,TOTDATAlength
     $     ,datatracker,pnum,cmdnum,bid,alarm,aswr
c***********************************************************
      
