1 |
C------------------------------------------------ |
C------------------------------------------------ |
2 |
FUNCTION RDTOFCAL(calname) |
FUNCTION RDTOFCAL(calname,cnlen) |
3 |
C------------------------------------------------ |
C------------------------------------------------ |
4 |
|
|
5 |
include 'input_tof.txt' |
include 'input_tof.txt' |
15 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
16 |
character*250 calname |
character*250 calname |
17 |
character*250 calname1 |
character*250 calname1 |
18 |
character ch |
c character ch |
19 |
character*2 ch2 |
c character*2 ch2 |
20 |
|
integer cnlen |
21 |
c------------------------------------------------------------------ |
c------------------------------------------------------------------ |
22 |
|
|
23 |
COMMON/QUEST/IQUEST(100) |
COMMON/QUEST/IQUEST(100) |
42 |
c--------------- open ToF calib rz file |
c--------------- open ToF calib rz file |
43 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
44 |
|
|
45 |
do ii=1,250 |
c do ii=1,250 |
46 |
c ch=calname(ii:ii) |
c ch=calname(ii:ii) |
|
ch2=calname(ii:ii+1) |
|
|
c write(*,*) ii,ch |
|
47 |
c if (ch.eq.'.') goto 100 |
c if (ch.eq.'.') goto 100 |
48 |
if (ch2.eq.'rz') goto 100 |
c enddo |
49 |
enddo |
c100 continue |
|
100 continue |
|
50 |
c calname1 = calname(1:ii)//'rz' |
c calname1 = calname(1:ii)//'rz' |
|
calname1 = calname(1:ii+1) |
|
51 |
|
|
52 |
c print*,'__________ opening TOF calib rz file __________' |
c do ii=1,250 |
53 |
c print*,calname |
cc ch=calname(ii:ii) |
54 |
c print*,calname1 |
c ch2=calname(ii:ii+1) |
55 |
|
cc write(*,*) ii,ch |
56 |
|
cc if (ch.eq.'.') goto 100 |
57 |
|
c if (ch2.eq.'rz') goto 100 |
58 |
|
c enddo |
59 |
|
c100 continue |
60 |
|
c calname1 = calname(1:ii)//'rz' |
61 |
|
c calname1 = calname(1:ii+1) |
62 |
|
|
63 |
|
calname1 = calname(1:cnlen) |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
CALL HROPEN(59,'TOF K1A',calname1,'QP',4096,istat) |
CALL HROPEN(59,'TOFK1131',calname1,'QP',4096,istat) |
69 |
|
|
70 |
if (istat.ne.0) then ! check if HROPEN was OK |
if (istat.ne.0) then ! check if HROPEN was OK |
71 |
write(*,*) 'Can''t open correct ToF calibration File !!!' |
write(*,*) 'Can''t open correct ToF calibration File !!!' |
72 |
stop |
stop |
73 |
endif |
endif |
74 |
|
|
|
c print*,' reading TOF CALIB n-tuple...' |
|
|
|
|
75 |
call HRIN(ntp_tofcalib,9999,0) |
call HRIN(ntp_tofcalib,9999,0) |
76 |
|
|
77 |
call HBNAME(ntp_tofcalib,' ',0,'$CLEAR') |
call HBNAME(ntp_tofcalib,' ',0,'$CLEAR') |
78 |
|
|
79 |
call HBNAME(ntp_tofcalib,'TOFKA',k_s11s31,'$SET') |
call HBNAME(ntp_tofcalib,'TOFK1131',k_s11s31,'$SET') |
80 |
call HBNAME(ntp_tofcalib,'TOFKB',k_s12s32,'$SET') |
call HBNAME(ntp_tofcalib,'TOFK1132',k_s11s32,'$SET') |
81 |
call HBNAME(ntp_tofcalib,'TOFKC',k_s21s31,'$SET') |
call HBNAME(ntp_tofcalib,'TOFK1231',k_s12s31,'$SET') |
82 |
call HBNAME(ntp_tofcalib,'TOFKD',k_s22s32,'$SET') |
call HBNAME(ntp_tofcalib,'TOFK1232',k_s12s32,'$SET') |
83 |
|
|
84 |
|
call HBNAME(ntp_tofcalib,'TOFK2131',k_s21s31,'$SET') |
85 |
|
call HBNAME(ntp_tofcalib,'TOFK2132',k_s21s32,'$SET') |
86 |
|
call HBNAME(ntp_tofcalib,'TOFK2231',k_s22s31,'$SET') |
87 |
|
call HBNAME(ntp_tofcalib,'TOFK2232',k_s22s32,'$SET') |
88 |
|
|
89 |
|
call HBNAME(ntp_tofcalib,'TOFK1121',k_s11s21,'$SET') |
90 |
|
call HBNAME(ntp_tofcalib,'TOFK1122',k_s11s22,'$SET') |
91 |
|
call HBNAME(ntp_tofcalib,'TOFK1221',k_s12s21,'$SET') |
92 |
|
call HBNAME(ntp_tofcalib,'TOFK1222',k_s12s22,'$SET') |
93 |
|
|
94 |
|
C-------------- |
95 |
|
|
96 |
call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET') |
call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET') |
97 |
call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET') |
call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET') |
117 |
c call HPRNTU(ntp_tofcalib) |
c call HPRNTU(ntp_tofcalib) |
118 |
|
|
119 |
call HNOENT(ntp_tofcalib,iemax_cal) |
call HNOENT(ntp_tofcalib,iemax_cal) |
|
c write(*,*) 'Number of Events CALIB ',iemax_cal |
|
120 |
|
|
121 |
do iev=1,iemax_cal |
do iev=1,iemax_cal |
122 |
call HGNT(ntp_tofcalib,iev,ierr) !reads an event |
call HGNT(ntp_tofcalib,iev,ierr) !reads an event |
|
c write(34,*)iev,k1_s11s31,y_coor_lin11,tw11 |
|
123 |
enddo |
enddo |
124 |
|
|
125 |
call hrout(ntp_tofcalib,icycle,' ') |
call hrout(ntp_tofcalib,icycle,' ') |
126 |
call hrend('TOF K1A') |
call hrend('TOFK1131') |
127 |
close(0) |
close(0) |
128 |
|
|
129 |
return |
return |