SUBROUTINE dplot IMPLICIT NONE #include #include #include #include logical $ first integer $ id_tuple, ! ntuple ID number $ ltuple, ! length of ntuple $ hstat ! status of HBOOK I/O oper parameter( $ id_tuple = 1, $ ltuple = 11) character*8 $ tags_tuple(ltuple) ! ntuple varable names real $ tuple(ltuple) ! storage for ntuple entries integer $ is,il,ie,ih ! sector, layer, end, hit real $ bs, ! beam strobe $ ds ! detector strobe data tags_tuple $ /'event', 'sector', 'layer', 'end', 'hit', $ 'start', 'width', $ 'bs', 'ds', 'nhit', 'amp'/, $ first /.true./ save first ! test RSTDC --> RD and BL new stuff INTEGER*4 ii,jj,iseg,ilay,iend REAL*4 tmin,tmax tmin=00000. tmax=65000. if (first) then first = .false. call hropen(66,'RSTDC','rs_test.hbk','N',1024,hstat) call hbookn(id_tuple, 'RS TDC pulser test', ltuple, $ 'RSTDC', 30000, tags_tuple) call hcdir('//RSTDC',' ') end if call adcunp('RD','PED' ) CALL tdcunp('RD','RAW',tmin,tmax) CALL tdcunp('BV','RAW',tmin,tmax) CALL tdcunp('TS','RAW',tmin,tmax) do ii=1,2 write(*,*) 'Module ',ii, ' TDC=', tsttdc(ii,1), $ 'Width= ', tswtdc(ii,1) enddo bs = tsttdc(1,1) ! beam strobe ds = tsttdc(2,1) ! detector strobe do is = 1,24 ! for each sector do il = 1,21 ! for each layer do ie = 1,2 ! for each end do ih=1,rdthit(ie,il,is) ! for each hit call vzero(tuple, ltuple) ! clear array first tuple( 1) = nevt ! event number tuple( 2) = is ! sector number tuple( 3) = il ! layer number tuple( 4) = ie ! end number tuple( 5) = ih ! hit number tuple( 6) = rdttdc(ie,il,is,ih)! start time i-th hit tuple( 7) = rdwtdc(ie,il,is,ih)! width i-th hit tuple( 8) = bs ! beam strobe tuple( 9) = ds ! detector strobe tuple(10) = rdthit(ie,il,is) ! total number of hits tuple(11) = rdped(ie,il,is) ! amplitude call HFN(id_tuple, tuple) ! fill Ntuple enddo ! for each hit enddo ! for each end enddo ! for each layer enddo ! for each sector RETURN END c------------------------------------------------------------------------ subroutine define implicit none #include integer*4 nwpawc parameter (nwpawc=1000000) integer iquest common /quest/ iquest(100) real*4 hmemor common /pawc/ hmemor(nwpawc) c hbook stuff call hlimit(nwpawc) return end c------------------------------------------------------------------------ subroutine exec_on_exit implicit none #include #include integer $ icycle ! HBOOK cycle variable c ----- now save the ntuple ----- call hcdir('//RSTDC',' ') ! go to ntuple directory call hrout(1, icycle, 'NT') ! write ntuple out call hrend('RSTDC') ! close directory close(66) ! close file return end