C------------------------------------------------ FUNCTION RDTOFCAL(calname) C------------------------------------------------ include 'input_tof.txt' c----- HBOOK INTEGER HMEM parameter (NWPAWC=8500000) common/PAWC/HMEM(NWPAWC) parameter (ntp_tofcalib=60) c------------------------------------------------------------------------ c local variables c------------------------------------------------------------------------ character*250 calname character*250 calname1 character ch character*2 ch2 c------------------------------------------------------------------ COMMON/QUEST/IQUEST(100) C C------------------------------------------------------------------ C INTEGER lrec INTEGER istat, ierr, icycle PARAMETER (lrec=4096) C------------------------------------------------------------------------- c c HBOOK initialization c c------------------------------------------------------------------------ call HLIMIT(NWPAWC) c------------------------------------------------------------------------ c--------------- open ToF calib rz file c------------------------------------------------------------------------ do ii=1,250 c ch=calname(ii:ii) ch2=calname(ii:ii+1) c write(*,*) ii,ch c if (ch.eq.'.') goto 100 if (ch2.eq.'rz') goto 100 enddo 100 continue c calname1 = calname(1:ii)//'rz' calname1 = calname(1:ii+1) c print*,'__________ opening TOF calib rz file __________' c print*,calname c print*,calname1 CALL HROPEN(59,'TOF K1A',calname1,'QP',4096,istat) if (istat.ne.0) then ! check if HROPEN was OK write(*,*) 'Can''t open correct ToF calibration File !!!' stop endif c print*,' reading TOF CALIB n-tuple...' call HRIN(ntp_tofcalib,9999,0) call HBNAME(ntp_tofcalib,' ',0,'$CLEAR') call HBNAME(ntp_tofcalib,'TOFKA',k_s11s31,'$SET') call HBNAME(ntp_tofcalib,'TOFKB',k_s12s32,'$SET') call HBNAME(ntp_tofcalib,'TOFKC',k_s21s31,'$SET') call HBNAME(ntp_tofcalib,'TOFKD',k_s22s32,'$SET') call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET') call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET') call HBNAME(ntp_tofcalib,'TOFLIN21',x_coor_lin21,'$SET') call HBNAME(ntp_tofcalib,'TOFLIN22',y_coor_lin22,'$SET') call HBNAME(ntp_tofcalib,'TOFLIN31',y_coor_lin31,'$SET') call HBNAME(ntp_tofcalib,'TOFLIN32',x_coor_lin32,'$SET') call HBNAME(ntp_tofcalib,'TOFTW11',tw11,'$SET') call HBNAME(ntp_tofcalib,'TOFTW12',tw12,'$SET') call HBNAME(ntp_tofcalib,'TOFTW21',tw21,'$SET') call HBNAME(ntp_tofcalib,'TOFTW22',tw22,'$SET') call HBNAME(ntp_tofcalib,'TOFTW31',tw31,'$SET') call HBNAME(ntp_tofcalib,'TOFTW32',tw32,'$SET') call HBNAME(ntp_tofcalib,'TOFADC11',adcx11,'$SET') call HBNAME(ntp_tofcalib,'TOFADC12',adcx12,'$SET') call HBNAME(ntp_tofcalib,'TOFADC21',adcx21,'$SET') call HBNAME(ntp_tofcalib,'TOFADC22',adcx22,'$SET') call HBNAME(ntp_tofcalib,'TOFADC31',adcx31,'$SET') call HBNAME(ntp_tofcalib,'TOFADC32',adcx32,'$SET') c call HPRNTU(ntp_tofcalib) call HNOENT(ntp_tofcalib,iemax_cal) c write(*,*) 'Number of Events CALIB ',iemax_cal do iev=1,iemax_cal call HGNT(ntp_tofcalib,iev,ierr) !reads an event c write(34,*)iev,k1_s11s31,y_coor_lin11,tw11 enddo call hrout(ntp_tofcalib,icycle,' ') call hrend('TOF K1A') close(0) return end