1 |
mocchiut |
1.1 |
C------------------------------------------------ |
2 |
mocchiut |
1.4 |
FUNCTION RDTOFCAL(calname,cnlen) |
3 |
mocchiut |
1.1 |
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 |
mocchiut |
1.3 |
c character ch |
19 |
mocchiut |
1.4 |
c character*2 ch2 |
20 |
|
|
integer cnlen |
21 |
mocchiut |
1.1 |
c------------------------------------------------------------------ |
22 |
|
|
|
23 |
|
|
COMMON/QUEST/IQUEST(100) |
24 |
|
|
|
25 |
|
|
C |
26 |
|
|
C------------------------------------------------------------------ |
27 |
|
|
C |
28 |
|
|
|
29 |
|
|
INTEGER lrec |
30 |
|
|
INTEGER istat, ierr, icycle |
31 |
|
|
PARAMETER (lrec=4096) |
32 |
|
|
|
33 |
|
|
C------------------------------------------------------------------------- |
34 |
|
|
c |
35 |
|
|
c HBOOK initialization |
36 |
|
|
c |
37 |
|
|
c------------------------------------------------------------------------ |
38 |
|
|
|
39 |
|
|
call HLIMIT(NWPAWC) |
40 |
|
|
|
41 |
|
|
c------------------------------------------------------------------------ |
42 |
|
|
c--------------- open ToF calib rz file |
43 |
|
|
c------------------------------------------------------------------------ |
44 |
|
|
|
45 |
mocchiut |
1.3 |
c do ii=1,250 |
46 |
|
|
c ch=calname(ii:ii) |
47 |
|
|
c if (ch.eq.'.') goto 100 |
48 |
|
|
c enddo |
49 |
|
|
c100 continue |
50 |
|
|
c calname1 = calname(1:ii)//'rz' |
51 |
|
|
|
52 |
mocchiut |
1.4 |
c do ii=1,250 |
53 |
|
|
cc ch=calname(ii:ii) |
54 |
|
|
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 |
pam-de |
1.2 |
c calname1 = calname(1:ii)//'rz' |
61 |
mocchiut |
1.4 |
c calname1 = calname(1:ii+1) |
62 |
|
|
|
63 |
|
|
calname1 = calname(1:cnlen) |
64 |
pam-de |
1.2 |
|
65 |
mocchiut |
1.3 |
|
66 |
|
|
|
67 |
mocchiut |
1.1 |
|
68 |
mocchiut |
1.3 |
CALL HROPEN(59,'TOFK1131',calname1,'QP',4096,istat) |
69 |
mocchiut |
1.1 |
|
70 |
|
|
if (istat.ne.0) then ! check if HROPEN was OK |
71 |
|
|
write(*,*) 'Can''t open correct ToF calibration File !!!' |
72 |
|
|
stop |
73 |
|
|
endif |
74 |
|
|
|
75 |
|
|
call HRIN(ntp_tofcalib,9999,0) |
76 |
|
|
|
77 |
|
|
call HBNAME(ntp_tofcalib,' ',0,'$CLEAR') |
78 |
|
|
|
79 |
mocchiut |
1.3 |
call HBNAME(ntp_tofcalib,'TOFK1131',k_s11s31,'$SET') |
80 |
|
|
call HBNAME(ntp_tofcalib,'TOFK1132',k_s11s32,'$SET') |
81 |
|
|
call HBNAME(ntp_tofcalib,'TOFK1231',k_s12s31,'$SET') |
82 |
|
|
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 |
mocchiut |
1.1 |
|
96 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET') |
97 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET') |
98 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN21',x_coor_lin21,'$SET') |
99 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN22',y_coor_lin22,'$SET') |
100 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN31',y_coor_lin31,'$SET') |
101 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN32',x_coor_lin32,'$SET') |
102 |
|
|
|
103 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW11',tw11,'$SET') |
104 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW12',tw12,'$SET') |
105 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW21',tw21,'$SET') |
106 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW22',tw22,'$SET') |
107 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW31',tw31,'$SET') |
108 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW32',tw32,'$SET') |
109 |
|
|
|
110 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC11',adcx11,'$SET') |
111 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC12',adcx12,'$SET') |
112 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC21',adcx21,'$SET') |
113 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC22',adcx22,'$SET') |
114 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC31',adcx31,'$SET') |
115 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC32',adcx32,'$SET') |
116 |
|
|
|
117 |
|
|
c call HPRNTU(ntp_tofcalib) |
118 |
|
|
|
119 |
|
|
call HNOENT(ntp_tofcalib,iemax_cal) |
120 |
|
|
|
121 |
|
|
do iev=1,iemax_cal |
122 |
|
|
call HGNT(ntp_tofcalib,iev,ierr) !reads an event |
123 |
|
|
enddo |
124 |
|
|
|
125 |
|
|
call hrout(ntp_tofcalib,icycle,' ') |
126 |
mocchiut |
1.3 |
call hrend('TOFK1131') |
127 |
mocchiut |
1.1 |
close(0) |
128 |
|
|
|
129 |
|
|
return |
130 |
|
|
end |
131 |
|
|
|