      subroutine hec_his
c
c system histogram package
c can pre require:
c     pedestal package
c     cubic fit package
c     calibration package
c     search package
c     beam package
c     max finder
c
c
c produce system histograms
c
      implicit none
c
      include'hec_par.inc'      !shared parameters
      include'hec_datacard.inc' !datacard values
c
c make system histograms if requested
c
      if (mk_his .le. 0) return
c
c book system histograms
c
      call hec_his_ini
c
c do one pass over data to fill some system histograms
c
      call hec_his_pass1
c
c output and delete system histograms
c
      call hec_his_ter
c
      print *, ' *** end of system histograms production'
c
      end
      


