1 |
***************************************************************************** |
|
2 |
|
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 |
|
|
31 |
INTEGER FUNCTION TOFL2COM() |
INTEGER FUNCTION TOFL2COM() |
32 |
c |
c |
33 |
IMPLICIT NONE |
IMPLICIT NONE |
42 |
LOGICAL check |
LOGICAL check |
43 |
REAL secure |
REAL secure |
44 |
|
|
45 |
INTEGER j |
INTEGER j,hitvec(6) |
|
REAL xhelp_a,xhelp_t |
|
46 |
|
|
47 |
REAL dx,dy,dr,ds |
REAL dx,dy,dr,ds |
48 |
REAL yhelp,xdummy,xkorr0,xhelp,xhelp1,xhelp2 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
49 |
REAL c1,c2,sw,sxw,w_i |
REAL c1,c2 |
50 |
INTEGER icount |
|
51 |
|
C REAL sw,sxw,w_i |
52 |
|
C INTEGER icount |
53 |
|
C REAL beta_mean |
54 |
|
|
55 |
INTEGER tof11_j,tof21_j,tof31_j |
INTEGER tof11_j,tof21_j,tof31_j |
56 |
INTEGER tof12_j,tof22_j,tof32_j |
INTEGER tof12_j,tof22_j,tof32_j |
57 |
|
|
|
REAL beta_mean |
|
|
|
|
|
|
|
58 |
c value for status of each PM-data |
c value for status of each PM-data |
59 |
c first index : 1 = left, 2 = right |
c first index : 1 = left, 2 = right |
60 |
c second index : 1... number of paddle |
c second index : 1... number of paddle |
62 |
INTEGER tof21_event(2,2),tof22_event(2,2) |
INTEGER tof21_event(2,2),tof22_event(2,2) |
63 |
INTEGER tof31_event(2,3),tof32_event(2,3) |
INTEGER tof31_event(2,3),tof32_event(2,3) |
64 |
|
|
65 |
|
|
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 |
|
|
101 |
REAL theta12,theta13,theta23 |
REAL theta13 |
102 |
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 |
103 |
REAL tofarm12 |
REAL tofarm12 |
104 |
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
106 |
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
107 |
REAL tofarm13 |
REAL tofarm13 |
108 |
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
109 |
|
|
110 |
|
REAL hepratio |
111 |
|
|
112 |
INTEGER ihelp |
INTEGER ihelp |
113 |
REAL xkorr |
REAL xkorr,btemp(12) |
114 |
|
|
115 |
|
REAL atten,pc_adc,check_charge,newbeta |
116 |
|
|
117 |
|
INTEGER IZ |
118 |
|
REAL k1corrA1,k1corrB1,k1corrC1 |
119 |
|
|
120 |
|
|
121 |
|
INTEGER ifst |
122 |
|
DATA ifst /0/ |
123 |
|
|
124 |
C--------------------------------------- |
C--------------------------------------- |
125 |
C |
C |
129 |
C |
C |
130 |
C CALCULATE COMMON VARIABLES |
C CALCULATE COMMON VARIABLES |
131 |
C |
C |
132 |
|
C------------------------------------------------------------------- |
133 |
|
|
134 |
******************************************************************* |
if (ifst.eq.0) then |
135 |
icounter = icounter + 1 |
|
136 |
|
ifst=1 |
137 |
|
|
138 |
|
C amplitude has to be 'secure' higher than pedestal for an adc event |
139 |
|
secure = 2. |
140 |
|
|
141 |
|
C ratio between helium and proton ca. 4 |
142 |
|
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 |
* amplitude has to be 'secure' higher than pedestal for an adc event |
icounter = icounter + 1 |
|
secure = 2. |
|
164 |
|
|
|
offset = 1 |
|
|
slope = 2 |
|
|
left = 1 |
|
|
right = 2 |
|
|
none_ev = 0 |
|
|
none_find = 0 |
|
|
tdc_ev = 1 |
|
|
adc_ev = 1 |
|
|
itdc = 1 |
|
|
iadc = 2 |
|
165 |
|
|
166 |
do i=1,13 |
do i=1,13 |
167 |
betatof_a(i) = 100. ! As in "troftrk.for" |
betatof_a(i) = 100. ! As in "troftrk.for" |
168 |
enddo |
enddo |
169 |
|
|
170 |
|
do i=1,6 |
171 |
|
hitvec(i) = -1 |
172 |
|
enddo |
173 |
|
|
174 |
do i=1,4 |
do i=1,4 |
175 |
do j=1,12 |
do j=1,12 |
176 |
adctof_c(i,j) = 1000. |
adctof_c(i,j) = 1000. |
185 |
enddo |
enddo |
186 |
|
|
187 |
|
|
188 |
c the calibration files are read in the main program from xxx_tofcalib.rz |
do i=1,12 |
189 |
|
do j=1,4 |
190 |
|
tofmask(j,i) = 0 |
191 |
|
enddo |
192 |
|
enddo |
193 |
|
|
194 |
|
|
195 |
|
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 |
|
|
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 |
|
c the calibration files are read in the main program from xxx_tofcalib.rz |
218 |
|
|
219 |
c-------------------------get ToF data -------------------------------- |
c-------------------------get ToF data -------------------------------- |
220 |
|
|
221 |
c put the adc and tdc values from ntuple into tofxx(i,j,k) variables |
c put the adc and tdc values from ntuple into tofxx(i,j,k) variables |
222 |
|
c adc valueas are then pC |
223 |
|
|
224 |
do j=1,8 |
do j=1,8 |
225 |
tof11(1,j,2) = adc(ch11a(j),hb11a(j)) |
tof11(1,j,2) = pc_adc(adc(ch11a(j),hb11a(j))) |
226 |
tof11(2,j,2) = adc(ch11b(j),hb11b(j)) |
tof11(2,j,2) = pc_adc(adc(ch11b(j),hb11b(j))) |
227 |
tof11(1,j,1) = tdc(ch11a(j),hb11a(j)) |
tof11(1,j,1) = (tdc(ch11a(j),hb11a(j))) |
228 |
tof11(2,j,1) = tdc(ch11b(j),hb11b(j)) |
tof11(2,j,1) = (tdc(ch11b(j),hb11b(j))) |
229 |
enddo |
enddo |
230 |
|
|
231 |
|
|
232 |
do j=1,6 |
do j=1,6 |
233 |
tof12(1,j,2) = adc(ch12a(j),hb12a(j)) |
tof12(1,j,2) = pc_adc(adc(ch12a(j),hb12a(j))) |
234 |
tof12(2,j,2) = adc(ch12b(j),hb12b(j)) |
tof12(2,j,2) = pc_adc(adc(ch12b(j),hb12b(j))) |
235 |
tof12(1,j,1) = tdc(ch12a(j),hb12a(j)) |
tof12(1,j,1) = (tdc(ch12a(j),hb12a(j))) |
236 |
tof12(2,j,1) = tdc(ch12b(j),hb12b(j)) |
tof12(2,j,1) = (tdc(ch12b(j),hb12b(j))) |
237 |
enddo |
enddo |
238 |
|
|
239 |
do j=1,2 |
do j=1,2 |
240 |
tof21(1,j,2) = adc(ch21a(j),hb21a(j)) |
tof21(1,j,2) = pc_adc(adc(ch21a(j),hb21a(j))) |
241 |
tof21(2,j,2) = adc(ch21b(j),hb21b(j)) |
tof21(2,j,2) = pc_adc(adc(ch21b(j),hb21b(j))) |
242 |
tof21(1,j,1) = tdc(ch21a(j),hb21a(j)) |
tof21(1,j,1) = (tdc(ch21a(j),hb21a(j))) |
243 |
tof21(2,j,1) = tdc(ch21b(j),hb21b(j)) |
tof21(2,j,1) = (tdc(ch21b(j),hb21b(j))) |
244 |
enddo |
enddo |
245 |
|
|
246 |
do j=1,2 |
do j=1,2 |
247 |
tof22(1,j,2) = adc(ch22a(j),hb22a(j)) |
tof22(1,j,2) = pc_adc(adc(ch22a(j),hb22a(j))) |
248 |
tof22(2,j,2) = adc(ch22b(j),hb22b(j)) |
tof22(2,j,2) = pc_adc(adc(ch22b(j),hb22b(j))) |
249 |
tof22(1,j,1) = tdc(ch22a(j),hb22a(j)) |
tof22(1,j,1) = (tdc(ch22a(j),hb22a(j))) |
250 |
tof22(2,j,1) = tdc(ch22b(j),hb22b(j)) |
tof22(2,j,1) = (tdc(ch22b(j),hb22b(j))) |
251 |
enddo |
enddo |
252 |
|
|
253 |
do j=1,3 |
do j=1,3 |
254 |
tof31(1,j,2) = adc(ch31a(j),hb31a(j)) |
tof31(1,j,2) = pc_adc(adc(ch31a(j),hb31a(j))) |
255 |
tof31(2,j,2) = adc(ch31b(j),hb31b(j)) |
tof31(2,j,2) = pc_adc(adc(ch31b(j),hb31b(j))) |
256 |
tof31(1,j,1) = tdc(ch31a(j),hb31a(j)) |
tof31(1,j,1) = (tdc(ch31a(j),hb31a(j))) |
257 |
tof31(2,j,1) = tdc(ch31b(j),hb31b(j)) |
tof31(2,j,1) = (tdc(ch31b(j),hb31b(j))) |
258 |
enddo |
enddo |
259 |
|
|
260 |
do j=1,3 |
do j=1,3 |
261 |
tof32(1,j,2) = adc(ch32a(j),hb32a(j)) |
tof32(1,j,2) = pc_adc(adc(ch32a(j),hb32a(j))) |
262 |
tof32(2,j,2) = adc(ch32b(j),hb32b(j)) |
tof32(2,j,2) = pc_adc(adc(ch32b(j),hb32b(j))) |
263 |
tof32(1,j,1) = tdc(ch32a(j),hb32a(j)) |
tof32(1,j,1) = (tdc(ch32a(j),hb32a(j))) |
264 |
tof32(2,j,1) = tdc(ch32b(j),hb32b(j)) |
tof32(2,j,1) = (tdc(ch32b(j),hb32b(j))) |
265 |
enddo |
enddo |
266 |
|
|
267 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
309 |
if (abs(tof32(2,i,iadc)).gt.10000.) tof32(2,i,iadc)= 10000. |
if (abs(tof32(2,i,iadc)).gt.10000.) tof32(2,i,iadc)= 10000. |
310 |
ENDDO |
ENDDO |
311 |
|
|
312 |
|
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 |
|
C---------------------------------------------------------------- |
354 |
|
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---------------------------------------------------------------- |
C---------------------------------------------------------------- |
370 |
C------------Check Paddles for hits ----------------------- |
C------------ Check Paddles for hits ----------------------- |
371 |
|
C------ a "hit" means TDC values<4095 on both sides ------------ |
372 |
C---------------------------------------------------------------- |
C---------------------------------------------------------------- |
373 |
|
|
374 |
C upper tof S11 |
C upper tof S11 |
378 |
tof11_event(j,i) = none_ev |
tof11_event(j,i) = none_ev |
379 |
IF ((tof11(j,i,itdc).LT.2000).AND.(tof11(j,i,itdc).GT.100)) |
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 |
+ tof11_event(j,i) = tof11_event(j,i) + tdc_ev |
|
IF ((tof11(j,i,iadc).GT.secure).AND. |
|
|
+ (tof11(j,i,iadc).LT.4095)) |
|
|
+ tof11_event(j,i) = tof11_event(j,i) + adc_ev |
|
381 |
ENDDO |
ENDDO |
382 |
ENDDO |
ENDDO |
383 |
|
|
408 |
tof12_event(j,i) = none_ev |
tof12_event(j,i) = none_ev |
409 |
IF ((tof12(j,i,itdc).LT.2000).AND.(tof12(j,i,itdc).GT.100)) |
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 |
+ tof12_event(j,i) = tof12_event(j,i) + tdc_ev |
|
IF ((tof12(j,i,iadc).GT.secure).AND. |
|
|
+ (tof12(j,i,iadc).LT.4095)) |
|
|
+ tof12_event(j,i) = tof12_event(j,i) + adc_ev |
|
411 |
ENDDO |
ENDDO |
412 |
ENDDO |
ENDDO |
413 |
|
|
438 |
tof21_event(j,i) = none_ev |
tof21_event(j,i) = none_ev |
439 |
IF ((tof21(j,i,itdc).LT.2000).AND.(tof21(j,i,itdc).GT.100)) |
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 |
+ tof21_event(j,i) = tof21_event(j,i) + tdc_ev |
|
IF ((tof21(j,i,iadc).GT.secure).AND. |
|
|
+ (tof21(j,i,iadc).LT.4095)) |
|
|
+ tof21_event(j,i) = tof21_event(j,i) + adc_ev |
|
441 |
ENDDO |
ENDDO |
442 |
ENDDO |
ENDDO |
443 |
|
|
467 |
tof22_event(j,i) = none_ev |
tof22_event(j,i) = none_ev |
468 |
IF ((tof22(j,i,itdc).LT.2000).AND.(tof22(j,i,itdc).GT.100)) |
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 |
+ tof22_event(j,i) = tof22_event(j,i) + tdc_ev |
|
IF ((tof22(j,i,iadc).GT.secure).AND. |
|
|
+ (tof22(j,i,iadc).LT.4095)) |
|
|
+ tof22_event(j,i) = tof22_event(j,i) + adc_ev |
|
470 |
ENDDO |
ENDDO |
471 |
ENDDO |
ENDDO |
472 |
|
|
497 |
tof31_event(j,i) = none_ev |
tof31_event(j,i) = none_ev |
498 |
IF ((tof31(j,i,itdc).LT.2000).AND.(tof31(j,i,itdc).GT.100)) |
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 |
+ tof31_event(j,i) = tof31_event(j,i) + tdc_ev |
|
IF ((tof31(j,i,iadc).GT.secure).AND. |
|
|
+ (tof31(j,i,iadc).LT.4095)) |
|
|
+ tof31_event(j,i) = tof31_event(j,i) + adc_ev |
|
500 |
ENDDO |
ENDDO |
501 |
ENDDO |
ENDDO |
502 |
|
|
526 |
tof32_event(j,i) = none_ev |
tof32_event(j,i) = none_ev |
527 |
IF ((tof32(j,i,itdc).LT.2000).AND.(tof32(j,i,itdc).GT.100)) |
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 |
+ tof32_event(j,i) = tof32_event(j,i) + tdc_ev |
|
IF ((tof32(j,i,iadc).GT.secure).AND. |
|
|
+ (tof32(j,i,iadc).LT.4095)) |
|
|
+ tof32_event(j,i) = tof32_event(j,i) + adc_ev |
|
529 |
ENDDO |
ENDDO |
530 |
ENDDO |
ENDDO |
531 |
|
|
547 |
ENDIF |
ENDIF |
548 |
ENDIF |
ENDIF |
549 |
ENDIF |
ENDIF |
550 |
ENDDO |
ENDDO |
551 |
|
|
552 |
do i=1,6 |
do i=1,6 |
553 |
tof_i_flag(i)=0 |
tof_i_flag(i)=0 |
554 |
tof_j_flag(i)=0 |
tof_j_flag(i)=0 |
555 |
enddo |
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 |
|
|
578 |
|
c write(*,*) 'tofl2com', |
579 |
|
c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
580 |
|
|
581 |
|
C------------------------------------------------------------------ |
582 |
|
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 |
|
C------------------------------------------------------------------ |
588 |
|
|
589 |
|
do i=1,3 |
590 |
|
xtofpos(i)=100. |
591 |
|
ytofpos(i)=100. |
592 |
|
enddo |
593 |
|
|
594 |
|
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 |
|
+ -y_coor_lin11c(tof11_i,offset))/y_coor_lin11c(tof11_i,slope) |
599 |
|
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 |
|
+ -x_coor_lin12c(tof12_i,offset))/x_coor_lin12c(tof12_i,slope) |
604 |
|
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 |
|
+ -x_coor_lin21c(tof21_i,offset))/x_coor_lin21c(tof21_i,slope) |
612 |
|
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 |
|
+ -y_coor_lin22c(tof22_i,offset))/y_coor_lin22c(tof22_i,slope) |
617 |
|
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 |
|
+ -y_coor_lin31c(tof31_i,offset))/y_coor_lin31c(tof31_i,slope) |
625 |
|
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 |
|
+ -x_coor_lin32c(tof32_i,offset))/x_coor_lin32c(tof32_i,slope) |
630 |
|
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 |
tof_i_flag(1)=tof11_i |
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
643 |
tof_i_flag(2)=tof12_i |
& dx = xtofpos(1) - xtofpos(3) |
644 |
tof_i_flag(3)=tof21_i |
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
645 |
tof_i_flag(4)=tof22_i |
& dy = ytofpos(1) - ytofpos(3) |
646 |
tof_i_flag(5)=tof31_i |
dr = sqrt(dx*dx+dy*dy) |
647 |
tof_i_flag(6)=tof32_i |
theta13 = atan(dr/tofarm13) |
648 |
|
|
649 |
tof_j_flag(1)=tof11_j |
|
650 |
tof_j_flag(2)=tof12_j |
C---------------------------------------------------------------------- |
651 |
tof_j_flag(3)=tof21_j |
C--- check charge: |
652 |
tof_j_flag(4)=tof22_j |
C--- if Z=2 we should use the attenuation curve for helium to |
653 |
tof_j_flag(5)=tof31_j |
C--- fill the artificail ADC values and NOT divide by "hepratio" |
654 |
tof_j_flag(6)=tof32_j |
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 |
|
|
661 |
C-------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
662 |
C--------------------Time walk correction ------------------------- |
C---- if TDCleft.and.TDCright and NO ADC insert artificial ADC |
663 |
|
C---- values |
664 |
C-------------------------------------------------------------------- |
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 |
|
if (adc(ch11a(i),hb11a(i)).eq.4095) then |
683 |
|
xkorr = atten(left,11,i,yhelp) |
684 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
685 |
|
tof11(left,i,iadc)=xkorr/cos(theta13) |
686 |
|
adcflagtof(ch11a(i),hb11a(i)) = 1 |
687 |
|
endif |
688 |
|
if (adc(ch11b(i),hb11b(i)).eq.4095) then |
689 |
|
xkorr = atten(right,11,i,yhelp) |
690 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
691 |
|
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 |
|
if (adc(ch12a(i),hb12a(i)).eq.4095) then |
703 |
|
xkorr = atten(left,12,i,xhelp) |
704 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
705 |
|
tof12(left,i,iadc) = xkorr/cos(theta13) |
706 |
|
adcflagtof(ch12a(i),hb12a(i)) = 1 |
707 |
|
endif |
708 |
|
if (adc(ch12b(i),hb12b(i)).eq.4095) then |
709 |
|
xkorr = atten(right,12,i,xhelp) |
710 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
711 |
|
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 |
|
if (adc(ch21a(i),hb21a(i)).eq.4095) then |
725 |
|
xkorr = atten(left,21,i,xhelp) |
726 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
727 |
|
tof21(left,i,iadc) = xkorr/cos(theta13) |
728 |
|
adcflagtof(ch21a(i),hb21a(i)) = 1 |
729 |
|
endif |
730 |
|
if (adc(ch21b(i),hb21b(i)).eq.4095) then |
731 |
|
xkorr = atten(right,21,i,xhelp) |
732 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
733 |
|
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 |
|
if (adc(ch22a(i),hb22a(i)).eq.4095) then |
746 |
|
xkorr = atten(left,22,i,yhelp) |
747 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
748 |
|
tof22(left,i,iadc) = xkorr/cos(theta13) |
749 |
|
adcflagtof(ch22a(i),hb22a(i)) = 1 |
750 |
|
endif |
751 |
|
if (adc(ch22b(i),hb22b(i)).eq.4095) then |
752 |
|
xkorr = atten(right,22,i,yhelp) |
753 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
754 |
|
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 |
|
if (adc(ch31a(i),hb31a(i)).eq.4095) then |
768 |
|
xkorr = atten(left,31,i,yhelp) |
769 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
770 |
|
tof31(left,i,iadc) = xkorr/cos(theta13) |
771 |
|
adcflagtof(ch31a(i),hb31a(i)) = 1 |
772 |
|
endif |
773 |
|
if (adc(ch31b(i),hb31b(i)).eq.4095) then |
774 |
|
xkorr = atten(right,31,i,yhelp) |
775 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
776 |
|
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 |
|
if (adc(ch32a(i),hb32a(i)).eq.4095) then |
788 |
|
xkorr = atten(left,32,i,xhelp) |
789 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
790 |
|
tof32(left,i,iadc) = xkorr/cos(theta13) |
791 |
|
adcflagtof(ch32a(i),hb32a(i)) = 1 |
792 |
|
endif |
793 |
|
if (adc(ch32b(i),hb32b(i)).eq.4095) then |
794 |
|
xkorr = atten(right,32,i,xhelp) |
795 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
796 |
|
tof32(right,i,iadc) = xkorr/cos(theta13) |
797 |
|
adcflagtof(ch32b(i),hb32b(i)) = 1 |
798 |
|
endif |
799 |
|
ENDIF |
800 |
|
|
801 |
|
|
802 |
|
C------------------------------------------------------------------- |
803 |
|
C--------------------Time walk correction ------------------------- |
804 |
|
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 |
|
|
823 |
DO i=1,8 |
DO i=1,8 |
824 |
xhelp_a = tof11(left,i,iadc) |
if ((tdc(ch11a(i),hb11a(i)).lt.4095).and. |
825 |
xhelp_t = tof11(left,i,itdc) |
& (tof11(left,i,iadc).lt.3786)) THEN |
826 |
if(xhelp_a>0) xhelp = tw11(left,i)/sqrt(xhelp_a) |
xhelp = tw11(left,i)/(tof11(left,i,iadc)**0.5) |
827 |
tof11(left,i,itdc) = xhelp_t + xhelp |
tof11(left,i,itdc) = tof11(left,i,itdc) + xhelp |
828 |
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
829 |
xhelp_a = tof11(right,i,iadc) |
ENDIF |
830 |
xhelp_t = tof11(right,i,itdc) |
|
831 |
if(xhelp_a>0) xhelp = tw11(right,i)/sqrt(xhelp_a) |
if ((tdc(ch11b(i),hb11b(i)).lt.4095).and. |
832 |
tof11(right,i,itdc) = xhelp_t + xhelp |
& (tof11(right,i,iadc).lt.3786)) THEN |
833 |
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
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 |
ENDDO |
ENDDO |
838 |
|
|
839 |
|
|
840 |
DO i=1,6 |
DO i=1,6 |
841 |
xhelp_a = tof12(left,i,iadc) |
if ((tdc(ch12a(i),hb12a(i)).lt.4095).and. |
842 |
xhelp_t = tof12(left,i,itdc) |
& (tof12(left,i,iadc).lt.3786)) THEN |
843 |
if(xhelp_a>0) xhelp = tw12(left,i)/sqrt(xhelp_a) |
xhelp = tw12(left,i)/(tof12(left,i,iadc)**0.5) |
844 |
tof12(left,i,itdc) = xhelp_t + xhelp |
tof12(left,i,itdc) = tof12(left,i,itdc) + xhelp |
845 |
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
846 |
xhelp_a = tof12(right,i,iadc) |
ENDIF |
847 |
xhelp_t = tof12(right,i,itdc) |
|
848 |
if(xhelp_a>0) xhelp = tw12(right,i)/sqrt(xhelp_a) |
if ((tdc(ch12b(i),hb12b(i)).lt.4095).and. |
849 |
tof12(right,i,itdc) = xhelp_t + xhelp |
& (tof12(right,i,iadc).lt.3786)) THEN |
850 |
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
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 |
ENDDO |
ENDDO |
855 |
|
|
856 |
C---- |
C---- |
857 |
DO i=1,2 |
DO I=1,2 |
858 |
xhelp_a = tof21(left,i,iadc) |
if ((tdc(ch21a(i),hb21a(i)).lt.4095).and. |
859 |
xhelp_t = tof21(left,i,itdc) |
& (tof21(left,i,iadc).lt.3786)) THEN |
860 |
if(xhelp_a>0) xhelp = tw21(left,i)/sqrt(xhelp_a) |
xhelp = tw21(left,i)/(tof21(left,i,iadc)**0.5) |
861 |
tof21(left,i,itdc) = xhelp_t + xhelp |
tof21(left,i,itdc) = tof21(left,i,itdc) + xhelp |
862 |
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
863 |
xhelp_a = tof21(right,i,iadc) |
ENDIF |
864 |
xhelp_t = tof21(right,i,itdc) |
|
865 |
if(xhelp_a>0) xhelp = tw21(right,i)/sqrt(xhelp_a) |
if ((tdc(ch21b(i),hb21b(i)).lt.4095).and. |
866 |
tof21(right,i,itdc) = xhelp_t + xhelp |
& (tof21(right,i,iadc).lt.3786)) THEN |
867 |
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
xhelp = tw21(right,i)/(tof21(right,i,iadc)**0.5) |
868 |
ENDDO |
tof21(right,i,itdc) = tof21(right,i,itdc) + xhelp |
869 |
|
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
870 |
DO i=1,2 |
ENDIF |
871 |
xhelp_a = tof22(left,i,iadc) |
ENDDO |
872 |
xhelp_t = tof22(left,i,itdc) |
|
873 |
if(xhelp_a>0) xhelp = tw22(left,i)/sqrt(xhelp_a) |
DO I=1,2 |
874 |
tof22(left,i,itdc) = xhelp_t + xhelp |
if ((tdc(ch22a(i),hb22a(i)).lt.4095).and. |
875 |
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
& (tof22(left,i,iadc).lt.3786)) THEN |
876 |
xhelp_a = tof22(right,i,iadc) |
xhelp = tw22(left,i)/(tof22(left,i,iadc)**0.5) |
877 |
xhelp_t = tof22(right,i,itdc) |
tof22(left,i,itdc) = tof22(left,i,itdc) + xhelp |
878 |
if(xhelp_a>0) xhelp = tw22(right,i)/sqrt(xhelp_a) |
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
879 |
tof22(right,i,itdc) = xhelp_t + xhelp |
ENDIF |
880 |
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
|
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 |
ENDDO |
ENDDO |
|
C---- |
|
888 |
|
|
|
DO i=1,3 |
|
|
xhelp_a = tof31(left,i,iadc) |
|
|
xhelp_t = tof31(left,i,itdc) |
|
|
if(xhelp_a>0) xhelp = tw31(left,i)/sqrt(xhelp_a) |
|
|
tof31(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
|
|
xhelp_a = tof31(right,i,iadc) |
|
|
xhelp_t = tof31(right,i,itdc) |
|
|
if(xhelp_a>0) xhelp = tw31(right,i)/sqrt(xhelp_a) |
|
|
tof31(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
|
|
ENDDO |
|
|
|
|
|
DO i=1,3 |
|
|
xhelp_a = tof32(left,i,iadc) |
|
|
xhelp_t = tof32(left,i,itdc) |
|
|
if(xhelp_a>0) xhelp = tw32(left,i)/sqrt(xhelp_a) |
|
|
tof32(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
|
|
xhelp_a = tof32(right,i,iadc) |
|
|
xhelp_t = tof32(right,i,itdc) |
|
|
if(xhelp_a>0) xhelp = tw32(right,i)/sqrt(xhelp_a) |
|
|
tof32(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
|
|
ENDDO |
|
889 |
C---- |
C---- |
890 |
|
DO I=1,3 |
891 |
C------------------------------------------------------------------ |
if ((tdc(ch31a(i),hb31a(i)).lt.4095).and. |
892 |
C--- calculate track position in paddle using timing difference |
& (tof31(left,i,iadc).lt.3786)) THEN |
893 |
C------------------------------------------------------------------ |
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 |
do i=1,3 |
928 |
xtofpos(i)=100. |
xtofpos(i)=100. |
929 |
ytofpos(i)=100. |
ytofpos(i)=100. |
930 |
enddo |
enddo |
931 |
|
|
932 |
C-----------------------------S1 -------------------------------- |
C-----------------------------S1 -------------------------------- |
933 |
|
|
934 |
IF (tof11_i.GT.none_find) THEN |
IF (tof11_i.GT.none_find) THEN |
968 |
endif |
endif |
969 |
|
|
970 |
|
|
971 |
do i=1,3 |
c do i=1,3 |
972 |
if (abs(xtofpos(i)).gt.100.) then |
c if (abs(xtofpos(i)).gt.100.) then |
973 |
xtofpos(i)=101. |
c xtofpos(i)=101. |
974 |
endif |
c endif |
975 |
if (abs(ytofpos(i)).gt.100.) then |
c if (abs(ytofpos(i)).gt.100.) then |
976 |
ytofpos(i)=101. |
c ytofpos(i)=101. |
977 |
endif |
c endif |
978 |
enddo |
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 |
|
|
983 |
|
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---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
993 |
C--------------------Corrections on ADC-data ------------------------- |
C--------------------- zenith angle theta --------------------------- |
|
C---------------------zenith angle theta --------------------------- |
|
994 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
995 |
|
|
996 |
dx=0. |
dx=0. |
1005 |
dr = sqrt(dx*dx+dy*dy) |
dr = sqrt(dx*dx+dy*dy) |
1006 |
theta13 = atan(dr/tofarm13) |
theta13 = atan(dr/tofarm13) |
1007 |
|
|
1008 |
dx=0. |
C------------------------------------------------------------------ |
1009 |
dy=0. |
c dx=0. |
1010 |
dr=0. |
c dy=0. |
1011 |
theta12 = 0. |
c dr=0. |
1012 |
|
c theta12 = 0. |
1013 |
IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find)) |
c |
1014 |
& dx = xtofpos(1) - xtofpos(2) |
c IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find)) |
1015 |
IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find)) |
c & dx = xtofpos(1) - xtofpos(2) |
1016 |
& dy = ytofpos(1) - ytofpos(2) |
c IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find)) |
1017 |
dr = sqrt(dx*dx+dy*dy) |
c & dy = ytofpos(1) - ytofpos(2) |
1018 |
theta12 = atan(dr/tofarm12) |
c dr = sqrt(dx*dx+dy*dy) |
1019 |
|
c theta12 = atan(dr/tofarm12) |
1020 |
dx=0. |
c |
1021 |
dy=0. |
c dx=0. |
1022 |
dr=0. |
c dy=0. |
1023 |
theta23 = 0. |
c dr=0. |
1024 |
|
c theta23 = 0. |
1025 |
IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
c |
1026 |
& dx = xtofpos(2) - xtofpos(3) |
c IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
1027 |
IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
c & dx = xtofpos(2) - xtofpos(3) |
1028 |
& dy = ytofpos(2) - ytofpos(3) |
c IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
1029 |
dr = sqrt(dx*dx+dy*dy) |
c & dy = ytofpos(2) - ytofpos(3) |
1030 |
theta23 = atan(dr/tofarm23) |
c dr = sqrt(dx*dx+dy*dy) |
1031 |
|
c theta23 = atan(dr/tofarm23) |
1032 |
|
c |
1033 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
1034 |
C------------------angle and ADC(x) correction |
C------------------angle and ADC(x) correction |
1035 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
1037 |
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 |
1038 |
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/ |
1039 |
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/ |
1040 |
c DATA tof21_y/ -3.75,3.75/ |
c DATA tof21_y/ 3.75,-3.75/ ! paddles in different order |
1041 |
c DATA tof22_x/ -4.5,4.5/ |
c DATA tof22_x/ -4.5,4.5/ |
1042 |
c DATA tof31_x/ -6.0,0.,6.0/ |
c DATA tof31_x/ -6.0,0.,6.0/ |
1043 |
c DATA tof32_y/ -5.0,0.0,5.0/ |
c DATA tof32_y/ -5.0,0.0,5.0/ |
1049 |
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1050 |
|
|
1051 |
i = tof11_i |
i = tof11_i |
1052 |
xdummy=tof11(left,i,iadc) |
if (tof11(left,i,iadc).lt.3786) then |
1053 |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
c if (adc(ch11a(i),hb11a(i)).lt.4095) then |
1054 |
if (tof11(left,i,iadc).lt.1000) then |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
1055 |
xkorr=adcx11(left,i,1)*exp(-yhelp/adcx11(left,i,2)) |
xkorr = atten(left,11,i,yhelp) |
1056 |
xkorr0=adcx11(left,i,1) |
c write(40+i,*) yhelp,xkorr |
1057 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1058 |
adctof_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
adctof_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
1059 |
endif |
endif |
1060 |
|
|
1061 |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
if (tof11(right,i,iadc).lt.3786) then |
1062 |
if (tof11(right,i,iadc).lt.1000) then |
c if (adc(ch11b(i),hb11b(i)).lt.4095) then |
1063 |
xkorr=adcx11(right,i,1)*exp(yhelp/adcx11(right,i,2)) |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
1064 |
xkorr0=adcx11(right,i,1) |
xkorr = atten(right,11,i,yhelp) |
1065 |
|
c write(40+i,*) yhelp,xkorr |
1066 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1067 |
adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
1068 |
endif |
endif |
1069 |
ENDIF |
ENDIF |
1075 |
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1076 |
|
|
1077 |
i = tof12_i |
i = tof12_i |
1078 |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
if (tof12(left,i,iadc).lt.3786) then |
1079 |
if (tof12(left,i,iadc).lt.1000) then |
c if (adc(ch12a(i),hb12a(i)).lt.4095) then |
1080 |
xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
1081 |
xkorr0=adcx12(left,i,1) |
xkorr = atten(left,12,i,xhelp) |
1082 |
|
c write(50+i,*) xhelp,xkorr |
1083 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1084 |
adctof_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
adctof_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
1085 |
endif |
endif |
1086 |
|
|
1087 |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
if (tof12(right,i,iadc).lt.3786) then |
1088 |
if (tof12(right,i,iadc).lt.1000) then |
c if (adc(ch12b(i),hb12b(i)).lt.4095) then |
1089 |
xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
1090 |
xkorr0=adcx12(right,i,1) |
xkorr = atten(right,12,i,xhelp) |
1091 |
|
c write(50+i,*) xhelp,xkorr |
1092 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1093 |
adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
1094 |
endif |
endif |
1095 |
ENDIF |
ENDIF |
1103 |
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1104 |
|
|
1105 |
i = tof21_i |
i = tof21_i |
1106 |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
if (tof21(left,i,iadc).lt.3786) then |
1107 |
if (tof21(left,i,iadc).lt.1000) then |
c if (adc(ch21a(i),hb21a(i)).lt.4095) then |
1108 |
xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
1109 |
xkorr0=adcx21(left,i,1) |
xkorr = atten(left,21,i,xhelp) |
1110 |
|
c write(60+i,*) xhelp,xkorr |
1111 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1112 |
adctof_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
adctof_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
1113 |
endif |
endif |
1114 |
|
|
1115 |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
if (tof21(right,i,iadc).lt.3786) then |
1116 |
if (tof21(right,i,iadc).lt.1000) then |
c if (adc(ch21b(i),hb21b(i)).lt.4095) then |
1117 |
|
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
1118 |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
1119 |
xkorr0=adcx21(right,i,1) |
xkorr = atten(right,21,i,xhelp) |
1120 |
|
c write(60+i,*) xhelp,xkorr |
1121 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1122 |
adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
1123 |
endif |
endif |
1124 |
ENDIF |
ENDIF |
1131 |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1132 |
|
|
1133 |
i = tof22_i |
i = tof22_i |
1134 |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
if (tof22(left,i,iadc).lt.3786) then |
1135 |
if (tof22(left,i,iadc).lt.1000) then |
c if (adc(ch22a(i),hb22a(i)).lt.4095) then |
1136 |
xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
1137 |
xkorr0=adcx22(left,i,1) |
xkorr = atten(left,22,i,yhelp) |
1138 |
|
c write(70+i,*) yhelp,xkorr |
1139 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1140 |
adctof_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
adctof_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
1141 |
endif |
endif |
1142 |
|
|
1143 |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
if (tof22(right,i,iadc).lt.3786) then |
1144 |
if (tof22(right,i,iadc).lt.1000) then |
c if (adc(ch22b(i),hb22b(i)).lt.4095) then |
1145 |
xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
1146 |
xkorr0=adcx22(right,i,1) |
xkorr = atten(right,22,i,yhelp) |
1147 |
|
c write(70+i,*) yhelp,xkorr |
1148 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1149 |
adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
1150 |
endif |
endif |
1151 |
ENDIF |
ENDIF |
1159 |
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1160 |
|
|
1161 |
i = tof31_i |
i = tof31_i |
1162 |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
if (tof31(left,i,iadc).lt.3786) then |
1163 |
if (tof31(left,i,iadc).lt.1000) then |
c if (adc(ch31a(i),hb31a(i)).lt.4095) then |
1164 |
xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
1165 |
xkorr0=adcx31(left,i,1) |
xkorr = atten(left,31,i,yhelp) |
1166 |
|
c write(80+i,*) yhelp,xkorr |
1167 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1168 |
adctof_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
adctof_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
1169 |
endif |
endif |
1170 |
|
|
1171 |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
if (tof31(right,i,iadc).lt.3786) then |
1172 |
if (tof31(right,i,iadc).lt.1000) then |
c if (adc(ch31b(i),hb31b(i)).lt.4095) then |
1173 |
xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
1174 |
xkorr0=adcx31(right,i,1) |
xkorr = atten(right,31,i,yhelp) |
1175 |
|
c write(80+i,*) yhelp,xkorr |
1176 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1177 |
adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
1178 |
endif |
endif |
1179 |
ENDIF |
ENDIF |
1185 |
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1186 |
|
|
1187 |
i = tof32_i |
i = tof32_i |
1188 |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
if (tof32(left,i,iadc).lt.3786) then |
1189 |
if (tof32(left,i,iadc).lt.1000) then |
c if (adc(ch32a(i),hb32a(i)).lt.4095) then |
1190 |
xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
1191 |
xkorr0=adcx32(left,i,1) |
xkorr = atten(left,32,i,xhelp) |
1192 |
|
c write(90+i,*) xhelp,xkorr |
1193 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1194 |
adctof_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
adctof_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
1195 |
endif |
endif |
1196 |
|
|
1197 |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
if (tof32(right,i,iadc).lt.3786) then |
1198 |
if (tof32(right,i,iadc).lt.1000) then |
c if (adc(ch32b(i),hb32b(i)).lt.4095) then |
1199 |
xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
1200 |
xkorr0=adcx32(right,i,1) |
xkorr = atten(right,32,i,xhelp) |
1201 |
|
c write(90+i,*) xhelp,xkorr |
1202 |
|
if (iz.le.1) xkorr=xkorr/hepratio |
1203 |
adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
1204 |
endif |
endif |
1205 |
ENDIF |
ENDIF |
1206 |
|
|
1207 |
C----------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
1208 |
C----------------------calculate Beta ------------------------------ |
C----------------------calculate Beta ------------------------------ |
1209 |
C----------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
1210 |
C-------------------difference of sums --------------------------- |
C-------------------difference of sums ----------------------------- |
1211 |
C |
C |
1212 |
C DS = (t1+t2) - t3+t4) |
C DS = (t1+t2) - t3+t4) |
1213 |
C DS = c1 + c2/beta*cos(theta) |
C DS = c1 + c2/beta*cos(theta) |
1216 |
C since TDC resolution varies slightly c2 has to be calibrated |
C since TDC resolution varies slightly c2 has to be calibrated |
1217 |
|
|
1218 |
C S11 - S31 |
C S11 - S31 |
1219 |
IF (tof11_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1223 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1224 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1225 |
ihelp=(tof11_i-1)*3+tof31_i |
ihelp=(tof11_i-1)*3+tof31_i |
1226 |
c1 = k_S11S31(1,ihelp) |
c1 = k_S11S31(1,ihelp) |
1227 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1228 |
c2 = k_S11S31(2,ihelp) |
c2 = k_S11S31(2,ihelp) |
1229 |
betatof_a(1) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(1) = c2/(cos(theta13)*(ds-c1)) |
1230 |
|
|
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 |
ENDIF |
ENDIF |
1246 |
|
|
1247 |
C S11 - S32 |
C S11 - S32 |
1248 |
IF (tof11_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1252 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1253 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1254 |
ihelp=(tof11_i-1)*3+tof32_i |
ihelp=(tof11_i-1)*3+tof32_i |
1255 |
c1 = k_S11S32(1,ihelp) |
c1 = k_S11S32(1,ihelp) |
1256 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1257 |
c2 = k_S11S32(2,ihelp) |
c2 = k_S11S32(2,ihelp) |
1258 |
betatof_a(2) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(2) = c2/(cos(theta13)*(ds-c1)) |
|
ENDIF |
|
1259 |
|
|
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 |
|
ENDIF |
1275 |
|
|
1276 |
C S12 - S31 |
C S12 - S31 |
1277 |
IF (tof12_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1281 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1282 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1283 |
ihelp=(tof12_i-1)*3+tof31_i |
ihelp=(tof12_i-1)*3+tof31_i |
1284 |
c1 = k_S12S31(1,ihelp) |
c1 = k_S12S31(1,ihelp) |
1285 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1286 |
c2 = k_S12S31(2,ihelp) |
c2 = k_S12S31(2,ihelp) |
1287 |
betatof_a(3) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(3) = c2/(cos(theta13)*(ds-c1)) |
|
ENDIF |
|
1288 |
|
|
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 |
|
ENDIF |
1304 |
|
|
1305 |
C S12 - S32 |
C S12 - S32 |
1306 |
IF (tof12_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1310 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1311 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1312 |
ihelp=(tof12_i-1)*3+tof32_i |
ihelp=(tof12_i-1)*3+tof32_i |
1313 |
c1 = k_S12S32(1,ihelp) |
c1 = k_S12S32(1,ihelp) |
1314 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1315 |
c2 = k_S12S32(2,ihelp) |
c2 = k_S12S32(2,ihelp) |
1316 |
betatof_a(4) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(4) = c2/(cos(theta13)*(ds-c1)) |
1317 |
|
|
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 |
ENDIF |
ENDIF |
1333 |
|
|
1334 |
C S21 - S31 |
C S21 - S31 |
1335 |
IF (tof21_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1339 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1340 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1341 |
ihelp=(tof21_i-1)*3+tof31_i |
ihelp=(tof21_i-1)*3+tof31_i |
1342 |
c1 = k_S21S31(1,ihelp) |
c1 = k_S21S31(1,ihelp) |
1343 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1344 |
c2 = k_S21S31(2,ihelp) |
c2 = k_S21S31(2,ihelp) |
1345 |
betatof_a(5) = c2/(cos(theta23)*(ds-c1)) |
betatof_a(5) = c2/(cos(theta13)*(ds-c1)) |
1346 |
|
|
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 |
ENDIF |
ENDIF |
1362 |
|
|
1363 |
C S21 - S32 |
C S21 - S32 |
1364 |
IF (tof21_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1368 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1369 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1370 |
ihelp=(tof21_i-1)*3+tof32_i |
ihelp=(tof21_i-1)*3+tof32_i |
1371 |
c1 = k_S21S32(1,ihelp) |
c1 = k_S21S32(1,ihelp) |
1372 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1373 |
c2 = k_S21S32(2,ihelp) |
c2 = k_S21S32(2,ihelp) |
1374 |
betatof_a(6) = c2/(cos(theta23)*(ds-c1)) |
betatof_a(6) = c2/(cos(theta13)*(ds-c1)) |
1375 |
|
|
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 |
ENDIF |
ENDIF |
1391 |
|
|
1392 |
C S22 - S31 |
C S22 - S31 |
1393 |
IF (tof22_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1397 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
1398 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1399 |
ihelp=(tof22_i-1)*3+tof31_i |
ihelp=(tof22_i-1)*3+tof31_i |
1400 |
c1 = k_S22S31(1,ihelp) |
c1 = k_S22S31(1,ihelp) |
1401 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1402 |
c2 = k_S22S31(2,ihelp) |
c2 = k_S22S31(2,ihelp) |
1403 |
betatof_a(7) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(7) = c2/(cos(theta13)*(ds-c1)) |
1404 |
|
|
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 |
ENDIF |
ENDIF |
1420 |
|
|
1421 |
C S22 - S32 |
C S22 - S32 |
1422 |
IF (tof22_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1426 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
1427 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1428 |
ihelp=(tof22_i-1)*3+tof32_i |
ihelp=(tof22_i-1)*3+tof32_i |
1429 |
c1 = k_S22S32(1,ihelp) |
c1 = k_S22S32(1,ihelp) |
1430 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1431 |
c2 = k_S22S32(2,ihelp) |
c2 = k_S22S32(2,ihelp) |
1432 |
betatof_a(8) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(8) = c2/(cos(theta13)*(ds-c1)) |
1433 |
|
|
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 |
ENDIF |
ENDIF |
1449 |
|
|
1450 |
C S11 - S21 |
C S11 - S21 |
1451 |
IF (tof11_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1455 |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1456 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1457 |
ihelp=(tof11_i-1)*2+tof21_i |
ihelp=(tof11_i-1)*2+tof21_i |
1458 |
c1 = k_S11S21(1,ihelp) |
c1 = k_S11S21(1,ihelp) |
1459 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1460 |
c2 = k_S11S21(2,ihelp) |
c2 = k_S11S21(2,ihelp) |
1461 |
betatof_a(9) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(9) = c2/(cos(theta13)*(ds-c1)) |
1462 |
|
|
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 |
ENDIF |
ENDIF |
1478 |
|
|
1479 |
C S11 - S22 |
C S11 - S22 |
1480 |
IF (tof11_i.GT.none_find.AND.tof22_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
1484 |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1485 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1486 |
ihelp=(tof11_i-1)*2+tof22_i |
ihelp=(tof11_i-1)*2+tof22_i |
1487 |
c1 = k_S11S22(1,ihelp) |
c1 = k_S11S22(1,ihelp) |
1488 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1489 |
c2 = k_S11S22(2,ihelp) |
c2 = k_S11S22(2,ihelp) |
1490 |
betatof_a(10) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(10) = c2/(cos(theta13)*(ds-c1)) |
1491 |
|
|
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 |
ENDIF |
ENDIF |
1507 |
|
|
1508 |
C S12 - S21 |
C S12 - S21 |
1509 |
IF (tof12_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1513 |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
1514 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1515 |
ihelp=(tof12_i-1)*2+tof21_i |
ihelp=(tof12_i-1)*2+tof21_i |
1516 |
c1 = k_S12S21(1,ihelp) |
c1 = k_S12S21(1,ihelp) |
1517 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1518 |
c2 = k_S12S21(2,ihelp) |
c2 = k_S12S21(2,ihelp) |
1519 |
betatof_a(11) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(11) = c2/(cos(theta13)*(ds-c1)) |
1520 |
|
|
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 |
ENDIF |
ENDIF |
1536 |
|
|
1537 |
C S12 - S22 |
C S12 - S22 |
1538 |
IF (tof12_i.GT.none_find.AND.tof22_i.GT.none_find) THEN |
|
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 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
1542 |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
1543 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1544 |
ihelp=(tof12_i-1)*2+tof22_i |
ihelp=(tof12_i-1)*2+tof22_i |
1545 |
c1 = k_S12S22(1,ihelp) |
c1 = k_S12S22(1,ihelp) |
1546 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1547 |
c2 = k_S12S22(2,ihelp) |
c2 = k_S12S22(2,ihelp) |
1548 |
betatof_a(12) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(12) = c2/(cos(theta13)*(ds-c1)) |
1549 |
|
|
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 |
ENDIF |
ENDIF |
|
|
|
|
C------- |
|
1565 |
|
|
1566 |
icount=0 |
C--------------------------------------------------------- |
1567 |
sw=0. |
C |
1568 |
sxw=0. |
C icount=0 |
1569 |
beta_mean=100. |
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 |
|
|
1589 |
do i=1,12 |
do i=1,12 |
1590 |
if ((betatof_a(i).gt.-1.5).and.(betatof_a(i).lt.1.5)) then |
btemp(i) = betatof_a(i) |
1591 |
icount= icount+1 |
enddo |
1592 |
if (i.le.4) w_i=1./(0.13**2.) |
|
1593 |
if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
betatof_a(13)=newbeta(btemp,hitvec,10.,10.,20.) |
1594 |
if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
|
1595 |
sxw=sxw + betatof_a(i)*w_i |
C-------------------------------------------------------------- |
1596 |
sw =sw + w_i |
C write(*,*) betatof_a |
1597 |
endif |
c write(*,*) xtofpos |
1598 |
enddo |
c write(*,*) ytofpos |
1599 |
|
c write(*,*)'tofl2com beta', betatof_a |
1600 |
|
C write(*,*) adcflagtof |
1601 |
|
c write(*,*) 'tofl2com' |
1602 |
|
c write(*,*) xtofpos |
1603 |
|
c write(*,*) ytofpos |
1604 |
|
c write(*,*) xtr_tof |
1605 |
|
c write(*,*) ytr_tof |
1606 |
|
|
|
if (icount.gt.0) beta_mean=sxw/sw |
|
|
betatof_a(13) = beta_mean |
|
|
c write(*,*) '------------- end tofl2com ----------' |
|
|
|
|
1607 |
100 continue |
100 continue |
1608 |
|
|
1609 |
C |
C |
1610 |
RETURN |
RETURN |
1611 |
END |
END |
1612 |
|
|
1613 |
|
|
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 |
|
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 |
|
|
2307 |
|
|