      subroutine hec_slow_pass
c
c quick dummy pass to get slow control info 
c
      implicit none
c
c user datacard values common
c
      include'hec_par.inc'      !shared parameters
      include'hec_datacard.inc'
      include'hec_hvstat.inc'
      include'hec_runh.inc'
      include'hec_stats_epio.inc' !epio banks stats
c
c set maximum epio buffers with dummy arrays
c
      include'hec_maxepio.inc'
c
c local variable declaration
c
      logical hec_nextevt_epio_slow
      external hec_nextevt_epio_slow
      integer iubuff, ierr
c
c initialize HV related variables
c
      lhvstat = .false.
      call vzero(ic_hvstat,i_adc_dim)
      call vfill(ic_hv_cor,i_adc_dim, 1.) ! preset HV correction factors to 1
      call vzero(ic_hv_known,i_adc_dim)
c
c do not try to read slow control records before 1998
c
      if (irunpd. lt. 7) return
c
      print *, ' '
      print *, ' *** starting slow control pass'
c
c initialise data io for pass
c
      call hec_io_pass_ini
c
c two logical slow control records/run
c
      do while ( hec_nextevt_epio_slow(epdatabuf,iepbufset) )
c
c handle end of event data io
c
c        print *, '*** slow pass *** again'
        call hec_io_pass_evt
c
      enddo
c
c print the epio banks stats
c
      if (in_typ(1) .eq. 2) call hec_stats_epio_print
c
c pass termination
c zebra
c
      if (in_typ(1) .eq. 1) then
        call fzendi(in_typ(2), 'T')
        call fzinfo(in_typ(2))
        rewind(in_typ(2))
c
c epio
c
      elseif (in_typ(1) .eq. 2) then
        call eprwnd(in_typ(2), iubuff, ierr)
        if (ierr .ne. 0) then
          print *, ' *** error calling eprwnd in hec_io_pass_ter', ierr
          stop
        endif
      endif
c
      if (stat_slow_pc .eq. 0) then
        print *, ' *** WARNING: no slow control PC block found'
      endif
      if (stat_slow_sps .eq. 0) then
        print *, ' *** WARNING: no slow control SPS block found'
      endif
      if (stat_slow_beam .eq. 0) then
        print *, ' *** WARNING: no slow control beam block found'
      endif
c
c fill HV status arrays for each cell.
c
      call hec_hvstat
c
      print *, ' *** slow control pass done'
c
      end

 
              
            
          
