subroutine hec_evth_epio c c read event header from epio block c implicit none c include'hec_epio.inc' !epio include'hec_evth.inc' !event header include'hec_runh.inc' !run header c c local variables c integer j integer ipat integer mask integer bit integer ilow,ihigh c c compare the run number from the event header with the one c from the run header c if (run_no .ne. ibankbuf(3)) then print *, ' *** WARNING *** inconsistent run number', + run_no, ibankbuf(3) endif c c add run number from event header to event common block c evt_rnum = ibankbuf(3) c c time c ilow=0 ihigh = ishft(run_start,-16) ihigh = ishft(ihigh, 16) ilow = ibankbuf(8) evt_time = ior(ihigh,ilow) c c for each pattern unit, unpack bits and fill common. c make this a common subroutine. c c pattern unit 1 c ipat = ibankbuf(9) do j = 1, 16 lpat_1(j) = .false. mask = 2**(j - 1) bit = iand(ipat, mask) if (bit .ne. 0) lpat_1(j) = .true. ccc print *,'lpat_1(j)-->',lpat_1(j) if (lpat_1(j)) i_trigcnt(j) = i_trigcnt(j) + 1 enddo c c pattern unit 2 c ipat = ibankbuf(10) do j = 1, 16 lpat_2(j) = .false. mask = 2**(j - 1) bit = iand(ipat, mask) if (bit .ne. 0) lpat_2(j) = .true. ccc print *,'ipat,lpat_2(j)-->',ipat,lpat_2(j) if (lpat_2(j)) i_trigcnt(j+16) = i_trigcnt(j+16) + 1 enddo c c pattern unit 3 c ipat = ibankbuf(11) do j= 1, 16 lpat_3(j) = .false. mask = 2**(j - 1) bit = iand(ipat, mask) if (bit .ne. 0) lpat_3(j) = .true. ccc print *,'ipat,lpat_3(j)-->',ipat,lpat_3(j) if (lpat_3(j)) i_trigcnt(j+32) = i_trigcnt(j+32) + 1 enddo c c pattern unit 4 c ipat = ibankbuf(12) do j = 1, 16 lpat_4(j) = .false. mask = 2**(j - 1) bit = iand(ipat, mask) if (bit .ne. 0) lpat_4(j) = .true. ccc print *,'ipat,lpat_4(j)-->',ipat,lpat_4(j) if (lpat_4(j)) i_trigcnt(j+48) = i_trigcnt(j+48) + 1 enddo c c print *,' *** EVTH read' c end