1 |
mocchiut |
1.6 |
|
2 |
mocchiut |
1.7 |
C****************************************************************************** |
3 |
|
|
C |
4 |
|
|
C 08-12-06 WM: adc_c-bug : The raw ADc value was multiplied with cos(theta) |
5 |
|
|
C and AFTER that there was an if statement "if tof32(right,i,iadc) < 4095" |
6 |
|
|
C |
7 |
|
|
C jan-07 GF: ADCflags(4,12) inserted to flag artificial ADC values |
8 |
|
|
C jan-07 WM: artificial ADC values created using attenuation calibration |
9 |
|
|
C jan-07 WM: modified xtofpos flag "101". xtofpos must be inside physical |
10 |
|
|
C dimension of the paddle +/- 10 cm |
11 |
|
|
C jan-07 WM: if xtofpos=101 then this paddle is not used for beta |
12 |
|
|
C calculation |
13 |
|
|
C jan-07 WM: the definition for a "hit" is changed: Now we must have a |
14 |
|
|
C valid TDC signal on both sides |
15 |
|
|
C jan-07 WM: flag for PMTs #10 and #35 added, TDC=819 due to bit-shift |
16 |
|
|
C jan-07 WM: bug removed: in some cases tdc_tw was calculated due to a |
17 |
|
|
C leftover "xhelp" value |
18 |
|
|
C apr-07 WM: attenuation fit curve is now a double exponential fit |
19 |
|
|
C conversion from raw ADC to pC using calibration function |
20 |
|
|
C variables xtr_tof and ytr_tof inserted (filled with default) |
21 |
|
|
C jan-08 WM: Major Update: Time Walk correction introduced |
22 |
|
|
C Additionalyl we use the information from the "check_charge" |
23 |
|
|
C function to fill artificial ADC values and make small corrections |
24 |
|
|
C to the k1-parameter (for Z>2) |
25 |
|
|
C feb-08 WM: Calculation of beta(13) changed: First a mean beta is calculated, |
26 |
|
|
C then in a second step we check the residuals of the single |
27 |
|
|
C measurements, reject if > 10 sigma, calculate chi2 and "quality" |
28 |
|
|
C beta is taken as good if chi2<20 and quality>10 |
29 |
|
|
C****************************************************************************** |
30 |
mocchiut |
1.4 |
|
31 |
mocchiut |
1.1 |
INTEGER FUNCTION TOFL2COM() |
32 |
|
|
c |
33 |
|
|
IMPLICIT NONE |
34 |
|
|
C |
35 |
|
|
include 'input_tof.txt' |
36 |
|
|
include 'output_tof.txt' |
37 |
|
|
include 'tofcomm.txt' |
38 |
|
|
|
39 |
|
|
INTEGER icounter |
40 |
|
|
DATA icounter / 0/ |
41 |
|
|
|
42 |
|
|
LOGICAL check |
43 |
|
|
REAL secure |
44 |
|
|
|
45 |
mocchiut |
1.7 |
INTEGER j,hitvec(6) |
46 |
mocchiut |
1.1 |
|
47 |
|
|
REAL dx,dy,dr,ds |
48 |
mocchiut |
1.4 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
49 |
mocchiut |
1.7 |
REAL c1,c2 |
50 |
mocchiut |
1.1 |
|
51 |
mocchiut |
1.7 |
C REAL sw,sxw,w_i |
52 |
|
|
C INTEGER icount |
53 |
|
|
C REAL beta_mean |
54 |
mocchiut |
1.4 |
|
55 |
mocchiut |
1.1 |
INTEGER tof11_j,tof21_j,tof31_j |
56 |
|
|
INTEGER tof12_j,tof22_j,tof32_j |
57 |
|
|
|
58 |
|
|
c value for status of each PM-data |
59 |
|
|
c first index : 1 = left, 2 = right |
60 |
|
|
c second index : 1... number of paddle |
61 |
|
|
INTEGER tof11_event(2,8),tof12_event(2,6) |
62 |
|
|
INTEGER tof21_event(2,2),tof22_event(2,2) |
63 |
|
|
INTEGER tof31_event(2,3),tof32_event(2,3) |
64 |
|
|
|
65 |
mocchiut |
1.7 |
|
66 |
|
|
REAL y_coor_lin11c(8,2),x_coor_lin12c(6,2) |
67 |
|
|
REAL x_coor_lin21c(2,2),y_coor_lin22c(2,2) |
68 |
|
|
REAL y_coor_lin31c(3,2),x_coor_lin32c(3,2) |
69 |
|
|
|
70 |
|
|
DATA y_coor_lin11c(1,1),y_coor_lin11c(1,2) /-20.66,-2.497/ |
71 |
|
|
DATA y_coor_lin11c(2,1),y_coor_lin11c(2,2) /-9.10, -2.52/ |
72 |
|
|
DATA y_coor_lin11c(3,1),y_coor_lin11c(3,2) /-24.07,-2.12/ |
73 |
|
|
DATA y_coor_lin11c(4,1),y_coor_lin11c(4,2) /-13.40,-2.47/ |
74 |
|
|
DATA y_coor_lin11c(5,1),y_coor_lin11c(5,2) /-31.07,-2.32/ |
75 |
|
|
DATA y_coor_lin11c(6,1),y_coor_lin11c(6,2) /-21.69,-2.63/ |
76 |
|
|
DATA y_coor_lin11c(7,1),y_coor_lin11c(7,2) /-12.37,-2.65/ |
77 |
|
|
DATA y_coor_lin11c(8,1),y_coor_lin11c(8,2) /-10.81,-3.15/ |
78 |
|
|
|
79 |
|
|
DATA x_coor_lin12c(1,1),x_coor_lin12c(1,2) /12.96, -2.65/ |
80 |
|
|
DATA x_coor_lin12c(2,1),x_coor_lin12c(2,2) /17.12,-2.44/ |
81 |
|
|
DATA x_coor_lin12c(3,1),x_coor_lin12c(3,2) /7.26, -1.98/ |
82 |
|
|
DATA x_coor_lin12c(4,1),x_coor_lin12c(4,2) /-22.52,-2.27/ |
83 |
|
|
DATA x_coor_lin12c(5,1),x_coor_lin12c(5,2) /-18.54,-2.28/ |
84 |
|
|
DATA x_coor_lin12c(6,1),x_coor_lin12c(6,2) /-7.67,-2.15/ |
85 |
|
|
|
86 |
|
|
DATA x_coor_lin21c(1,1),x_coor_lin21c(1,2) /22.56,-1.56/ |
87 |
|
|
DATA x_coor_lin21c(2,1),x_coor_lin21c(2,2) /13.94,-1.56/ |
88 |
|
|
|
89 |
|
|
DATA y_coor_lin22c(1,1),y_coor_lin22c(1,2) /-24.24,-2.23/ |
90 |
|
|
DATA y_coor_lin22c(2,1),y_coor_lin22c(2,2) /-45.99,-1.68/ |
91 |
|
|
|
92 |
|
|
DATA y_coor_lin31c(1,1),y_coor_lin31c(1,2) /-22.99,-3.54/ |
93 |
|
|
DATA y_coor_lin31c(2,1),y_coor_lin31c(2,2) /-42.28,-4.10/ |
94 |
|
|
DATA y_coor_lin31c(3,1),y_coor_lin31c(3,2) /-41.29,-3.69/ |
95 |
|
|
|
96 |
|
|
DATA x_coor_lin32c(1,1),x_coor_lin32c(1,2) /0.961, -3.22/ |
97 |
|
|
DATA x_coor_lin32c(2,1),x_coor_lin32c(2,2) /4.98,-3.48/ |
98 |
|
|
DATA x_coor_lin32c(3,1),x_coor_lin32c(3,2) /-22.08,-3.37/ |
99 |
|
|
|
100 |
mocchiut |
1.1 |
|
101 |
mocchiut |
1.4 |
REAL theta13 |
102 |
mocchiut |
1.1 |
C-- DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
103 |
|
|
REAL tofarm12 |
104 |
|
|
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
105 |
|
|
REAL tofarm23 |
106 |
|
|
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
107 |
|
|
REAL tofarm13 |
108 |
|
|
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
109 |
mocchiut |
1.4 |
|
110 |
|
|
REAL hepratio |
111 |
mocchiut |
1.1 |
|
112 |
|
|
INTEGER ihelp |
113 |
mocchiut |
1.7 |
REAL xkorr,btemp(12) |
114 |
|
|
|
115 |
|
|
REAL atten,pc_adc,check_charge,newbeta |
116 |
|
|
|
117 |
|
|
INTEGER IZ |
118 |
|
|
REAL k1corrA1,k1corrB1,k1corrC1 |
119 |
|
|
|
120 |
mocchiut |
1.1 |
|
121 |
mocchiut |
1.7 |
INTEGER ifst |
122 |
|
|
DATA ifst /0/ |
123 |
mocchiut |
1.6 |
|
124 |
mocchiut |
1.1 |
C--------------------------------------- |
125 |
|
|
C |
126 |
|
|
C Begin ! |
127 |
|
|
C |
128 |
|
|
TOFL2COM = 0 |
129 |
|
|
C |
130 |
|
|
C CALCULATE COMMON VARIABLES |
131 |
|
|
C |
132 |
mocchiut |
1.7 |
C------------------------------------------------------------------- |
133 |
mocchiut |
1.1 |
|
134 |
mocchiut |
1.7 |
if (ifst.eq.0) then |
135 |
|
|
|
136 |
|
|
ifst=1 |
137 |
mocchiut |
1.1 |
|
138 |
mocchiut |
1.7 |
C amplitude has to be 'secure' higher than pedestal for an adc event |
139 |
|
|
secure = 2. |
140 |
mocchiut |
1.1 |
|
141 |
mocchiut |
1.4 |
C ratio between helium and proton ca. 4 |
142 |
mocchiut |
1.7 |
hepratio = 4. ! |
143 |
|
|
offset = 1 |
144 |
|
|
slope = 2 |
145 |
|
|
left = 1 |
146 |
|
|
right = 2 |
147 |
|
|
none_ev = 0 |
148 |
|
|
none_find = 0 |
149 |
|
|
tdc_ev = 1 |
150 |
|
|
adc_ev = 1 |
151 |
|
|
itdc = 1 |
152 |
|
|
iadc = 2 |
153 |
|
|
|
154 |
|
|
C--- These are the corrections to the k1-value for Z>2 particles |
155 |
|
|
k1corrA1 = 0. |
156 |
|
|
k1corrB1 = -5.0 |
157 |
|
|
k1corrC1= 8.0 |
158 |
|
|
|
159 |
|
|
|
160 |
|
|
ENDIF |
161 |
|
|
C--------------------------------------------------------------------- |
162 |
|
|
|
163 |
|
|
icounter = icounter + 1 |
164 |
|
|
|
165 |
mocchiut |
1.1 |
|
166 |
|
|
do i=1,13 |
167 |
|
|
betatof_a(i) = 100. ! As in "troftrk.for" |
168 |
|
|
enddo |
169 |
|
|
|
170 |
mocchiut |
1.7 |
do i=1,6 |
171 |
|
|
hitvec(i) = -1 |
172 |
|
|
enddo |
173 |
|
|
|
174 |
mocchiut |
1.1 |
do i=1,4 |
175 |
|
|
do j=1,12 |
176 |
|
|
adctof_c(i,j) = 1000. |
177 |
|
|
enddo |
178 |
|
|
enddo |
179 |
|
|
|
180 |
|
|
|
181 |
|
|
do i=1,4 |
182 |
|
|
do j=1,12 |
183 |
|
|
tdc_c(i,j) = 4095. |
184 |
|
|
enddo |
185 |
|
|
enddo |
186 |
|
|
|
187 |
|
|
|
188 |
mocchiut |
1.2 |
do i=1,12 |
189 |
|
|
do j=1,4 |
190 |
|
|
tofmask(j,i) = 0 |
191 |
|
|
enddo |
192 |
|
|
enddo |
193 |
|
|
|
194 |
|
|
|
195 |
mocchiut |
1.4 |
c gf adc falg: |
196 |
|
|
do i=1,4 |
197 |
|
|
do j=1,12 |
198 |
|
|
adcflagtof(i,j) = 0 |
199 |
|
|
enddo |
200 |
|
|
enddo |
201 |
|
|
|
202 |
|
|
c gf tdc falg: |
203 |
|
|
do i=1,4 |
204 |
|
|
do j=1,12 |
205 |
|
|
tdcflagtof(i,j) = 0 |
206 |
|
|
enddo |
207 |
|
|
enddo |
208 |
|
|
|
209 |
mocchiut |
1.6 |
|
210 |
|
|
C--- Fill xtr_tof and ytr_tof: positions from tracker at ToF layers |
211 |
|
|
C--- since this is standalone ToF fill with default values |
212 |
|
|
do j=1,6 |
213 |
|
|
xtr_tof(j) = 101. |
214 |
|
|
ytr_tof(j) = 101. |
215 |
|
|
enddo |
216 |
|
|
|
217 |
mocchiut |
1.1 |
c the calibration files are read in the main program from xxx_tofcalib.rz |
218 |
|
|
|
219 |
|
|
c-------------------------get ToF data -------------------------------- |
220 |
|
|
|
221 |
|
|
c put the adc and tdc values from ntuple into tofxx(i,j,k) variables |
222 |
mocchiut |
1.6 |
c adc valueas are then pC |
223 |
mocchiut |
1.1 |
|
224 |
|
|
do j=1,8 |
225 |
mocchiut |
1.6 |
tof11(1,j,2) = pc_adc(adc(ch11a(j),hb11a(j))) |
226 |
|
|
tof11(2,j,2) = pc_adc(adc(ch11b(j),hb11b(j))) |
227 |
|
|
tof11(1,j,1) = (tdc(ch11a(j),hb11a(j))) |
228 |
|
|
tof11(2,j,1) = (tdc(ch11b(j),hb11b(j))) |
229 |
mocchiut |
1.1 |
enddo |
230 |
|
|
|
231 |
|
|
|
232 |
|
|
do j=1,6 |
233 |
mocchiut |
1.6 |
tof12(1,j,2) = pc_adc(adc(ch12a(j),hb12a(j))) |
234 |
|
|
tof12(2,j,2) = pc_adc(adc(ch12b(j),hb12b(j))) |
235 |
|
|
tof12(1,j,1) = (tdc(ch12a(j),hb12a(j))) |
236 |
|
|
tof12(2,j,1) = (tdc(ch12b(j),hb12b(j))) |
237 |
mocchiut |
1.1 |
enddo |
238 |
|
|
|
239 |
|
|
do j=1,2 |
240 |
mocchiut |
1.6 |
tof21(1,j,2) = pc_adc(adc(ch21a(j),hb21a(j))) |
241 |
|
|
tof21(2,j,2) = pc_adc(adc(ch21b(j),hb21b(j))) |
242 |
|
|
tof21(1,j,1) = (tdc(ch21a(j),hb21a(j))) |
243 |
|
|
tof21(2,j,1) = (tdc(ch21b(j),hb21b(j))) |
244 |
mocchiut |
1.1 |
enddo |
245 |
|
|
|
246 |
|
|
do j=1,2 |
247 |
mocchiut |
1.6 |
tof22(1,j,2) = pc_adc(adc(ch22a(j),hb22a(j))) |
248 |
|
|
tof22(2,j,2) = pc_adc(adc(ch22b(j),hb22b(j))) |
249 |
|
|
tof22(1,j,1) = (tdc(ch22a(j),hb22a(j))) |
250 |
|
|
tof22(2,j,1) = (tdc(ch22b(j),hb22b(j))) |
251 |
mocchiut |
1.1 |
enddo |
252 |
|
|
|
253 |
|
|
do j=1,3 |
254 |
mocchiut |
1.6 |
tof31(1,j,2) = pc_adc(adc(ch31a(j),hb31a(j))) |
255 |
|
|
tof31(2,j,2) = pc_adc(adc(ch31b(j),hb31b(j))) |
256 |
|
|
tof31(1,j,1) = (tdc(ch31a(j),hb31a(j))) |
257 |
|
|
tof31(2,j,1) = (tdc(ch31b(j),hb31b(j))) |
258 |
mocchiut |
1.1 |
enddo |
259 |
|
|
|
260 |
|
|
do j=1,3 |
261 |
mocchiut |
1.6 |
tof32(1,j,2) = pc_adc(adc(ch32a(j),hb32a(j))) |
262 |
|
|
tof32(2,j,2) = pc_adc(adc(ch32b(j),hb32b(j))) |
263 |
|
|
tof32(1,j,1) = (tdc(ch32a(j),hb32a(j))) |
264 |
|
|
tof32(2,j,1) = (tdc(ch32b(j),hb32b(j))) |
265 |
mocchiut |
1.1 |
enddo |
266 |
|
|
|
267 |
|
|
C---------------------------------------------------------------------- |
268 |
|
|
|
269 |
|
|
DO i = 1,8 |
270 |
|
|
if (abs(tof11(1,i,itdc)).gt.10000.) tof11(1,i,itdc)= 10000. |
271 |
|
|
if (abs(tof11(2,i,itdc)).gt.10000.) tof11(2,i,itdc)= 10000. |
272 |
|
|
if (abs(tof11(1,i,iadc)).gt.10000.) tof11(1,i,iadc)= 10000. |
273 |
|
|
if (abs(tof11(2,i,iadc)).gt.10000.) tof11(2,i,iadc)= 10000. |
274 |
|
|
ENDDO |
275 |
|
|
|
276 |
|
|
DO i = 1,6 |
277 |
|
|
if (abs(tof12(1,i,itdc)).gt.10000.) tof12(1,i,itdc)= 10000. |
278 |
|
|
if (abs(tof12(2,i,itdc)).gt.10000.) tof12(2,i,itdc)= 10000. |
279 |
|
|
if (abs(tof12(1,i,iadc)).gt.10000.) tof12(1,i,iadc)= 10000. |
280 |
|
|
if (abs(tof12(2,i,iadc)).gt.10000.) tof12(2,i,iadc)= 10000. |
281 |
|
|
ENDDO |
282 |
|
|
|
283 |
|
|
|
284 |
|
|
DO i = 1,2 |
285 |
|
|
if (abs(tof21(1,i,itdc)).gt.10000.) tof21(1,i,itdc)= 10000. |
286 |
|
|
if (abs(tof21(2,i,itdc)).gt.10000.) tof21(2,i,itdc)= 10000. |
287 |
|
|
if (abs(tof21(1,i,iadc)).gt.10000.) tof21(1,i,iadc)= 10000. |
288 |
|
|
if (abs(tof21(2,i,iadc)).gt.10000.) tof21(2,i,iadc)= 10000. |
289 |
|
|
ENDDO |
290 |
|
|
|
291 |
|
|
DO i = 1,2 |
292 |
|
|
if (abs(tof22(1,i,itdc)).gt.10000.) tof22(1,i,itdc)= 10000. |
293 |
|
|
if (abs(tof22(2,i,itdc)).gt.10000.) tof22(2,i,itdc)= 10000. |
294 |
|
|
if (abs(tof22(1,i,iadc)).gt.10000.) tof22(1,i,iadc)= 10000. |
295 |
|
|
if (abs(tof22(2,i,iadc)).gt.10000.) tof22(2,i,iadc)= 10000. |
296 |
|
|
ENDDO |
297 |
|
|
|
298 |
|
|
DO i = 1,3 |
299 |
|
|
if (abs(tof31(1,i,itdc)).gt.10000.) tof31(1,i,itdc)= 10000. |
300 |
|
|
if (abs(tof31(2,i,itdc)).gt.10000.) tof31(2,i,itdc)= 10000. |
301 |
|
|
if (abs(tof31(1,i,iadc)).gt.10000.) tof31(1,i,iadc)= 10000. |
302 |
|
|
if (abs(tof31(2,i,iadc)).gt.10000.) tof31(2,i,iadc)= 10000. |
303 |
|
|
ENDDO |
304 |
|
|
|
305 |
|
|
DO i = 1,3 |
306 |
|
|
if (abs(tof32(1,i,itdc)).gt.10000.) tof32(1,i,itdc)= 10000. |
307 |
|
|
if (abs(tof32(2,i,itdc)).gt.10000.) tof32(2,i,itdc)= 10000. |
308 |
|
|
if (abs(tof32(1,i,iadc)).gt.10000.) tof32(1,i,iadc)= 10000. |
309 |
|
|
if (abs(tof32(2,i,iadc)).gt.10000.) tof32(2,i,iadc)= 10000. |
310 |
|
|
ENDDO |
311 |
|
|
|
312 |
mocchiut |
1.4 |
C---------------------------------------------------------------------- |
313 |
|
|
C------------------ set ADC & TDC flag = 0 ------------------------ |
314 |
|
|
C---------------------------------------------------------------------- |
315 |
|
|
|
316 |
|
|
do j=1,8 |
317 |
|
|
if (adc(ch11a(j),hb11a(j)).LT.4096)adcflagtof(ch11a(j),hb11a(j))=0 |
318 |
|
|
if (adc(ch11b(j),hb11b(j)).LT.4096)adcflagtof(ch11b(j),hb11b(j))=0 |
319 |
|
|
if (tdc(ch11a(j),hb11a(j)).LT.4096)tdcflagtof(ch11a(j),hb11a(j))=0 |
320 |
|
|
if (tdc(ch11b(j),hb11b(j)).LT.4096)tdcflagtof(ch11b(j),hb11b(j))=0 |
321 |
|
|
enddo |
322 |
|
|
do j=1,6 |
323 |
|
|
if (adc(ch12a(j),hb12a(j)).LT.4096)adcflagtof(ch12a(j),hb12a(j))=0 |
324 |
|
|
if (adc(ch12b(j),hb12b(j)).LT.4096)adcflagtof(ch12b(j),hb12b(j))=0 |
325 |
|
|
if (tdc(ch12a(j),hb12a(j)).LT.4096)tdcflagtof(ch12a(j),hb12a(j))=0 |
326 |
|
|
if (tdc(ch12b(j),hb12b(j)).LT.4096)tdcflagtof(ch12b(j),hb12b(j))=0 |
327 |
|
|
enddo |
328 |
|
|
do j=1,2 |
329 |
|
|
if (adc(ch21a(j),hb21a(j)).LT.4096)adcflagtof(ch21a(j),hb21a(j))=0 |
330 |
|
|
if (adc(ch21b(j),hb21b(j)).LT.4096)adcflagtof(ch21b(j),hb21b(j))=0 |
331 |
|
|
if (tdc(ch21a(j),hb21a(j)).LT.4096)tdcflagtof(ch21a(j),hb21a(j))=0 |
332 |
|
|
if (tdc(ch21b(j),hb21b(j)).LT.4096)tdcflagtof(ch21b(j),hb21b(j))=0 |
333 |
|
|
enddo |
334 |
|
|
do j=1,2 |
335 |
|
|
if (adc(ch22a(j),hb22a(j)).LT.4096)adcflagtof(ch22a(j),hb22a(j))=0 |
336 |
|
|
if (adc(ch22b(j),hb22b(j)).LT.4096)adcflagtof(ch22b(j),hb22b(j))=0 |
337 |
|
|
if (tdc(ch22a(j),hb22a(j)).LT.4096)tdcflagtof(ch22a(j),hb22a(j))=0 |
338 |
|
|
if (tdc(ch22b(j),hb22b(j)).LT.4096)tdcflagtof(ch22b(j),hb22b(j))=0 |
339 |
|
|
enddo |
340 |
|
|
do j=1,3 |
341 |
|
|
if (adc(ch31a(j),hb31a(j)).LT.4096)adcflagtof(ch31a(j),hb31a(j))=0 |
342 |
|
|
if (adc(ch31b(j),hb31b(j)).LT.4096)adcflagtof(ch31b(j),hb31b(j))=0 |
343 |
|
|
if (tdc(ch31a(j),hb31a(j)).LT.4096)tdcflagtof(ch31a(j),hb31a(j))=0 |
344 |
|
|
if (tdc(ch31b(j),hb31b(j)).LT.4096)tdcflagtof(ch31b(j),hb31b(j))=0 |
345 |
|
|
enddo |
346 |
|
|
do j=1,3 |
347 |
|
|
if (adc(ch32a(j),hb32a(j)).LT.4096)adcflagtof(ch32a(j),hb32a(j))=0 |
348 |
|
|
if (adc(ch32b(j),hb32b(j)).LT.4096)adcflagtof(ch32b(j),hb32b(j))=0 |
349 |
|
|
if (tdc(ch32a(j),hb32a(j)).LT.4096)tdcflagtof(ch32a(j),hb32a(j))=0 |
350 |
|
|
if (tdc(ch32b(j),hb32b(j)).LT.4096)tdcflagtof(ch32b(j),hb32b(j))=0 |
351 |
|
|
enddo |
352 |
|
|
|
353 |
mocchiut |
1.1 |
C---------------------------------------------------------------- |
354 |
mocchiut |
1.4 |
C---------- Check PMTs 10 and 35 for strange TDC values---------- |
355 |
|
|
C---------------------------------------------------------------- |
356 |
|
|
|
357 |
|
|
C---- S116A TDC=819 |
358 |
|
|
if (tof11(1,6,1).EQ.819) then |
359 |
|
|
tof11(1,6,1) = 4095 |
360 |
|
|
tdcflagtof(ch11a(6),hb11a(6))=2 |
361 |
|
|
endif |
362 |
|
|
|
363 |
|
|
C---- S222B TDC=819 |
364 |
|
|
if (tof22(2,2,1).EQ.819) then |
365 |
|
|
tof22(2,2,1) = 4095 |
366 |
|
|
tdcflagtof(ch22b(2),hb22b(2))=2 |
367 |
|
|
endif |
368 |
|
|
|
369 |
|
|
C---------------------------------------------------------------- |
370 |
|
|
C------------ Check Paddles for hits ----------------------- |
371 |
|
|
C------ a "hit" means TDC values<4095 on both sides ------------ |
372 |
mocchiut |
1.1 |
C---------------------------------------------------------------- |
373 |
|
|
|
374 |
|
|
C upper tof S11 |
375 |
|
|
DO i = 1,8 |
376 |
|
|
|
377 |
|
|
DO j = 1,2 |
378 |
|
|
tof11_event(j,i) = none_ev |
379 |
|
|
IF ((tof11(j,i,itdc).LT.2000).AND.(tof11(j,i,itdc).GT.100)) |
380 |
|
|
+ tof11_event(j,i) = tof11_event(j,i) + tdc_ev |
381 |
|
|
ENDDO |
382 |
|
|
ENDDO |
383 |
|
|
|
384 |
|
|
c find single paddle in upper tof with tdc and adc signal |
385 |
|
|
tof11_i = none_find |
386 |
|
|
tof11_j = none_find |
387 |
|
|
check = .TRUE. |
388 |
|
|
DO i = 1, 8 |
389 |
|
|
IF ((tof11_event(left,i).GE.1).AND.(tof11_event(right,i).GE.1)) |
390 |
|
|
+ THEN |
391 |
|
|
c check if an other paddle has also an event - then set flag |
392 |
|
|
tof11_j = tof11_j + 2**(i-1) |
393 |
|
|
IF (check.EQV..TRUE.) THEN |
394 |
|
|
IF (tof11_i.EQ.none_find) THEN |
395 |
|
|
tof11_i = i |
396 |
|
|
ELSE |
397 |
|
|
tof11_i = -1 |
398 |
|
|
check = .FALSE. |
399 |
|
|
ENDIF |
400 |
|
|
ENDIF |
401 |
|
|
ENDIF |
402 |
|
|
ENDDO |
403 |
|
|
|
404 |
|
|
|
405 |
|
|
C upper tof S12 |
406 |
|
|
DO i = 1,6 |
407 |
|
|
DO j = 1,2 |
408 |
|
|
tof12_event(j,i) = none_ev |
409 |
|
|
IF ((tof12(j,i,itdc).LT.2000).AND.(tof12(j,i,itdc).GT.100)) |
410 |
|
|
+ tof12_event(j,i) = tof12_event(j,i) + tdc_ev |
411 |
|
|
ENDDO |
412 |
|
|
ENDDO |
413 |
|
|
|
414 |
|
|
c find single paddle in upper tof with tdc and adc signal |
415 |
|
|
tof12_i = none_find |
416 |
|
|
tof12_j = none_find |
417 |
|
|
check = .TRUE. |
418 |
|
|
DO i = 1, 6 |
419 |
|
|
IF ((tof12_event(left,i).GE.1).AND.(tof12_event(right,i).GE.1)) |
420 |
|
|
+ THEN |
421 |
|
|
c check if an other paddle has also an event - then set flag |
422 |
|
|
tof12_j = tof12_j + 2**(i-1) |
423 |
|
|
IF (check.EQV..TRUE.) THEN |
424 |
|
|
IF (tof12_i.EQ.none_find) THEN |
425 |
|
|
tof12_i = i |
426 |
|
|
ELSE |
427 |
|
|
tof12_i = -1 |
428 |
|
|
check = .FALSE. |
429 |
|
|
ENDIF |
430 |
|
|
ENDIF |
431 |
|
|
ENDIF |
432 |
|
|
ENDDO |
433 |
|
|
|
434 |
|
|
|
435 |
|
|
C middle tof S21 |
436 |
|
|
DO i = 1,2 |
437 |
|
|
DO j = 1,2 |
438 |
|
|
tof21_event(j,i) = none_ev |
439 |
|
|
IF ((tof21(j,i,itdc).LT.2000).AND.(tof21(j,i,itdc).GT.100)) |
440 |
|
|
+ tof21_event(j,i) = tof21_event(j,i) + tdc_ev |
441 |
|
|
ENDDO |
442 |
|
|
ENDDO |
443 |
|
|
|
444 |
|
|
c find single paddle in upper tof with tdc and adc signal |
445 |
|
|
tof21_i = none_find |
446 |
|
|
tof21_j = none_find |
447 |
|
|
check = .TRUE. |
448 |
|
|
DO i = 1, 2 |
449 |
|
|
IF ((tof21_event(left,i).GE.1).AND.(tof21_event(right,i).GE.1)) |
450 |
|
|
+ THEN |
451 |
|
|
c check if an other paddle has also an event - then set flag |
452 |
|
|
tof21_j = tof21_j + 2**(i-1) |
453 |
|
|
IF (check.EQV..TRUE.) THEN |
454 |
|
|
IF (tof21_i.EQ.none_find) THEN |
455 |
|
|
tof21_i = i |
456 |
|
|
ELSE |
457 |
|
|
tof21_i = -1 |
458 |
|
|
check = .FALSE. |
459 |
|
|
ENDIF |
460 |
|
|
ENDIF |
461 |
|
|
ENDIF |
462 |
|
|
ENDDO |
463 |
|
|
|
464 |
|
|
C middle tof S22 |
465 |
|
|
DO i = 1,2 |
466 |
|
|
DO j = 1,2 |
467 |
|
|
tof22_event(j,i) = none_ev |
468 |
|
|
IF ((tof22(j,i,itdc).LT.2000).AND.(tof22(j,i,itdc).GT.100)) |
469 |
|
|
+ tof22_event(j,i) = tof22_event(j,i) + tdc_ev |
470 |
|
|
ENDDO |
471 |
|
|
ENDDO |
472 |
|
|
|
473 |
|
|
c find single paddle in upper tof with tdc and adc signal |
474 |
|
|
tof22_i = none_find |
475 |
|
|
tof22_j = none_find |
476 |
|
|
check = .TRUE. |
477 |
|
|
DO i = 1, 2 |
478 |
|
|
IF ((tof22_event(left,i).GE.1).AND.(tof22_event(right,i).GE.1)) |
479 |
|
|
+ THEN |
480 |
|
|
c check if an other paddle has also an event - then set flag |
481 |
|
|
tof22_j = tof22_j + 2**(i-1) |
482 |
|
|
IF (check.EQV..TRUE.) THEN |
483 |
|
|
IF (tof22_i.EQ.none_find) THEN |
484 |
|
|
tof22_i = i |
485 |
|
|
ELSE |
486 |
|
|
tof22_i = -1 |
487 |
|
|
check = .FALSE. |
488 |
|
|
ENDIF |
489 |
|
|
ENDIF |
490 |
|
|
ENDIF |
491 |
|
|
ENDDO |
492 |
|
|
|
493 |
|
|
|
494 |
|
|
C bottom tof S31 |
495 |
|
|
DO i = 1,3 |
496 |
|
|
DO j = 1,2 |
497 |
|
|
tof31_event(j,i) = none_ev |
498 |
|
|
IF ((tof31(j,i,itdc).LT.2000).AND.(tof31(j,i,itdc).GT.100)) |
499 |
|
|
+ tof31_event(j,i) = tof31_event(j,i) + tdc_ev |
500 |
|
|
ENDDO |
501 |
|
|
ENDDO |
502 |
|
|
|
503 |
|
|
c find single paddle in upper tof with tdc and adc signal |
504 |
|
|
tof31_i = none_find |
505 |
|
|
tof31_j = none_find |
506 |
|
|
check = .TRUE. |
507 |
|
|
DO i = 1, 3 |
508 |
|
|
IF ((tof31_event(left,i).GE.1).AND.(tof31_event(right,i).GE.1)) |
509 |
|
|
+ THEN |
510 |
|
|
c check if an other paddle has also an event - then set flag |
511 |
|
|
tof31_j = tof31_j + 2**(i-1) |
512 |
|
|
IF (check.EQV..TRUE.) THEN |
513 |
|
|
IF (tof31_i.EQ.none_find) THEN |
514 |
|
|
tof31_i = i |
515 |
|
|
ELSE |
516 |
|
|
tof31_i = -1 |
517 |
|
|
check = .FALSE. |
518 |
|
|
ENDIF |
519 |
|
|
ENDIF |
520 |
|
|
ENDIF |
521 |
|
|
ENDDO |
522 |
|
|
|
523 |
|
|
C bottom tof S32 |
524 |
|
|
DO i = 1,3 |
525 |
|
|
DO j = 1,2 |
526 |
|
|
tof32_event(j,i) = none_ev |
527 |
|
|
IF ((tof32(j,i,itdc).LT.2000).AND.(tof32(j,i,itdc).GT.100)) |
528 |
|
|
+ tof32_event(j,i) = tof32_event(j,i) + tdc_ev |
529 |
|
|
ENDDO |
530 |
|
|
ENDDO |
531 |
|
|
|
532 |
|
|
c find single paddle in upper tof with tdc and adc signal |
533 |
|
|
tof32_i = none_find |
534 |
|
|
tof32_j = none_find |
535 |
|
|
check = .TRUE. |
536 |
|
|
DO i = 1, 3 |
537 |
|
|
IF ((tof32_event(left,i).GE.1).AND.(tof32_event(right,i).GE.1)) |
538 |
|
|
+ THEN |
539 |
|
|
c check if an other paddle has also an event - then set flag |
540 |
|
|
tof32_j = tof32_j + 2**(i-1) |
541 |
|
|
IF (check.EQV..TRUE.) THEN |
542 |
|
|
IF (tof32_i.EQ.none_find) THEN |
543 |
|
|
tof32_i = i |
544 |
|
|
ELSE |
545 |
|
|
tof32_i = -1 |
546 |
|
|
check = .FALSE. |
547 |
|
|
ENDIF |
548 |
|
|
ENDIF |
549 |
|
|
ENDIF |
550 |
mocchiut |
1.7 |
ENDDO |
551 |
mocchiut |
1.1 |
|
552 |
mocchiut |
1.7 |
do i=1,6 |
553 |
mocchiut |
1.1 |
tof_i_flag(i)=0 |
554 |
|
|
tof_j_flag(i)=0 |
555 |
mocchiut |
1.7 |
enddo |
556 |
|
|
|
557 |
|
|
tof_i_flag(1)=tof11_i |
558 |
|
|
tof_i_flag(2)=tof12_i |
559 |
|
|
tof_i_flag(3)=tof21_i |
560 |
|
|
tof_i_flag(4)=tof22_i |
561 |
|
|
tof_i_flag(5)=tof31_i |
562 |
|
|
tof_i_flag(6)=tof32_i |
563 |
|
|
|
564 |
|
|
tof_j_flag(1)=tof11_j |
565 |
|
|
tof_j_flag(2)=tof12_j |
566 |
|
|
tof_j_flag(3)=tof21_j |
567 |
|
|
tof_j_flag(4)=tof22_j |
568 |
|
|
tof_j_flag(5)=tof31_j |
569 |
|
|
tof_j_flag(6)=tof32_j |
570 |
|
|
|
571 |
|
|
hitvec(1)=tof11_i |
572 |
|
|
hitvec(2)=tof12_i |
573 |
|
|
hitvec(3)=tof21_i |
574 |
|
|
hitvec(4)=tof22_i |
575 |
|
|
hitvec(5)=tof31_i |
576 |
|
|
hitvec(6)=tof32_i |
577 |
mocchiut |
1.1 |
|
578 |
mocchiut |
1.7 |
c write(*,*) 'tofl2com', |
579 |
|
|
c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
580 |
mocchiut |
1.1 |
|
581 |
mocchiut |
1.4 |
C------------------------------------------------------------------ |
582 |
mocchiut |
1.7 |
C-- calculate track position in paddle using timing difference |
583 |
|
|
C-- this calculation is preliminary and uses some standard |
584 |
|
|
C-- calibration values, but we need to find a rough position to |
585 |
|
|
C-- be able to calculate artificial ADC values (needed for the |
586 |
|
|
C-- timewalk... |
587 |
mocchiut |
1.4 |
C------------------------------------------------------------------ |
588 |
|
|
|
589 |
mocchiut |
1.7 |
do i=1,3 |
590 |
mocchiut |
1.4 |
xtofpos(i)=100. |
591 |
|
|
ytofpos(i)=100. |
592 |
mocchiut |
1.7 |
enddo |
593 |
|
|
|
594 |
mocchiut |
1.4 |
C-----------------------------S1 -------------------------------- |
595 |
|
|
|
596 |
|
|
IF (tof11_i.GT.none_find) THEN |
597 |
|
|
ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. |
598 |
mocchiut |
1.7 |
+ -y_coor_lin11c(tof11_i,offset))/y_coor_lin11c(tof11_i,slope) |
599 |
mocchiut |
1.4 |
endif |
600 |
|
|
|
601 |
|
|
IF (tof12_i.GT.none_find) THEN |
602 |
|
|
xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. |
603 |
mocchiut |
1.7 |
+ -x_coor_lin12c(tof12_i,offset))/x_coor_lin12c(tof12_i,slope) |
604 |
mocchiut |
1.4 |
endif |
605 |
|
|
|
606 |
|
|
|
607 |
|
|
C-----------------------------S2 -------------------------------- |
608 |
|
|
|
609 |
|
|
IF (tof21_i.GT.none_find) THEN |
610 |
|
|
xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. |
611 |
mocchiut |
1.7 |
+ -x_coor_lin21c(tof21_i,offset))/x_coor_lin21c(tof21_i,slope) |
612 |
mocchiut |
1.4 |
endif |
613 |
|
|
|
614 |
|
|
IF (tof22_i.GT.none_find) THEN |
615 |
|
|
ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. |
616 |
mocchiut |
1.7 |
+ -y_coor_lin22c(tof22_i,offset))/y_coor_lin22c(tof22_i,slope) |
617 |
mocchiut |
1.4 |
endif |
618 |
|
|
|
619 |
|
|
|
620 |
|
|
C-----------------------------S3 -------------------------------- |
621 |
|
|
|
622 |
|
|
IF (tof31_i.GT.none_find) THEN |
623 |
|
|
ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. |
624 |
mocchiut |
1.7 |
+ -y_coor_lin31c(tof31_i,offset))/y_coor_lin31c(tof31_i,slope) |
625 |
mocchiut |
1.4 |
endif |
626 |
|
|
|
627 |
|
|
IF (tof32_i.GT.none_find) THEN |
628 |
|
|
xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. |
629 |
mocchiut |
1.7 |
+ -x_coor_lin32c(tof32_i,offset))/x_coor_lin32c(tof32_i,slope) |
630 |
mocchiut |
1.4 |
endif |
631 |
|
|
|
632 |
|
|
|
633 |
|
|
C---------------------------------------------------------------------- |
634 |
|
|
C--------------------- zenith angle theta --------------------------- |
635 |
|
|
C---------------------------------------------------------------------- |
636 |
|
|
|
637 |
|
|
dx=0. |
638 |
|
|
dy=0. |
639 |
|
|
dr=0. |
640 |
|
|
theta13 = 0. |
641 |
|
|
|
642 |
|
|
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
643 |
|
|
& dx = xtofpos(1) - xtofpos(3) |
644 |
|
|
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
645 |
|
|
& dy = ytofpos(1) - ytofpos(3) |
646 |
|
|
dr = sqrt(dx*dx+dy*dy) |
647 |
|
|
theta13 = atan(dr/tofarm13) |
648 |
|
|
|
649 |
|
|
|
650 |
mocchiut |
1.7 |
C---------------------------------------------------------------------- |
651 |
|
|
C--- check charge: |
652 |
|
|
C--- if Z=2 we should use the attenuation curve for helium to |
653 |
|
|
C--- fill the artificail ADC values and NOT divide by "hepratio" |
654 |
|
|
C--- if Z>2 we should do a correction to |
655 |
|
|
C--- the k1 constants in the beta calculation |
656 |
|
|
C---------------------------------------------------------------------- |
657 |
|
|
|
658 |
|
|
iz = int(check_charge(theta13,hitvec)) |
659 |
|
|
C write(*,*) 'in tofl2com',iz |
660 |
mocchiut |
1.4 |
|
661 |
|
|
C-------------------------------------------------------------------- |
662 |
|
|
C---- if TDCleft.and.TDCright and NO ADC insert artificial ADC |
663 |
|
|
C---- values |
664 |
|
|
C-------------------------------------------------------------------- |
665 |
|
|
c middle y (or x) position of the upper and middle ToF-Paddle |
666 |
|
|
c DATA tof11_x/ -17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85/ |
667 |
|
|
c DATA tof12_y/ -13.75,-8.25,-2.75,2.75,8.25,13.75/ |
668 |
|
|
c DATA tof21_y/ 3.75,-3.75/ ! paddles in different order |
669 |
|
|
c DATA tof22_x/ -4.5,4.5/ |
670 |
|
|
c DATA tof31_x/ -6.0,0.,6.0/ |
671 |
|
|
c DATA tof32_y/ -5.0,0.0,5.0/ |
672 |
|
|
|
673 |
|
|
|
674 |
|
|
C---------------------------- S1 ------------------------------------- |
675 |
|
|
|
676 |
|
|
yhelp=0. |
677 |
|
|
if (tof12_i.GT.none_find) yhelp=tof12_y(tof12_i) |
678 |
|
|
if (ytofpos(1).lt.100) yhelp=ytofpos(1) |
679 |
|
|
|
680 |
|
|
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
681 |
|
|
i = tof11_i |
682 |
mocchiut |
1.6 |
if (adc(ch11a(i),hb11a(i)).eq.4095) then |
683 |
|
|
xkorr = atten(left,11,i,yhelp) |
684 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
685 |
mocchiut |
1.4 |
tof11(left,i,iadc)=xkorr/cos(theta13) |
686 |
|
|
adcflagtof(ch11a(i),hb11a(i)) = 1 |
687 |
|
|
endif |
688 |
mocchiut |
1.6 |
if (adc(ch11b(i),hb11b(i)).eq.4095) then |
689 |
|
|
xkorr = atten(right,11,i,yhelp) |
690 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
691 |
mocchiut |
1.4 |
tof11(right,i,iadc)=xkorr/cos(theta13) |
692 |
|
|
adcflagtof(ch11b(i),hb11b(i)) = 1 |
693 |
|
|
endif |
694 |
|
|
ENDIF |
695 |
|
|
|
696 |
|
|
xhelp=0. |
697 |
|
|
if (tof11_i.GT.none_find) xhelp=tof11_x(tof11_i) |
698 |
|
|
if (xtofpos(1).lt.100) xhelp=xtofpos(1) |
699 |
|
|
|
700 |
|
|
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
701 |
|
|
i = tof12_i |
702 |
mocchiut |
1.6 |
if (adc(ch12a(i),hb12a(i)).eq.4095) then |
703 |
|
|
xkorr = atten(left,12,i,xhelp) |
704 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
705 |
mocchiut |
1.4 |
tof12(left,i,iadc) = xkorr/cos(theta13) |
706 |
|
|
adcflagtof(ch12a(i),hb12a(i)) = 1 |
707 |
|
|
endif |
708 |
mocchiut |
1.6 |
if (adc(ch12b(i),hb12b(i)).eq.4095) then |
709 |
|
|
xkorr = atten(right,12,i,xhelp) |
710 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
711 |
mocchiut |
1.4 |
tof12(right,i,iadc) = xkorr/cos(theta13) |
712 |
|
|
adcflagtof(ch12b(i),hb12b(i)) = 1 |
713 |
|
|
endif |
714 |
|
|
ENDIF |
715 |
|
|
|
716 |
|
|
C-----------------------------S2 -------------------------------- |
717 |
|
|
|
718 |
|
|
xhelp=0. |
719 |
|
|
if (tof22_i.GT.none_find) xhelp=tof22_x(tof22_i) |
720 |
|
|
if (xtofpos(2).lt.100) xhelp=xtofpos(2) |
721 |
|
|
|
722 |
|
|
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
723 |
|
|
i = tof21_i |
724 |
mocchiut |
1.6 |
if (adc(ch21a(i),hb21a(i)).eq.4095) then |
725 |
|
|
xkorr = atten(left,21,i,xhelp) |
726 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
727 |
mocchiut |
1.4 |
tof21(left,i,iadc) = xkorr/cos(theta13) |
728 |
|
|
adcflagtof(ch21a(i),hb21a(i)) = 1 |
729 |
|
|
endif |
730 |
mocchiut |
1.6 |
if (adc(ch21b(i),hb21b(i)).eq.4095) then |
731 |
|
|
xkorr = atten(right,21,i,xhelp) |
732 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
733 |
mocchiut |
1.4 |
tof21(right,i,iadc) = xkorr/cos(theta13) |
734 |
|
|
adcflagtof(ch21b(i),hb21b(i)) = 1 |
735 |
|
|
endif |
736 |
|
|
ENDIF |
737 |
|
|
|
738 |
|
|
|
739 |
|
|
yhelp=0. |
740 |
|
|
if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) |
741 |
|
|
if (ytofpos(2).lt.100) yhelp=ytofpos(2) |
742 |
|
|
|
743 |
|
|
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
744 |
|
|
i = tof22_i |
745 |
mocchiut |
1.6 |
if (adc(ch22a(i),hb22a(i)).eq.4095) then |
746 |
|
|
xkorr = atten(left,22,i,yhelp) |
747 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
748 |
mocchiut |
1.4 |
tof22(left,i,iadc) = xkorr/cos(theta13) |
749 |
|
|
adcflagtof(ch22a(i),hb22a(i)) = 1 |
750 |
|
|
endif |
751 |
mocchiut |
1.6 |
if (adc(ch22b(i),hb22b(i)).eq.4095) then |
752 |
|
|
xkorr = atten(right,22,i,yhelp) |
753 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
754 |
mocchiut |
1.4 |
tof22(right,i,iadc) = xkorr/cos(theta13) |
755 |
|
|
adcflagtof(ch22b(i),hb22b(i)) = 1 |
756 |
|
|
endif |
757 |
|
|
ENDIF |
758 |
|
|
|
759 |
|
|
C-----------------------------S3 -------------------------------- |
760 |
|
|
|
761 |
|
|
yhelp=0. |
762 |
|
|
if (tof32_i.GT.none_find) yhelp=tof32_y(tof32_i) |
763 |
|
|
if (ytofpos(3).lt.100) yhelp=ytofpos(3) |
764 |
|
|
|
765 |
|
|
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
766 |
|
|
i = tof31_i |
767 |
mocchiut |
1.6 |
if (adc(ch31a(i),hb31a(i)).eq.4095) then |
768 |
|
|
xkorr = atten(left,31,i,yhelp) |
769 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
770 |
mocchiut |
1.4 |
tof31(left,i,iadc) = xkorr/cos(theta13) |
771 |
|
|
adcflagtof(ch31a(i),hb31a(i)) = 1 |
772 |
|
|
endif |
773 |
mocchiut |
1.6 |
if (adc(ch31b(i),hb31b(i)).eq.4095) then |
774 |
|
|
xkorr = atten(right,31,i,yhelp) |
775 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
776 |
mocchiut |
1.4 |
tof31(right,i,iadc) = xkorr/cos(theta13) |
777 |
|
|
adcflagtof(ch31b(i),hb31b(i)) = 1 |
778 |
|
|
endif |
779 |
|
|
ENDIF |
780 |
|
|
|
781 |
|
|
xhelp=0. |
782 |
|
|
if (tof31_i.GT.none_find) xhelp=tof31_x(tof31_i) |
783 |
|
|
if (xtofpos(3).lt.100) xhelp=xtofpos(3) |
784 |
|
|
|
785 |
|
|
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
786 |
|
|
i = tof32_i |
787 |
mocchiut |
1.6 |
if (adc(ch32a(i),hb32a(i)).eq.4095) then |
788 |
|
|
xkorr = atten(left,32,i,xhelp) |
789 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
790 |
mocchiut |
1.4 |
tof32(left,i,iadc) = xkorr/cos(theta13) |
791 |
|
|
adcflagtof(ch32a(i),hb32a(i)) = 1 |
792 |
|
|
endif |
793 |
mocchiut |
1.6 |
if (adc(ch32b(i),hb32b(i)).eq.4095) then |
794 |
|
|
xkorr = atten(right,32,i,xhelp) |
795 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
796 |
mocchiut |
1.4 |
tof32(right,i,iadc) = xkorr/cos(theta13) |
797 |
|
|
adcflagtof(ch32b(i),hb32b(i)) = 1 |
798 |
|
|
endif |
799 |
|
|
ENDIF |
800 |
|
|
|
801 |
mocchiut |
1.1 |
|
802 |
mocchiut |
1.7 |
C------------------------------------------------------------------- |
803 |
mocchiut |
1.1 |
C--------------------Time walk correction ------------------------- |
804 |
mocchiut |
1.7 |
C------------------------------------------------------------------- |
805 |
|
|
C------------------------------------------------------------------- |
806 |
|
|
C Now there is for each hitted paddle a TDC and ADC value, if the |
807 |
|
|
C TDC was < 4095. |
808 |
|
|
C There might be also TDC-ADC pairs in paddles not hitted |
809 |
|
|
|
810 |
|
|
C------------------------------------------------------------------- |
811 |
|
|
C If we have multiple paddles hit, so that no artificial ADC value |
812 |
|
|
C is created, we set the raw TDC value as "tdc_c" |
813 |
|
|
C------------------------------------------------------------------- |
814 |
|
|
c |
815 |
|
|
c do i=1,4 |
816 |
|
|
c do j=1,12 |
817 |
|
|
c tdc_c(i,j) = tdc(i,j) |
818 |
|
|
c enddo |
819 |
|
|
c enddo |
820 |
|
|
c |
821 |
|
|
C---- Let's correct the raw TDC value with the time walk --------- |
822 |
mocchiut |
1.1 |
|
823 |
|
|
DO i=1,8 |
824 |
mocchiut |
1.7 |
if ((tdc(ch11a(i),hb11a(i)).lt.4095).and. |
825 |
|
|
& (tof11(left,i,iadc).lt.3786)) THEN |
826 |
|
|
xhelp = tw11(left,i)/(tof11(left,i,iadc)**0.5) |
827 |
|
|
tof11(left,i,itdc) = tof11(left,i,itdc) + xhelp |
828 |
|
|
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
829 |
|
|
ENDIF |
830 |
|
|
|
831 |
|
|
if ((tdc(ch11b(i),hb11b(i)).lt.4095).and. |
832 |
|
|
& (tof11(right,i,iadc).lt.3786)) THEN |
833 |
|
|
xhelp = tw11(right,i)/(tof11(right,i,iadc)**0.5) |
834 |
|
|
tof11(right,i,itdc) = tof11(right,i,itdc) + xhelp |
835 |
|
|
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
836 |
|
|
ENDIF |
837 |
mocchiut |
1.1 |
ENDDO |
838 |
|
|
|
839 |
mocchiut |
1.7 |
|
840 |
mocchiut |
1.1 |
DO i=1,6 |
841 |
mocchiut |
1.7 |
if ((tdc(ch12a(i),hb12a(i)).lt.4095).and. |
842 |
|
|
& (tof12(left,i,iadc).lt.3786)) THEN |
843 |
|
|
xhelp = tw12(left,i)/(tof12(left,i,iadc)**0.5) |
844 |
|
|
tof12(left,i,itdc) = tof12(left,i,itdc) + xhelp |
845 |
|
|
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
846 |
|
|
ENDIF |
847 |
|
|
|
848 |
|
|
if ((tdc(ch12b(i),hb12b(i)).lt.4095).and. |
849 |
|
|
& (tof12(right,i,iadc).lt.3786)) THEN |
850 |
|
|
xhelp = tw12(right,i)/(tof12(right,i,iadc)**0.5) |
851 |
|
|
tof12(right,i,itdc) = tof12(right,i,itdc) + xhelp |
852 |
|
|
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
853 |
|
|
ENDIF |
854 |
mocchiut |
1.1 |
ENDDO |
855 |
mocchiut |
1.7 |
|
856 |
mocchiut |
1.1 |
C---- |
857 |
mocchiut |
1.7 |
DO I=1,2 |
858 |
|
|
if ((tdc(ch21a(i),hb21a(i)).lt.4095).and. |
859 |
|
|
& (tof21(left,i,iadc).lt.3786)) THEN |
860 |
|
|
xhelp = tw21(left,i)/(tof21(left,i,iadc)**0.5) |
861 |
|
|
tof21(left,i,itdc) = tof21(left,i,itdc) + xhelp |
862 |
|
|
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
863 |
|
|
ENDIF |
864 |
|
|
|
865 |
|
|
if ((tdc(ch21b(i),hb21b(i)).lt.4095).and. |
866 |
|
|
& (tof21(right,i,iadc).lt.3786)) THEN |
867 |
|
|
xhelp = tw21(right,i)/(tof21(right,i,iadc)**0.5) |
868 |
|
|
tof21(right,i,itdc) = tof21(right,i,itdc) + xhelp |
869 |
|
|
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
870 |
|
|
ENDIF |
871 |
|
|
ENDDO |
872 |
|
|
|
873 |
|
|
DO I=1,2 |
874 |
|
|
if ((tdc(ch22a(i),hb22a(i)).lt.4095).and. |
875 |
|
|
& (tof22(left,i,iadc).lt.3786)) THEN |
876 |
|
|
xhelp = tw22(left,i)/(tof22(left,i,iadc)**0.5) |
877 |
|
|
tof22(left,i,itdc) = tof22(left,i,itdc) + xhelp |
878 |
|
|
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
879 |
|
|
ENDIF |
880 |
|
|
|
881 |
|
|
if ((tdc(ch22b(i),hb22b(i)).lt.4095).and. |
882 |
|
|
& (tof22(right,i,iadc).lt.3786)) THEN |
883 |
|
|
xhelp = tw22(right,i)/(tof22(right,i,iadc)**0.5) |
884 |
|
|
tof22(right,i,itdc) = tof22(right,i,itdc) + xhelp |
885 |
|
|
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
886 |
|
|
ENDIF |
887 |
mocchiut |
1.1 |
ENDDO |
888 |
mocchiut |
1.7 |
|
889 |
mocchiut |
1.1 |
C---- |
890 |
mocchiut |
1.7 |
DO I=1,3 |
891 |
|
|
if ((tdc(ch31a(i),hb31a(i)).lt.4095).and. |
892 |
|
|
& (tof31(left,i,iadc).lt.3786)) THEN |
893 |
|
|
xhelp = tw31(left,i)/(tof31(left,i,iadc)**0.5) |
894 |
|
|
tof31(left,i,itdc) = tof31(left,i,itdc) + xhelp |
895 |
|
|
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
896 |
|
|
ENDIF |
897 |
|
|
|
898 |
|
|
if ((tdc(ch31b(i),hb31b(i)).lt.4095).and. |
899 |
|
|
& (tof31(right,i,iadc).lt.3786)) THEN |
900 |
|
|
xhelp = tw31(right,i)/(tof31(right,i,iadc)**0.5) |
901 |
|
|
tof31(right,i,itdc) = tof31(right,i,itdc) + xhelp |
902 |
|
|
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
903 |
|
|
ENDIF |
904 |
|
|
ENDDO |
905 |
|
|
|
906 |
|
|
DO I=1,3 |
907 |
|
|
if ((tdc(ch32a(i),hb32a(i)).lt.4095).and. |
908 |
|
|
& (tof32(left,i,iadc).lt.3786)) THEN |
909 |
|
|
xhelp = tw32(left,i)/(tof32(left,i,iadc)**0.5) |
910 |
|
|
tof32(left,i,itdc) = tof32(left,i,itdc) + xhelp |
911 |
|
|
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
912 |
|
|
ENDIF |
913 |
|
|
|
914 |
|
|
if ((tdc(ch32b(i),hb32b(i)).lt.4095).and. |
915 |
|
|
& (tof32(right,i,iadc).lt.3786)) THEN |
916 |
|
|
xhelp = tw32(right,i)/(tof32(right,i,iadc)**0.5) |
917 |
|
|
tof32(right,i,itdc) = tof32(right,i,itdc) + xhelp |
918 |
|
|
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
919 |
|
|
ENDIF |
920 |
|
|
ENDDO |
921 |
|
|
|
922 |
|
|
C--------------------------------------------------------------- |
923 |
|
|
C--- calculate track position in paddle using timing difference |
924 |
|
|
C--- now using the time-walk corrected TDC values |
925 |
|
|
C--------------------------------------------------------------- |
926 |
|
|
|
927 |
|
|
do i=1,3 |
928 |
|
|
xtofpos(i)=100. |
929 |
|
|
ytofpos(i)=100. |
930 |
|
|
enddo |
931 |
|
|
|
932 |
|
|
C-----------------------------S1 -------------------------------- |
933 |
|
|
|
934 |
|
|
IF (tof11_i.GT.none_find) THEN |
935 |
|
|
ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. |
936 |
|
|
+ -y_coor_lin11(tof11_i,offset))/y_coor_lin11(tof11_i,slope) |
937 |
|
|
endif |
938 |
|
|
|
939 |
|
|
IF (tof12_i.GT.none_find) THEN |
940 |
|
|
xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. |
941 |
|
|
+ -x_coor_lin12(tof12_i,offset))/x_coor_lin12(tof12_i,slope) |
942 |
|
|
endif |
943 |
|
|
|
944 |
|
|
|
945 |
|
|
C-----------------------------S2 -------------------------------- |
946 |
|
|
|
947 |
|
|
IF (tof21_i.GT.none_find) THEN |
948 |
|
|
xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. |
949 |
|
|
+ -x_coor_lin21(tof21_i,offset))/x_coor_lin21(tof21_i,slope) |
950 |
|
|
endif |
951 |
|
|
|
952 |
|
|
IF (tof22_i.GT.none_find) THEN |
953 |
|
|
ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. |
954 |
|
|
+ -y_coor_lin22(tof22_i,offset))/y_coor_lin22(tof22_i,slope) |
955 |
|
|
endif |
956 |
|
|
|
957 |
|
|
|
958 |
|
|
C-----------------------------S3 -------------------------------- |
959 |
|
|
|
960 |
|
|
IF (tof31_i.GT.none_find) THEN |
961 |
|
|
ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. |
962 |
|
|
+ -y_coor_lin31(tof31_i,offset))/y_coor_lin31(tof31_i,slope) |
963 |
|
|
endif |
964 |
|
|
|
965 |
|
|
IF (tof32_i.GT.none_find) THEN |
966 |
|
|
xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. |
967 |
|
|
+ -x_coor_lin32(tof32_i,offset))/x_coor_lin32(tof32_i,slope) |
968 |
|
|
endif |
969 |
|
|
|
970 |
|
|
|
971 |
|
|
c do i=1,3 |
972 |
|
|
c if (abs(xtofpos(i)).gt.100.) then |
973 |
|
|
c xtofpos(i)=101. |
974 |
|
|
c endif |
975 |
|
|
c if (abs(ytofpos(i)).gt.100.) then |
976 |
|
|
c ytofpos(i)=101. |
977 |
|
|
c endif |
978 |
|
|
c enddo |
979 |
|
|
|
980 |
|
|
C-- restrict TDC measurements to physical paddle dimensions +/- 10 cm |
981 |
|
|
C-- this cut is now stronger than in the old versions |
982 |
mocchiut |
1.1 |
|
983 |
mocchiut |
1.7 |
if (abs(xtofpos(1)).gt.31.) xtofpos(1)=101. |
984 |
|
|
if (abs(xtofpos(2)).gt.19.) xtofpos(2)=101. |
985 |
|
|
if (abs(xtofpos(3)).gt.19.) xtofpos(3)=101. |
986 |
|
|
|
987 |
|
|
if (abs(ytofpos(1)).gt.26.) ytofpos(1)=101. |
988 |
|
|
if (abs(ytofpos(2)).gt.18.) ytofpos(2)=101. |
989 |
|
|
if (abs(ytofpos(3)).gt.18.) ytofpos(3)=101. |
990 |
|
|
|
991 |
|
|
|
992 |
|
|
C---------------------------------------------------------------------- |
993 |
|
|
C--------------------- zenith angle theta --------------------------- |
994 |
|
|
C---------------------------------------------------------------------- |
995 |
|
|
|
996 |
|
|
dx=0. |
997 |
|
|
dy=0. |
998 |
|
|
dr=0. |
999 |
|
|
theta13 = 0. |
1000 |
|
|
|
1001 |
|
|
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
1002 |
|
|
& dx = xtofpos(1) - xtofpos(3) |
1003 |
|
|
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
1004 |
|
|
& dy = ytofpos(1) - ytofpos(3) |
1005 |
|
|
dr = sqrt(dx*dx+dy*dy) |
1006 |
|
|
theta13 = atan(dr/tofarm13) |
1007 |
mocchiut |
1.1 |
|
1008 |
mocchiut |
1.7 |
C------------------------------------------------------------------ |
1009 |
|
|
c dx=0. |
1010 |
|
|
c dy=0. |
1011 |
|
|
c dr=0. |
1012 |
|
|
c theta12 = 0. |
1013 |
|
|
c |
1014 |
|
|
c IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find)) |
1015 |
|
|
c & dx = xtofpos(1) - xtofpos(2) |
1016 |
|
|
c IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find)) |
1017 |
|
|
c & dy = ytofpos(1) - ytofpos(2) |
1018 |
|
|
c dr = sqrt(dx*dx+dy*dy) |
1019 |
|
|
c theta12 = atan(dr/tofarm12) |
1020 |
|
|
c |
1021 |
|
|
c dx=0. |
1022 |
|
|
c dy=0. |
1023 |
|
|
c dr=0. |
1024 |
|
|
c theta23 = 0. |
1025 |
|
|
c |
1026 |
|
|
c IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
1027 |
|
|
c & dx = xtofpos(2) - xtofpos(3) |
1028 |
|
|
c IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
1029 |
|
|
c & dy = ytofpos(2) - ytofpos(3) |
1030 |
|
|
c dr = sqrt(dx*dx+dy*dy) |
1031 |
|
|
c theta23 = atan(dr/tofarm23) |
1032 |
|
|
c |
1033 |
mocchiut |
1.1 |
C---------------------------------------------------------------------- |
1034 |
|
|
C------------------angle and ADC(x) correction |
1035 |
|
|
C---------------------------------------------------------------------- |
1036 |
|
|
C-----------------------------S1 -------------------------------- |
1037 |
|
|
c middle y (or x) position of the upper and middle ToF-Paddle |
1038 |
|
|
c DATA tof11_x/ -17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85/ |
1039 |
|
|
c DATA tof12_y/ -13.75,-8.25,-2.75,2.75,8.25,13.75/ |
1040 |
mocchiut |
1.4 |
c DATA tof21_y/ 3.75,-3.75/ ! paddles in different order |
1041 |
mocchiut |
1.1 |
c DATA tof22_x/ -4.5,4.5/ |
1042 |
|
|
c DATA tof31_x/ -6.0,0.,6.0/ |
1043 |
|
|
c DATA tof32_y/ -5.0,0.0,5.0/ |
1044 |
|
|
|
1045 |
|
|
yhelp=0. |
1046 |
|
|
if (tof12_i.GT.none_find) yhelp=tof12_y(tof12_i) |
1047 |
|
|
if (ytofpos(1).lt.100) yhelp=ytofpos(1) |
1048 |
|
|
|
1049 |
|
|
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1050 |
|
|
|
1051 |
|
|
i = tof11_i |
1052 |
mocchiut |
1.6 |
if (tof11(left,i,iadc).lt.3786) then |
1053 |
|
|
c if (adc(ch11a(i),hb11a(i)).lt.4095) then |
1054 |
mocchiut |
1.4 |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
1055 |
mocchiut |
1.6 |
xkorr = atten(left,11,i,yhelp) |
1056 |
|
|
c write(40+i,*) yhelp,xkorr |
1057 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1058 |
mocchiut |
1.1 |
adctof_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
1059 |
|
|
endif |
1060 |
|
|
|
1061 |
mocchiut |
1.6 |
if (tof11(right,i,iadc).lt.3786) then |
1062 |
|
|
c if (adc(ch11b(i),hb11b(i)).lt.4095) then |
1063 |
mocchiut |
1.4 |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
1064 |
mocchiut |
1.6 |
xkorr = atten(right,11,i,yhelp) |
1065 |
|
|
c write(40+i,*) yhelp,xkorr |
1066 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1067 |
mocchiut |
1.1 |
adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
1068 |
|
|
endif |
1069 |
|
|
ENDIF |
1070 |
|
|
|
1071 |
|
|
xhelp=0. |
1072 |
|
|
if (tof11_i.GT.none_find) xhelp=tof11_x(tof11_i) |
1073 |
|
|
if (xtofpos(1).lt.100) xhelp=xtofpos(1) |
1074 |
|
|
|
1075 |
|
|
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1076 |
|
|
|
1077 |
|
|
i = tof12_i |
1078 |
mocchiut |
1.6 |
if (tof12(left,i,iadc).lt.3786) then |
1079 |
|
|
c if (adc(ch12a(i),hb12a(i)).lt.4095) then |
1080 |
mocchiut |
1.4 |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
1081 |
mocchiut |
1.6 |
xkorr = atten(left,12,i,xhelp) |
1082 |
|
|
c write(50+i,*) xhelp,xkorr |
1083 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1084 |
mocchiut |
1.1 |
adctof_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
1085 |
|
|
endif |
1086 |
|
|
|
1087 |
mocchiut |
1.6 |
if (tof12(right,i,iadc).lt.3786) then |
1088 |
|
|
c if (adc(ch12b(i),hb12b(i)).lt.4095) then |
1089 |
mocchiut |
1.4 |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
1090 |
mocchiut |
1.6 |
xkorr = atten(right,12,i,xhelp) |
1091 |
|
|
c write(50+i,*) xhelp,xkorr |
1092 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1093 |
mocchiut |
1.1 |
adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
1094 |
|
|
endif |
1095 |
|
|
ENDIF |
1096 |
|
|
|
1097 |
|
|
C-----------------------------S2 -------------------------------- |
1098 |
|
|
|
1099 |
|
|
xhelp=0. |
1100 |
|
|
if (tof22_i.GT.none_find) xhelp=tof22_x(tof22_i) |
1101 |
|
|
if (xtofpos(2).lt.100) xhelp=xtofpos(2) |
1102 |
|
|
|
1103 |
|
|
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1104 |
|
|
|
1105 |
|
|
i = tof21_i |
1106 |
mocchiut |
1.6 |
if (tof21(left,i,iadc).lt.3786) then |
1107 |
|
|
c if (adc(ch21a(i),hb21a(i)).lt.4095) then |
1108 |
mocchiut |
1.4 |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
1109 |
mocchiut |
1.6 |
xkorr = atten(left,21,i,xhelp) |
1110 |
|
|
c write(60+i,*) xhelp,xkorr |
1111 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1112 |
mocchiut |
1.1 |
adctof_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
1113 |
|
|
endif |
1114 |
|
|
|
1115 |
mocchiut |
1.6 |
if (tof21(right,i,iadc).lt.3786) then |
1116 |
|
|
c if (adc(ch21b(i),hb21b(i)).lt.4095) then |
1117 |
mocchiut |
1.4 |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
1118 |
mocchiut |
1.1 |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
1119 |
mocchiut |
1.6 |
xkorr = atten(right,21,i,xhelp) |
1120 |
|
|
c write(60+i,*) xhelp,xkorr |
1121 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1122 |
mocchiut |
1.1 |
adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
1123 |
|
|
endif |
1124 |
|
|
ENDIF |
1125 |
|
|
|
1126 |
|
|
|
1127 |
|
|
yhelp=0. |
1128 |
|
|
if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) |
1129 |
|
|
if (ytofpos(2).lt.100) yhelp=ytofpos(2) |
1130 |
|
|
|
1131 |
|
|
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1132 |
|
|
|
1133 |
|
|
i = tof22_i |
1134 |
mocchiut |
1.6 |
if (tof22(left,i,iadc).lt.3786) then |
1135 |
|
|
c if (adc(ch22a(i),hb22a(i)).lt.4095) then |
1136 |
mocchiut |
1.4 |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
1137 |
mocchiut |
1.6 |
xkorr = atten(left,22,i,yhelp) |
1138 |
|
|
c write(70+i,*) yhelp,xkorr |
1139 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1140 |
mocchiut |
1.1 |
adctof_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
1141 |
|
|
endif |
1142 |
|
|
|
1143 |
mocchiut |
1.6 |
if (tof22(right,i,iadc).lt.3786) then |
1144 |
|
|
c if (adc(ch22b(i),hb22b(i)).lt.4095) then |
1145 |
mocchiut |
1.4 |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
1146 |
mocchiut |
1.6 |
xkorr = atten(right,22,i,yhelp) |
1147 |
|
|
c write(70+i,*) yhelp,xkorr |
1148 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1149 |
mocchiut |
1.1 |
adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
1150 |
|
|
endif |
1151 |
|
|
ENDIF |
1152 |
|
|
|
1153 |
|
|
C-----------------------------S3 -------------------------------- |
1154 |
|
|
|
1155 |
|
|
yhelp=0. |
1156 |
|
|
if (tof32_i.GT.none_find) yhelp=tof32_y(tof32_i) |
1157 |
|
|
if (ytofpos(3).lt.100) yhelp=ytofpos(3) |
1158 |
|
|
|
1159 |
|
|
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1160 |
|
|
|
1161 |
|
|
i = tof31_i |
1162 |
mocchiut |
1.6 |
if (tof31(left,i,iadc).lt.3786) then |
1163 |
|
|
c if (adc(ch31a(i),hb31a(i)).lt.4095) then |
1164 |
mocchiut |
1.4 |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
1165 |
mocchiut |
1.6 |
xkorr = atten(left,31,i,yhelp) |
1166 |
|
|
c write(80+i,*) yhelp,xkorr |
1167 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1168 |
mocchiut |
1.1 |
adctof_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
1169 |
|
|
endif |
1170 |
|
|
|
1171 |
mocchiut |
1.6 |
if (tof31(right,i,iadc).lt.3786) then |
1172 |
|
|
c if (adc(ch31b(i),hb31b(i)).lt.4095) then |
1173 |
mocchiut |
1.4 |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
1174 |
mocchiut |
1.6 |
xkorr = atten(right,31,i,yhelp) |
1175 |
|
|
c write(80+i,*) yhelp,xkorr |
1176 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1177 |
mocchiut |
1.1 |
adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
1178 |
|
|
endif |
1179 |
|
|
ENDIF |
1180 |
|
|
|
1181 |
|
|
xhelp=0. |
1182 |
|
|
if (tof31_i.GT.none_find) xhelp=tof31_x(tof31_i) |
1183 |
|
|
if (xtofpos(3).lt.100) xhelp=xtofpos(3) |
1184 |
|
|
|
1185 |
|
|
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1186 |
|
|
|
1187 |
|
|
i = tof32_i |
1188 |
mocchiut |
1.6 |
if (tof32(left,i,iadc).lt.3786) then |
1189 |
|
|
c if (adc(ch32a(i),hb32a(i)).lt.4095) then |
1190 |
mocchiut |
1.4 |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
1191 |
mocchiut |
1.6 |
xkorr = atten(left,32,i,xhelp) |
1192 |
|
|
c write(90+i,*) xhelp,xkorr |
1193 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1194 |
mocchiut |
1.1 |
adctof_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
1195 |
|
|
endif |
1196 |
|
|
|
1197 |
mocchiut |
1.6 |
if (tof32(right,i,iadc).lt.3786) then |
1198 |
|
|
c if (adc(ch32b(i),hb32b(i)).lt.4095) then |
1199 |
mocchiut |
1.4 |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
1200 |
mocchiut |
1.6 |
xkorr = atten(right,32,i,xhelp) |
1201 |
|
|
c write(90+i,*) xhelp,xkorr |
1202 |
mocchiut |
1.7 |
if (iz.le.1) xkorr=xkorr/hepratio |
1203 |
mocchiut |
1.1 |
adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
1204 |
|
|
endif |
1205 |
|
|
ENDIF |
1206 |
|
|
|
1207 |
mocchiut |
1.4 |
C-------------------------------------------------------------------- |
1208 |
mocchiut |
1.1 |
C----------------------calculate Beta ------------------------------ |
1209 |
mocchiut |
1.4 |
C-------------------------------------------------------------------- |
1210 |
|
|
C-------------------difference of sums ----------------------------- |
1211 |
mocchiut |
1.1 |
C |
1212 |
|
|
C DS = (t1+t2) - t3+t4) |
1213 |
|
|
C DS = c1 + c2/beta*cos(theta) |
1214 |
|
|
C c2 = 2d/c gives c2 = 2d/(c*TDCresolution) TDC=50ps/channel |
1215 |
|
|
C => c2 = ca.60 for 0.45 m c2 = ca.109 for 0.81 m |
1216 |
|
|
C since TDC resolution varies slightly c2 has to be calibrated |
1217 |
|
|
|
1218 |
|
|
C S11 - S31 |
1219 |
mocchiut |
1.4 |
|
1220 |
|
|
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1221 |
|
|
& (ytofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1222 |
mocchiut |
1.1 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1223 |
|
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1224 |
|
|
ds = xhelp1-xhelp2 |
1225 |
|
|
ihelp=(tof11_i-1)*3+tof31_i |
1226 |
|
|
c1 = k_S11S31(1,ihelp) |
1227 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
1228 |
mocchiut |
1.1 |
c2 = k_S11S31(2,ihelp) |
1229 |
|
|
betatof_a(1) = c2/(cos(theta13)*(ds-c1)) |
1230 |
mocchiut |
1.2 |
|
1231 |
|
|
C------- ToF Mask - S11 - S31 |
1232 |
|
|
|
1233 |
|
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1234 |
|
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1235 |
|
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1236 |
|
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1237 |
|
|
|
1238 |
|
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1239 |
|
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1240 |
|
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1241 |
|
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1242 |
|
|
|
1243 |
|
|
C------- |
1244 |
|
|
|
1245 |
mocchiut |
1.1 |
ENDIF |
1246 |
|
|
|
1247 |
|
|
C S11 - S32 |
1248 |
mocchiut |
1.4 |
|
1249 |
|
|
IF ((tof11_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1250 |
|
|
& (ytofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1251 |
mocchiut |
1.1 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1252 |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1253 |
|
|
ds = xhelp1-xhelp2 |
1254 |
|
|
ihelp=(tof11_i-1)*3+tof32_i |
1255 |
|
|
c1 = k_S11S32(1,ihelp) |
1256 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
1257 |
mocchiut |
1.1 |
c2 = k_S11S32(2,ihelp) |
1258 |
|
|
betatof_a(2) = c2/(cos(theta13)*(ds-c1)) |
1259 |
mocchiut |
1.2 |
|
1260 |
|
|
C------- ToF Mask - S11 - S32 |
1261 |
|
|
|
1262 |
|
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1263 |
|
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1264 |
|
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1265 |
|
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1266 |
|
|
|
1267 |
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1268 |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1269 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1270 |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1271 |
|
|
|
1272 |
|
|
C------- |
1273 |
|
|
|
1274 |
mocchiut |
1.1 |
ENDIF |
1275 |
mocchiut |
1.2 |
|
1276 |
mocchiut |
1.1 |
C S12 - S31 |
1277 |
mocchiut |
1.4 |
|
1278 |
|
|
IF ((tof12_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1279 |
|
|
& (xtofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1280 |
mocchiut |
1.1 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1281 |
|
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1282 |
|
|
ds = xhelp1-xhelp2 |
1283 |
|
|
ihelp=(tof12_i-1)*3+tof31_i |
1284 |
|
|
c1 = k_S12S31(1,ihelp) |
1285 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
1286 |
mocchiut |
1.1 |
c2 = k_S12S31(2,ihelp) |
1287 |
|
|
betatof_a(3) = c2/(cos(theta13)*(ds-c1)) |
1288 |
mocchiut |
1.2 |
|
1289 |
|
|
C------- ToF Mask - S12 - S31 |
1290 |
|
|
|
1291 |
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1292 |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1293 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1294 |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1295 |
|
|
|
1296 |
|
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1297 |
|
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1298 |
|
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1299 |
|
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1300 |
|
|
|
1301 |
|
|
C------- |
1302 |
|
|
|
1303 |
mocchiut |
1.1 |
ENDIF |
1304 |
mocchiut |
1.2 |
|
1305 |
mocchiut |
1.1 |
C S12 - S32 |
1306 |
mocchiut |
1.4 |
|
1307 |
|
|
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1308 |
|
|
& (xtofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1309 |
mocchiut |
1.1 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1310 |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1311 |
|
|
ds = xhelp1-xhelp2 |
1312 |
|
|
ihelp=(tof12_i-1)*3+tof32_i |
1313 |
|
|
c1 = k_S12S32(1,ihelp) |
1314 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
1315 |
mocchiut |
1.1 |
c2 = k_S12S32(2,ihelp) |
1316 |
|
|
betatof_a(4) = c2/(cos(theta13)*(ds-c1)) |
1317 |
mocchiut |
1.2 |
|
1318 |
|
|
C------- ToF Mask - S12 - S32 |
1319 |
|
|
|
1320 |
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1321 |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1322 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1323 |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1324 |
|
|
|
1325 |
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1326 |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1327 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1328 |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1329 |
|
|
|
1330 |
|
|
C------- |
1331 |
|
|
|
1332 |
mocchiut |
1.1 |
ENDIF |
1333 |
|
|
|
1334 |
|
|
C S21 - S31 |
1335 |
mocchiut |
1.4 |
|
1336 |
|
|
IF ((tof21_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1337 |
|
|
& (xtofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1338 |
mocchiut |
1.1 |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1339 |
|
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1340 |
|
|
ds = xhelp1-xhelp2 |
1341 |
|
|
ihelp=(tof21_i-1)*3+tof31_i |
1342 |
|
|
c1 = k_S21S31(1,ihelp) |
1343 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
1344 |
mocchiut |
1.1 |
c2 = k_S21S31(2,ihelp) |
1345 |
mocchiut |
1.4 |
betatof_a(5) = c2/(cos(theta13)*(ds-c1)) |
1346 |
mocchiut |
1.2 |
|
1347 |
|
|
C------- ToF Mask - S21 - S31 |
1348 |
|
|
|
1349 |
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1350 |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1351 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1352 |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1353 |
|
|
|
1354 |
|
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1355 |
|
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1356 |
|
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1357 |
|
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1358 |
|
|
|
1359 |
|
|
C------- |
1360 |
|
|
|
1361 |
mocchiut |
1.1 |
ENDIF |
1362 |
|
|
|
1363 |
|
|
C S21 - S32 |
1364 |
mocchiut |
1.4 |
|
1365 |
|
|
IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1366 |
|
|
& (xtofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1367 |
mocchiut |
1.1 |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1368 |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1369 |
|
|
ds = xhelp1-xhelp2 |
1370 |
|
|
ihelp=(tof21_i-1)*3+tof32_i |
1371 |
|
|
c1 = k_S21S32(1,ihelp) |
1372 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
1373 |
mocchiut |
1.1 |
c2 = k_S21S32(2,ihelp) |
1374 |
mocchiut |
1.4 |
betatof_a(6) = c2/(cos(theta13)*(ds-c1)) |
1375 |
mocchiut |
1.2 |
|
1376 |
|
|
C------- ToF Mask - S21 - S32 |
1377 |
|
|
|
1378 |
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1379 |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1380 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1381 |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1382 |
|
|
|
1383 |
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1384 |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1385 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1386 |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1387 |
|
|
|
1388 |
|
|
C------- |
1389 |
|
|
|
1390 |
mocchiut |
1.1 |
ENDIF |
1391 |
|
|
|
1392 |
|
|
C S22 - S31 |
1393 |
mocchiut |
1.4 |
|
1394 |
|
|
IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1395 |
|
|
& (ytofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1396 |
mocchiut |
1.1 |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1397 |
|
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1398 |
|
|
ds = xhelp1-xhelp2 |
1399 |
|
|
ihelp=(tof22_i-1)*3+tof31_i |
1400 |
|
|
c1 = k_S22S31(1,ihelp) |
1401 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
1402 |
mocchiut |
1.1 |
c2 = k_S22S31(2,ihelp) |
1403 |
|
|
betatof_a(7) = c2/(cos(theta13)*(ds-c1)) |
1404 |
mocchiut |
1.2 |
|
1405 |
|
|
C------- ToF Mask - S22 - S31 |
1406 |
|
|
|
1407 |
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1408 |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1409 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1410 |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1411 |
|
|
|
1412 |
|
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1413 |
|
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1414 |
|
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1415 |
|
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1416 |
|
|
|
1417 |
|
|
C------- |
1418 |
|
|
|
1419 |
mocchiut |
1.1 |
ENDIF |
1420 |
|
|
|
1421 |
|
|
C S22 - S32 |
1422 |
mocchiut |
1.4 |
|
1423 |
|
|
IF ((tof22_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1424 |
|
|
& (ytofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1425 |
mocchiut |
1.1 |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1426 |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1427 |
|
|
ds = xhelp1-xhelp2 |
1428 |
|
|
ihelp=(tof22_i-1)*3+tof32_i |
1429 |
|
|
c1 = k_S22S32(1,ihelp) |
1430 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
1431 |
mocchiut |
1.1 |
c2 = k_S22S32(2,ihelp) |
1432 |
|
|
betatof_a(8) = c2/(cos(theta13)*(ds-c1)) |
1433 |
mocchiut |
1.2 |
|
1434 |
|
|
C------- ToF Mask - S22 - S32 |
1435 |
|
|
|
1436 |
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1437 |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1438 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1439 |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1440 |
|
|
|
1441 |
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1442 |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1443 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1444 |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1445 |
|
|
|
1446 |
|
|
C------- |
1447 |
|
|
|
1448 |
mocchiut |
1.1 |
ENDIF |
1449 |
|
|
|
1450 |
|
|
C S11 - S21 |
1451 |
mocchiut |
1.4 |
|
1452 |
|
|
IF ((tof11_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
1453 |
|
|
& (ytofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
1454 |
mocchiut |
1.1 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1455 |
|
|
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1456 |
|
|
ds = xhelp1-xhelp2 |
1457 |
|
|
ihelp=(tof11_i-1)*2+tof21_i |
1458 |
|
|
c1 = k_S11S21(1,ihelp) |
1459 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
1460 |
mocchiut |
1.1 |
c2 = k_S11S21(2,ihelp) |
1461 |
|
|
betatof_a(9) = c2/(cos(theta13)*(ds-c1)) |
1462 |
mocchiut |
1.2 |
|
1463 |
|
|
C------- ToF Mask - S11 - S21 |
1464 |
|
|
|
1465 |
|
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1466 |
|
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1467 |
|
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1468 |
|
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1469 |
|
|
|
1470 |
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1471 |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1472 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1473 |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1474 |
|
|
|
1475 |
|
|
C------- |
1476 |
|
|
|
1477 |
mocchiut |
1.1 |
ENDIF |
1478 |
|
|
|
1479 |
|
|
C S11 - S22 |
1480 |
mocchiut |
1.4 |
|
1481 |
|
|
IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
1482 |
|
|
& (ytofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
1483 |
mocchiut |
1.1 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1484 |
|
|
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1485 |
|
|
ds = xhelp1-xhelp2 |
1486 |
|
|
ihelp=(tof11_i-1)*2+tof22_i |
1487 |
|
|
c1 = k_S11S22(1,ihelp) |
1488 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
1489 |
mocchiut |
1.1 |
c2 = k_S11S22(2,ihelp) |
1490 |
|
|
betatof_a(10) = c2/(cos(theta13)*(ds-c1)) |
1491 |
mocchiut |
1.2 |
|
1492 |
|
|
C------- ToF Mask - S11 - S22 |
1493 |
|
|
|
1494 |
|
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1495 |
|
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1496 |
|
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1497 |
|
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1498 |
|
|
|
1499 |
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1500 |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1501 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1502 |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1503 |
|
|
|
1504 |
|
|
C------- |
1505 |
|
|
|
1506 |
mocchiut |
1.1 |
ENDIF |
1507 |
|
|
|
1508 |
|
|
C S12 - S21 |
1509 |
mocchiut |
1.4 |
|
1510 |
|
|
IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
1511 |
|
|
& (xtofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
1512 |
mocchiut |
1.1 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1513 |
|
|
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1514 |
|
|
ds = xhelp1-xhelp2 |
1515 |
|
|
ihelp=(tof12_i-1)*2+tof21_i |
1516 |
|
|
c1 = k_S12S21(1,ihelp) |
1517 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
1518 |
mocchiut |
1.1 |
c2 = k_S12S21(2,ihelp) |
1519 |
|
|
betatof_a(11) = c2/(cos(theta13)*(ds-c1)) |
1520 |
mocchiut |
1.2 |
|
1521 |
|
|
C------- ToF Mask - S12 - S21 |
1522 |
|
|
|
1523 |
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1524 |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1525 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1526 |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1527 |
|
|
|
1528 |
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1529 |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1530 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1531 |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1532 |
|
|
|
1533 |
|
|
C------- |
1534 |
|
|
|
1535 |
mocchiut |
1.1 |
ENDIF |
1536 |
|
|
|
1537 |
|
|
C S12 - S22 |
1538 |
mocchiut |
1.4 |
|
1539 |
|
|
IF ((tof12_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
1540 |
|
|
& (xtofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
1541 |
mocchiut |
1.1 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1542 |
|
|
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1543 |
|
|
ds = xhelp1-xhelp2 |
1544 |
|
|
ihelp=(tof12_i-1)*2+tof22_i |
1545 |
|
|
c1 = k_S12S22(1,ihelp) |
1546 |
mocchiut |
1.7 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
1547 |
mocchiut |
1.1 |
c2 = k_S12S22(2,ihelp) |
1548 |
|
|
betatof_a(12) = c2/(cos(theta13)*(ds-c1)) |
1549 |
mocchiut |
1.2 |
|
1550 |
|
|
C------- ToF Mask - S12 - S22 |
1551 |
|
|
|
1552 |
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1553 |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1554 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1555 |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1556 |
|
|
|
1557 |
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1558 |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1559 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1560 |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1561 |
|
|
|
1562 |
|
|
C------- |
1563 |
|
|
|
1564 |
mocchiut |
1.1 |
ENDIF |
1565 |
mocchiut |
1.2 |
|
1566 |
|
|
C--------------------------------------------------------- |
1567 |
mocchiut |
1.7 |
C |
1568 |
|
|
C icount=0 |
1569 |
|
|
C sw=0. |
1570 |
|
|
C sxw=0. |
1571 |
|
|
C beta_mean=100. |
1572 |
|
|
C |
1573 |
|
|
C do i=1,12 |
1574 |
|
|
C if ((betatof_a(i).gt.-1.5).and.(betatof_a(i).lt.1.5)) then |
1575 |
|
|
C icount= icount+1 |
1576 |
|
|
C if (i.le.4) w_i=1./(0.13**2.) |
1577 |
|
|
C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
1578 |
|
|
C if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
1579 |
|
|
C sxw=sxw + betatof_a(i)*w_i |
1580 |
|
|
C sw =sw + w_i |
1581 |
|
|
C endif |
1582 |
|
|
C enddo |
1583 |
|
|
C |
1584 |
|
|
C if (icount.gt.0) beta_mean=sxw/sw |
1585 |
|
|
C betatof_a(13) = beta_mean |
1586 |
|
|
C |
1587 |
|
|
C-------- New mean beta calculation ----------------------- |
1588 |
mocchiut |
1.1 |
|
1589 |
mocchiut |
1.7 |
do i=1,12 |
1590 |
|
|
btemp(i) = betatof_a(i) |
1591 |
|
|
enddo |
1592 |
mocchiut |
1.1 |
|
1593 |
mocchiut |
1.7 |
betatof_a(13)=newbeta(btemp,hitvec,10.,10.,20.) |
1594 |
mocchiut |
1.1 |
|
1595 |
mocchiut |
1.7 |
C-------------------------------------------------------------- |
1596 |
|
|
C write(*,*) betatof_a |
1597 |
mocchiut |
1.4 |
c write(*,*) xtofpos |
1598 |
|
|
c write(*,*) ytofpos |
1599 |
mocchiut |
1.6 |
c write(*,*)'tofl2com beta', betatof_a |
1600 |
mocchiut |
1.4 |
C write(*,*) adcflagtof |
1601 |
mocchiut |
1.6 |
c write(*,*) 'tofl2com' |
1602 |
|
|
c write(*,*) xtofpos |
1603 |
|
|
c write(*,*) ytofpos |
1604 |
|
|
c write(*,*) xtr_tof |
1605 |
|
|
c write(*,*) ytr_tof |
1606 |
|
|
|
1607 |
mocchiut |
1.1 |
100 continue |
1608 |
|
|
|
1609 |
|
|
C |
1610 |
|
|
RETURN |
1611 |
|
|
END |
1612 |
mocchiut |
1.4 |
|
1613 |
mocchiut |
1.6 |
|
1614 |
|
|
C------------------------------------------------------------------ |
1615 |
|
|
C------------------------------------------------------------------ |
1616 |
|
|
|
1617 |
|
|
function atten(is,ilay,ipad,x) |
1618 |
|
|
include 'input_tof.txt' |
1619 |
|
|
real atten |
1620 |
|
|
real x |
1621 |
|
|
real xmin,xmax |
1622 |
|
|
integer ilay,ipad |
1623 |
|
|
|
1624 |
|
|
* S11 8 paddles 33.0 x 5.1 cm |
1625 |
|
|
* S12 6 paddles 40.8 x 5.5 cm |
1626 |
|
|
* S21 2 paddles 18.0 x 7.5 cm |
1627 |
|
|
* S22 2 paddles 15.0 x 9.0 cm |
1628 |
|
|
* S31 3 paddles 15.0 x 6.0 cm |
1629 |
|
|
* S32 3 paddles 18.0 x 5.0 cm |
1630 |
|
|
|
1631 |
|
|
|
1632 |
|
|
c if (ilay.eq.11) write(*,*) 'start ',ipad,is,adcx11(is,ipad,1), |
1633 |
|
|
c & adcx11(is,ipad,2),adcx11(is,ipad,3),adcx11(is,ipad,4) |
1634 |
|
|
c if (ilay.eq.12) write(*,*) 'start ',ipad,is,adcx12(is,ipad,1), |
1635 |
|
|
c & adcx12(is,ipad,2),adcx12(is,ipad,3),adcx12(is,ipad,4) |
1636 |
|
|
|
1637 |
|
|
|
1638 |
|
|
if (ilay.eq.11) xmin=-33.0/2. |
1639 |
|
|
if (ilay.eq.11) xmax= 33.0/2. |
1640 |
|
|
if (ilay.eq.12) xmin=-40.8/2. |
1641 |
|
|
if (ilay.eq.12) xmax= 40.8/2. |
1642 |
|
|
|
1643 |
|
|
if (ilay.eq.21) xmin=-18.0/2. |
1644 |
|
|
if (ilay.eq.21) xmax= 18.0/2. |
1645 |
|
|
if (ilay.eq.22) xmin=-15.0/2. |
1646 |
|
|
if (ilay.eq.22) xmax= 15.0/2. |
1647 |
|
|
|
1648 |
|
|
if (ilay.eq.31) xmin=-15.0/2. |
1649 |
|
|
if (ilay.eq.31) xmax= 15.0/2. |
1650 |
|
|
if (ilay.eq.32) xmin=-18.0/2. |
1651 |
|
|
if (ilay.eq.32) xmax= 18.0/2. |
1652 |
|
|
|
1653 |
|
|
if (x .lt. xmin) x=xmin |
1654 |
|
|
if (x .gt. xmax) x=xmax |
1655 |
|
|
|
1656 |
|
|
|
1657 |
|
|
if (ilay.eq.11) atten= |
1658 |
|
|
& adcx11(is,ipad,1)*exp(x*adcx11(is,ipad,2)) |
1659 |
|
|
& + adcx11(is,ipad,3)*exp(x*adcx11(is,ipad,4)) |
1660 |
|
|
|
1661 |
|
|
if (ilay.eq.12) atten= |
1662 |
|
|
& adcx12(is,ipad,1)*exp(x*adcx12(is,ipad,2)) |
1663 |
|
|
& + adcx12(is,ipad,3)*exp(x*adcx12(is,ipad,4)) |
1664 |
|
|
|
1665 |
|
|
if (ilay.eq.21) atten= |
1666 |
|
|
& adcx21(is,ipad,1)*exp(x*adcx21(is,ipad,2)) |
1667 |
|
|
& + adcx21(is,ipad,3)*exp(x*adcx21(is,ipad,4)) |
1668 |
|
|
|
1669 |
|
|
if (ilay.eq.22) atten= |
1670 |
|
|
& adcx22(is,ipad,1)*exp(x*adcx22(is,ipad,2)) |
1671 |
|
|
& + adcx22(is,ipad,3)*exp(x*adcx22(is,ipad,4)) |
1672 |
|
|
|
1673 |
|
|
if (ilay.eq.31) atten= |
1674 |
|
|
& adcx31(is,ipad,1)*exp(x*adcx31(is,ipad,2)) |
1675 |
|
|
& + adcx31(is,ipad,3)*exp(x*adcx31(is,ipad,4)) |
1676 |
|
|
|
1677 |
|
|
if (ilay.eq.32) atten= |
1678 |
|
|
& adcx32(is,ipad,1)*exp(x*adcx32(is,ipad,2)) |
1679 |
|
|
& + adcx32(is,ipad,3)*exp(x*adcx32(is,ipad,4)) |
1680 |
|
|
|
1681 |
|
|
if (atten.gt.10000) atten=10000. |
1682 |
|
|
|
1683 |
|
|
end |
1684 |
|
|
|
1685 |
|
|
C------------------------------------------------------------------ |
1686 |
|
|
C------------------------------------------------------------------ |
1687 |
|
|
|
1688 |
|
|
function pc_adc(ix) |
1689 |
|
|
include 'input_tof.txt' |
1690 |
|
|
real pc_adc |
1691 |
|
|
integer ix |
1692 |
|
|
|
1693 |
|
|
pc_adc=28.0407 + 0.628929*ix |
1694 |
|
|
& - 5.80901e-05*ix*ix + 3.14092e-08*ix*ix*ix |
1695 |
|
|
c write(*,*) ix,pc_adc |
1696 |
|
|
end |
1697 |
|
|
|
1698 |
|
|
C------------------------------------------------------------------ |
1699 |
mocchiut |
1.7 |
C------------------------------------------------------------------ |
1700 |
|
|
|
1701 |
|
|
function check_charge(theta,hitvec) |
1702 |
|
|
|
1703 |
|
|
include 'input_tof.txt' |
1704 |
|
|
include 'tofcomm.txt' |
1705 |
|
|
|
1706 |
|
|
real check_charge |
1707 |
|
|
integer hitvec(6) |
1708 |
|
|
REAL CHARGE, theta |
1709 |
|
|
|
1710 |
|
|
C upper and lower limits for the helium selection |
1711 |
|
|
REAL A_l(24),A_h(24) |
1712 |
|
|
DATA A_l /200,190,300,210,220,200,210,60,60,120,220, |
1713 |
|
|
& 120,160,50,300,200,120,250,350,300,350,250,280,300/ |
1714 |
|
|
DATA A_h /550,490,800,600,650,600,600,260,200,380, |
1715 |
|
|
& 620,380,550,200,850,560,400,750,900,800,880,800,750,800/ |
1716 |
|
|
|
1717 |
|
|
C The k1 constants for the beta calculation, only for S1-S3 |
1718 |
|
|
C k2 constant is taken to be the standard 2D/c |
1719 |
|
|
REAL k1(84) |
1720 |
|
|
DATA k1 /50,59.3296,28.4328,-26.0818,5.91253,-19.588, |
1721 |
|
|
& -9.26316,24.7544,2.32465,-50.5058,-15.3195,-39.1443, |
1722 |
|
|
& -91.2546,-58.6243,-84.5641,-63.1516,-32.2091,-58.3358, |
1723 |
|
|
& 13.8084,45.5322,33.2416,-11.5313,51.3271,75,-14.1141, |
1724 |
|
|
& 42.8466,15.1794,-63.6672,-6.07739,-32.164,-41.771,10.5274, |
1725 |
|
|
& -9.46096,-81.7404,-28.783,-52.7167,-127.394,-69.6166, |
1726 |
|
|
& -93.4655,-98.9543,-42.863,-67.8244,-19.3238,31.1221,8.7319, |
1727 |
|
|
& -43.1627,5.55573,-14.4078,-83.4466,-47.4647,-77.8379, |
1728 |
|
|
& -108.222,-75.986,-101.297,-96.0205,-63.1881,-90.1372, |
1729 |
|
|
& -22.7347,8.31409,-19.6912,-7.49008,23.6979,-1.66677, |
1730 |
|
|
& 1.81556,34.4668,6.23693,-100,-59.5861,-90.9159,-141.639, |
1731 |
|
|
& -89.2521,-112.881,-130.199,-77.0357,-98.4632,-60.2086, |
1732 |
|
|
& -4.82097,-29.3705,-43.6469,10.5884,-9.31304,-35.3329, |
1733 |
|
|
& 25.2514,25.6/ |
1734 |
|
|
|
1735 |
|
|
|
1736 |
|
|
|
1737 |
|
|
REAL zin(6) |
1738 |
|
|
DATA zin /53.74, 53.04, 23.94, 23.44, -23.49, -24.34/ |
1739 |
|
|
|
1740 |
|
|
REAL c1,c2,xhelp,xhelp1,xhelp2,ds,dist,F |
1741 |
|
|
REAL sw,sxw,beta_mean_tof,w_i |
1742 |
|
|
INTEGER ihelp |
1743 |
|
|
INTEGER ipmt(4) |
1744 |
|
|
REAL time(4),beta1(4) |
1745 |
|
|
|
1746 |
|
|
REAL adca(48), tdca(48) |
1747 |
|
|
|
1748 |
|
|
REAL a1,a2 |
1749 |
|
|
INTEGER jj |
1750 |
|
|
|
1751 |
|
|
C----------------------------------------------------------- |
1752 |
|
|
C--- get data |
1753 |
|
|
C----------------------------------------------------------- |
1754 |
|
|
|
1755 |
|
|
do j=1,8 |
1756 |
|
|
ih = 1 + 0 +((j-1)*2) |
1757 |
|
|
adca(ih) = adc(ch11a(j),hb11a(j)) |
1758 |
|
|
adca(ih+1) = adc(ch11b(j),hb11b(j)) |
1759 |
|
|
tdca(ih) = tdc(ch11a(j),hb11a(j)) |
1760 |
|
|
tdca(ih+1) = tdc(ch11b(j),hb11b(j)) |
1761 |
|
|
enddo |
1762 |
|
|
|
1763 |
|
|
do j=1,6 |
1764 |
|
|
ih = 1 + 16+((j-1)*2) |
1765 |
|
|
adca(ih) = adc(ch12a(j),hb12a(j)) |
1766 |
|
|
adca(ih+1) = adc(ch12b(j),hb12b(j)) |
1767 |
|
|
tdca(ih) = tdc(ch12a(j),hb12a(j)) |
1768 |
|
|
tdca(ih+1) = tdc(ch12b(j),hb12b(j)) |
1769 |
|
|
enddo |
1770 |
|
|
|
1771 |
|
|
do j=1,2 |
1772 |
|
|
ih = 1 + 28+((j-1)*2) |
1773 |
|
|
adca(ih) = adc(ch21a(j),hb21a(j)) |
1774 |
|
|
adca(ih+1) = adc(ch21b(j),hb21b(j)) |
1775 |
|
|
tdca(ih) = tdc(ch21a(j),hb21a(j)) |
1776 |
|
|
tdca(ih+1) = tdc(ch21b(j),hb21b(j)) |
1777 |
|
|
enddo |
1778 |
|
|
|
1779 |
|
|
do j=1,2 |
1780 |
|
|
ih = 1 + 32+((j-1)*2) |
1781 |
|
|
adca(ih) = adc(ch22a(j),hb22a(j)) |
1782 |
|
|
adca(ih+1) = adc(ch22b(j),hb22b(j)) |
1783 |
|
|
tdca(ih) = tdc(ch22a(j),hb22a(j)) |
1784 |
|
|
tdca(ih+1) = tdc(ch22b(j),hb22b(j)) |
1785 |
|
|
enddo |
1786 |
|
|
|
1787 |
|
|
do j=1,3 |
1788 |
|
|
ih = 1 + 36+((j-1)*2) |
1789 |
|
|
adca(ih) = adc(ch31a(j),hb31a(j)) |
1790 |
|
|
adca(ih+1) = adc(ch31b(j),hb31b(j)) |
1791 |
|
|
tdca(ih) = tdc(ch31a(j),hb31a(j)) |
1792 |
|
|
tdca(ih+1) = tdc(ch31b(j),hb31b(j)) |
1793 |
|
|
enddo |
1794 |
|
|
|
1795 |
|
|
do j=1,3 |
1796 |
|
|
ih = 1 + 42+((j-1)*2) |
1797 |
|
|
adca(ih) = adc(ch32a(j),hb32a(j)) |
1798 |
|
|
adca(ih+1) = adc(ch32b(j),hb32b(j)) |
1799 |
|
|
tdca(ih) = tdc(ch32a(j),hb32a(j)) |
1800 |
|
|
tdca(ih+1) = tdc(ch32b(j),hb32b(j)) |
1801 |
|
|
enddo |
1802 |
|
|
|
1803 |
|
|
|
1804 |
|
|
c write(*,*) adca |
1805 |
|
|
c write(*,*) tdca |
1806 |
|
|
|
1807 |
|
|
|
1808 |
|
|
C============ calculate beta and select charge > Z=1 =============== |
1809 |
|
|
|
1810 |
|
|
ICHARGE=1 |
1811 |
|
|
|
1812 |
|
|
C find hitted paddle by looking for ADC values on both sides |
1813 |
|
|
C since we looking for Z>1 this gives decent results |
1814 |
|
|
|
1815 |
|
|
tof11_i = hitvec(1)-1 |
1816 |
|
|
tof12_i = hitvec(2)-1 |
1817 |
|
|
tof21_i = hitvec(3)-1 |
1818 |
|
|
tof22_i = hitvec(4)-1 |
1819 |
|
|
tof31_i = hitvec(5)-1 |
1820 |
|
|
tof32_i = hitvec(6)-1 |
1821 |
|
|
|
1822 |
|
|
c write(*,*) ' in charge check' |
1823 |
|
|
c write(*,*) theta,tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
1824 |
|
|
|
1825 |
|
|
C---------------------------------------------------------------- |
1826 |
|
|
|
1827 |
|
|
beta_help=100. |
1828 |
|
|
beta_mean_tof=100. |
1829 |
|
|
|
1830 |
|
|
do jj=1,4 |
1831 |
|
|
beta1(jj) = 100. |
1832 |
|
|
enddo |
1833 |
|
|
|
1834 |
|
|
C---------------------------------------------------------------- |
1835 |
|
|
C--------- S1 - S3 --------------------------------------------- |
1836 |
|
|
C---------------------------------------------------------------- |
1837 |
|
|
|
1838 |
|
|
C--------- S11 - S31 ------------------------------------------- |
1839 |
|
|
|
1840 |
|
|
if ((tof11_i.gt.-1).and.(tof31_i.gt.-1)) then |
1841 |
|
|
|
1842 |
|
|
dist = zin(1) - zin(5) |
1843 |
|
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12) |
1844 |
|
|
F = 1./cos(theta) |
1845 |
|
|
|
1846 |
|
|
ipmt(1) = (tof11_i)*2+1 |
1847 |
|
|
ipmt(2) = (tof11_i)*2+2 |
1848 |
|
|
ipmt(3) = 36+(tof31_i)*2+1 |
1849 |
|
|
ipmt(4) = 36+(tof31_i)*2+2 |
1850 |
|
|
|
1851 |
|
|
c write(*,*) ipmt |
1852 |
|
|
|
1853 |
|
|
do jj=1,4 |
1854 |
|
|
time(jj) = tdca(ipmt(jj)) |
1855 |
|
|
enddo |
1856 |
|
|
|
1857 |
|
|
c write(*,*) time |
1858 |
|
|
|
1859 |
|
|
if ((time(1).lt.4095).and.(time(2).lt.4095).and. |
1860 |
|
|
& (time(3).lt.4095).and.(time(4).lt.4095)) then |
1861 |
|
|
xhelp1 = time(1) + time(2) |
1862 |
|
|
xhelp2 = time(3) + time(4) |
1863 |
|
|
ds = xhelp1-xhelp2 |
1864 |
|
|
ihelp=0+(tof11_i)*3+tof31_i |
1865 |
|
|
c1 = k1(ihelp+1) |
1866 |
|
|
beta1(1) = c2*F/(ds-c1); |
1867 |
|
|
endif |
1868 |
|
|
c write(*,*) beta1(1) |
1869 |
|
|
endif ! tof_.... |
1870 |
|
|
|
1871 |
|
|
|
1872 |
|
|
C--------- S11 - S32 ------------------------------------------- |
1873 |
|
|
|
1874 |
|
|
if ((tof11_i.gt.-1).and.(tof32_i.gt.-1)) then |
1875 |
|
|
|
1876 |
|
|
dist = zin(1) - zin(6) |
1877 |
|
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12) |
1878 |
|
|
F = 1./cos(theta) |
1879 |
|
|
|
1880 |
|
|
ipmt(1) = (tof11_i)*2+1 |
1881 |
|
|
ipmt(2) = (tof11_i)*2+2 |
1882 |
|
|
ipmt(3) = 42+(tof32_i)*2+1 |
1883 |
|
|
ipmt(4) = 42+(tof32_i)*2+2 |
1884 |
|
|
|
1885 |
|
|
do jj=1,4 |
1886 |
|
|
time(jj) = tdca(ipmt(jj)) |
1887 |
|
|
enddo |
1888 |
|
|
|
1889 |
|
|
if ((time(1).lt.4095).and.(time(2).lt.4095).and. |
1890 |
|
|
& (time(3).lt.4095).and.(time(4).lt.4095)) then |
1891 |
|
|
xhelp1 = time(1) + time(2) |
1892 |
|
|
xhelp2 = time(3) + time(4) |
1893 |
|
|
ds = xhelp1-xhelp2 |
1894 |
|
|
ihelp=24+(tof11_i)*3+tof32_i |
1895 |
|
|
c1 = k1(ihelp+1) |
1896 |
|
|
beta1(2) = c2*F/(ds-c1); |
1897 |
|
|
endif |
1898 |
|
|
endif ! tof_.... |
1899 |
|
|
|
1900 |
|
|
|
1901 |
|
|
C--------- S12 - S31 ------------------------------------------- |
1902 |
|
|
|
1903 |
|
|
if ((tof12_i.gt.-1).and.(tof31_i.gt.-1)) then |
1904 |
|
|
|
1905 |
|
|
dist = zin(2) - zin(5) |
1906 |
|
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12) |
1907 |
|
|
F = 1./cos(theta) |
1908 |
|
|
|
1909 |
|
|
ipmt(1) = 16+(tof12_i)*2+1 |
1910 |
|
|
ipmt(2) = 16+(tof12_i)*2+2 |
1911 |
|
|
ipmt(3) = 36+(tof31_i)*2+1 |
1912 |
|
|
ipmt(4) = 36+(tof31_i)*2+2 |
1913 |
|
|
|
1914 |
|
|
do jj=1,4 |
1915 |
|
|
time(jj) = tdca(ipmt(jj)) |
1916 |
|
|
enddo |
1917 |
|
|
|
1918 |
|
|
if ((time(1).lt.4095).and.(time(2).lt.4095).and. |
1919 |
|
|
& (time(3).lt.4095).and.(time(4).lt.4095)) then |
1920 |
|
|
xhelp1 = time(1) + time(2) |
1921 |
|
|
xhelp2 = time(3) + time(4) |
1922 |
|
|
ds = xhelp1-xhelp2 |
1923 |
|
|
ihelp=48+(tof12_i)*3+tof31_i |
1924 |
|
|
c1 = k1(ihelp+1) |
1925 |
|
|
beta1(3) = c2*F/(ds-c1); |
1926 |
|
|
endif |
1927 |
|
|
endif ! tof_.... |
1928 |
|
|
|
1929 |
|
|
|
1930 |
|
|
C--------- S12 - S32 ------------------------------------------- |
1931 |
|
|
|
1932 |
|
|
if ((tof12_i.gt.-1).and.(tof32_i.gt.-1)) then |
1933 |
|
|
|
1934 |
|
|
dist = zin(2) - zin(6) |
1935 |
|
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12) |
1936 |
|
|
F = 1./cos(theta) |
1937 |
|
|
|
1938 |
|
|
ipmt(1) = 16+(tof12_i)*2+1 |
1939 |
|
|
ipmt(2) = 16+(tof12_i)*2+2 |
1940 |
|
|
ipmt(3) = 42+(tof32_i)*2+1 |
1941 |
|
|
ipmt(4) = 42+(tof32_i)*2+2 |
1942 |
|
|
|
1943 |
|
|
do jj=1,4 |
1944 |
|
|
time(jj) = tdca(ipmt(jj)) |
1945 |
|
|
enddo |
1946 |
|
|
|
1947 |
|
|
if ((time(1).lt.4095).and.(time(2).lt.4095).and. |
1948 |
|
|
& (time(3).lt.4095).and.(time(4).lt.4095)) then |
1949 |
|
|
xhelp1 = time(1) + time(2) |
1950 |
|
|
xhelp2 = time(3) + time(4) |
1951 |
|
|
ds = xhelp1-xhelp2 |
1952 |
|
|
ihelp=56+(tof12_i)*3+tof32_i |
1953 |
|
|
c1 = k1(ihelp+1) |
1954 |
|
|
beta1(4) = c2*F/(ds-c1); |
1955 |
|
|
endif |
1956 |
|
|
|
1957 |
|
|
endif ! tof_.... |
1958 |
|
|
|
1959 |
|
|
c write(*,*) beta1 |
1960 |
|
|
|
1961 |
|
|
C---- calculate beta mean, only downward going particles are interesting ---- |
1962 |
|
|
|
1963 |
|
|
sw=0. |
1964 |
|
|
sxw=0. |
1965 |
|
|
beta_mean_tof=100. |
1966 |
|
|
|
1967 |
|
|
do jj=1,4 |
1968 |
|
|
if ((beta1(jj).gt.0.1).and.(beta1(jj).lt.2.0)) then |
1969 |
|
|
w_i=1./(0.13*0.13) |
1970 |
|
|
sxw=sxw + beta1(jj)*w_i |
1971 |
|
|
sw =sw + w_i ; |
1972 |
|
|
endif |
1973 |
|
|
enddo |
1974 |
|
|
|
1975 |
|
|
if (sw.gt.0) beta_mean_tof=sxw/sw; |
1976 |
|
|
|
1977 |
|
|
c write(*,*) 'beta_mean_tof ',beta_mean_tof |
1978 |
|
|
|
1979 |
|
|
beta_help = beta_mean_tof ! pow(beta_mean_tof,1.0) gave best results |
1980 |
|
|
|
1981 |
|
|
CCCCC endif ! if tof11_i > -1 && ...... beta calculation |
1982 |
|
|
|
1983 |
|
|
C----------------------- Select charge -------------------------- |
1984 |
|
|
|
1985 |
|
|
charge=0 |
1986 |
|
|
|
1987 |
|
|
if ((beta_mean_tof.gt.0.2).and.(beta_mean_tof.lt.2.0)) then |
1988 |
|
|
|
1989 |
|
|
icount1=0 |
1990 |
|
|
icount2=0 |
1991 |
|
|
icount3=0 |
1992 |
|
|
|
1993 |
|
|
do jj=0,23 |
1994 |
|
|
a1 = adca(2*jj+1) |
1995 |
|
|
a2 = adca(2*jj+2) |
1996 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
1997 |
|
|
a1 = adca(2*jj+1)*cos(theta) |
1998 |
|
|
a2 = adca(2*jj+2)*cos(theta) |
1999 |
|
|
xhelp = 100000. |
2000 |
|
|
xhelp1 = 100000. |
2001 |
|
|
xhelp = sqrt(a1*a2) ! geometric mean |
2002 |
|
|
xhelp1 = beta_help*xhelp |
2003 |
|
|
C if geometric mean multiplied by beta_help is inside/outside helium |
2004 |
|
|
C limits, increase counter |
2005 |
|
|
if (xhelp1.lt.A_l(jj+1)) icount1=icount1+1 |
2006 |
|
|
if ((xhelp1.gt.A_l(jj+1)).and.(xhelp1.lt.A_h(jj+1))) |
2007 |
|
|
& icount2=icount2+1 |
2008 |
|
|
if (xhelp1.gt.A_h(jj+1)) icount3=icount3+1 |
2009 |
|
|
endif |
2010 |
|
|
enddo |
2011 |
|
|
|
2012 |
|
|
|
2013 |
|
|
C if more than three paddles see the same... |
2014 |
|
|
|
2015 |
|
|
if (icount1 .gt. 3) charge=1 |
2016 |
|
|
if (icount2 .gt. 3) charge=2 |
2017 |
|
|
if (icount3 .gt. 3) charge=3 |
2018 |
|
|
|
2019 |
|
|
endif ! 0.2<beta<2.0 |
2020 |
|
|
|
2021 |
|
|
C no beta found? Sum up geometric means of paddles and derive the mean... |
2022 |
|
|
|
2023 |
|
|
if (beta_mean_tof.eq.100.) then |
2024 |
|
|
|
2025 |
|
|
xhelp = 0. |
2026 |
|
|
icount = 0 |
2027 |
|
|
|
2028 |
|
|
if (tof11_i.gt.-1) then |
2029 |
|
|
jj=tof11_i |
2030 |
|
|
a1 = adca(0+2*jj+1) |
2031 |
|
|
a2 = adca(0+2*jj+2) |
2032 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
2033 |
|
|
a1 = a1*cos(theta) |
2034 |
|
|
a2 = a2*cos(theta) |
2035 |
|
|
xhelp = xhelp + sqrt(a1*a2) |
2036 |
|
|
icount=icount+1 |
2037 |
|
|
endif |
2038 |
|
|
endif |
2039 |
|
|
|
2040 |
|
|
if (tof12_i.gt.-1) then |
2041 |
|
|
jj=tof12_i |
2042 |
|
|
a1 = adca(16+2*jj+1) |
2043 |
|
|
a2 = adca(16+2*jj+2) |
2044 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
2045 |
|
|
a1 = a1*cos(theta) |
2046 |
|
|
a2 = a2*cos(theta) |
2047 |
|
|
xhelp = xhelp + sqrt(a1*a2) |
2048 |
|
|
icount=icount+1 |
2049 |
|
|
endif |
2050 |
|
|
endif |
2051 |
|
|
|
2052 |
|
|
if (tof21_i.gt.-1) then |
2053 |
|
|
jj=tof21_i |
2054 |
|
|
a1 = adca(28+2*jj+1) |
2055 |
|
|
a2 = adca(28+2*jj+2) |
2056 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
2057 |
|
|
a1 = a1*cos(theta) |
2058 |
|
|
a2 = a2*cos(theta) |
2059 |
|
|
xhelp = xhelp + sqrt(a1*a2) |
2060 |
|
|
icount=icount+1 |
2061 |
|
|
endif |
2062 |
|
|
endif |
2063 |
|
|
|
2064 |
|
|
if (tof22_i.gt.-1) then |
2065 |
|
|
jj=tof22_i |
2066 |
|
|
a1 = adca(32+2*jj+1) |
2067 |
|
|
a2 = adca(32+2*jj+2) |
2068 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
2069 |
|
|
a1 = a1*cos(theta) |
2070 |
|
|
a2 = a2*cos(theta) |
2071 |
|
|
xhelp = xhelp + sqrt(a1*a2) |
2072 |
|
|
icount=icount+1 |
2073 |
|
|
endif |
2074 |
|
|
endif |
2075 |
|
|
|
2076 |
|
|
if (tof31_i.gt.-1) then |
2077 |
|
|
jj=tof31_i |
2078 |
|
|
a1 = adca(36+2*jj+1) |
2079 |
|
|
a2 = adca(36+2*jj+2) |
2080 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
2081 |
|
|
a1 = a1*cos(theta) |
2082 |
|
|
a2 = a2*cos(theta) |
2083 |
|
|
xhelp = xhelp + sqrt(a1*a2) |
2084 |
|
|
icount=icount+1 |
2085 |
|
|
endif |
2086 |
|
|
endif |
2087 |
|
|
|
2088 |
|
|
if (tof32_i.gt.-1) then |
2089 |
|
|
jj=tof32_i |
2090 |
|
|
a1 = adca(42+2*jj+1) |
2091 |
|
|
a2 = adca(42+2*jj+2) |
2092 |
|
|
if ((a1.lt.4095).and.(a2.lt.4095)) then |
2093 |
|
|
a1 = a1*cos(theta) |
2094 |
|
|
a2 = a2*cos(theta) |
2095 |
|
|
xhelp = xhelp + sqrt(a1*a2) |
2096 |
|
|
icount=icount+1 |
2097 |
|
|
endif |
2098 |
|
|
endif |
2099 |
|
|
|
2100 |
|
|
|
2101 |
|
|
if (icount.gt.0) xhelp=xhelp/icount |
2102 |
|
|
if ((icount.gt.2).and.(xhelp.gt.1500.)) charge=3 |
2103 |
|
|
|
2104 |
|
|
endif ! beta_mean_tof.eq.100. |
2105 |
|
|
|
2106 |
|
|
c write(*,*) 'in function charge: ',charge |
2107 |
|
|
check_charge = charge |
2108 |
|
|
|
2109 |
|
|
|
2110 |
|
|
END |
2111 |
|
|
|
2112 |
|
|
C**************************************************************************** |
2113 |
|
|
C**************************************************************************** |
2114 |
|
|
C**************************************************************************** |
2115 |
|
|
|
2116 |
|
|
function newbeta(b,hitvec,resmax,qualitycut,chi2cut) |
2117 |
|
|
|
2118 |
|
|
include 'input_tof.txt' |
2119 |
|
|
include 'output_tof.txt' |
2120 |
|
|
include 'tofcomm.txt' |
2121 |
|
|
|
2122 |
|
|
REAL newbeta |
2123 |
|
|
REAL resmax,qualitycut,chi2cut |
2124 |
|
|
REAL w_i(12),w_il(6),quality,res,betachi,beta_mean_inv |
2125 |
|
|
REAL sw,sxw,b(12),beta_mean,chi2,xhelp |
2126 |
|
|
|
2127 |
|
|
INTEGER icount,hitvec(6) |
2128 |
|
|
|
2129 |
|
|
INTEGER itop(12),ibot(12) |
2130 |
|
|
DATA itop /1,1,2,2,3,3,4,4,1,1,2,2/ |
2131 |
|
|
DATA ibot /5,6,5,6,5,6,5,6,3,4,3,4/ |
2132 |
|
|
|
2133 |
|
|
C==================================================================== |
2134 |
|
|
|
2135 |
|
|
tof11_i = hitvec(1) |
2136 |
|
|
tof12_i = hitvec(2) |
2137 |
|
|
tof21_i = hitvec(3) |
2138 |
|
|
tof22_i = hitvec(4) |
2139 |
|
|
tof31_i = hitvec(5) |
2140 |
|
|
tof32_i = hitvec(6) |
2141 |
|
|
|
2142 |
|
|
c write(*,*) '------------ In NEWBETA ----------------' |
2143 |
|
|
c write(*,*) hitvec |
2144 |
|
|
c write(*,*) b |
2145 |
|
|
|
2146 |
|
|
C--- Find out ToF layers with artificial TDC values ------------- |
2147 |
|
|
|
2148 |
|
|
do jj=1,6 |
2149 |
|
|
w_il(jj) = 1000. |
2150 |
|
|
enddo |
2151 |
|
|
|
2152 |
|
|
C write(*,*) tdcflagtof |
2153 |
|
|
|
2154 |
|
|
if (tof11_i.gt.0) then |
2155 |
|
|
if ((tofmask(ch11a(tof11_i),hb11a(tof11_i)).gt.0).or. |
2156 |
|
|
& (tofmask(ch11b(tof11_i),hb11b(tof11_i)).gt.0)) then |
2157 |
|
|
w_il(1)=0 |
2158 |
|
|
i1=tdcflagtof(ch11a(tof11_i),hb11a(tof11_i)) |
2159 |
|
|
i2=tdcflagtof(ch11b(tof11_i),hb11b(tof11_i)) |
2160 |
|
|
c write(*,*) '11 ',i1,i2 |
2161 |
|
|
if ((i1.eq.1).or.(i2.eq.1)) w_il(1) = 1 ! tdcflag |
2162 |
|
|
endif |
2163 |
|
|
endif |
2164 |
|
|
|
2165 |
|
|
if (tof12_i.gt.0) then |
2166 |
|
|
if ((tofmask(ch12a(tof12_i),hb12a(tof12_i)).gt.0).or. |
2167 |
|
|
& (tofmask(ch12b(tof12_i),hb12b(tof12_i)).gt.0)) then |
2168 |
|
|
w_il(2)=0 |
2169 |
|
|
i1=tdcflagtof(ch12a(tof12_i),hb12a(tof12_i)) |
2170 |
|
|
i2=tdcflagtof(ch12b(tof12_i),hb12b(tof12_i)) |
2171 |
|
|
c write(*,*) '12 ',i1,i2 |
2172 |
|
|
if ((i1.eq.1).or.(i2.eq.1)) w_il(2) = 1 ! tdcflag |
2173 |
|
|
endif |
2174 |
|
|
endif |
2175 |
|
|
|
2176 |
|
|
if (tof21_i.gt.0) then |
2177 |
|
|
if ((tofmask(ch21a(tof21_i),hb21a(tof21_i)).gt.0).or. |
2178 |
|
|
& (tofmask(ch21b(tof21_i),hb21b(tof21_i)).gt.0)) then |
2179 |
|
|
w_il(3)=0 |
2180 |
|
|
i1=tdcflagtof(ch21a(tof21_i),hb21a(tof21_i)) |
2181 |
|
|
i2=tdcflagtof(ch21b(tof21_i),hb21b(tof21_i)) |
2182 |
|
|
c write(*,*) '21 ',i1,i2 |
2183 |
|
|
if ((i1.eq.1).or.(i2.eq.1)) w_il(3) = 1 ! tdcflag |
2184 |
|
|
endif |
2185 |
|
|
endif |
2186 |
|
|
|
2187 |
|
|
if (tof22_i.gt.0) then |
2188 |
|
|
if ((tofmask(ch22a(tof22_i),hb22a(tof22_i)).gt.0).or. |
2189 |
|
|
& (tofmask(ch22b(tof22_i),hb22b(tof22_i)).gt.0)) then |
2190 |
|
|
w_il(4)=0 |
2191 |
|
|
i1=tdcflagtof(ch22a(tof22_i),hb22a(tof22_i)) |
2192 |
|
|
i2=tdcflagtof(ch22b(tof22_i),hb22b(tof22_i)) |
2193 |
|
|
c write(*,*) '22 ',i1,i2 |
2194 |
|
|
if ((i1.eq.1).or.(i2.eq.1)) w_il(4) = 1 ! tdcflag |
2195 |
|
|
endif |
2196 |
|
|
endif |
2197 |
|
|
|
2198 |
|
|
if (tof31_i.gt.0) then |
2199 |
|
|
if ((tofmask(ch31a(tof31_i),hb11a(tof31_i)).gt.0).or. |
2200 |
|
|
& (tofmask(ch31b(tof31_i),hb31b(tof31_i)).gt.0)) then |
2201 |
|
|
w_il(5)=0 |
2202 |
|
|
i1=tdcflagtof(ch31a(tof31_i),hb31a(tof31_i)) |
2203 |
|
|
i2=tdcflagtof(ch31b(tof31_i),hb31b(tof31_i)) |
2204 |
|
|
c write(*,*) '31 ',i1,i2 |
2205 |
|
|
if ((i1.eq.1).or.(i2.eq.1)) w_il(5) = 1 ! tdcflag |
2206 |
|
|
endif |
2207 |
|
|
endif |
2208 |
|
|
|
2209 |
|
|
if (tof32_i.gt.0) then |
2210 |
|
|
if ((tofmask(ch32a(tof32_i),hb32a(tof32_i)).gt.0).or. |
2211 |
|
|
& (tofmask(ch32b(tof32_i),hb32b(tof32_i)).gt.0)) then |
2212 |
|
|
w_il(6)=0 |
2213 |
|
|
i1=tdcflagtof(ch32a(tof32_i),hb32a(tof32_i)) |
2214 |
|
|
i2=tdcflagtof(ch32b(tof32_i),hb32b(tof32_i)) |
2215 |
|
|
c write(*,*) '32 ',i1,i2 |
2216 |
|
|
if ((i1.eq.1).or.(i2.eq.1)) w_il(6) = 1 ! tdcflag |
2217 |
|
|
endif |
2218 |
|
|
endif |
2219 |
|
|
|
2220 |
|
|
c write(*,*) w_il |
2221 |
|
|
C------------------------------------------------------------------------ |
2222 |
|
|
C--- Set weights for the 12 measurements using information for top and bottom: |
2223 |
|
|
C--- if no measurements: weight = set to very high value=> not used |
2224 |
|
|
C--- top or bottom artificial: weight*sqrt(2) |
2225 |
|
|
C--- top and bottom artificial: weight*sqrt(2)*sqrt(2) |
2226 |
|
|
|
2227 |
|
|
DO jj=1,12 |
2228 |
|
|
if (jj.le.4) xhelp = 0.11 ! S1-S3 |
2229 |
|
|
if ((jj.gt.4).and.(jj.le.8)) xhelp = 0.18 ! S2-S3 |
2230 |
|
|
if (jj.gt.8) xhelp = 0.28 ! S1-S2 |
2231 |
|
|
if ((w_il(itop(jj)).eq.1000.).and.(w_il(ibot(jj)).eq.1000.)) |
2232 |
|
|
& xhelp = 1.E09 |
2233 |
|
|
if ((w_il(itop(jj)).eq.1).or.(w_il(ibot(jj)).eq.1.)) |
2234 |
|
|
& xhelp = xhelp*1.414 |
2235 |
|
|
if ((w_il(itop(jj)).eq.1).and.(w_il(ibot(jj)).eq.1.)) |
2236 |
|
|
& xhelp = xhelp*2. |
2237 |
|
|
w_i(jj) = 1./xhelp |
2238 |
|
|
ENDDO |
2239 |
|
|
|
2240 |
|
|
c write(*,*) w_i |
2241 |
|
|
|
2242 |
|
|
C======================================================================== |
2243 |
|
|
C--- Calculate mean beta for the first time ----------------------------- |
2244 |
|
|
C--- We are using "1/beta" since its error is gaussian ------------------ |
2245 |
|
|
|
2246 |
|
|
icount=0 |
2247 |
|
|
sw=0. |
2248 |
|
|
sxw=0. |
2249 |
|
|
beta_mean=100. |
2250 |
|
|
|
2251 |
|
|
DO jj=1,12 |
2252 |
|
|
IF ((abs(1./b(jj)).gt.0.1).and.(abs(1./b(jj)).lt.15.)) THEN |
2253 |
|
|
icount = icount+1 |
2254 |
|
|
sxw = sxw + (1./b(jj))*w_i(jj)*w_i(jj) |
2255 |
|
|
sw = sw + w_i(jj)*w_i(jj) |
2256 |
|
|
ENDIF |
2257 |
|
|
ENDDO |
2258 |
|
|
|
2259 |
|
|
if (icount.gt.0) beta_mean=1./(sxw/sw) |
2260 |
|
|
beta_mean_inv = 1./beta_mean |
2261 |
|
|
|
2262 |
|
|
c write(*,*) icount,beta_mean |
2263 |
|
|
|
2264 |
|
|
C--- Calculate beta for the second time, use residuals of the single |
2265 |
|
|
C--- measurements to get a chi2 value |
2266 |
|
|
|
2267 |
|
|
icount = 0 |
2268 |
|
|
sw = 0. |
2269 |
|
|
sxw = 0. |
2270 |
|
|
betachi = 100. |
2271 |
|
|
chi2 = 0. |
2272 |
|
|
quality = 0. |
2273 |
|
|
|
2274 |
|
|
DO jj=1,12 |
2275 |
|
|
IF ((abs(1./b(jj)).gt.0.1).and.(abs(1./b(jj)).lt.15.) |
2276 |
|
|
& .and.(w_i(jj).GT.0.01)) THEN |
2277 |
|
|
res = beta_mean_inv - (1./b(jj)) ; |
2278 |
|
|
C write(*,*) jj,abs(res*w_i(jj)) |
2279 |
|
|
if (abs(res*w_i(jj)).lt.resmax) THEN |
2280 |
|
|
chi2 = chi2 + (res*w_i(jj))**2. |
2281 |
|
|
icount = icount+1 |
2282 |
|
|
sxw = sxw + (1./b(jj))*w_i(jj)*w_i(jj) |
2283 |
|
|
sw = sw + w_i(jj)*w_i(jj) |
2284 |
|
|
ENDIF |
2285 |
|
|
ENDIF |
2286 |
|
|
ENDDO |
2287 |
|
|
|
2288 |
|
|
c quality = sw |
2289 |
|
|
quality = sqrt(sw) |
2290 |
|
|
|
2291 |
|
|
if (icount.eq.0) chi2 = 1000. |
2292 |
|
|
if (icount.gt.0) chi2 = chi2/(icount) |
2293 |
|
|
|
2294 |
|
|
if (icount.gt.0) betachi=1./(sxw/sw); |
2295 |
|
|
|
2296 |
|
|
beta_mean=100. |
2297 |
|
|
if ((chi2.lt.chi2cut).and.(quality.gt.qualitycut)) |
2298 |
|
|
& beta_mean = betachi |
2299 |
|
|
c write(*,*) icount,chi2,quality,beta_mean |
2300 |
|
|
newbeta = beta_mean |
2301 |
|
|
|
2302 |
|
|
END |
2303 |
|
|
|
2304 |
|
|
C**************************************************************************** |
2305 |
|
|
|
2306 |
mocchiut |
1.6 |
|
2307 |
mocchiut |
1.7 |
|