1 |
***************************************************************************** |
***************************************************************************** |
2 |
INTEGER FUNCTION TOFTRK() |
INTEGER FUNCTION TOFTRK() |
3 |
c |
|
4 |
|
C**************************************************************************** |
5 |
|
C 31-08-06 WM |
6 |
|
C Changed to use DOTRACK2 |
7 |
|
C Beta calculation: now the flightpath (instead of cos(theta)) is used |
8 |
|
C Beta calculation: all 4 TDV measurements must be < 4095 (in the old |
9 |
|
C routine it was (t1+t2)<8000 |
10 |
|
C |
11 |
|
C 08-12-06 WM: |
12 |
|
C adc_c-bug : The raw ADC value was multiplied with cos(theta) |
13 |
|
C and AFTER that there was an if statement "if tof32(right,i,iadc) < 4095" |
14 |
|
C |
15 |
|
C jan-07 GF: ADC/TDCflags(4,12) inserted to flag artificial ADC/TDC |
16 |
|
C values |
17 |
|
C jan-07 WM: artificial ADC values created using attenuation calibration |
18 |
|
C jan-07 WM: artificial TDC values created using xy_coor calibration |
19 |
|
C jan-07 WM: modified xtofpos flag "101". xtofpos must be inside physical |
20 |
|
C dimension of the paddle +/- 10 cm |
21 |
|
C jan-07 WM: if xtofpos=101 then this paddle is not used for beta |
22 |
|
C calculation |
23 |
|
C jan-07 WM: in the xtofpos calculation a check for TDC.ne.4095 was |
24 |
|
C inserted. In the old code one would still calculate a |
25 |
|
C xtofpos-value even if the TDC information was missing |
26 |
|
C jan-07 WM: flag for PMTs #10 and #35 added, TDC=819 due to bit-shift |
27 |
|
C jan-05 WM: bug fixed: calculation of zenith angles using DOTRACK2 |
28 |
|
C was incorrect |
29 |
|
C jan-07 WM: bug fixed: in some cases tdc_tw was calculated due to a |
30 |
|
C leftover "xhelp" value |
31 |
|
C apr-07 WM: attenuation fit curve is now a double exponential fit |
32 |
|
C conversion from raw ADC to pC using calibration function |
33 |
|
C new variables xtr_tof(6) and ytr_tof(6) give track position |
34 |
|
C at ToF layers |
35 |
|
C aug-07 WM: artificial ADC creation revised: Now an ADC value is created |
36 |
|
C only if there is a TDC value (before ADC was created in ANY |
37 |
|
C case) |
38 |
|
C jan-08 WM: Major Update: Time Walk correction introduced |
39 |
|
C Additionally we use the information from the "check_charge" |
40 |
|
C function to fill artificial ADC values and make small corrections |
41 |
|
C to the k1-parameter (for Z>2) |
42 |
|
C feb-08 WM: Calculation of beta(13) changed: First a mean beta is calculated, |
43 |
|
C then in a second step we check the residuals of the single |
44 |
|
C measurements, reject if > 10 sigma, calculate chi2 and "quality" |
45 |
|
C beta is taken as good if chi2<20 and quality>10 |
46 |
|
C The function "newbeta" is located in "tofl2com.for" |
47 |
|
C mar-08 WM: Call to "newbeta" changed, now a flag tells the function if the |
48 |
|
C call comes from "tofl2com" or form "toftrack" |
49 |
|
C mar-08 WM: Bug found in dEdx if check_charge>1 |
50 |
|
C |
51 |
|
C**************************************************************************** |
52 |
IMPLICIT NONE |
IMPLICIT NONE |
53 |
C |
C |
54 |
include 'input_tof.txt' |
include 'input_tof.txt' |
55 |
include 'output_tof.txt' |
include 'output_tof.txt' |
56 |
include 'tofcomm.txt' |
include 'tofcomm.txt' |
57 |
C |
C |
58 |
|
|
59 |
c ======================================= |
c ======================================= |
60 |
c variables for tracking routine |
c variables for tracking routine |
61 |
c ======================================= |
c ======================================= |
68 |
DOUBLE PRECISION ZTOF(NPTOF) |
DOUBLE PRECISION ZTOF(NPTOF) |
69 |
DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
70 |
|
|
71 |
integer itof |
integer itof,pmt_id |
72 |
|
|
73 |
DOUBLE PRECISION al_p(5), |
DOUBLE PRECISION al_p(5), |
74 |
& xout(NPOINT_MAX),yout(NPOINT_MAX),zin(NPTOF) |
& xout(NPOINT_MAX),yout(NPOINT_MAX),zin(NPTOF), |
75 |
|
& THXOUT(NPOINT_MAX),THYOUT(NPOINT_MAX),TLOUT(NPOINT_MAX) |
76 |
|
|
77 |
|
|
78 |
INTEGER IFAIL |
INTEGER IFAIL |
79 |
REAL dx,dy,dr,ds |
c REAL dx,dy,dr |
80 |
REAL yhelp,xdummy,xkorr0,xhelp,xhelp1,xhelp2 |
REAL ds |
81 |
REAL c1,c2,sw,sxw,w_i |
REAL t1,t2,t3,t4 |
82 |
INTEGER icount |
REAL yhelp,xhelp,xhelp1,xhelp2 |
83 |
|
REAL c1,c2 |
84 |
|
C REAL sw,sxw,w_i |
85 |
|
REAL dist,dl,F |
86 |
|
INTEGER ievent |
87 |
|
C INTEGER icount |
88 |
|
C REAL beta_mean |
89 |
|
REAL btemp(12) |
90 |
|
REAL hepratio |
91 |
|
|
92 |
|
INTEGER j,hitvec(6) |
93 |
|
|
94 |
|
real atten,pc_adc,check_charge,newbeta |
95 |
|
|
|
REAL beta_mean |
|
|
INTEGER j |
|
96 |
|
|
97 |
REAL theta12,theta13,theta23 |
REAL theta,phi |
98 |
C-- DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
C-- DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
99 |
REAL tofarm12 |
REAL tofarm12 |
100 |
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
101 |
REAL tofarm23 |
REAL tofarm23 |
102 |
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
103 |
REAL tofarm13 |
REAL tofarm13 |
104 |
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
105 |
|
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
INTEGER ihelp |
INTEGER ihelp |
108 |
REAL xkorr |
REAL xkorr,xpos |
109 |
|
|
110 |
|
INTEGER IZ |
111 |
|
REAL k1corrA1,k1corrB1,k1corrC1 |
112 |
|
|
113 |
REAL yl,yh,xl,xh |
REAL yl,yh,xl,xh |
114 |
C |
C |
115 |
REAL hmemor(9000000) |
REAL hmemor(9000000) |
116 |
INTEGER Iquest(100) |
INTEGER Iquest(100) |
117 |
C |
C |
118 |
|
DATA ievent / 0 / |
119 |
|
|
120 |
|
INTEGER ifst |
121 |
|
DATA ifst /0/ |
122 |
|
|
123 |
COMMON / pawcd / hmemor |
COMMON / pawcd / hmemor |
124 |
save / pawcd / |
save / pawcd / |
125 |
C |
C |
126 |
Common / QUESTd / Iquest |
Common / QUESTd / Iquest |
127 |
save / questd / |
save / questd / |
128 |
C |
C |
129 |
C Begin ! |
C Begin ! |
130 |
C |
C |
131 |
TOFTRK = 0 |
TOFTRK = 0 |
132 |
|
|
133 |
******************************************************************* |
******************************************************************* |
134 |
|
|
135 |
|
if (ifst.eq.0) then |
136 |
|
ifst=1 |
137 |
|
|
138 |
|
C ratio helium to proton ca. 4 |
139 |
|
hepratio = 4. |
140 |
|
|
141 |
offset = 1 |
offset = 1 |
142 |
slope = 2 |
slope = 2 |
143 |
left = 1 |
left = 1 |
149 |
itdc = 1 |
itdc = 1 |
150 |
iadc = 2 |
iadc = 2 |
151 |
|
|
152 |
|
|
153 |
|
k1corrA1 = 0. |
154 |
|
k1corrB1 = -5.0 |
155 |
|
k1corrC1= 8.0 |
156 |
|
|
157 |
|
ENDIF ! ifst |
158 |
|
|
159 |
|
******************************************************************* |
160 |
|
|
161 |
|
ievent = ievent +1 |
162 |
|
|
163 |
do i=1,13 |
do i=1,13 |
164 |
beta_a(i) = 100. |
beta_a(i) = 100. |
165 |
enddo |
enddo |
176 |
enddo |
enddo |
177 |
enddo |
enddo |
178 |
|
|
179 |
C------ read tracking routine |
do i=1,4 |
180 |
|
do j=1,12 |
181 |
|
adcflag(i,j) = 0 |
182 |
|
enddo |
183 |
|
enddo |
184 |
|
|
185 |
|
do i=1,4 |
186 |
|
do j=1,12 |
187 |
|
tdcflag(i,j) = 0 |
188 |
|
enddo |
189 |
|
enddo |
190 |
|
|
191 |
|
pmt_id=0 |
192 |
|
|
193 |
|
do j=1,6 |
194 |
|
THXOUT(j) = 0. |
195 |
|
THYOUT(j) = 0. |
196 |
|
enddo |
197 |
|
|
198 |
|
do j=1,6 |
199 |
|
xtr_tof(j) = 100. |
200 |
|
ytr_tof(j) = 100. |
201 |
|
enddo |
202 |
|
|
203 |
|
|
204 |
|
C---------------------------------------------------------------------- |
205 |
|
C-------------------------get ToF data -------------------------------- |
206 |
|
C we cannot use the tofxx(x,x,x) data from tofl2com since it is |
207 |
|
C manipulated (Time-walk, artificila ADc and TDC values using ToF |
208 |
|
C standalone information |
209 |
|
C---------------------------------------------------------------------- |
210 |
|
|
211 |
|
c put the adc and tdc values from ntuple into tofxx(i,j,k) variables |
212 |
|
|
213 |
|
do j=1,8 |
214 |
|
tof11(1,j,2) = pc_adc(adc(ch11a(j),hb11a(j))) |
215 |
|
tof11(2,j,2) = pc_adc(adc(ch11b(j),hb11b(j))) |
216 |
|
tof11(1,j,1) = (tdc(ch11a(j),hb11a(j))) |
217 |
|
tof11(2,j,1) = (tdc(ch11b(j),hb11b(j))) |
218 |
|
enddo |
219 |
|
|
220 |
|
|
221 |
|
do j=1,6 |
222 |
|
tof12(1,j,2) = pc_adc(adc(ch12a(j),hb12a(j))) |
223 |
|
tof12(2,j,2) = pc_adc(adc(ch12b(j),hb12b(j))) |
224 |
|
tof12(1,j,1) = (tdc(ch12a(j),hb12a(j))) |
225 |
|
tof12(2,j,1) = (tdc(ch12b(j),hb12b(j))) |
226 |
|
enddo |
227 |
|
|
228 |
|
do j=1,2 |
229 |
|
tof21(1,j,2) = pc_adc(adc(ch21a(j),hb21a(j))) |
230 |
|
tof21(2,j,2) = pc_adc(adc(ch21b(j),hb21b(j))) |
231 |
|
tof21(1,j,1) = (tdc(ch21a(j),hb21a(j))) |
232 |
|
tof21(2,j,1) = (tdc(ch21b(j),hb21b(j))) |
233 |
|
enddo |
234 |
|
|
235 |
|
do j=1,2 |
236 |
|
tof22(1,j,2) = pc_adc(adc(ch22a(j),hb22a(j))) |
237 |
|
tof22(2,j,2) = pc_adc(adc(ch22b(j),hb22b(j))) |
238 |
|
tof22(1,j,1) = (tdc(ch22a(j),hb22a(j))) |
239 |
|
tof22(2,j,1) = (tdc(ch22b(j),hb22b(j))) |
240 |
|
enddo |
241 |
|
|
242 |
|
do j=1,3 |
243 |
|
tof31(1,j,2) = pc_adc(adc(ch31a(j),hb31a(j))) |
244 |
|
tof31(2,j,2) = pc_adc(adc(ch31b(j),hb31b(j))) |
245 |
|
tof31(1,j,1) = (tdc(ch31a(j),hb31a(j))) |
246 |
|
tof31(2,j,1) = (tdc(ch31b(j),hb31b(j))) |
247 |
|
enddo |
248 |
|
|
249 |
|
do j=1,3 |
250 |
|
tof32(1,j,2) = pc_adc(adc(ch32a(j),hb32a(j))) |
251 |
|
tof32(2,j,2) = pc_adc(adc(ch32b(j),hb32b(j))) |
252 |
|
tof32(1,j,1) = (tdc(ch32a(j),hb32a(j))) |
253 |
|
tof32(2,j,1) = (tdc(ch32b(j),hb32b(j))) |
254 |
|
enddo |
255 |
|
|
256 |
|
C---------------------------------------------------------------------- |
257 |
|
|
258 |
|
DO i = 1,8 |
259 |
|
if (abs(tof11(1,i,itdc)).gt.10000.) tof11(1,i,itdc)= 10000. |
260 |
|
if (abs(tof11(2,i,itdc)).gt.10000.) tof11(2,i,itdc)= 10000. |
261 |
|
if (abs(tof11(1,i,iadc)).gt.10000.) tof11(1,i,iadc)= 10000. |
262 |
|
if (abs(tof11(2,i,iadc)).gt.10000.) tof11(2,i,iadc)= 10000. |
263 |
|
ENDDO |
264 |
|
|
265 |
|
DO i = 1,6 |
266 |
|
if (abs(tof12(1,i,itdc)).gt.10000.) tof12(1,i,itdc)= 10000. |
267 |
|
if (abs(tof12(2,i,itdc)).gt.10000.) tof12(2,i,itdc)= 10000. |
268 |
|
if (abs(tof12(1,i,iadc)).gt.10000.) tof12(1,i,iadc)= 10000. |
269 |
|
if (abs(tof12(2,i,iadc)).gt.10000.) tof12(2,i,iadc)= 10000. |
270 |
|
ENDDO |
271 |
|
|
272 |
|
|
273 |
|
DO i = 1,2 |
274 |
|
if (abs(tof21(1,i,itdc)).gt.10000.) tof21(1,i,itdc)= 10000. |
275 |
|
if (abs(tof21(2,i,itdc)).gt.10000.) tof21(2,i,itdc)= 10000. |
276 |
|
if (abs(tof21(1,i,iadc)).gt.10000.) tof21(1,i,iadc)= 10000. |
277 |
|
if (abs(tof21(2,i,iadc)).gt.10000.) tof21(2,i,iadc)= 10000. |
278 |
|
ENDDO |
279 |
|
|
280 |
|
DO i = 1,2 |
281 |
|
if (abs(tof22(1,i,itdc)).gt.10000.) tof22(1,i,itdc)= 10000. |
282 |
|
if (abs(tof22(2,i,itdc)).gt.10000.) tof22(2,i,itdc)= 10000. |
283 |
|
if (abs(tof22(1,i,iadc)).gt.10000.) tof22(1,i,iadc)= 10000. |
284 |
|
if (abs(tof22(2,i,iadc)).gt.10000.) tof22(2,i,iadc)= 10000. |
285 |
|
ENDDO |
286 |
|
|
287 |
|
DO i = 1,3 |
288 |
|
if (abs(tof31(1,i,itdc)).gt.10000.) tof31(1,i,itdc)= 10000. |
289 |
|
if (abs(tof31(2,i,itdc)).gt.10000.) tof31(2,i,itdc)= 10000. |
290 |
|
if (abs(tof31(1,i,iadc)).gt.10000.) tof31(1,i,iadc)= 10000. |
291 |
|
if (abs(tof31(2,i,iadc)).gt.10000.) tof31(2,i,iadc)= 10000. |
292 |
|
ENDDO |
293 |
|
|
294 |
|
DO i = 1,3 |
295 |
|
if (abs(tof32(1,i,itdc)).gt.10000.) tof32(1,i,itdc)= 10000. |
296 |
|
if (abs(tof32(2,i,itdc)).gt.10000.) tof32(2,i,itdc)= 10000. |
297 |
|
if (abs(tof32(1,i,iadc)).gt.10000.) tof32(1,i,iadc)= 10000. |
298 |
|
if (abs(tof32(2,i,iadc)).gt.10000.) tof32(2,i,iadc)= 10000. |
299 |
|
ENDDO |
300 |
|
|
301 |
|
C---------------------------------------------------------------------- |
302 |
|
|
303 |
|
C------read tracking routine |
304 |
* igoodevent = igoodevent+1 |
* igoodevent = igoodevent+1 |
305 |
* assigned input parameters for track routine |
* assigned input parameters for track routine |
306 |
* 1) Z-coordinates where the trajectory is evaluated |
* 1) Z-coordinates where the trajectory is evaluated |
312 |
do i=1,5 |
do i=1,5 |
313 |
AL_P(i) = al_pp(i) |
AL_P(i) = al_pp(i) |
314 |
enddo |
enddo |
315 |
|
|
316 |
|
c write(*,*) AL_P |
317 |
|
|
318 |
if (al_p(5).eq.0.) THEN |
if (al_p(5).eq.0.) THEN |
319 |
PRINT *,' TOF - WARNING F77: track with R = 0, discarded' |
c PRINT *,' TOF - WARNING F77: track with R = 0, discarded' |
320 |
GOTO 969 |
GOTO 969 |
321 |
ENDIF |
ENDIF |
322 |
* -------- *** tracking routine *** -------- |
* -------- *** tracking routine *** -------- |
323 |
IFAIL = 0 |
IFAIL = 0 |
324 |
call DOTRACK(NPTOF,ZIN,XOUT,YOUT,AL_P,IFAIL) |
C call DOTRACK(NPTOF,ZIN,XOUT,YOUT,AL_P,IFAIL) |
325 |
|
call DOTRACK2(NPTOF,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P,IFAIL) |
326 |
|
|
327 |
|
C write(*,*) (TLOUT(i),i=1,6) |
328 |
|
|
329 |
if(IFAIL.ne.0)then |
if(IFAIL.ne.0)then |
330 |
print *,' TOF - WARNING F77: tracking failed ' |
c print *,' TOF - WARNING F77: tracking failed ' |
331 |
goto 969 |
goto 969 |
332 |
endif |
endif |
333 |
* ------------------------------------------ |
* ------------------------------------------ |
334 |
|
|
335 |
969 continue |
969 continue |
336 |
|
|
337 |
|
C--- Fill xtr_tof and ytr_tof: positions from tracker at ToF layers |
338 |
|
do j=1,6 |
339 |
|
xtr_tof(j) = XOUT(j) |
340 |
|
ytr_tof(j) = YOUT(j) |
341 |
|
enddo |
342 |
|
|
343 |
|
|
344 |
|
C--- convert angles to radian |
345 |
|
do j=1,6 |
346 |
|
THXOUT(j) = 3.1415927*THXOUT(j)/180. |
347 |
|
THYOUT(j) = 3.1415927*THYOUT(j)/180. |
348 |
|
enddo |
349 |
|
|
350 |
|
do j=1,6 |
351 |
|
c write (*,*) j,THXOUT(j),THYOUT(j) |
352 |
|
enddo |
353 |
|
|
354 |
|
|
355 |
|
C---------------------------------------------------------------------- |
356 |
|
C------------------ set ADC & TDC flag = 0 ------------------------ |
357 |
|
C---------------------------------------------------------------------- |
358 |
|
|
359 |
|
do j=1,8 |
360 |
|
if (adc(ch11a(j),hb11a(j)).LT.4096)adcflagtof(ch11a(j),hb11a(j))=0 |
361 |
|
if (adc(ch11b(j),hb11b(j)).LT.4096)adcflagtof(ch11b(j),hb11b(j))=0 |
362 |
|
if (tdc(ch11a(j),hb11a(j)).LT.4096)tdcflagtof(ch11a(j),hb11a(j))=0 |
363 |
|
if (tdc(ch11b(j),hb11b(j)).LT.4096)tdcflagtof(ch11b(j),hb11b(j))=0 |
364 |
|
enddo |
365 |
|
do j=1,6 |
366 |
|
if (adc(ch12a(j),hb12a(j)).LT.4096)adcflagtof(ch12a(j),hb12a(j))=0 |
367 |
|
if (adc(ch12b(j),hb12b(j)).LT.4096)adcflagtof(ch12b(j),hb12b(j))=0 |
368 |
|
if (tdc(ch12a(j),hb12a(j)).LT.4096)tdcflagtof(ch12a(j),hb12a(j))=0 |
369 |
|
if (tdc(ch12b(j),hb12b(j)).LT.4096)tdcflagtof(ch12b(j),hb12b(j))=0 |
370 |
|
enddo |
371 |
|
do j=1,2 |
372 |
|
if (adc(ch21a(j),hb21a(j)).LT.4096)adcflagtof(ch21a(j),hb21a(j))=0 |
373 |
|
if (adc(ch21b(j),hb21b(j)).LT.4096)adcflagtof(ch21b(j),hb21b(j))=0 |
374 |
|
if (tdc(ch21a(j),hb21a(j)).LT.4096)tdcflagtof(ch21a(j),hb21a(j))=0 |
375 |
|
if (tdc(ch21b(j),hb21b(j)).LT.4096)tdcflagtof(ch21b(j),hb21b(j))=0 |
376 |
|
enddo |
377 |
|
do j=1,2 |
378 |
|
if (adc(ch22a(j),hb22a(j)).LT.4096)adcflagtof(ch22a(j),hb22a(j))=0 |
379 |
|
if (adc(ch22b(j),hb22b(j)).LT.4096)adcflagtof(ch22b(j),hb22b(j))=0 |
380 |
|
if (tdc(ch22a(j),hb22a(j)).LT.4096)tdcflagtof(ch22a(j),hb22a(j))=0 |
381 |
|
if (tdc(ch22b(j),hb22b(j)).LT.4096)tdcflagtof(ch22b(j),hb22b(j))=0 |
382 |
|
enddo |
383 |
|
do j=1,3 |
384 |
|
if (adc(ch31a(j),hb31a(j)).LT.4096)adcflagtof(ch31a(j),hb31a(j))=0 |
385 |
|
if (adc(ch31b(j),hb31b(j)).LT.4096)adcflagtof(ch31b(j),hb31b(j))=0 |
386 |
|
if (tdc(ch31a(j),hb31a(j)).LT.4096)tdcflagtof(ch31a(j),hb31a(j))=0 |
387 |
|
if (tdc(ch31b(j),hb31b(j)).LT.4096)tdcflagtof(ch31b(j),hb31b(j))=0 |
388 |
|
enddo |
389 |
|
do j=1,3 |
390 |
|
if (adc(ch32a(j),hb32a(j)).LT.4096)adcflagtof(ch32a(j),hb32a(j))=0 |
391 |
|
if (adc(ch32b(j),hb32b(j)).LT.4096)adcflagtof(ch32b(j),hb32b(j))=0 |
392 |
|
if (tdc(ch32a(j),hb32a(j)).LT.4096)tdcflagtof(ch32a(j),hb32a(j))=0 |
393 |
|
if (tdc(ch32b(j),hb32b(j)).LT.4096)tdcflagtof(ch32b(j),hb32b(j))=0 |
394 |
|
enddo |
395 |
|
|
396 |
|
|
397 |
|
C---------------------------------------------------------------- |
398 |
|
C---------- Check PMTs 10 and 35 for strange TDC values---------- |
399 |
|
C---------------------------------------------------------------- |
400 |
|
|
401 |
|
C---- S116A TDC=819 |
402 |
|
if (tof11(1,6,1).EQ.819) then |
403 |
|
tof11(1,6,1) = 4095 |
404 |
|
tdcflagtof(ch11a(6),hb11a(6))=2 |
405 |
|
endif |
406 |
|
|
407 |
|
C---- S222B TDC=819 |
408 |
|
if (tof22(2,2,1).EQ.819) then |
409 |
|
tof22(2,2,1) = 4095 |
410 |
|
tdcflagtof(ch22b(2),hb22b(2))=2 |
411 |
|
endif |
412 |
|
|
413 |
C------------------------------------------------------------- |
C------------------------------------------------------------- |
414 |
C------- check which paddle penetrated the track ----------- |
C-------check which paddle penetrated the track ----------- |
415 |
C------------------------------------------------------------- |
C------------------------------------------------------------- |
416 |
c middle y (or x) position of the upper and middle ToF-Paddle |
c middle y (or x) position of the upper and middle ToF-Paddle |
417 |
c DATA tof11_x/ -17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85/ |
c DATA tof11_x/ -17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85/ |
418 |
c DATA tof12_y/ -13.75,-8.25,-2.75,2.75,8.25,13.75/ |
c DATA tof12_y/ -13.75,-8.25,-2.75,2.75,8.25,13.75/ |
419 |
c DATA tof21_y/ -3.75,3.75/ |
c DATA tof21_y/ 3.75,-3.75/ ! paddles in different order |
420 |
c DATA tof22_x/ -4.5,4.5/ |
c DATA tof22_x/ -4.5,4.5/ |
421 |
c DATA tof31_x/ -6.0,0.,6.0/ |
c DATA tof31_x/ -6.0,0.,6.0/ |
422 |
c DATA tof32_y/ -5.0,0.0,5.0/ |
c DATA tof32_y/ -5.0,0.0,5.0/ |
423 |
c |
c |
424 |
c S11 8 paddles 33.0 x 5.1 cm |
c S11 8 paddles 33.0 x 5.1 cm |
425 |
c S12 6 paddles 40.8 x 5.5 cm |
c S12 6 paddles 40.8 x 5.5 cm |
426 |
c S21 2 paddles 18.0 x 7.5 cm |
c S21 2 paddles 18.0 x 7.5 cm |
427 |
c S22 2 paddles 15.0 x 9.0 cm |
c S22 2 paddles 15.0 x 9.0 cm |
428 |
c S31 3 paddles 15.0 x 6.0 cm |
c S31 3 paddles 15.0 x 6.0 cm |
429 |
c S32 3 paddles 18.0 x 5.0 cm |
c S32 3 paddles 18.0 x 5.0 cm |
430 |
|
|
431 |
|
c write(*,*) xout(1),xout(2),xout(3),xout(4),xout(5),xout(6) |
432 |
|
c write(*,*) yout(1),yout(2),yout(3),yout(4),yout(5),yout(6) |
433 |
|
|
434 |
C-------------- S11 -------------------------------------- |
C--------------S11 -------------------------------------- |
435 |
|
|
436 |
tof11_i = none_find |
tof11_i = none_find |
437 |
|
|
439 |
yh = 33.0/2. |
yh = 33.0/2. |
440 |
|
|
441 |
if ((yout(1).gt.yl).and.(yout(1).lt.yh)) then |
if ((yout(1).gt.yl).and.(yout(1).lt.yh)) then |
442 |
do i=1,8 |
do i=1,8 |
443 |
xl = tof11_x(i) - 5.1/2. |
xl = tof11_x(i) - 5.1/2. |
444 |
xh = tof11_x(i) + 5.1/2. |
xh = tof11_x(i) + 5.1/2. |
445 |
if ((xout(1).gt.xl).and.(xout(1).le.xh)) then |
if ((xout(1).gt.xl).and.(xout(1).le.xh)) then |
446 |
tof11_i=i |
tof11_i=i |
447 |
endif |
endif |
448 |
enddo |
enddo |
449 |
endif |
endif |
450 |
|
|
451 |
C-------------- S12 -------------------------------------- |
C--------------S12 -------------------------------------- |
452 |
|
|
453 |
tof12_i = none_find |
tof12_i = none_find |
454 |
|
|
455 |
xl = -40.8/2. |
xl = -40.8/2. |
456 |
xh = 40.8/2. |
xh = 40.8/2. |
457 |
|
|
458 |
if ((xout(2).gt.xl).and.(xout(2).lt.xh)) then |
if ((xout(2).gt.xl).and.(xout(2).lt.xh)) then |
459 |
do i=1,6 |
do i=1,6 |
460 |
yl = tof12_y(i) - 5.5/2. |
yl = tof12_y(i) - 5.5/2. |
461 |
yh = tof12_y(i) + 5.5/2. |
yh = tof12_y(i) + 5.5/2. |
462 |
if ((yout(2).gt.yl).and.(yout(2).le.yh)) then |
if ((yout(2).gt.yl).and.(yout(2).le.yh)) then |
463 |
tof12_i=i |
tof12_i=i |
464 |
endif |
endif |
465 |
enddo |
enddo |
466 |
endif |
endif |
467 |
|
|
468 |
C-------------- S21 -------------------------------------- |
C--------------S21 -------------------------------------- |
469 |
|
|
470 |
tof21_i = none_find |
tof21_i = none_find |
471 |
|
|
472 |
xl = -18./2. |
xl = -18./2. |
473 |
xh = 18./2. |
xh = 18./2. |
474 |
|
|
475 |
if ((xout(3).gt.xl).and.(xout(3).lt.xh)) then |
if ((xout(3).gt.xl).and.(xout(3).lt.xh)) then |
476 |
do i=1,2 |
do i=1,2 |
477 |
yl = tof21_y(i) - 7.5/2. |
yl = tof21_y(i) - 7.5/2. |
478 |
yh = tof21_y(i) + 7.5/2. |
yh = tof21_y(i) + 7.5/2. |
479 |
if ((yout(3).gt.yl).and.(yout(3).le.yh)) then |
if ((yout(3).gt.yl).and.(yout(3).le.yh)) then |
480 |
tof21_i=i |
tof21_i=i |
481 |
endif |
endif |
482 |
enddo |
enddo |
483 |
endif |
endif |
484 |
|
|
485 |
C-------------- S22 -------------------------------------- |
C--------------S22 -------------------------------------- |
486 |
|
|
487 |
tof22_i = none_find |
tof22_i = none_find |
488 |
|
|
489 |
yl = -15./2. |
yl = -15./2. |
490 |
yh = 15./2. |
yh = 15./2. |
491 |
|
|
492 |
if ((yout(4).gt.yl).and.(yout(4).lt.yh)) then |
if ((yout(4).gt.yl).and.(yout(4).lt.yh)) then |
493 |
do i=1,2 |
do i=1,2 |
494 |
xl = tof22_x(i) - 9.0/2. |
xl = tof22_x(i) - 9.0/2. |
495 |
xh = tof22_x(i) + 9.0/2. |
xh = tof22_x(i) + 9.0/2. |
496 |
if ((xout(4).gt.xl).and.(xout(4).le.xh)) then |
if ((xout(4).gt.xl).and.(xout(4).le.xh)) then |
497 |
tof22_i=i |
tof22_i=i |
498 |
endif |
endif |
499 |
enddo |
enddo |
500 |
endif |
endif |
501 |
|
|
502 |
C-------------- S31 -------------------------------------- |
C--------------S31 -------------------------------------- |
503 |
|
|
504 |
tof31_i = none_find |
tof31_i = none_find |
505 |
|
|
506 |
yl = -15.0/2. |
yl = -15.0/2. |
507 |
yh = 15.0/2. |
yh = 15.0/2. |
508 |
|
|
509 |
if ((yout(5).gt.yl).and.(yout(5).lt.yh)) then |
if ((yout(5).gt.yl).and.(yout(5).lt.yh)) then |
510 |
do i=1,3 |
do i=1,3 |
511 |
xl = tof31_x(i) - 6.0/2. |
xl = tof31_x(i) - 6.0/2. |
512 |
xh = tof31_x(i) + 6.0/2. |
xh = tof31_x(i) + 6.0/2. |
513 |
if ((xout(5).gt.xl).and.(xout(5).le.xh)) then |
if ((xout(5).gt.xl).and.(xout(5).le.xh)) then |
514 |
tof31_i=i |
tof31_i=i |
515 |
endif |
endif |
516 |
enddo |
enddo |
517 |
endif |
endif |
518 |
|
|
519 |
C-------------- S32 -------------------------------------- |
C--------------S32 -------------------------------------- |
520 |
|
|
521 |
tof32_i = none_find |
tof32_i = none_find |
522 |
|
|
523 |
xl = -18.0/2. |
xl = -18.0/2. |
524 |
xh = 18.0/2. |
xh = 18.0/2. |
525 |
|
|
526 |
if ((xout(6).gt.xl).and.(xout(6).lt.xh)) then |
if ((xout(6).gt.xl).and.(xout(6).lt.xh)) then |
527 |
do i=1,3 |
do i=1,3 |
528 |
yl = tof32_y(i) - 5.0/2. |
yl = tof32_y(i) - 5.0/2. |
529 |
yh = tof32_y(i) + 5.0/2. |
yh = tof32_y(i) + 5.0/2. |
530 |
if ((yout(6).gt.yl).and.(yout(6).le.yh)) then |
if ((yout(6).gt.yl).and.(yout(6).le.yh)) then |
531 |
tof32_i=i |
tof32_i=i |
532 |
endif |
endif |
533 |
enddo |
enddo |
534 |
endif |
endif |
535 |
|
|
536 |
|
|
537 |
|
C write(*,*) tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
538 |
|
|
539 |
|
hitvec(1)=tof11_i |
540 |
|
hitvec(2)=tof12_i |
541 |
|
hitvec(3)=tof21_i |
542 |
|
hitvec(4)=tof22_i |
543 |
|
hitvec(5)=tof31_i |
544 |
|
hitvec(6)=tof32_i |
545 |
|
|
546 |
|
c write(*,*) 'toftrk ', |
547 |
|
c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
548 |
|
|
549 |
|
C---------------------------------------------------------------------- |
550 |
|
C--- check charge: |
551 |
|
C--- if Z=2 we should use the attenuation curve for helium to |
552 |
|
C--- fill the artificail ADC values and NOT divide by "hepratio" |
553 |
|
C--- if Z>2 we should do a correction to |
554 |
|
C--- the k1 constants in the beta calculation |
555 |
|
C---------------------------------------------------------------------- |
556 |
|
|
557 |
|
theta=0. |
558 |
|
dist = ZTOF(1) - ZTOF(5) |
559 |
|
dl = 0. |
560 |
|
DO I=1,5 |
561 |
|
dl = dl + TLOUT(i) |
562 |
|
ENDDO |
563 |
|
F = dl/dist |
564 |
|
theta = acos(1/F) |
565 |
|
|
566 |
|
iz = int(check_charge(theta,hitvec)) |
567 |
|
c write(*,*) 'in toftrk',iz |
568 |
|
|
569 |
|
C-------------------------------------------------------------------- |
570 |
|
C---- if paddle hit: if we have TDC value but no ADC, create ADC value |
571 |
|
C-------------------------------------------------------------------- |
572 |
|
c middle y (or x) position of the upper and middle ToF-Paddle |
573 |
|
c DATA tof11_x/ -17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85/ |
574 |
|
c DATA tof12_y/ -13.75,-8.25,-2.75,2.75,8.25,13.75/ |
575 |
|
c DATA tof21_y/ 3.75,-3.75/ ! paddles in different order |
576 |
|
c DATA tof22_x/ -4.5,4.5/ |
577 |
|
c DATA tof31_x/ -6.0,0.,6.0/ |
578 |
|
c DATA tof32_y/ -5.0,0.0,5.0/ |
579 |
|
|
580 |
|
C----------------------------S1 ------------------------------------- |
581 |
|
|
582 |
|
yhelp=yout(1) |
583 |
|
IF (tof11_i.GT.none_find.AND.abs(yout(1)).lt.100) THEN |
584 |
|
i = tof11_i |
585 |
|
if ((tdc(ch11a(i),hb11a(i)).lt.4095).AND. |
586 |
|
& (adc(ch11a(i),hb11a(i)).eq.4095)) then |
587 |
|
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
588 |
|
theta = atan(tan(THXOUT(1))/cos(phi)) |
589 |
|
xkorr = atten(left,11,i,yhelp) |
590 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
591 |
|
tof11(left,i,iadc)=xkorr/cos(theta) |
592 |
|
adcflag(ch11a(i),hb11a(i)) = 1 |
593 |
|
endif |
594 |
|
if ((tdc(ch11b(i),hb11b(i)).lt.4095).AND. |
595 |
|
& (adc(ch11b(i),hb11b(i)).eq.4095)) then |
596 |
|
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
597 |
|
theta = atan(tan(THXOUT(1))/cos(phi)) |
598 |
|
xkorr = atten(right,11,i,yhelp) |
599 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
600 |
|
tof11(right,i,iadc)=xkorr/cos(theta) |
601 |
|
adcflag(ch11b(i),hb11b(i)) = 1 |
602 |
|
endif |
603 |
|
ENDIF |
604 |
|
|
605 |
|
xhelp=xout(2) |
606 |
|
IF (tof12_i.GT.none_find.AND.abs(xout(2)).lt.100) THEN |
607 |
|
i = tof12_i |
608 |
|
if ((tdc(ch12a(i),hb12a(i)).lt.4095).AND. |
609 |
|
& (adc(ch12a(i),hb12a(i)).eq.4095)) then |
610 |
|
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
611 |
|
theta = atan(tan(THXOUT(2))/cos(phi)) |
612 |
|
c xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
613 |
|
xkorr = atten(left,12,i,xhelp) |
614 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
615 |
|
tof12(left,i,iadc) = xkorr/cos(theta) |
616 |
|
adcflag(ch12a(i),hb12a(i)) = 1 |
617 |
|
endif |
618 |
|
if ((tdc(ch12b(i),hb12b(i)).lt.4095).AND. |
619 |
|
& (adc(ch12b(i),hb12b(i)).eq.4095)) then |
620 |
|
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
621 |
|
theta = atan(tan(THXOUT(2))/cos(phi)) |
622 |
|
c xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
623 |
|
xkorr = atten(right,12,i,xhelp) |
624 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
625 |
|
tof12(right,i,iadc) = xkorr/cos(theta) |
626 |
|
adcflag(ch12b(i),hb12b(i)) = 1 |
627 |
|
endif |
628 |
|
ENDIF |
629 |
|
|
630 |
|
C-----------------------------S2 -------------------------------- |
631 |
|
|
632 |
|
xhelp=xout(3) |
633 |
|
IF (tof21_i.GT.none_find.AND.abs(xout(3)).lt.100) THEN |
634 |
|
i = tof21_i |
635 |
|
if ((tdc(ch21a(i),hb21a(i)).lt.4095).AND. |
636 |
|
& (adc(ch21a(i),hb21a(i)).eq.4095)) then |
637 |
|
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
638 |
|
theta = atan(tan(THXOUT(3))/cos(phi)) |
639 |
|
c xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
640 |
|
xkorr = atten(left,21,i,xhelp) |
641 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
642 |
|
tof21(left,i,iadc) = xkorr/cos(theta) |
643 |
|
adcflag(ch21a(i),hb21a(i)) = 1 |
644 |
|
endif |
645 |
|
if ((tdc(ch21b(i),hb21b(i)).lt.4095).AND. |
646 |
|
& (adc(ch21b(i),hb21b(i)).eq.4095)) then |
647 |
|
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
648 |
|
theta = atan(tan(THXOUT(3))/cos(phi)) |
649 |
|
c xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
650 |
|
xkorr = atten(right,21,i,xhelp) |
651 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
652 |
|
tof21(right,i,iadc) = xkorr/cos(theta) |
653 |
|
adcflag(ch21b(i),hb21b(i)) = 1 |
654 |
|
endif |
655 |
|
ENDIF |
656 |
|
|
657 |
|
|
658 |
|
yhelp=yout(4) |
659 |
|
IF (tof22_i.GT.none_find.AND.abs(yout(4)).lt.100) THEN |
660 |
|
i = tof22_i |
661 |
|
if ((tdc(ch22a(i),hb22a(i)).lt.4095).AND. |
662 |
|
& (adc(ch22a(i),hb22a(i)).eq.4095)) then |
663 |
|
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
664 |
|
theta = atan(tan(THXOUT(4))/cos(phi)) |
665 |
|
c xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
666 |
|
xkorr = atten(left,22,i,yhelp) |
667 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
668 |
|
tof22(left,i,iadc) = xkorr/cos(theta) |
669 |
|
adcflag(ch22a(i),hb22a(i)) = 1 |
670 |
|
endif |
671 |
|
if ((tdc(ch22a(i),hb22b(i)).lt.4095).AND. |
672 |
|
& (adc(ch22b(i),hb22b(i)).eq.4095)) then |
673 |
|
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
674 |
|
theta = atan(tan(THXOUT(4))/cos(phi)) |
675 |
|
c xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
676 |
|
xkorr = atten(right,22,i,yhelp) |
677 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
678 |
|
tof22(right,i,iadc) = xkorr/cos(theta) |
679 |
|
adcflag(ch22b(i),hb22b(i)) = 1 |
680 |
|
endif |
681 |
|
ENDIF |
682 |
|
|
683 |
|
C-----------------------------S3 -------------------------------- |
684 |
|
|
685 |
|
yhelp=yout(5) |
686 |
|
IF (tof31_i.GT.none_find.AND.abs(yout(5)).lt.100) THEN |
687 |
|
i = tof31_i |
688 |
|
if ((tdc(ch31a(i),hb31a(i)).lt.4095).AND. |
689 |
|
& (adc(ch31a(i),hb31a(i)).eq.4095)) then |
690 |
|
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
691 |
|
theta = atan(tan(THXOUT(5))/cos(phi)) |
692 |
|
c xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
693 |
|
xkorr = atten(left,31,i,yhelp) |
694 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
695 |
|
tof31(left,i,iadc) = xkorr/cos(theta) |
696 |
|
adcflag(ch31a(i),hb31a(i)) = 1 |
697 |
|
endif |
698 |
|
if ((tdc(ch31b(i),hb31b(i)).lt.4095).AND. |
699 |
|
& (adc(ch31b(i),hb31b(i)).eq.4095)) then |
700 |
|
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
701 |
|
theta = atan(tan(THXOUT(5))/cos(phi)) |
702 |
|
c xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
703 |
|
xkorr = atten(right,31,i,yhelp) |
704 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
705 |
|
tof31(right,i,iadc) = xkorr/cos(theta) |
706 |
|
adcflag(ch31b(i),hb31b(i)) = 1 |
707 |
|
endif |
708 |
|
ENDIF |
709 |
|
|
710 |
|
|
711 |
|
xhelp=xout(6) |
712 |
|
IF (tof32_i.GT.none_find.AND.abs(xout(6)).lt.100) THEN |
713 |
|
i = tof32_i |
714 |
|
if ((tdc(ch32a(i),hb32a(i)).lt.4095).AND. |
715 |
|
& (adc(ch32a(i),hb32a(i)).eq.4095)) then |
716 |
|
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
717 |
|
theta = atan(tan(THXOUT(6))/cos(phi)) |
718 |
|
c xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
719 |
|
xkorr = atten(left,32,i,xhelp) |
720 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
721 |
|
tof32(left,i,iadc) = xkorr/cos(theta) |
722 |
|
adcflag(ch32a(i),hb32a(i)) = 1 |
723 |
|
endif |
724 |
|
if ((tdc(ch32b(i),hb32b(i)).lt.4095).AND. |
725 |
|
& (adc(ch32b(i),hb32b(i)).eq.4095)) then |
726 |
|
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
727 |
|
theta = atan(tan(THXOUT(6))/cos(phi)) |
728 |
|
c xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
729 |
|
xkorr = atten(right,32,i,xhelp) |
730 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
731 |
|
tof32(right,i,iadc) = xkorr/cos(theta) |
732 |
|
adcflag(ch32b(i),hb32b(i)) = 1 |
733 |
|
endif |
734 |
|
ENDIF |
735 |
|
|
736 |
|
C------------------------------------------------------------------- |
737 |
|
C Now there is for each hitted paddle a TDC and ADC value, if the |
738 |
|
C TDC was < 4095. |
739 |
|
C There might be also TDC-ADC pairs in paddles not hitted |
740 |
|
C Let's correct the raw TDC value with the time walk |
741 |
|
C------------------------------------------------------------------- |
742 |
|
C--------------------Time walk correction ------------------------- |
743 |
|
C------------------------------------------------------------------- |
744 |
|
|
745 |
|
DO i=1,8 |
746 |
|
if ((tdc(ch11a(i),hb11a(i)).lt.4095).and. |
747 |
|
& (tof11(left,i,iadc).lt.3786)) THEN |
748 |
|
xhelp = tw11(left,i)/(tof11(left,i,iadc)**0.5) |
749 |
|
tof11(left,i,itdc) = tof11(left,i,itdc) + xhelp |
750 |
|
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
751 |
|
ENDIF |
752 |
|
|
753 |
|
if ((tdc(ch11b(i),hb11b(i)).lt.4095).and. |
754 |
|
& (tof11(right,i,iadc).lt.3786)) THEN |
755 |
|
xhelp = tw11(right,i)/(tof11(right,i,iadc)**0.5) |
756 |
|
tof11(right,i,itdc) = tof11(right,i,itdc) + xhelp |
757 |
|
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
758 |
|
ENDIF |
759 |
|
ENDDO |
760 |
|
|
761 |
|
|
762 |
|
DO i=1,6 |
763 |
|
if ((tdc(ch12a(i),hb12a(i)).lt.4095).and. |
764 |
|
& (tof12(left,i,iadc).lt.3786)) THEN |
765 |
|
xhelp = tw12(left,i)/(tof12(left,i,iadc)**0.5) |
766 |
|
tof12(left,i,itdc) = tof12(left,i,itdc) + xhelp |
767 |
|
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
768 |
|
ENDIF |
769 |
|
|
770 |
|
if ((tdc(ch12b(i),hb12b(i)).lt.4095).and. |
771 |
|
& (tof12(right,i,iadc).lt.3786)) THEN |
772 |
|
xhelp = tw12(right,i)/(tof12(right,i,iadc)**0.5) |
773 |
|
tof12(right,i,itdc) = tof12(right,i,itdc) + xhelp |
774 |
|
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
775 |
|
ENDIF |
776 |
|
ENDDO |
777 |
|
|
778 |
|
C---- |
779 |
|
DO I=1,2 |
780 |
|
if ((tdc(ch21a(i),hb21a(i)).lt.4095).and. |
781 |
|
& (tof21(left,i,iadc).lt.3786)) THEN |
782 |
|
xhelp = tw21(left,i)/(tof21(left,i,iadc)**0.5) |
783 |
|
tof21(left,i,itdc) = tof21(left,i,itdc) + xhelp |
784 |
|
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
785 |
|
ENDIF |
786 |
|
|
787 |
|
if ((tdc(ch21b(i),hb21b(i)).lt.4095).and. |
788 |
|
& (tof21(right,i,iadc).lt.3786)) THEN |
789 |
|
xhelp = tw21(right,i)/(tof21(right,i,iadc)**0.5) |
790 |
|
tof21(right,i,itdc) = tof21(right,i,itdc) + xhelp |
791 |
|
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
792 |
|
ENDIF |
793 |
|
ENDDO |
794 |
|
|
795 |
|
DO I=1,2 |
796 |
|
if ((tdc(ch22a(i),hb22a(i)).lt.4095).and. |
797 |
|
& (tof22(left,i,iadc).lt.3786)) THEN |
798 |
|
xhelp = tw22(left,i)/(tof22(left,i,iadc)**0.5) |
799 |
|
tof22(left,i,itdc) = tof22(left,i,itdc) + xhelp |
800 |
|
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
801 |
|
ENDIF |
802 |
|
|
803 |
|
if ((tdc(ch22b(i),hb22b(i)).lt.4095).and. |
804 |
|
& (tof22(right,i,iadc).lt.3786)) THEN |
805 |
|
xhelp = tw22(right,i)/(tof22(right,i,iadc)**0.5) |
806 |
|
tof22(right,i,itdc) = tof22(right,i,itdc) + xhelp |
807 |
|
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
808 |
|
ENDIF |
809 |
|
ENDDO |
810 |
|
|
811 |
|
C---- |
812 |
|
DO I=1,3 |
813 |
|
if ((tdc(ch31a(i),hb31a(i)).lt.4095).and. |
814 |
|
& (tof31(left,i,iadc).lt.3786)) THEN |
815 |
|
xhelp = tw31(left,i)/(tof31(left,i,iadc)**0.5) |
816 |
|
tof31(left,i,itdc) = tof31(left,i,itdc) + xhelp |
817 |
|
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
818 |
|
ENDIF |
819 |
|
|
820 |
|
if ((tdc(ch31b(i),hb31b(i)).lt.4095).and. |
821 |
|
& (tof31(right,i,iadc).lt.3786)) THEN |
822 |
|
xhelp = tw31(right,i)/(tof31(right,i,iadc)**0.5) |
823 |
|
tof31(right,i,itdc) = tof31(right,i,itdc) + xhelp |
824 |
|
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
825 |
|
ENDIF |
826 |
|
ENDDO |
827 |
|
|
828 |
|
DO I=1,3 |
829 |
|
if ((tdc(ch32a(i),hb32a(i)).lt.4095).and. |
830 |
|
& (tof32(left,i,iadc).lt.3786)) THEN |
831 |
|
xhelp = tw32(left,i)/(tof32(left,i,iadc)**0.5) |
832 |
|
tof32(left,i,itdc) = tof32(left,i,itdc) + xhelp |
833 |
|
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
834 |
|
ENDIF |
835 |
|
|
836 |
|
if ((tdc(ch32b(i),hb32b(i)).lt.4095).and. |
837 |
|
& (tof32(right,i,iadc).lt.3786)) THEN |
838 |
|
xhelp = tw32(right,i)/(tof32(right,i,iadc)**0.5) |
839 |
|
tof32(right,i,itdc) = tof32(right,i,itdc) + xhelp |
840 |
|
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
841 |
|
ENDIF |
842 |
|
ENDDO |
843 |
|
|
844 |
|
|
845 |
|
C----------------------------------------------------------------------- |
846 |
|
C--------------------Insert Artifical TDC Value --------------------- |
847 |
|
C For each Paddle perform check: |
848 |
|
C if left paddle=4095 and right paddle OK => create TDC value left |
849 |
|
C if right paddle=4095 and left paddle OK => create TDC value right |
850 |
|
C----------------------------------------------------------------------- |
851 |
|
|
852 |
|
C-----------------------S11 ----------------------------------------- |
853 |
|
|
854 |
|
IF (tof11_i.GT.none_find) THEN |
855 |
|
xpos = yout(1) |
856 |
|
i = tof11_i |
857 |
|
if ((tdc(ch11a(i),hb11a(i)).EQ.4095).AND. |
858 |
|
& (tdc(ch11b(i),hb11b(i)).LT.4095)) THEN |
859 |
|
tof11(1,tof11_i,itdc) = tof11(2,tof11_i,itdc) |
860 |
|
& + 2*(y_coor_lin11(tof11_i,offset) |
861 |
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
862 |
|
tdcflag(ch11a(i),hb11a(i)) = 1 |
863 |
|
ENDIF |
864 |
|
|
865 |
|
if ((tdc(ch11b(i),hb11b(i)).EQ.4095).AND. |
866 |
|
& (tdc(ch11a(i),hb11a(i)).LT.4095)) THEN |
867 |
|
tof11(2,tof11_i,itdc) = tof11(1,tof11_i,itdc) |
868 |
|
& - 2*(y_coor_lin11(tof11_i,offset) |
869 |
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
870 |
|
tdcflag(ch11b(i),hb11b(i)) = 1 |
871 |
|
ENDIF |
872 |
|
|
873 |
|
ENDIF |
874 |
|
|
875 |
|
C-----------------------S12 ----------------------------------------- |
876 |
|
|
877 |
|
IF (tof12_i.GT.none_find) THEN |
878 |
|
xpos = xout(2) |
879 |
|
i = tof12_i |
880 |
|
if ((tdc(ch12a(i),hb12a(i)).EQ.4095).AND. |
881 |
|
& (tdc(ch12b(i),hb12b(i)).LT.4095)) THEN |
882 |
|
tof12(1,tof12_i,itdc) = tof12(2,tof12_i,itdc) |
883 |
|
& + 2*(x_coor_lin12(tof12_i,offset) |
884 |
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
885 |
|
tdcflag(ch12a(i),hb12a(i)) = 1 |
886 |
|
ENDIF |
887 |
|
|
888 |
|
if ((tdc(ch12b(i),hb12b(i)).EQ.4095).AND. |
889 |
|
& (tdc(ch12a(i),hb12a(i)).LT.4095)) THEN |
890 |
|
tof12(2,tof12_i,itdc) = tof12(1,tof12_i,itdc) |
891 |
|
& - 2*(x_coor_lin12(tof12_i,offset) |
892 |
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
893 |
|
tdcflag(ch12b(i),hb12b(i)) = 1 |
894 |
|
ENDIF |
895 |
|
ENDIF |
896 |
|
|
897 |
|
C-----------------------S21 ----------------------------------------- |
898 |
|
|
899 |
|
IF (tof21_i.GT.none_find) THEN |
900 |
|
xpos = xout(3) |
901 |
|
i = tof21_i |
902 |
|
if ((tdc(ch21a(i),hb21a(i)).EQ.4095).AND. |
903 |
|
& (tdc(ch21b(i),hb21b(i)).LT.4095)) THEN |
904 |
|
tof21(1,tof21_i,itdc) = tof21(2,tof21_i,itdc) |
905 |
|
& + 2*(x_coor_lin21(tof21_i,offset) |
906 |
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
907 |
|
tdcflag(ch21a(i),hb21a(i)) = 1 |
908 |
|
ENDIF |
909 |
|
|
910 |
|
if ((tdc(ch21b(i),hb21b(i)).EQ.4095).AND. |
911 |
|
& (tdc(ch21a(i),hb21a(i)).LT.4095)) THEN |
912 |
|
tof21(2,tof21_i,itdc) = tof21(1,tof21_i,itdc) |
913 |
|
& - 2*(x_coor_lin21(tof21_i,offset) |
914 |
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
915 |
|
tdcflag(ch21b(i),hb21b(i)) = 1 |
916 |
|
ENDIF |
917 |
|
ENDIF |
918 |
|
|
919 |
|
C-----------------------S22 ----------------------------------------- |
920 |
|
|
921 |
|
IF (tof22_i.GT.none_find) THEN |
922 |
|
xpos = yout(4) |
923 |
|
i = tof22_i |
924 |
|
if ((tdc(ch22a(i),hb22a(i)).EQ.4095).AND. |
925 |
|
& (tdc(ch22b(i),hb22b(i)).LT.4095)) THEN |
926 |
|
tof22(1,tof22_i,itdc) = tof22(2,tof22_i,itdc) |
927 |
|
& + 2*(y_coor_lin22(tof22_i,offset) |
928 |
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
929 |
|
tdcflag(ch22a(i),hb22a(i)) = 1 |
930 |
|
ENDIF |
931 |
|
|
932 |
|
if ((tdc(ch22b(i),hb22b(i)).EQ.4095).AND. |
933 |
|
& (tdc(ch22a(i),hb22a(i)).LT.4095)) THEN |
934 |
|
tof22(2,tof22_i,itdc) = tof22(1,tof22_i,itdc) |
935 |
|
& - 2*(y_coor_lin22(tof22_i,offset) |
936 |
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
937 |
|
tdcflag(ch22b(i),hb22b(i)) = 1 |
938 |
|
ENDIF |
939 |
|
ENDIF |
940 |
|
|
941 |
|
C-----------------------S31 ----------------------------------------- |
942 |
|
|
943 |
|
IF (tof31_i.GT.none_find) THEN |
944 |
|
xpos = yout(5) |
945 |
|
i = tof31_i |
946 |
|
if ((tdc(ch31a(i),hb31a(i)).EQ.4095).AND. |
947 |
|
& (tdc(ch31b(i),hb31b(i)).LT.4095)) THEN |
948 |
|
tof31(1,tof31_i,itdc) = tof31(2,tof31_i,itdc) |
949 |
|
& + 2*(y_coor_lin31(tof31_i,offset) |
950 |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
951 |
|
tdcflag(ch31a(i),hb31a(i)) = 1 |
952 |
|
ENDIF |
953 |
|
|
954 |
|
if ((tdc(ch31b(i),hb31b(i)).EQ.4095).AND. |
955 |
|
& (tdc(ch31a(i),hb31a(i)).LT.4095)) THEN |
956 |
|
tof31(2,tof31_i,itdc) = tof31(1,tof31_i,itdc) |
957 |
|
& - 2*(y_coor_lin31(tof31_i,offset) |
958 |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
959 |
|
tdcflag(ch31b(i),hb31b(i)) = 1 |
960 |
|
ENDIF |
961 |
|
ENDIF |
962 |
|
|
963 |
|
C-----------------------S32 ----------------------------------------- |
964 |
|
|
965 |
|
IF (tof32_i.GT.none_find) THEN |
966 |
|
xpos = xout(6) |
967 |
|
i = tof32_i |
968 |
|
if ((tdc(ch32a(i),hb32a(i)).EQ.4095).AND. |
969 |
|
& (tdc(ch32b(i),hb32b(i)).LT.4095)) THEN |
970 |
|
tof32(1,tof32_i,itdc) = tof32(2,tof32_i,itdc) |
971 |
|
& + 2*(x_coor_lin32(tof32_i,offset) |
972 |
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
973 |
|
tdcflag(ch32a(i),hb32a(i)) = 1 |
974 |
|
ENDIF |
975 |
|
|
976 |
|
if ((tdc(ch32b(i),hb32b(i)).EQ.4095).AND. |
977 |
|
& (tdc(ch32a(i),hb32a(i)).LT.4095)) THEN |
978 |
|
tof32(2,tof32_i,itdc) = tof32(1,tof32_i,itdc) |
979 |
|
& - 2*(x_coor_lin32(tof32_i,offset) |
980 |
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
981 |
|
tdcflag(ch32b(i),hb32b(i)) = 1 |
982 |
|
ENDIF |
983 |
|
ENDIF |
984 |
|
|
985 |
|
|
986 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
987 |
C--- calculate track position in paddle using timing difference |
C--- calculate track position in paddle using timing difference |
988 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
990 |
do i=1,3 |
do i=1,3 |
991 |
xtofpos(i)=100. |
xtofpos(i)=100. |
992 |
ytofpos(i)=100. |
ytofpos(i)=100. |
993 |
enddo |
enddo |
994 |
|
|
995 |
C-----------------------------S1 -------------------------------- |
C-----------------------------S1 -------------------------------- |
996 |
|
|
997 |
IF (tof11_i.GT.none_find) THEN |
IF (tof11_i.GT.none_find) THEN |
998 |
|
IF ((tof11(1,tof11_i,itdc).NE.4095).AND. |
999 |
|
& (tof11(2,tof11_i,itdc).NE.4095)) THEN |
1000 |
ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. |
ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. |
1001 |
+ -y_coor_lin11(tof11_i,offset))/y_coor_lin11(tof11_i,slope) |
+ -y_coor_lin11(tof11_i,offset))/y_coor_lin11(tof11_i,slope) |
1002 |
|
if (abs(ytofpos(1)).gt.26.) ytofpos(1)=101. |
1003 |
|
endif |
1004 |
endif |
endif |
1005 |
|
|
1006 |
IF (tof12_i.GT.none_find) THEN |
IF (tof12_i.GT.none_find) THEN |
1007 |
|
IF ((tof12(1,tof12_i,itdc).NE.4095).AND. |
1008 |
|
& (tof12(2,tof12_i,itdc).NE.4095)) THEN |
1009 |
xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. |
xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. |
1010 |
+ -x_coor_lin12(tof12_i,offset))/x_coor_lin12(tof12_i,slope) |
+ -x_coor_lin12(tof12_i,offset))/x_coor_lin12(tof12_i,slope) |
1011 |
|
if (abs(xtofpos(1)).gt.31.) xtofpos(1)=101. |
1012 |
endif |
endif |
1013 |
|
endif |
1014 |
|
|
1015 |
C-----------------------------S2 -------------------------------- |
C-----------------------------S2 -------------------------------- |
1016 |
|
|
1017 |
IF (tof21_i.GT.none_find) THEN |
IF (tof21_i.GT.none_find) THEN |
1018 |
|
IF ((tof21(1,tof21_i,itdc).NE.4095).AND. |
1019 |
|
& (tof21(2,tof21_i,itdc).NE.4095)) THEN |
1020 |
xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. |
xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. |
1021 |
+ -x_coor_lin21(tof21_i,offset))/x_coor_lin21(tof21_i,slope) |
+ -x_coor_lin21(tof21_i,offset))/x_coor_lin21(tof21_i,slope) |
1022 |
|
if (abs(xtofpos(2)).gt.19.) xtofpos(2)=101. |
1023 |
|
endif |
1024 |
endif |
endif |
1025 |
|
|
1026 |
IF (tof22_i.GT.none_find) THEN |
IF (tof22_i.GT.none_find) THEN |
1027 |
|
IF ((tof22(1,tof22_i,itdc).NE.4095).AND. |
1028 |
|
& (tof22(2,tof22_i,itdc).NE.4095)) THEN |
1029 |
ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. |
ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. |
1030 |
+ -y_coor_lin22(tof22_i,offset))/y_coor_lin22(tof22_i,slope) |
+ -y_coor_lin22(tof22_i,offset))/y_coor_lin22(tof22_i,slope) |
1031 |
|
if (abs(ytofpos(2)).gt.18.) ytofpos(2)=101. |
1032 |
|
endif |
1033 |
endif |
endif |
1034 |
|
|
|
|
|
1035 |
C-----------------------------S3 -------------------------------- |
C-----------------------------S3 -------------------------------- |
1036 |
|
|
1037 |
IF (tof31_i.GT.none_find) THEN |
IF (tof31_i.GT.none_find) THEN |
1038 |
|
IF ((tof31(1,tof31_i,itdc).NE.4095).AND. |
1039 |
|
& (tof31(2,tof31_i,itdc).NE.4095)) THEN |
1040 |
ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. |
ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. |
1041 |
+ -y_coor_lin31(tof31_i,offset))/y_coor_lin31(tof31_i,slope) |
+ -y_coor_lin31(tof31_i,offset))/y_coor_lin31(tof31_i,slope) |
1042 |
|
if (abs(ytofpos(3)).gt.18.) ytofpos(3)=101. |
1043 |
|
endif |
1044 |
endif |
endif |
1045 |
|
|
1046 |
IF (tof32_i.GT.none_find) THEN |
IF (tof32_i.GT.none_find) THEN |
1047 |
|
IF ((tof32(1,tof32_i,itdc).NE.4095).AND. |
1048 |
|
& (tof32(2,tof32_i,itdc).NE.4095)) THEN |
1049 |
xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. |
xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. |
1050 |
+ -x_coor_lin32(tof32_i,offset))/x_coor_lin32(tof32_i,slope) |
+ -x_coor_lin32(tof32_i,offset))/x_coor_lin32(tof32_i,slope) |
1051 |
|
if (abs(xtofpos(3)).gt.19.) xtofpos(3)=101. |
1052 |
|
endif |
1053 |
endif |
endif |
|
|
|
|
|
|
|
do i=1,3 |
|
|
if (abs(xtofpos(i)).gt.100.) then |
|
|
xtofpos(i)=101. |
|
|
endif |
|
|
if (abs(ytofpos(i)).gt.100.) then |
|
|
ytofpos(i)=101. |
|
|
endif |
|
|
enddo |
|
|
|
|
|
C---------------------------------------------------------------------- |
|
|
C--------------------Corrections on ADC-data ------------------------- |
|
|
C---------------------zenith angle theta --------------------------- |
|
|
C---------------------------------------------------------------------- |
|
1054 |
|
|
1055 |
|
c do i=1,3 |
1056 |
|
c if (abs(xtofpos(i)).gt.100.) then |
1057 |
|
c xtofpos(i)=101. |
1058 |
|
c endif |
1059 |
|
c if (abs(ytofpos(i)).gt.100.) then |
1060 |
|
c ytofpos(i)=101. |
1061 |
|
c endif |
1062 |
|
c enddo |
1063 |
|
|
|
dx=0. |
|
|
dy=0. |
|
|
dr=0. |
|
|
theta13 = 0. |
|
|
|
|
|
if (xout(1).lt.100.) then |
|
|
dx = xout(1)-xout(6) |
|
|
dy = yout(1)-yout(6) |
|
|
dr = sqrt(dx*dx+dy*dy) |
|
|
theta13 = atan(dr/tofarm13) |
|
|
endif |
|
1064 |
|
|
1065 |
|
|
1066 |
C---------------------------------------------------------------------- |
C--------------------------------------------------------------------- |
1067 |
C------------------angle and ADC(x) correction |
C--------------------Corrections on ADC-data ------------------------- |
1068 |
C---------------------------------------------------------------------- |
C-----------------angle and ADC(x) correction ----------------------- |
1069 |
C-----------------------------S1 -------------------------------- |
|
1070 |
|
C-----------------------------S1 ------------------------------------- |
1071 |
|
|
1072 |
yhelp=yout(1) |
yhelp=yout(1) |
1073 |
|
|
1074 |
|
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
1075 |
|
theta = atan(tan(THXOUT(1))/cos(phi)) |
1076 |
|
|
1077 |
IF (tof11_i.GT.none_find.AND.yhelp.lt.100) THEN |
IF (tof11_i.GT.none_find.AND.yhelp.lt.100) THEN |
1078 |
|
|
1079 |
i = tof11_i |
i = tof11_i |
1080 |
xdummy=tof11(left,i,iadc) |
|
1081 |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
if (tof11(left,i,iadc).lt.3786) then |
1082 |
if (tof11(left,i,iadc).lt.1000) then |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta) |
1083 |
xkorr=adcx11(left,i,1)*exp(-yhelp/adcx11(left,i,2)) |
xkorr = atten(left,11,i,yhelp) |
1084 |
xkorr0=adcx11(left,i,1) |
xkorr=xkorr/hepratio |
1085 |
adc_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
adc_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
1086 |
endif |
endif |
1087 |
|
|
1088 |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
|
1089 |
if (tof11(right,i,iadc).lt.1000) then |
if (tof11(right,i,iadc).lt.3786) then |
1090 |
xkorr=adcx11(right,i,1)*exp(yhelp/adcx11(right,i,2)) |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta) |
1091 |
xkorr0=adcx11(right,i,1) |
xkorr = atten(right,11,i,yhelp) |
1092 |
|
xkorr=xkorr/hepratio |
1093 |
adc_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
adc_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
1094 |
endif |
endif |
1095 |
ENDIF |
ENDIF |
1096 |
|
|
1097 |
|
|
1098 |
xhelp=xout(2) |
xhelp=xout(2) |
1099 |
IF (tof12_i.GT.none_find.AND.xhelp.lt.100) THEN |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
1100 |
|
theta = atan(tan(THXOUT(2))/cos(phi)) |
1101 |
|
|
1102 |
|
IF (tof12_i.GT.none_find.AND.xhelp.lt.100) THEN |
1103 |
i = tof12_i |
i = tof12_i |
1104 |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
if (tof12(left,i,iadc).lt.3786) then |
1105 |
if (tof12(left,i,iadc).lt.1000) then |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta) |
1106 |
xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
xkorr = atten(left,12,i,xhelp) |
1107 |
xkorr0=adcx12(left,i,1) |
xkorr=xkorr/hepratio |
1108 |
adc_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
adc_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
1109 |
endif |
endif |
1110 |
|
|
1111 |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
if (tof12(right,i,iadc).lt.3786) then |
1112 |
if (tof12(right,i,iadc).lt.1000) then |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta) |
1113 |
xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
xkorr = atten(right,12,i,xhelp) |
1114 |
xkorr0=adcx12(right,i,1) |
xkorr=xkorr/hepratio |
1115 |
adc_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
adc_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
1116 |
endif |
endif |
1117 |
ENDIF |
ENDIF |
1119 |
C-----------------------------S2 -------------------------------- |
C-----------------------------S2 -------------------------------- |
1120 |
|
|
1121 |
xhelp=xout(3) |
xhelp=xout(3) |
1122 |
IF (tof21_i.GT.none_find.AND.xhelp.lt.100) THEN |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
1123 |
|
theta = atan(tan(THXOUT(3))/cos(phi)) |
1124 |
|
|
1125 |
|
IF (tof21_i.GT.none_find.AND.xhelp.lt.100) THEN |
1126 |
i = tof21_i |
i = tof21_i |
1127 |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
if (tof21(left,i,iadc).lt.3786) then |
1128 |
if (tof21(left,i,iadc).lt.1000) then |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta) |
1129 |
xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
xkorr = atten(left,21,i,xhelp) |
1130 |
xkorr0=adcx21(left,i,1) |
xkorr=xkorr/hepratio |
1131 |
adc_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
adc_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
1132 |
endif |
endif |
1133 |
|
|
1134 |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
if (tof21(right,i,iadc).lt.3786) then |
1135 |
if (tof21(right,i,iadc).lt.1000) then |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta) |
1136 |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
xkorr = atten(right,21,i,xhelp) |
1137 |
xkorr0=adcx21(right,i,1) |
xkorr=xkorr/hepratio |
1138 |
adc_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
adc_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
1139 |
endif |
endif |
1140 |
ENDIF |
ENDIF |
1141 |
|
|
1142 |
yhelp=yout(4) |
yhelp=yout(4) |
1143 |
IF (tof22_i.GT.none_find.AND.yhelp.lt.100) THEN |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
1144 |
|
theta = atan(tan(THXOUT(4))/cos(phi)) |
1145 |
|
|
1146 |
|
IF (tof22_i.GT.none_find.AND.yhelp.lt.100) THEN |
1147 |
i = tof22_i |
i = tof22_i |
1148 |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
if (tof22(left,i,iadc).lt.3786) then |
1149 |
if (tof22(left,i,iadc).lt.1000) then |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta) |
1150 |
xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
xkorr = atten(left,22,i,yhelp) |
1151 |
xkorr0=adcx22(left,i,1) |
xkorr=xkorr/hepratio |
1152 |
adc_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
adc_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
1153 |
endif |
endif |
1154 |
|
|
1155 |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
if (tof22(right,i,iadc).lt.3786) then |
1156 |
if (tof22(right,i,iadc).lt.1000) then |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta) |
1157 |
xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
xkorr = atten(right,22,i,yhelp) |
1158 |
xkorr0=adcx22(right,i,1) |
xkorr=xkorr/hepratio |
1159 |
adc_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
adc_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
1160 |
endif |
endif |
1161 |
ENDIF |
ENDIF |
1163 |
C-----------------------------S3 -------------------------------- |
C-----------------------------S3 -------------------------------- |
1164 |
|
|
1165 |
yhelp=yout(5) |
yhelp=yout(5) |
1166 |
|
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
1167 |
|
theta = atan(tan(THXOUT(5))/cos(phi)) |
1168 |
|
|
1169 |
IF (tof31_i.GT.none_find.AND.yhelp.lt.100) THEN |
IF (tof31_i.GT.none_find.AND.yhelp.lt.100) THEN |
1170 |
|
|
1171 |
i = tof31_i |
i = tof31_i |
1172 |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
if (tof31(left,i,iadc).lt.3786) then |
1173 |
if (tof31(left,i,iadc).lt.1000) then |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta) |
1174 |
xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
xkorr = atten(left,31,i,yhelp) |
1175 |
xkorr0=adcx31(left,i,1) |
xkorr=xkorr/hepratio |
1176 |
adc_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
adc_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
1177 |
endif |
endif |
1178 |
|
|
1179 |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
if (tof31(right,i,iadc).lt.3786) then |
1180 |
if (tof31(right,i,iadc).lt.1000) then |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta) |
1181 |
xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
xkorr = atten(right,31,i,yhelp) |
1182 |
xkorr0=adcx31(right,i,1) |
xkorr=xkorr/hepratio |
1183 |
adc_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
adc_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
1184 |
endif |
endif |
1185 |
ENDIF |
ENDIF |
1186 |
|
|
1187 |
xhelp=xout(6) |
xhelp=xout(6) |
1188 |
IF (tof32_i.GT.none_find.AND.xhelp.lt.100) THEN |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
1189 |
|
theta = atan(tan(THXOUT(6))/cos(phi)) |
1190 |
|
|
1191 |
|
IF (tof32_i.GT.none_find.AND.xhelp.lt.100) THEN |
1192 |
i = tof32_i |
i = tof32_i |
1193 |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
if (tof32(left,i,iadc).lt.3786) then |
1194 |
if (tof32(left,i,iadc).lt.1000) then |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta) |
1195 |
xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
xkorr = atten(left,32,i,xhelp) |
1196 |
xkorr0=adcx32(left,i,1) |
xkorr=xkorr/hepratio |
1197 |
adc_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
adc_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
1198 |
endif |
endif |
1199 |
|
|
1200 |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
if (tof32(right,i,iadc).lt.3786) then |
1201 |
if (tof32(right,i,iadc).lt.1000) then |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta) |
1202 |
xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
xkorr = atten(right,32,i,xhelp) |
1203 |
xkorr0=adcx32(right,i,1) |
xkorr=xkorr/hepratio |
1204 |
adc_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
adc_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
1205 |
endif |
endif |
1206 |
ENDIF |
ENDIF |
1207 |
|
|
1208 |
|
|
1209 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
1210 |
C----------------------calculate Beta ------------------------------ |
C----------------------calculate Beta ------------------------------ |
1211 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
1216 |
C c2 = 2d/c gives c2 = 2d/(c*TDCresolution) TDC=50ps/channel |
C c2 = 2d/c gives c2 = 2d/(c*TDCresolution) TDC=50ps/channel |
1217 |
C => c2 = ca.60 for 0.45 m c2 = ca.109 for 0.81 m |
C => c2 = ca.60 for 0.45 m c2 = ca.109 for 0.81 m |
1218 |
C since TDC resolution varies slightly c2 has to be calibrated |
C since TDC resolution varies slightly c2 has to be calibrated |
1219 |
|
C instead of cos(theta) use factor F: |
1220 |
|
C F = pathlength/d |
1221 |
|
C => beta = c2*F/(DS-c1)) |
1222 |
|
|
1223 |
|
dist = ZTOF(1) - ZTOF(5) |
1224 |
|
dl = 0. |
1225 |
|
DO I=1,5 |
1226 |
|
dl = dl + TLOUT(i) |
1227 |
|
ENDDO |
1228 |
|
F = dl/dist |
1229 |
|
|
1230 |
C S11 - S31 |
C S11 - S31 |
1231 |
IF (tof11_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
C IF (tof11_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
1232 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1233 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
& (ytofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1234 |
ds = xhelp1-xhelp2 |
t1 = tof11(1,tof11_i,itdc) |
1235 |
ihelp=(tof11_i-1)*3+tof31_i |
t2 = tof11(2,tof11_i,itdc) |
1236 |
c1 = k_S11S31(1,ihelp) |
t3 = tof31(1,tof31_i,itdc) |
1237 |
c2 = k_S11S31(2,ihelp) |
t4 = tof31(2,tof31_i,itdc) |
1238 |
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1239 |
& beta_a(1) = c2/(cos(theta13)*(ds-c1)) |
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1240 |
|
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1241 |
C------- ToF Mask - S11 - S31 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1242 |
|
ds = xhelp1-xhelp2 |
1243 |
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
ihelp=(tof11_i-1)*3+tof31_i |
1244 |
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
c1 = k_S11S31(1,ihelp) |
1245 |
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
if (iz.gt.2) c1 = c1 + k1corrA1 |
1246 |
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
c2 = k_S11S31(2,ihelp) |
1247 |
|
beta_a(1) = c2*F/(ds-c1) |
1248 |
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
c write(*,*) 'S11-S31 ',c1,c2,F |
1249 |
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
c write(*,*) 'S11-S31 ',xhelp1,xhelp2, beta_a(1) |
1250 |
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
C-------ToF Mask - S11 - S31 |
1251 |
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
|
1252 |
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1253 |
C------- |
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1254 |
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1255 |
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1256 |
|
|
1257 |
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1258 |
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1259 |
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1260 |
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1261 |
|
|
1262 |
|
ENDIF |
1263 |
ENDIF |
ENDIF |
1264 |
|
|
1265 |
|
dist = ZTOF(1) - ZTOF(6) |
1266 |
|
dl = 0. |
1267 |
|
DO I=1,6 |
1268 |
|
dl = dl + TLOUT(i) |
1269 |
|
ENDDO |
1270 |
|
F = dl/dist |
1271 |
|
|
1272 |
C S11 - S32 |
C S11 - S32 |
1273 |
IF (tof11_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
C IF (tof11_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
1274 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
IF ((tof11_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1275 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
& (ytofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1276 |
ds = xhelp1-xhelp2 |
t1 = tof11(1,tof11_i,itdc) |
1277 |
ihelp=(tof11_i-1)*3+tof32_i |
t2 = tof11(2,tof11_i,itdc) |
1278 |
c1 = k_S11S32(1,ihelp) |
t3 = tof32(1,tof32_i,itdc) |
1279 |
c2 = k_S11S32(2,ihelp) |
t4 = tof32(2,tof32_i,itdc) |
1280 |
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1281 |
& beta_a(2) = c2/(cos(theta13)*(ds-c1)) |
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1282 |
|
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1283 |
C------- ToF Mask - S11 - S32 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1284 |
|
ds = xhelp1-xhelp2 |
1285 |
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
ihelp=(tof11_i-1)*3+tof32_i |
1286 |
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
c1 = k_S11S32(1,ihelp) |
1287 |
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
if (iz.gt.2) c1 = c1 + k1corrA1 |
1288 |
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
c2 = k_S11S32(2,ihelp) |
1289 |
|
beta_a(2) = c2*F/(ds-c1) |
1290 |
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
C write(*,*) 'S11-S32 ',xhelp1,xhelp2, beta_a(2) |
1291 |
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
|
1292 |
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
C-------ToF Mask - S11 - S32 |
1293 |
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
|
1294 |
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1295 |
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1296 |
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1297 |
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1298 |
|
|
1299 |
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1300 |
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1301 |
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1302 |
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1303 |
|
|
1304 |
C------- |
C------- |
1305 |
|
|
1306 |
|
ENDIF |
1307 |
ENDIF |
ENDIF |
1308 |
|
|
1309 |
C S12 - S31 |
C S12 - S31 |
1310 |
IF (tof12_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
dist = ZTOF(2) - ZTOF(5) |
1311 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
dl = 0. |
1312 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
DO I=2,5 |
1313 |
ds = xhelp1-xhelp2 |
dl = dl + TLOUT(i) |
1314 |
ihelp=(tof12_i-1)*3+tof31_i |
ENDDO |
1315 |
c1 = k_S12S31(1,ihelp) |
F = dl/dist |
1316 |
c2 = k_S12S31(2,ihelp) |
|
1317 |
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
C IF (tof12_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
1318 |
& beta_a(3) = c2/(cos(theta13)*(ds-c1)) |
IF ((tof12_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1319 |
|
& (xtofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1320 |
C------- ToF Mask - S12 - S31 |
t1 = tof12(1,tof12_i,itdc) |
1321 |
|
t2 = tof12(2,tof12_i,itdc) |
1322 |
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
t3 = tof31(1,tof31_i,itdc) |
1323 |
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
t4 = tof31(2,tof31_i,itdc) |
1324 |
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1325 |
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1326 |
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1327 |
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1328 |
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
ds = xhelp1-xhelp2 |
1329 |
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
ihelp=(tof12_i-1)*3+tof31_i |
1330 |
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
c1 = k_S12S31(1,ihelp) |
1331 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1332 |
|
c2 = k_S12S31(2,ihelp) |
1333 |
|
beta_a(3) = c2*F/(ds-c1) |
1334 |
|
C write(*,*) 'S12-S31 ',xhelp1,xhelp2, beta_a(3) |
1335 |
|
|
1336 |
|
C-------ToF Mask - S12 - S31 |
1337 |
|
|
1338 |
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1339 |
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1340 |
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1341 |
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1342 |
|
|
1343 |
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1344 |
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1345 |
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1346 |
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1347 |
|
|
1348 |
C------- |
C------- |
1349 |
|
|
1350 |
|
ENDIF |
1351 |
ENDIF |
ENDIF |
1352 |
|
|
1353 |
C S12 - S32 |
C S12 - S32 |
|
IF (tof12_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof12_i-1)*3+tof32_i |
|
|
c1 = k_S12S32(1,ihelp) |
|
|
c2 = k_S12S32(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(4) = c2/(cos(theta13)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S12 - S32 |
|
|
|
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
|
|
|
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
|
1354 |
|
|
1355 |
C------- |
dist = ZTOF(2) - ZTOF(6) |
1356 |
|
dl = 0. |
1357 |
|
DO I=2,6 |
1358 |
|
dl = dl + TLOUT(i) |
1359 |
|
ENDDO |
1360 |
|
F = dl/dist |
1361 |
|
|
1362 |
|
C IF (tof12_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
1363 |
|
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1364 |
|
& (xtofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1365 |
|
t1 = tof12(1,tof12_i,itdc) |
1366 |
|
t2 = tof12(2,tof12_i,itdc) |
1367 |
|
t3 = tof32(1,tof32_i,itdc) |
1368 |
|
t4 = tof32(2,tof32_i,itdc) |
1369 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1370 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1371 |
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1372 |
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1373 |
|
ds = xhelp1-xhelp2 |
1374 |
|
ihelp=(tof12_i-1)*3+tof32_i |
1375 |
|
c1 = k_S12S32(1,ihelp) |
1376 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1377 |
|
c2 = k_S12S32(2,ihelp) |
1378 |
|
beta_a(4) = c2*F/(ds-c1) |
1379 |
|
C write(*,*) 'S12-S32 ',xhelp1,xhelp2, beta_a(4) |
1380 |
|
|
1381 |
|
C-------ToF Mask - S12 - S32 |
1382 |
|
|
1383 |
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1384 |
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1385 |
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1386 |
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1387 |
|
|
1388 |
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1389 |
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1390 |
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1391 |
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1392 |
|
|
1393 |
|
C------- |
1394 |
|
|
1395 |
|
ENDIF |
1396 |
ENDIF |
ENDIF |
1397 |
|
|
1398 |
C S21 - S31 |
C S21 - S31 |
|
IF (tof21_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
|
|
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
|
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof21_i-1)*3+tof31_i |
|
|
c1 = k_S21S31(1,ihelp) |
|
|
c2 = k_S21S31(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(5) = c2/(cos(theta23)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S21 - S31 |
|
|
|
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
|
|
|
|
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
|
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
|
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
|
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
|
1399 |
|
|
1400 |
C------- |
dist = ZTOF(3) - ZTOF(5) |
1401 |
|
dl = 0. |
1402 |
|
DO I=3,5 |
1403 |
|
dl = dl + TLOUT(i) |
1404 |
|
ENDDO |
1405 |
|
F = dl/dist |
1406 |
|
|
1407 |
|
C IF (tof21_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
1408 |
|
IF ((tof21_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1409 |
|
& (xtofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1410 |
|
t1 = tof21(1,tof21_i,itdc) |
1411 |
|
t2 = tof21(2,tof21_i,itdc) |
1412 |
|
t3 = tof31(1,tof31_i,itdc) |
1413 |
|
t4 = tof31(2,tof31_i,itdc) |
1414 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1415 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1416 |
|
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1417 |
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1418 |
|
ds = xhelp1-xhelp2 |
1419 |
|
ihelp=(tof21_i-1)*3+tof31_i |
1420 |
|
c1 = k_S21S31(1,ihelp) |
1421 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1422 |
|
c2 = k_S21S31(2,ihelp) |
1423 |
|
beta_a(5) = c2*F/(ds-c1) |
1424 |
|
|
1425 |
|
C-------ToF Mask - S21 - S31 |
1426 |
|
|
1427 |
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1428 |
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1429 |
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1430 |
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1431 |
|
|
1432 |
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1433 |
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1434 |
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1435 |
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1436 |
|
|
1437 |
|
C------- |
1438 |
|
|
1439 |
|
ENDIF |
1440 |
ENDIF |
ENDIF |
1441 |
|
|
1442 |
C S21 - S32 |
C S21 - S32 |
|
IF (tof21_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
|
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof21_i-1)*3+tof32_i |
|
|
c1 = k_S21S32(1,ihelp) |
|
|
c2 = k_S21S32(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(6) = c2/(cos(theta23)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S21 - S32 |
|
|
|
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
|
|
|
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
|
1443 |
|
|
1444 |
C------- |
dist = ZTOF(3) - ZTOF(6) |
1445 |
|
dl = 0. |
1446 |
|
DO I=3,6 |
1447 |
|
dl = dl + TLOUT(i) |
1448 |
|
ENDDO |
1449 |
|
F = dl/dist |
1450 |
|
|
1451 |
|
C IF (tof21_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
1452 |
|
IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1453 |
|
& (xtofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1454 |
|
t1 = tof21(1,tof21_i,itdc) |
1455 |
|
t2 = tof21(2,tof21_i,itdc) |
1456 |
|
t3 = tof32(1,tof32_i,itdc) |
1457 |
|
t4 = tof32(2,tof32_i,itdc) |
1458 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1459 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1460 |
|
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1461 |
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1462 |
|
ds = xhelp1-xhelp2 |
1463 |
|
ihelp=(tof21_i-1)*3+tof32_i |
1464 |
|
c1 = k_S21S32(1,ihelp) |
1465 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1466 |
|
c2 = k_S21S32(2,ihelp) |
1467 |
|
beta_a(6) = c2*F/(ds-c1) |
1468 |
|
|
1469 |
|
C-------ToF Mask - S21 - S32 |
1470 |
|
|
1471 |
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1472 |
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1473 |
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1474 |
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1475 |
|
|
1476 |
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1477 |
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1478 |
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1479 |
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1480 |
|
|
1481 |
|
C------- |
1482 |
|
|
1483 |
|
ENDIF |
1484 |
ENDIF |
ENDIF |
1485 |
|
|
1486 |
C S22 - S31 |
C S22 - S31 |
|
IF (tof22_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
|
|
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
|
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof22_i-1)*3+tof31_i |
|
|
c1 = k_S22S31(1,ihelp) |
|
|
c2 = k_S22S31(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(7) = c2/(cos(theta13)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S22 - S31 |
|
|
|
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
|
|
|
|
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
|
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
|
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
|
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
|
1487 |
|
|
1488 |
C------- |
dist = ZTOF(4) - ZTOF(5) |
1489 |
|
dl = 0. |
1490 |
|
DO I=4,5 |
1491 |
|
dl = dl + TLOUT(i) |
1492 |
|
ENDDO |
1493 |
|
F = dl/dist |
1494 |
|
|
1495 |
|
C IF (tof22_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
1496 |
|
IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1497 |
|
& (ytofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
1498 |
|
t1 = tof22(1,tof22_i,itdc) |
1499 |
|
t2 = tof22(2,tof22_i,itdc) |
1500 |
|
t3 = tof31(1,tof31_i,itdc) |
1501 |
|
t4 = tof31(2,tof31_i,itdc) |
1502 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1503 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1504 |
|
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1505 |
|
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1506 |
|
ds = xhelp1-xhelp2 |
1507 |
|
ihelp=(tof22_i-1)*3+tof31_i |
1508 |
|
c1 = k_S22S31(1,ihelp) |
1509 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1510 |
|
c2 = k_S22S31(2,ihelp) |
1511 |
|
beta_a(7) = c2*F/(ds-c1) |
1512 |
|
|
1513 |
|
C-------ToF Mask - S22 - S31 |
1514 |
|
|
1515 |
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1516 |
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1517 |
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1518 |
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1519 |
|
|
1520 |
|
tofmask(ch31a(tof31_i),hb31a(tof31_i)) = |
1521 |
|
$ tofmask(ch31a(tof31_i),hb31a(tof31_i)) + 1 |
1522 |
|
tofmask(ch31b(tof31_i),hb31b(tof31_i)) = |
1523 |
|
$ tofmask(ch31b(tof31_i),hb31b(tof31_i)) + 1 |
1524 |
|
|
1525 |
|
C------- |
1526 |
|
|
1527 |
|
ENDIF |
1528 |
ENDIF |
ENDIF |
1529 |
|
|
1530 |
C S22 - S32 |
C S22 - S32 |
|
IF (tof22_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
|
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
|
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof22_i-1)*3+tof32_i |
|
|
c1 = k_S22S32(1,ihelp) |
|
|
c2 = k_S22S32(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(8) = c2/(cos(theta13)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S22 - S32 |
|
|
|
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
|
|
|
|
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
|
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
|
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
|
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
|
1531 |
|
|
1532 |
C------- |
dist = ZTOF(4) - ZTOF(6) |
1533 |
|
dl = 0. |
1534 |
|
DO I=4,6 |
1535 |
|
dl = dl + TLOUT(i) |
1536 |
|
ENDDO |
1537 |
|
F = dl/dist |
1538 |
|
|
1539 |
|
C IF (tof22_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
1540 |
|
IF ((tof22_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1541 |
|
& (ytofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
1542 |
|
t1 = tof22(1,tof22_i,itdc) |
1543 |
|
t2 = tof22(2,tof22_i,itdc) |
1544 |
|
t3 = tof32(1,tof32_i,itdc) |
1545 |
|
t4 = tof32(2,tof32_i,itdc) |
1546 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1547 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1548 |
|
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1549 |
|
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1550 |
|
ds = xhelp1-xhelp2 |
1551 |
|
ihelp=(tof22_i-1)*3+tof32_i |
1552 |
|
c1 = k_S22S32(1,ihelp) |
1553 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1554 |
|
c2 = k_S22S32(2,ihelp) |
1555 |
|
beta_a(8) = c2*F/(ds-c1) |
1556 |
|
|
1557 |
|
C-------ToF Mask - S22 - S32 |
1558 |
|
|
1559 |
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1560 |
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1561 |
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1562 |
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1563 |
|
|
1564 |
|
tofmask(ch32a(tof32_i),hb32a(tof32_i)) = |
1565 |
|
$ tofmask(ch32a(tof32_i),hb32a(tof32_i)) + 1 |
1566 |
|
tofmask(ch32b(tof32_i),hb32b(tof32_i)) = |
1567 |
|
$ tofmask(ch32b(tof32_i),hb32b(tof32_i)) + 1 |
1568 |
|
|
1569 |
|
C------- |
1570 |
|
|
1571 |
|
ENDIF |
1572 |
ENDIF |
ENDIF |
1573 |
|
|
1574 |
C S11 - S21 |
C S11 - S21 |
|
IF (tof11_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
|
|
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
|
|
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof11_i-1)*2+tof21_i |
|
|
c1 = k_S11S21(1,ihelp) |
|
|
c2 = k_S11S21(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(9) = c2/(cos(theta12)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S11 - S21 |
|
|
|
|
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
|
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
|
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
|
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
|
|
|
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
|
1575 |
|
|
1576 |
C------- |
dist = ZTOF(1) - ZTOF(3) |
1577 |
|
dl = 0. |
1578 |
|
DO I=1,3 |
1579 |
|
dl = dl + TLOUT(i) |
1580 |
|
ENDDO |
1581 |
|
F = dl/dist |
1582 |
|
|
1583 |
|
C IF (tof11_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
1584 |
|
IF ((tof11_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
1585 |
|
& (ytofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
1586 |
|
t1 = tof11(1,tof11_i,itdc) |
1587 |
|
t2 = tof11(2,tof11_i,itdc) |
1588 |
|
t3 = tof21(1,tof21_i,itdc) |
1589 |
|
t4 = tof21(2,tof21_i,itdc) |
1590 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1591 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1592 |
|
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1593 |
|
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1594 |
|
ds = xhelp1-xhelp2 |
1595 |
|
ihelp=(tof11_i-1)*2+tof21_i |
1596 |
|
c1 = k_S11S21(1,ihelp) |
1597 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1598 |
|
c2 = k_S11S21(2,ihelp) |
1599 |
|
beta_a(9) = c2*F/(ds-c1) |
1600 |
|
|
1601 |
|
C-------ToF Mask - S11 - S21 |
1602 |
|
|
1603 |
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1604 |
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1605 |
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1606 |
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1607 |
|
|
1608 |
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1609 |
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1610 |
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1611 |
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1612 |
|
|
1613 |
|
C------- |
1614 |
|
|
1615 |
|
ENDIF |
1616 |
ENDIF |
ENDIF |
1617 |
|
|
1618 |
C S11 - S22 |
C S11 - S22 |
|
IF (tof11_i.GT.none_find.AND.tof22_i.GT.none_find) THEN |
|
|
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
|
|
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof11_i-1)*2+tof22_i |
|
|
c1 = k_S11S22(1,ihelp) |
|
|
c2 = k_S11S22(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(10) = c2/(cos(theta12)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S11 - S22 |
|
|
|
|
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
|
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
|
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
|
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
|
|
|
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
|
1619 |
|
|
1620 |
C------- |
dist = ZTOF(1) - ZTOF(4) |
1621 |
|
dl = 0. |
1622 |
|
DO I=1,4 |
1623 |
|
dl = dl + TLOUT(i) |
1624 |
|
ENDDO |
1625 |
|
F = dl/dist |
1626 |
|
|
1627 |
|
C IF (tof11_i.GT.none_find.AND.tof22_i.GT.none_find) THEN |
1628 |
|
IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
1629 |
|
& (ytofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
1630 |
|
t1 = tof11(1,tof11_i,itdc) |
1631 |
|
t2 = tof11(2,tof11_i,itdc) |
1632 |
|
t3 = tof22(1,tof22_i,itdc) |
1633 |
|
t4 = tof22(2,tof22_i,itdc) |
1634 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1635 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1636 |
|
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1637 |
|
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1638 |
|
ds = xhelp1-xhelp2 |
1639 |
|
ihelp=(tof11_i-1)*2+tof22_i |
1640 |
|
c1 = k_S11S22(1,ihelp) |
1641 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1642 |
|
c2 = k_S11S22(2,ihelp) |
1643 |
|
beta_a(10) = c2*F/(ds-c1) |
1644 |
|
|
1645 |
|
C-------ToF Mask - S11 - S22 |
1646 |
|
|
1647 |
|
tofmask(ch11a(tof11_i),hb11a(tof11_i)) = |
1648 |
|
$ tofmask(ch11a(tof11_i),hb11a(tof11_i)) + 1 |
1649 |
|
tofmask(ch11b(tof11_i),hb11b(tof11_i)) = |
1650 |
|
$ tofmask(ch11b(tof11_i),hb11b(tof11_i)) + 1 |
1651 |
|
|
1652 |
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1653 |
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1654 |
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1655 |
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1656 |
|
|
1657 |
|
C------- |
1658 |
|
|
1659 |
|
ENDIF |
1660 |
ENDIF |
ENDIF |
1661 |
|
|
1662 |
C S12 - S21 |
C S12 - S21 |
|
IF (tof12_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
|
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
|
|
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof12_i-1)*2+tof21_i |
|
|
c1 = k_S12S21(1,ihelp) |
|
|
c2 = k_S12S21(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(11) = c2/(cos(theta12)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S12 - S21 |
|
|
|
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
|
|
|
|
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
|
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
|
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
|
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
|
1663 |
|
|
1664 |
C------- |
dist = ZTOF(2) - ZTOF(3) |
1665 |
|
dl = 0. |
1666 |
|
DO I=2,3 |
1667 |
|
dl = dl + TLOUT(i) |
1668 |
|
ENDDO |
1669 |
|
F = dl/dist |
1670 |
|
|
1671 |
|
C IF (tof12_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
1672 |
|
IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
1673 |
|
& (xtofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
1674 |
|
t1 = tof12(1,tof12_i,itdc) |
1675 |
|
t2 = tof12(2,tof12_i,itdc) |
1676 |
|
t3 = tof21(1,tof21_i,itdc) |
1677 |
|
t4 = tof21(2,tof21_i,itdc) |
1678 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1679 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1680 |
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1681 |
|
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1682 |
|
ds = xhelp1-xhelp2 |
1683 |
|
ihelp=(tof12_i-1)*2+tof21_i |
1684 |
|
c1 = k_S12S21(1,ihelp) |
1685 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1686 |
|
c2 = k_S12S21(2,ihelp) |
1687 |
|
beta_a(11) = c2*F/(ds-c1) |
1688 |
|
|
1689 |
|
C-------ToF Mask - S12 - S21 |
1690 |
|
|
1691 |
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1692 |
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1693 |
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1694 |
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1695 |
|
|
1696 |
|
tofmask(ch21a(tof21_i),hb21a(tof21_i)) = |
1697 |
|
$ tofmask(ch21a(tof21_i),hb21a(tof21_i)) + 1 |
1698 |
|
tofmask(ch21b(tof21_i),hb21b(tof21_i)) = |
1699 |
|
$ tofmask(ch21b(tof21_i),hb21b(tof21_i)) + 1 |
1700 |
|
|
1701 |
|
C------- |
1702 |
|
|
1703 |
|
ENDIF |
1704 |
ENDIF |
ENDIF |
1705 |
|
|
1706 |
C S12 - S22 |
C S12 - S22 |
|
IF (tof12_i.GT.none_find.AND.tof22_i.GT.none_find) THEN |
|
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
|
|
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
|
|
ds = xhelp1-xhelp2 |
|
|
ihelp=(tof12_i-1)*2+tof22_i |
|
|
c1 = k_S12S22(1,ihelp) |
|
|
c2 = k_S12S22(2,ihelp) |
|
|
if ((xhelp1.lt.8000.).and.(xhelp2.lt.8000)) |
|
|
& beta_a(12) = c2/(cos(theta12)*(ds-c1)) |
|
|
|
|
|
C------- ToF Mask - S12 - S22 |
|
|
|
|
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
|
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
|
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
|
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
|
|
|
|
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
|
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
|
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
|
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
|
|
|
|
|
C------- |
|
|
|
|
|
ENDIF |
|
|
|
|
|
C------- |
|
|
|
|
|
icount=0 |
|
|
sw=0. |
|
|
sxw=0. |
|
|
beta_mean=100. |
|
1707 |
|
|
1708 |
do i=1,12 |
dist = ZTOF(2) - ZTOF(4) |
1709 |
if ((beta_a(i).gt.-1.5).and.(beta_a(i).lt.1.5)) then |
dl = 0. |
1710 |
icount= icount+1 |
DO I=2,4 |
1711 |
if (i.le.4) w_i=1./(0.13**2.) |
dl = dl + TLOUT(i) |
1712 |
if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
ENDDO |
1713 |
if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
F = dl/dist |
1714 |
sxw=sxw + beta_a(i)*w_i |
|
1715 |
sw =sw + w_i |
C IF (tof12_i.GT.none_find.AND.tof22_i.GT.none_find) THEN |
1716 |
endif |
IF ((tof12_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
1717 |
enddo |
& (xtofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
1718 |
|
t1 = tof12(1,tof12_i,itdc) |
1719 |
if (icount.gt.0) beta_mean=sxw/sw |
t2 = tof12(2,tof12_i,itdc) |
1720 |
beta_a(13) = beta_mean |
t3 = tof22(1,tof22_i,itdc) |
1721 |
|
t4 = tof22(2,tof22_i,itdc) |
1722 |
|
IF ((t1.lt.4095).and.(t2.lt.4095).and. |
1723 |
|
& (t3.lt.4095).and.(t4.lt.4095)) THEN |
1724 |
|
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1725 |
|
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1726 |
|
ds = xhelp1-xhelp2 |
1727 |
|
ihelp=(tof12_i-1)*2+tof22_i |
1728 |
|
c1 = k_S12S22(1,ihelp) |
1729 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1730 |
|
c2 = k_S12S22(2,ihelp) |
1731 |
|
beta_a(12) = c2*F/(ds-c1) |
1732 |
|
|
1733 |
|
C-------ToF Mask - S12 - S22 |
1734 |
|
|
1735 |
|
tofmask(ch12a(tof12_i),hb12a(tof12_i)) = |
1736 |
|
$ tofmask(ch12a(tof12_i),hb12a(tof12_i)) + 1 |
1737 |
|
tofmask(ch12b(tof12_i),hb12b(tof12_i)) = |
1738 |
|
$ tofmask(ch12b(tof12_i),hb12b(tof12_i)) + 1 |
1739 |
|
|
1740 |
|
tofmask(ch22a(tof22_i),hb22a(tof22_i)) = |
1741 |
|
$ tofmask(ch22a(tof22_i),hb22a(tof22_i)) + 1 |
1742 |
|
tofmask(ch22b(tof22_i),hb22b(tof22_i)) = |
1743 |
|
$ tofmask(ch22b(tof22_i),hb22b(tof22_i)) + 1 |
1744 |
|
|
1745 |
|
C------- |
1746 |
|
|
1747 |
|
ENDIF |
1748 |
|
ENDIF |
1749 |
|
|
1750 |
|
C------- |
1751 |
|
C |
1752 |
|
C icount=0 |
1753 |
|
C sw=0. |
1754 |
|
C sxw=0. |
1755 |
|
C beta_mean=100. |
1756 |
|
C |
1757 |
|
C do i=1,12 |
1758 |
|
C if ((beta_a(i).gt.-1.5).and.(beta_a(i).lt.1.5)) then |
1759 |
|
C icount= icount+1 |
1760 |
|
C if (i.le.4) w_i=1./(0.13**2.) |
1761 |
|
C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
1762 |
|
C if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
1763 |
|
C sxw=sxw + beta_a(i)*w_i |
1764 |
|
C sw =sw + w_i |
1765 |
|
C endif |
1766 |
|
C enddo |
1767 |
|
C |
1768 |
|
C if (icount.gt.0) beta_mean=sxw/sw |
1769 |
|
C beta_a(13) = beta_mean |
1770 |
|
C |
1771 |
|
|
1772 |
|
C------- New mean beta calculation |
1773 |
|
|
1774 |
|
do i=1,12 |
1775 |
|
btemp(i) = beta_a(i) |
1776 |
|
enddo |
1777 |
|
|
1778 |
|
beta_a(13)=newbeta(2,btemp,hitvec,10.,10.,20.) |
1779 |
|
|
1780 |
|
C------- |
1781 |
|
|
1782 |
|
|
1783 |
|
c IF (tof11_i.GT.none_find) |
1784 |
|
c & write(*,*) '11 ',tof11(1,tof11_i,itdc),tof11(2,tof11_i,itdc) |
1785 |
|
c IF (tof12_i.GT.none_find) |
1786 |
|
c & write(*,*) '12 ',tof12(1,tof12_i,itdc),tof12(2,tof12_i,itdc) |
1787 |
|
|
1788 |
|
c IF (tof21_i.GT.none_find) |
1789 |
|
c & write(*,*) '21 ',tof21(1,tof21_i,itdc),tof21(2,tof21_i,itdc) |
1790 |
|
c IF (tof22_i.GT.none_find) |
1791 |
|
c & write(*,*) '22 ',tof22(1,tof22_i,itdc),tof22(2,tof22_i,itdc) |
1792 |
|
|
1793 |
|
c IF (tof31_i.GT.none_find) |
1794 |
|
c & write(*,*) '31 ',tof31(1,tof31_i,itdc),tof31(2,tof31_i,itdc) |
1795 |
|
c IF (tof32_i.GT.none_find) |
1796 |
|
c & write(*,*) '32 ',tof32(1,tof32_i,itdc),tof32(2,tof32_i,itdc) |
1797 |
|
|
1798 |
|
c write(*,*) xtofpos |
1799 |
|
c write(*,*) ytofpos |
1800 |
|
C write(*,*)'toftrk beta', beta_a |
1801 |
|
C write(*,*) adcflagtof |
1802 |
|
C write(*,*)'TOFTRK ',ievent,beta_a(1),beta_a(2),beta_a(3),beta_a(4) |
1803 |
|
c write(*,*) 'toftrk' |
1804 |
|
c write(*,*) xtofpos |
1805 |
|
c write(*,*) ytofpos |
1806 |
|
c write(*,*) xtr_tof |
1807 |
|
c write(*,*) ytr_tof |
1808 |
|
|
1809 |
|
|
1810 |
RETURN |
RETURN |
1811 |
END |
END |
1812 |
|
|
1813 |
|
|
1814 |
|
|
1815 |
|
|
1816 |
|
C------------------------------------------------------------------ |
1817 |
|
|
1818 |
|
|