1 |
mocchiut |
1.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 |
pam-de |
1.2 |
character*2 ch2 |
20 |
mocchiut |
1.1 |
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 |
|
|
do ii=1,250 |
45 |
pam-de |
1.2 |
c ch=calname(ii:ii) |
46 |
|
|
ch2=calname(ii:ii+1) |
47 |
|
|
c write(*,*) ii,ch |
48 |
|
|
c if (ch.eq.'.') goto 100 |
49 |
|
|
if (ch2.eq.'rz') goto 100 |
50 |
mocchiut |
1.1 |
enddo |
51 |
|
|
100 continue |
52 |
pam-de |
1.2 |
c calname1 = calname(1:ii)//'rz' |
53 |
|
|
calname1 = calname(1:ii+1) |
54 |
|
|
|
55 |
|
|
c print*,'__________ opening TOF calib rz file __________' |
56 |
|
|
c print*,calname |
57 |
|
|
c print*,calname1 |
58 |
mocchiut |
1.1 |
|
59 |
pam-de |
1.2 |
CALL HROPEN(59,'TOF K1A',calname1,'QP',4096,istat) |
60 |
mocchiut |
1.1 |
|
61 |
|
|
if (istat.ne.0) then ! check if HROPEN was OK |
62 |
|
|
write(*,*) 'Can''t open correct ToF calibration File !!!' |
63 |
|
|
stop |
64 |
|
|
endif |
65 |
|
|
|
66 |
pam-de |
1.2 |
c print*,' reading TOF CALIB n-tuple...' |
67 |
|
|
|
68 |
mocchiut |
1.1 |
call HRIN(ntp_tofcalib,9999,0) |
69 |
|
|
|
70 |
|
|
call HBNAME(ntp_tofcalib,' ',0,'$CLEAR') |
71 |
|
|
|
72 |
pam-de |
1.2 |
call HBNAME(ntp_tofcalib,'TOFKA',k_s11s31,'$SET') |
73 |
|
|
call HBNAME(ntp_tofcalib,'TOFKB',k_s12s32,'$SET') |
74 |
|
|
call HBNAME(ntp_tofcalib,'TOFKC',k_s21s31,'$SET') |
75 |
|
|
call HBNAME(ntp_tofcalib,'TOFKD',k_s22s32,'$SET') |
76 |
mocchiut |
1.1 |
|
77 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN11',y_coor_lin11,'$SET') |
78 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN12',x_coor_lin12,'$SET') |
79 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN21',x_coor_lin21,'$SET') |
80 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN22',y_coor_lin22,'$SET') |
81 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN31',y_coor_lin31,'$SET') |
82 |
|
|
call HBNAME(ntp_tofcalib,'TOFLIN32',x_coor_lin32,'$SET') |
83 |
|
|
|
84 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW11',tw11,'$SET') |
85 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW12',tw12,'$SET') |
86 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW21',tw21,'$SET') |
87 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW22',tw22,'$SET') |
88 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW31',tw31,'$SET') |
89 |
|
|
call HBNAME(ntp_tofcalib,'TOFTW32',tw32,'$SET') |
90 |
|
|
|
91 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC11',adcx11,'$SET') |
92 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC12',adcx12,'$SET') |
93 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC21',adcx21,'$SET') |
94 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC22',adcx22,'$SET') |
95 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC31',adcx31,'$SET') |
96 |
|
|
call HBNAME(ntp_tofcalib,'TOFADC32',adcx32,'$SET') |
97 |
|
|
|
98 |
|
|
c call HPRNTU(ntp_tofcalib) |
99 |
|
|
|
100 |
|
|
call HNOENT(ntp_tofcalib,iemax_cal) |
101 |
pam-de |
1.2 |
c write(*,*) 'Number of Events CALIB ',iemax_cal |
102 |
mocchiut |
1.1 |
|
103 |
|
|
do iev=1,iemax_cal |
104 |
|
|
call HGNT(ntp_tofcalib,iev,ierr) !reads an event |
105 |
pam-de |
1.2 |
c write(34,*)iev,k1_s11s31,y_coor_lin11,tw11 |
106 |
mocchiut |
1.1 |
enddo |
107 |
|
|
|
108 |
|
|
call hrout(ntp_tofcalib,icycle,' ') |
109 |
pam-de |
1.2 |
call hrend('TOF K1A') |
110 |
mocchiut |
1.1 |
close(0) |
111 |
|
|
|
112 |
|
|
return |
113 |
|
|
end |
114 |
|
|
|