1 |
C------------------------------------------------ |
2 |
FUNCTION RDTOFCAL(calname) |
3 |
C------------------------------------------------ |
4 |
|
5 |
include 'input_tof.txt' |
6 |
|
7 |
c----- HBOOK |
8 |
INTEGER HMEM |
9 |
parameter (NWPAWC=8500000) |
10 |
common/PAWC/HMEM(NWPAWC) |
11 |
|
12 |
parameter (ntp_tofcalib=60) |
13 |
c------------------------------------------------------------------------ |
14 |
c local variables |
15 |
c------------------------------------------------------------------------ |
16 |
character*250 calname |
17 |
character*250 calname1 |
18 |
c character ch |
19 |
character*2 ch2 |
20 |
c------------------------------------------------------------------ |
21 |
|
22 |
COMMON/QUEST/IQUEST(100) |
23 |
|
24 |
C |
25 |
C------------------------------------------------------------------ |
26 |
C |
27 |
|
28 |
INTEGER lrec |
29 |
INTEGER istat, ierr, icycle |
30 |
PARAMETER (lrec=4096) |
31 |
|
32 |
C------------------------------------------------------------------------- |
33 |
c |
34 |
c HBOOK initialization |
35 |
c |
36 |
c------------------------------------------------------------------------ |
37 |
|
38 |
call HLIMIT(NWPAWC) |
39 |
|
40 |
c------------------------------------------------------------------------ |
41 |
c--------------- open ToF calib rz file |
42 |
c------------------------------------------------------------------------ |
43 |
|
44 |
c do ii=1,250 |
45 |
c ch=calname(ii:ii) |
46 |
c if (ch.eq.'.') goto 100 |
47 |
c enddo |
48 |
c100 continue |
49 |
c calname1 = calname(1:ii)//'rz' |
50 |
|
51 |
do ii=1,250 |
52 |
c ch=calname(ii:ii) |
53 |
ch2=calname(ii:ii+1) |
54 |
c write(*,*) ii,ch |
55 |
c if (ch.eq.'.') goto 100 |
56 |
if (ch2.eq.'rz') goto 100 |
57 |
enddo |
58 |
100 continue |
59 |
c calname1 = calname(1:ii)//'rz' |
60 |
calname1 = calname(1:ii+1) |
61 |
|
62 |
|
63 |
|
64 |
|
65 |
CALL HROPEN(59,'TOFK1131',calname1,'QP',4096,istat) |
66 |
|
67 |
if (istat.ne.0) then ! check if HROPEN was OK |
68 |
write(*,*) 'Can''t open correct ToF calibration File !!!' |
69 |
stop |
70 |
endif |
71 |
|
72 |
call HRIN(ntp_tofcalib,9999,0) |
73 |
|
74 |
call HBNAME(ntp_tofcalib,' ',0,'$CLEAR') |
75 |
|
76 |
call HBNAME(ntp_tofcalib,'TOFK1131',k_s11s31,'$SET') |
77 |
call HBNAME(ntp_tofcalib,'TOFK1132',k_s11s32,'$SET') |
78 |
call HBNAME(ntp_tofcalib,'TOFK1231',k_s12s31,'$SET') |
79 |
call HBNAME(ntp_tofcalib,'TOFK1232',k_s12s32,'$SET') |
80 |
|
81 |
call HBNAME(ntp_tofcalib,'TOFK2131',k_s21s31,'$SET') |
82 |
call HBNAME(ntp_tofcalib,'TOFK2132',k_s21s32,'$SET') |
83 |
call HBNAME(ntp_tofcalib,'TOFK2231',k_s22s31,'$SET') |
84 |
call HBNAME(ntp_tofcalib,'TOFK2232',k_s22s32,'$SET') |
85 |
|
86 |
call HBNAME(ntp_tofcalib,'TOFK1121',k_s11s21,'$SET') |
87 |
call HBNAME(ntp_tofcalib,'TOFK1122',k_s11s22,'$SET') |
88 |
call HBNAME(ntp_tofcalib,'TOFK1221',k_s12s21,'$SET') |
89 |
call HBNAME(ntp_tofcalib,'TOFK1222',k_s12s22,'$SET') |
90 |
|
91 |
C-------------- |
92 |
|
93 |
call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET') |
94 |
call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET') |
95 |
call HBNAME(ntp_tofcalib,'TOFLIN21',x_coor_lin21,'$SET') |
96 |
call HBNAME(ntp_tofcalib,'TOFLIN22',y_coor_lin22,'$SET') |
97 |
call HBNAME(ntp_tofcalib,'TOFLIN31',y_coor_lin31,'$SET') |
98 |
call HBNAME(ntp_tofcalib,'TOFLIN32',x_coor_lin32,'$SET') |
99 |
|
100 |
call HBNAME(ntp_tofcalib,'TOFTW11',tw11,'$SET') |
101 |
call HBNAME(ntp_tofcalib,'TOFTW12',tw12,'$SET') |
102 |
call HBNAME(ntp_tofcalib,'TOFTW21',tw21,'$SET') |
103 |
call HBNAME(ntp_tofcalib,'TOFTW22',tw22,'$SET') |
104 |
call HBNAME(ntp_tofcalib,'TOFTW31',tw31,'$SET') |
105 |
call HBNAME(ntp_tofcalib,'TOFTW32',tw32,'$SET') |
106 |
|
107 |
call HBNAME(ntp_tofcalib,'TOFADC11',adcx11,'$SET') |
108 |
call HBNAME(ntp_tofcalib,'TOFADC12',adcx12,'$SET') |
109 |
call HBNAME(ntp_tofcalib,'TOFADC21',adcx21,'$SET') |
110 |
call HBNAME(ntp_tofcalib,'TOFADC22',adcx22,'$SET') |
111 |
call HBNAME(ntp_tofcalib,'TOFADC31',adcx31,'$SET') |
112 |
call HBNAME(ntp_tofcalib,'TOFADC32',adcx32,'$SET') |
113 |
|
114 |
c call HPRNTU(ntp_tofcalib) |
115 |
|
116 |
call HNOENT(ntp_tofcalib,iemax_cal) |
117 |
|
118 |
do iev=1,iemax_cal |
119 |
call HGNT(ntp_tofcalib,iev,ierr) !reads an event |
120 |
enddo |
121 |
|
122 |
call hrout(ntp_tofcalib,icycle,' ') |
123 |
call hrend('TOFK1131') |
124 |
close(0) |
125 |
|
126 |
return |
127 |
end |
128 |
|