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