1 |
kusanagi |
1.8 |
C |
2 |
|
|
C Written by Mirko Boezio and Emiliano Mocchiutti |
3 |
|
|
C |
4 |
|
|
C * Version: 2.17 * |
5 |
|
|
C |
6 |
kusanagi |
1.3 |
C------------------------------------------------ |
7 |
kusanagi |
1.7 |
SUBROUTINE CALUNPACK(vecta,lung,me) |
8 |
kusanagi |
1.3 |
C------------------------------------------------ |
9 |
|
|
|
10 |
|
|
IMPLICIT NONE |
11 |
|
|
C |
12 |
|
|
C Normal variables definition |
13 |
|
|
C |
14 |
kusanagi |
1.8 |
INTEGER SOGLIA, SOGLIA0, START |
15 |
|
|
PARAMETER (SOGLIA0=7) |
16 |
kusanagi |
1.3 |
PARAMETER (SOGLIA=27) |
17 |
kusanagi |
1.8 |
PARAMETER (START=80) |
18 |
kusanagi |
1.5 |
integer lung, me, pro, m |
19 |
kusanagi |
1.3 |
c |
20 |
|
|
INTEGER NPLA, NCHA, LENSEV |
21 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
22 |
kusanagi |
1.7 |
|
23 |
kusanagi |
1.3 |
INTEGER merror(4) |
24 |
|
|
C |
25 |
kusanagi |
1.8 |
INTEGER i, j, iev, min, st2c, bit, bi, lleng, salta |
26 |
kusanagi |
1.3 |
C |
27 |
kusanagi |
1.7 |
INTEGER*1 VECTA(lung) |
28 |
|
|
INTEGER*2 vect(30000), test |
29 |
kusanagi |
1.3 |
C |
30 |
kusanagi |
1.6 |
integer*2 check, crc, e2(4) |
31 |
kusanagi |
1.3 |
C |
32 |
|
|
INTEGER ic, k,l, ke, ic0, icsave(1000), chi(1000) |
33 |
|
|
INTEGER status, contr, cstatus, co, nta, conte |
34 |
kusanagi |
1.5 |
INTEGER inf, sup, em, esci, icb |
35 |
kusanagi |
1.6 |
INTEGER XO, YO, XE, YE,iev2 |
36 |
kusanagi |
1.3 |
|
37 |
|
|
INTEGER*2 length, length2 |
38 |
|
|
|
39 |
kusanagi |
1.5 |
INTEGER*2 st1, st2, cst1, st4 |
40 |
|
|
|
41 |
kusanagi |
1.7 |
integer st1b, st2b,p, lunga, pari |
42 |
kusanagi |
1.3 |
|
43 |
|
|
INTEGER*2 ival |
44 |
|
|
PARAMETER (ival='FFFF'x) |
45 |
|
|
|
46 |
|
|
real dedx1(11,96),dedx2(11,96),dedx3(11,96),dedx4(11,96) |
47 |
|
|
real dedx1c(11,96),dedx2c(11,96),dedx3c(11,96),dedx4c(11,96) |
48 |
|
|
real base1(11,6),base2(11,6),base3(11,6),base4(11,6) |
49 |
kusanagi |
1.6 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
50 |
kusanagi |
1.3 |
|
51 |
|
|
|
52 |
|
|
real auto(7) |
53 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
54 |
|
|
& calDSPtaberr(4), calevnum(4) |
55 |
|
|
|
56 |
|
|
DATA XO/241/ ! CODE_EV_R XO = 111 10001 |
57 |
|
|
DATA YO/237/ ! CODE_EV_R YO = 111 01101 |
58 |
|
|
DATA XE/234/ ! CODE_EV_R XE = 111 01010 |
59 |
|
|
DATA YE/246/ ! CODE_EV_R YE = 111 10110 |
60 |
|
|
|
61 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
62 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
63 |
|
|
REAL calpuls(4,11,96) |
64 |
kusanagi |
1.8 |
real perror(4) |
65 |
|
|
integer stwerr(4) |
66 |
kusanagi |
1.3 |
|
67 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr, perror, |
68 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
69 |
|
|
& calselftrig,calIItrig, |
70 |
|
|
& calstripshit,calDSPtaberr,calevnum |
71 |
|
|
|
72 |
|
|
save / evento / |
73 |
|
|
|
74 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
75 |
|
|
& calbase, |
76 |
|
|
& calvar, |
77 |
|
|
& calpuls |
78 |
|
|
|
79 |
|
|
save / calib / |
80 |
|
|
|
81 |
|
|
c |
82 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
83 |
kusanagi |
1.3 |
SAVE / VARIE / |
84 |
|
|
|
85 |
|
|
C |
86 |
|
|
C Begin ! |
87 |
|
|
C |
88 |
kusanagi |
1.8 |
c do l=1,lung,2 |
89 |
|
|
c write(*,18)l,vecta(l),vecta(l+1) |
90 |
|
|
c enddo |
91 |
|
|
if (iev.lt.0.or.iev.gt.9000000) iev = 0 |
92 |
kusanagi |
1.5 |
min = 0 |
93 |
kusanagi |
1.7 |
lleng = 0 |
94 |
kusanagi |
1.8 |
salta = 0 |
95 |
kusanagi |
1.5 |
m = 0 |
96 |
kusanagi |
1.7 |
pari = 0 |
97 |
|
|
IF (MOD(LUNG,2).EQ.0) THEN |
98 |
|
|
lunga = lung / 2 |
99 |
|
|
pari = 1 |
100 |
|
|
else |
101 |
|
|
lunga = int(lung/2) + 1 |
102 |
|
|
endif |
103 |
|
|
c |
104 |
|
|
if (lunga.gt.30000) then |
105 |
kusanagi |
1.8 |
c print *,'Calorimeter WARNING: more than 30000 words!' |
106 |
kusanagi |
1.7 |
lunga = 30000 |
107 |
kusanagi |
1.6 |
endif |
108 |
kusanagi |
1.5 |
c |
109 |
kusanagi |
1.7 |
c call minerr(ic,icsave,chi,min,co) |
110 |
|
|
call canctutto |
111 |
kusanagi |
1.6 |
call azero(dedx1,11*96) |
112 |
|
|
call azero(dedx2,11*96) |
113 |
|
|
call azero(dedx3,11*96) |
114 |
|
|
call azero(dedx4,11*96) |
115 |
|
|
call azero(dedx1c,11*96) |
116 |
|
|
call azero(dedx2c,11*96) |
117 |
|
|
call azero(dedx3c,11*96) |
118 |
|
|
call azero(dedx4c,11*96) |
119 |
|
|
call azero(base1,11*6) |
120 |
|
|
call azero(base2,11*6) |
121 |
|
|
call azero(base3,11*6) |
122 |
|
|
call azero(base4,11*6) |
123 |
|
|
C |
124 |
kusanagi |
1.5 |
do l = 1,4 |
125 |
kusanagi |
1.8 |
perror(l) = 0. |
126 |
|
|
stwerr(l) = 0 |
127 |
kusanagi |
1.5 |
e2(l) = 0 |
128 |
|
|
merror(l) = 0 |
129 |
|
|
enddo |
130 |
|
|
c |
131 |
kusanagi |
1.3 |
do l = 1,1000 |
132 |
|
|
icsave(l) = 0 |
133 |
|
|
chi(l) = 0 |
134 |
|
|
enddo |
135 |
|
|
em = 0 |
136 |
|
|
co = 0 |
137 |
|
|
esci = 0 |
138 |
|
|
me = 1 |
139 |
|
|
c |
140 |
|
|
contr = 1 |
141 |
|
|
c |
142 |
kusanagi |
1.8 |
ic = 1 |
143 |
kusanagi |
1.5 |
icb = 0 |
144 |
kusanagi |
1.3 |
nta = 0 |
145 |
|
|
c |
146 |
kusanagi |
1.8 |
CX length2 = ic - 2 |
147 |
|
|
length2 = start |
148 |
|
|
c length2 = 80 |
149 |
kusanagi |
1.3 |
c |
150 |
|
|
20 continue |
151 |
|
|
nta = nta + 1 |
152 |
kusanagi |
1.6 |
c |
153 |
kusanagi |
1.5 |
if (length2.ge.-2) then |
154 |
|
|
ic = ic + (2 * (length2 + 2)) |
155 |
|
|
else |
156 |
kusanagi |
1.8 |
c print *,'Calorimeter WARNING: length errors ',ic,length2,nta |
157 |
kusanagi |
1.5 |
endif |
158 |
|
|
c |
159 |
|
|
32 continue |
160 |
|
|
c |
161 |
kusanagi |
1.3 |
ke = 0 |
162 |
|
|
do while (ke.eq.0) |
163 |
|
|
C |
164 |
|
|
C Check consistency of header. |
165 |
|
|
C it is composed by CODE+D# (8 bits) and by SATUS WORD (8 bits) |
166 |
|
|
c so we must split vect into the two components: |
167 |
|
|
C |
168 |
|
|
C ST1 is CODE + D# |
169 |
kusanagi |
1.6 |
c |
170 |
kusanagi |
1.5 |
st1b = 0 |
171 |
|
|
st2b = 0 |
172 |
kusanagi |
1.7 |
if ((ic+3).gt.lung) then |
173 |
|
|
if (co.eq.0) co = 1 |
174 |
|
|
chi(co) = chi(co) + 8 * (5 - contr) |
175 |
|
|
merror(contr) = 130 |
176 |
|
|
if (contr.ne.1) contr=5 |
177 |
|
|
goto 200 |
178 |
|
|
endif |
179 |
kusanagi |
1.5 |
do bit = 0, 7 |
180 |
|
|
bi = ibits(vecta(ic),bit,1) |
181 |
|
|
if (bi.eq.1) st1b = ibset(st1b,bit) |
182 |
|
|
bi = ibits(vecta(ic+1),bit,1) |
183 |
|
|
if (bi.eq.1) st2b = ibset(st2b,bit) |
184 |
|
|
enddo |
185 |
kusanagi |
1.6 |
c |
186 |
kusanagi |
1.3 |
C ST2 is the STATUS WORD |
187 |
kusanagi |
1.6 |
c |
188 |
kusanagi |
1.5 |
length2 = 0 |
189 |
|
|
do bit=0, 7 |
190 |
|
|
bi = ibits(vecta(ic+3),bit,1) |
191 |
|
|
if (bi.eq.1) length2 = ibset(length2,bit) |
192 |
|
|
bi = ibits(vecta(ic+2),bit,1) |
193 |
|
|
if (bi.eq.1) length2 = ibset(length2,bit+8) |
194 |
|
|
enddo |
195 |
kusanagi |
1.3 |
c the crc should be at vect(length) with |
196 |
kusanagi |
1.5 |
length = length2 + 1 |
197 |
kusanagi |
1.3 |
C |
198 |
|
|
c some checks to be sure we have found the calorimeter data: |
199 |
|
|
c |
200 |
|
|
c status word is always less then 129 |
201 |
|
|
c |
202 |
kusanagi |
1.5 |
if (st2b.gt.128) then |
203 |
|
|
length = 0 |
204 |
|
|
goto 100 |
205 |
|
|
endif |
206 |
kusanagi |
1.3 |
c |
207 |
|
|
c length of the packet must be less then 20000 if no errors |
208 |
|
|
c are found |
209 |
|
|
c |
210 |
kusanagi |
1.7 |
if (st2b.eq.0.and.length2.gt.lunga) then |
211 |
kusanagi |
1.5 |
length = 0 |
212 |
|
|
goto 100 |
213 |
|
|
endif |
214 |
kusanagi |
1.3 |
c |
215 |
kusanagi |
1.6 |
if (length2.le.0) then |
216 |
kusanagi |
1.5 |
length = 0 |
217 |
|
|
goto 100 |
218 |
|
|
endif |
219 |
|
|
c |
220 |
kusanagi |
1.3 |
e2(contr) = 0 |
221 |
|
|
C |
222 |
|
|
if (contr.eq.1) then |
223 |
|
|
c |
224 |
|
|
c is it the first section? |
225 |
|
|
c |
226 |
kusanagi |
1.5 |
if (st1b.eq.YE) then |
227 |
kusanagi |
1.3 |
c if so go out of this loop and go on recording data |
228 |
|
|
ke = 1 |
229 |
|
|
if (em.eq.0) then |
230 |
|
|
em = 1 |
231 |
|
|
co = co + 1 |
232 |
|
|
icsave(co) = ic |
233 |
|
|
endif |
234 |
kusanagi |
1.5 |
m = ic |
235 |
kusanagi |
1.7 |
call riempi(m,lunga,lleng,lung,pari,vect,vecta) |
236 |
kusanagi |
1.5 |
icb = 1 |
237 |
|
|
if (st2b.ne.0) then |
238 |
|
|
E2(contr) = vect(icb) |
239 |
kusanagi |
1.3 |
call contaer(e2(contr),chi(co)) |
240 |
|
|
endif |
241 |
|
|
else |
242 |
|
|
c if not, is it one of the next sections? did we miss a section? |
243 |
kusanagi |
1.5 |
if (st1b.eq.YO.or.st1b.eq.XE.or.st1b.eq.XO) THEN |
244 |
kusanagi |
1.3 |
c if so, record an error and go back analizing this section |
245 |
|
|
merror(contr) = 129 |
246 |
|
|
contr = 2 |
247 |
|
|
if (em.eq.0) then |
248 |
|
|
em = 1 |
249 |
|
|
co = co + 1 |
250 |
|
|
icsave(co) = ic |
251 |
|
|
endif |
252 |
|
|
chi(co) = chi(co) + 8 |
253 |
kusanagi |
1.5 |
goto 32 |
254 |
kusanagi |
1.3 |
ELSE |
255 |
|
|
c if it is not the case, go on with the next value of vect |
256 |
|
|
GOTO 100 |
257 |
|
|
endif |
258 |
|
|
endif |
259 |
|
|
ENDIF |
260 |
|
|
C |
261 |
|
|
c the same for the second section, ... |
262 |
|
|
c |
263 |
|
|
if (CONTR.eq.2) then |
264 |
kusanagi |
1.5 |
if (st1b.eq.YO) then |
265 |
kusanagi |
1.3 |
ke = 1 |
266 |
|
|
if (em.eq.0) then |
267 |
|
|
em = 1 |
268 |
|
|
co = co + 1 |
269 |
|
|
icsave(co) = ic |
270 |
|
|
endif |
271 |
kusanagi |
1.5 |
m = ic |
272 |
kusanagi |
1.7 |
call riempi(m,lunga,lleng,lung,pari,vect,vecta) |
273 |
kusanagi |
1.5 |
icb = 1 |
274 |
|
|
if (st2b.ne.0) then |
275 |
|
|
E2(contr) = vect(icb) |
276 |
kusanagi |
1.3 |
call contaer(e2(contr),chi(co)) |
277 |
|
|
endif |
278 |
kusanagi |
1.5 |
goto 9 |
279 |
kusanagi |
1.3 |
else |
280 |
kusanagi |
1.5 |
if (st1b.eq.XE.or.st1b.eq.XO) then |
281 |
kusanagi |
1.3 |
merror(contr) = 129 |
282 |
|
|
contr = 3 |
283 |
|
|
if (em.eq.0) then |
284 |
|
|
em = 1 |
285 |
|
|
co = co + 1 |
286 |
|
|
icsave(co) = ic |
287 |
|
|
endif |
288 |
|
|
chi(co) = chi(co) + 8 |
289 |
kusanagi |
1.5 |
goto 32 |
290 |
kusanagi |
1.3 |
ELSE |
291 |
|
|
GOTO 100 |
292 |
|
|
endif |
293 |
|
|
endif |
294 |
|
|
ENDIF |
295 |
|
|
c |
296 |
|
|
C ... for the third,... |
297 |
|
|
c |
298 |
|
|
if (CONTR.eq.3) then |
299 |
kusanagi |
1.5 |
if (st1b.eq.XE) then |
300 |
kusanagi |
1.3 |
ke = 1 |
301 |
|
|
if (em.eq.0) then |
302 |
|
|
em = 1 |
303 |
|
|
co = co + 1 |
304 |
|
|
icsave(co) = ic |
305 |
|
|
endif |
306 |
kusanagi |
1.5 |
m = ic |
307 |
kusanagi |
1.7 |
call riempi(m,lunga,lleng,lung,pari,vect,vecta) |
308 |
kusanagi |
1.5 |
icb = 1 |
309 |
|
|
if (st2b.ne.0) then |
310 |
|
|
E2(contr) = vect(icb) |
311 |
kusanagi |
1.3 |
call contaer(e2(contr),chi(co)) |
312 |
|
|
endif |
313 |
kusanagi |
1.5 |
goto 9 |
314 |
kusanagi |
1.3 |
else |
315 |
kusanagi |
1.5 |
if (st1b.eq.XO) then |
316 |
kusanagi |
1.3 |
merror(contr) = 129 |
317 |
|
|
contr = 4 |
318 |
|
|
if (em.eq.0) then |
319 |
|
|
em = 1 |
320 |
|
|
co = co + 1 |
321 |
|
|
icsave(co) = ic |
322 |
|
|
endif |
323 |
|
|
chi(co) = chi(co) + 8 |
324 |
kusanagi |
1.5 |
goto 32 |
325 |
kusanagi |
1.3 |
ELSE |
326 |
|
|
GOTO 100 |
327 |
|
|
endif |
328 |
|
|
endif |
329 |
|
|
ENDIF |
330 |
|
|
C |
331 |
|
|
c ...and for the last section. |
332 |
|
|
c |
333 |
|
|
if (CONTR.eq.4) then |
334 |
kusanagi |
1.5 |
if (st1b.eq.XO) then |
335 |
kusanagi |
1.3 |
ke = 1 |
336 |
|
|
if (em.eq.0) then |
337 |
|
|
em = 1 |
338 |
|
|
co = co + 1 |
339 |
|
|
icsave(co) = ic |
340 |
|
|
endif |
341 |
kusanagi |
1.5 |
m = ic |
342 |
kusanagi |
1.7 |
call riempi(m,lunga,lleng,lung,pari,vect,vecta) |
343 |
kusanagi |
1.5 |
icb = 1 |
344 |
|
|
if (st2b.ne.0) then |
345 |
|
|
E2(contr) = vect(icb) |
346 |
kusanagi |
1.3 |
call contaer(e2(contr),chi(co)) |
347 |
|
|
endif |
348 |
|
|
else |
349 |
kusanagi |
1.6 |
c we should never arrive here (in case we run out of vector if section |
350 |
|
|
c four is missing!)... however here it is in case of bugs! |
351 |
|
|
c |
352 |
kusanagi |
1.5 |
goto 100 |
353 |
kusanagi |
1.3 |
endif |
354 |
|
|
endif |
355 |
|
|
C |
356 |
|
|
100 CONTINUE |
357 |
|
|
c |
358 |
|
|
c increment vector of one searching for the next section |
359 |
|
|
c |
360 |
kusanagi |
1.5 |
9 continue |
361 |
kusanagi |
1.3 |
ic = ic + 1 |
362 |
|
|
c |
363 |
|
|
c if we run out of vector give an error and exit the subroutine |
364 |
|
|
c |
365 |
kusanagi |
1.7 |
if (ic.gt.(lung-1)) then |
366 |
kusanagi |
1.5 |
if (co.eq.0) co = 1 |
367 |
kusanagi |
1.3 |
chi(co) = chi(co) + 8 * (5 - contr) |
368 |
|
|
merror(contr) = 130 |
369 |
|
|
if (contr.ne.1) contr=5 |
370 |
|
|
goto 200 |
371 |
|
|
endif |
372 |
|
|
enddo |
373 |
|
|
C |
374 |
|
|
c format not used |
375 |
|
|
c |
376 |
kusanagi |
1.7 |
10 FORMAT(2X,'Error for view:',2X,I1,2X,'Status word:',2X,Z4) |
377 |
|
|
11 FORMAT(2X,'View or command not recognized for view:',2X,I1,2X, |
378 |
|
|
& 'Status word:',2X,Z4) |
379 |
|
|
12 FORMAT(2X,'Error - did NOT find view:',2X,I1) |
380 |
|
|
13 FORMAT(2X,'Error - eof reached, exiting') |
381 |
|
|
14 FORMAT(2X,I8,2X,I10) |
382 |
|
|
15 FORMAT(2X,I8,2X,Z8) |
383 |
|
|
17 FORMAT(2X,'Elemento:',2X,I4,2X,' word:',2X,Z8) |
384 |
kusanagi |
1.8 |
18 FORMAT(2X,'Elemento:',2X,I4,2X,' word:',2X,Z2,Z2) |
385 |
kusanagi |
1.3 |
C |
386 |
|
|
c go on recording data |
387 |
kusanagi |
1.7 |
ic = ic - 1 |
388 |
|
|
c |
389 |
|
|
K = CONTR |
390 |
|
|
ic0 = icb |
391 |
|
|
icb = icb + 1 |
392 |
|
|
length = vect(icb) + 2 |
393 |
|
|
length2 = vect(icb) |
394 |
kusanagi |
1.8 |
lleng = (length*2) - 1 |
395 |
kusanagi |
1.3 |
C |
396 |
|
|
C Check consistency of CRC. |
397 |
|
|
C |
398 |
kusanagi |
1.7 |
check = 0. |
399 |
|
|
inf = ic0 |
400 |
|
|
sup = length - 1 |
401 |
|
|
do i = inf,sup |
402 |
|
|
check=crc(check,vect(i)) |
403 |
|
|
enddo |
404 |
kusanagi |
1.6 |
c |
405 |
kusanagi |
1.7 |
if (check.ne.vect(length)) then |
406 |
|
|
merror(contr) = 132 |
407 |
|
|
chi(co) = chi(co) + 4 |
408 |
|
|
lleng = 0 |
409 |
kusanagi |
1.8 |
if (length2.lt.lunga.and.length2.gt.0) then |
410 |
|
|
goto 19 |
411 |
|
|
else |
412 |
|
|
contr = contr + 1 |
413 |
|
|
c ic = ic + 1 |
414 |
|
|
goto 32 |
415 |
|
|
endif |
416 |
kusanagi |
1.7 |
endif |
417 |
kusanagi |
1.5 |
C |
418 |
kusanagi |
1.3 |
C Process data. |
419 |
|
|
C |
420 |
kusanagi |
1.8 |
19 CONTINUE |
421 |
kusanagi |
1.7 |
if (esci.eq.1) then |
422 |
|
|
c |
423 |
kusanagi |
1.5 |
do i = 1, 7 |
424 |
|
|
icb = icb + 1 |
425 |
|
|
auto(i) = vect(icb) |
426 |
kusanagi |
1.3 |
enddo |
427 |
kusanagi |
1.7 |
C |
428 |
kusanagi |
1.5 |
if (st2b.ne.0) then |
429 |
|
|
do bit=0, 6 |
430 |
|
|
bi = ibits(st2b,bit,1) |
431 |
|
|
if (bit.eq.3.and.bi.ne.0) st2c = 8 |
432 |
|
|
enddo |
433 |
|
|
endif |
434 |
kusanagi |
1.7 |
C |
435 |
kusanagi |
1.5 |
if (st2c.eq.8) then |
436 |
kusanagi |
1.3 |
if (length2.ne.1064) then |
437 |
|
|
merror(contr) = 133 |
438 |
|
|
chi(co) = chi(co) + 4 |
439 |
kusanagi |
1.7 |
lleng = 0 |
440 |
kusanagi |
1.3 |
goto 150 |
441 |
kusanagi |
1.5 |
else |
442 |
kusanagi |
1.6 |
if (k.eq.1) then |
443 |
|
|
call azero(dedx1,11*96) |
444 |
|
|
call azero(dedx2,11*96) |
445 |
|
|
call azero(dedx3,11*96) |
446 |
|
|
call azero(dedx4,11*96) |
447 |
|
|
call azero(dedx1c,11*96) |
448 |
|
|
call azero(dedx2c,11*96) |
449 |
|
|
call azero(dedx3c,11*96) |
450 |
|
|
call azero(dedx4c,11*96) |
451 |
|
|
call azero(base1,11*6) |
452 |
|
|
call azero(base2,11*6) |
453 |
|
|
call azero(base3,11*6) |
454 |
|
|
call azero(base4,11*6) |
455 |
|
|
call CALRAW(vect,icb+1,length-1,dedx1) |
456 |
|
|
endif |
457 |
kusanagi |
1.5 |
if (k.eq.2) call CALRAW(vect,icb+1,length-1,dedx2) |
458 |
|
|
if (k.eq.3) call CALRAW(vect,icb+1,length-1,dedx3) |
459 |
|
|
if (k.eq.4) call CALRAW(vect,icb+1,length-1,dedx4) |
460 |
kusanagi |
1.3 |
endif |
461 |
kusanagi |
1.5 |
goto 50 |
462 |
kusanagi |
1.3 |
endif |
463 |
kusanagi |
1.7 |
C |
464 |
kusanagi |
1.3 |
41 FORMAT(2X,I2,2X,'word :',1x,z4) |
465 |
kusanagi |
1.5 |
test = vect(icb+3) |
466 |
kusanagi |
1.7 |
c |
467 |
kusanagi |
1.5 |
if (test.eq.ival) then |
468 |
kusanagi |
1.3 |
if (length2.gt.1201) then |
469 |
|
|
merror(contr) = 134 |
470 |
|
|
chi(co) = chi(co) + 4 |
471 |
kusanagi |
1.7 |
lleng = 0 |
472 |
kusanagi |
1.3 |
goto 150 |
473 |
|
|
else |
474 |
kusanagi |
1.5 |
icb = icb + 1 |
475 |
|
|
calIItrig(k) = vect(icb) |
476 |
|
|
icb = icb + 1 |
477 |
|
|
calstripshit(k) = vect(icb) |
478 |
|
|
icb = icb + 1 |
479 |
|
|
C qui c'e` test! |
480 |
|
|
icb = icb + 1 |
481 |
|
|
calDSPtaberr(k) = vect(icb) |
482 |
|
|
icb = icb + 1 |
483 |
|
|
calevnum(k) = vect(icb) |
484 |
|
|
merror(contr) = 137 |
485 |
kusanagi |
1.6 |
if (k.eq.1) then |
486 |
|
|
call azero(dedx1,11*96) |
487 |
|
|
call azero(dedx2,11*96) |
488 |
|
|
call azero(dedx3,11*96) |
489 |
|
|
call azero(dedx4,11*96) |
490 |
|
|
call azero(dedx1c,11*96) |
491 |
|
|
call azero(dedx2c,11*96) |
492 |
|
|
call azero(dedx3c,11*96) |
493 |
|
|
call azero(dedx4c,11*96) |
494 |
|
|
call azero(base1,11*6) |
495 |
|
|
call azero(base2,11*6) |
496 |
|
|
call azero(base3,11*6) |
497 |
|
|
call azero(base4,11*6) |
498 |
|
|
call CALCOMPRESS(vect,icb+1,length-1,dedx1c, |
499 |
|
|
& base1) |
500 |
|
|
endif |
501 |
|
|
if (k.eq.2) call CALCOMPRESS(vect,icb+1,length-1,dedx2c, |
502 |
kusanagi |
1.3 |
& base2) |
503 |
kusanagi |
1.6 |
if (k.eq.3) call CALCOMPRESS(vect,icb+1,length-1,dedx3c, |
504 |
kusanagi |
1.3 |
& base3) |
505 |
kusanagi |
1.6 |
if (k.eq.4) call CALCOMPRESS(vect,icb+1,length-1,dedx4c, |
506 |
kusanagi |
1.3 |
& base4) |
507 |
kusanagi |
1.5 |
goto 50 |
508 |
kusanagi |
1.3 |
endif |
509 |
kusanagi |
1.5 |
else if (test.eq.0) then |
510 |
kusanagi |
1.3 |
if (length2.gt.2257) then |
511 |
|
|
merror(contr) = 135 |
512 |
|
|
chi(co) = chi(co) + 4 |
513 |
kusanagi |
1.7 |
lleng = 0 |
514 |
kusanagi |
1.3 |
goto 150 |
515 |
|
|
else |
516 |
kusanagi |
1.5 |
icb = icb + 1 |
517 |
|
|
calIItrig(k) = vect(icb) |
518 |
|
|
icb = icb + 1 |
519 |
|
|
calstripshit(k) = vect(icb) |
520 |
|
|
icb = icb + 1 |
521 |
kusanagi |
1.7 |
C qui c'e` test |
522 |
kusanagi |
1.5 |
icb = icb + 1 |
523 |
|
|
calDSPtaberr(k) = vect(icb) |
524 |
|
|
icb = icb + 1 |
525 |
|
|
calevnum(k) = vect(icb) |
526 |
|
|
merror(contr) = 138 |
527 |
kusanagi |
1.6 |
if (k.eq.1) then |
528 |
|
|
call azero(dedx1,11*96) |
529 |
|
|
call azero(dedx2,11*96) |
530 |
|
|
call azero(dedx3,11*96) |
531 |
|
|
call azero(dedx4,11*96) |
532 |
|
|
call azero(dedx1c,11*96) |
533 |
|
|
call azero(dedx2c,11*96) |
534 |
|
|
call azero(dedx3c,11*96) |
535 |
|
|
call azero(dedx4c,11*96) |
536 |
|
|
call azero(base1,11*6) |
537 |
|
|
call azero(base2,11*6) |
538 |
|
|
call azero(base3,11*6) |
539 |
|
|
call azero(base4,11*6) |
540 |
|
|
call CALFULL(vect,icb+1,length-1,dedx1, |
541 |
|
|
& dedx1c,base1) |
542 |
|
|
endif |
543 |
kusanagi |
1.5 |
if (k.eq.2) call CALFULL(vect,icb+1,length-1,dedx2, |
544 |
kusanagi |
1.3 |
& dedx2c,base2) |
545 |
kusanagi |
1.5 |
if (k.eq.3) call CALFULL(vect,icb+1,length-1,dedx3, |
546 |
kusanagi |
1.3 |
& dedx3c,base3) |
547 |
kusanagi |
1.5 |
if (k.eq.4) call CALFULL(vect,icb+1,length-1,dedx4, |
548 |
kusanagi |
1.3 |
& dedx4c,base4) |
549 |
kusanagi |
1.5 |
goto 50 |
550 |
kusanagi |
1.3 |
endif |
551 |
|
|
else |
552 |
|
|
merror(contr) = 136 |
553 |
|
|
chi(co) = chi(co) + 4 |
554 |
kusanagi |
1.7 |
lleng = 0 |
555 |
kusanagi |
1.5 |
goto 150 |
556 |
kusanagi |
1.3 |
endif |
557 |
kusanagi |
1.7 |
C |
558 |
kusanagi |
1.3 |
do i = 1,7 |
559 |
|
|
calselftrig(k,i) = auto(i) |
560 |
|
|
enddo |
561 |
kusanagi |
1.7 |
c |
562 |
kusanagi |
1.3 |
50 continue |
563 |
|
|
c |
564 |
kusanagi |
1.7 |
C |
565 |
|
|
DO I = 1,11 |
566 |
|
|
DO J = 1,96 |
567 |
|
|
DEXY(2,2*I-1,97-J) = DEDX3(I,J) |
568 |
|
|
DEXY(1,2*I-1,J) = DEDX2(I,J) |
569 |
|
|
DEXY(2,2*I,J) = DEDX4(I,J) |
570 |
|
|
DEXY(1,2*I,J) = DEDX1(I,J) |
571 |
|
|
DEXYC(2,2*I-1,97-J) = DEDX3C(I,J) |
572 |
|
|
DEXYC(1,2*I-1,J) = DEDX2C(I,J) |
573 |
|
|
DEXYC(2,2*I,J) = DEDX4C(I,J) |
574 |
|
|
DEXYC(1,2*I,J) = DEDX1C(I,J) |
575 |
|
|
enddo |
576 |
|
|
do j = 1,6 |
577 |
|
|
base(2,2*i-1,7-j) = base3(i,j) |
578 |
|
|
base(1,2*i-1,j) = base2(i,j) |
579 |
|
|
base(2,2*i,j) = base4(i,j) |
580 |
|
|
base(1,2*i,j) = base1(i,j) |
581 |
|
|
enddo |
582 |
kusanagi |
1.3 |
enddo |
583 |
kusanagi |
1.7 |
C |
584 |
|
|
endif |
585 |
kusanagi |
1.3 |
C |
586 |
|
|
150 continue |
587 |
|
|
C |
588 |
|
|
contr = contr + 1 |
589 |
|
|
C |
590 |
|
|
c go on till we have found all the four sections |
591 |
|
|
c |
592 |
kusanagi |
1.5 |
if (contr.lt.5) goto 20 |
593 |
kusanagi |
1.3 |
c |
594 |
kusanagi |
1.8 |
200 continue |
595 |
|
|
C |
596 |
kusanagi |
1.3 |
c |
597 |
kusanagi |
1.8 |
if (esci.eq.0.and.co.ge.1.and.icsave(co).le.lung) then |
598 |
|
|
if (salta.eq.co) then |
599 |
|
|
esci = 1 |
600 |
|
|
goto 201 |
601 |
|
|
else |
602 |
|
|
if (chi(co).lt.soglia0) then |
603 |
|
|
esci = 1 |
604 |
|
|
ic = icsave(co) |
605 |
|
|
else |
606 |
|
|
IF (salta.eq.0) then |
607 |
|
|
ic = 1 |
608 |
|
|
length2 = - 2 |
609 |
|
|
salta = -1 |
610 |
|
|
else |
611 |
|
|
ic = icsave(co) + 1 |
612 |
|
|
salta = co |
613 |
|
|
endif |
614 |
|
|
endif |
615 |
|
|
em = 0 |
616 |
|
|
contr = 1 |
617 |
|
|
goto 32 |
618 |
|
|
endif |
619 |
|
|
endif |
620 |
kusanagi |
1.3 |
c |
621 |
kusanagi |
1.8 |
if (co.eq.0.and.length2.eq.start) then |
622 |
|
|
em = 0 |
623 |
|
|
contr = 1 |
624 |
|
|
ic = 1 |
625 |
|
|
length2 = -2 |
626 |
|
|
goto 20 |
627 |
|
|
endif |
628 |
|
|
|
629 |
|
|
c |
630 |
|
|
|
631 |
|
|
201 continue |
632 |
|
|
|
633 |
kusanagi |
1.3 |
C |
634 |
|
|
C if all section are missing clear vectors and go out |
635 |
|
|
C |
636 |
|
|
if (merror(1).eq.129.and.merror(2).eq.129 |
637 |
|
|
& .and.merror(3).eq.129.and.merror(4).eq.130) then |
638 |
|
|
do l = 1,4 |
639 |
|
|
e2(l) = 0 |
640 |
|
|
merror(l) = 0 |
641 |
|
|
enddo |
642 |
kusanagi |
1.7 |
call canctutto |
643 |
kusanagi |
1.3 |
contr=1 |
644 |
|
|
if (esci.eq.0) then |
645 |
kusanagi |
1.5 |
ic = ic + 1 |
646 |
|
|
nta = nta +1 |
647 |
kusanagi |
1.7 |
lleng = 0 |
648 |
kusanagi |
1.5 |
goto 32 |
649 |
|
|
else |
650 |
|
|
goto 999 |
651 |
kusanagi |
1.3 |
endif |
652 |
|
|
endif |
653 |
|
|
c |
654 |
kusanagi |
1.8 |
if (esci.eq.1.and.salta.eq.co) then |
655 |
kusanagi |
1.3 |
min = 0 |
656 |
|
|
call minerr(ic,icsave,chi,min,co) |
657 |
kusanagi |
1.7 |
call canctutto |
658 |
kusanagi |
1.5 |
do l = 1,4 |
659 |
|
|
e2(l) = 0 |
660 |
|
|
merror(l) = 0 |
661 |
|
|
enddo |
662 |
kusanagi |
1.3 |
contr = 1 |
663 |
|
|
if (chi(min).lt.SOGLIA) then |
664 |
|
|
me = 0 |
665 |
kusanagi |
1.5 |
nta = nta + 1 |
666 |
kusanagi |
1.7 |
lleng = 0 |
667 |
kusanagi |
1.8 |
salta = -1 |
668 |
kusanagi |
1.5 |
goto 32 |
669 |
kusanagi |
1.3 |
else |
670 |
|
|
do l = 1,4 |
671 |
|
|
e2(l) = 0 |
672 |
|
|
merror(l) = 0 |
673 |
|
|
enddo |
674 |
|
|
me = 1 |
675 |
|
|
goto 999 |
676 |
|
|
endif |
677 |
|
|
endif |
678 |
|
|
c |
679 |
|
|
if (esci.eq.0) then |
680 |
kusanagi |
1.7 |
call canctutto |
681 |
kusanagi |
1.5 |
length = 0 |
682 |
kusanagi |
1.7 |
lleng = 0 |
683 |
kusanagi |
1.5 |
ic = ic + 1 |
684 |
|
|
do l = 1,4 |
685 |
|
|
e2(l) = 0 |
686 |
|
|
merror(l) = 0 |
687 |
|
|
enddo |
688 |
|
|
goto 32 |
689 |
kusanagi |
1.3 |
endif |
690 |
|
|
c |
691 |
|
|
999 continue |
692 |
kusanagi |
1.8 |
do l = 1, 4 |
693 |
|
|
do bit=0, 31 |
694 |
|
|
if (bit.lt.16) then |
695 |
|
|
bi = ibits(E2(L),bit,1) |
696 |
|
|
else |
697 |
|
|
bi = 0 |
698 |
|
|
endif |
699 |
|
|
if (bi.eq.1) stwerr(l) = ibset(stwerr(l),bit) |
700 |
|
|
enddo |
701 |
|
|
perror(l) = float(merror(l)) |
702 |
kusanagi |
1.7 |
enddo |
703 |
kusanagi |
1.8 |
c |
704 |
|
|
iev = iev + 1 |
705 |
kusanagi |
1.3 |
RETURN |
706 |
|
|
END |
707 |
|
|
|
708 |
|
|
|
709 |
|
|
C------------------------------------------------ |
710 |
|
|
SUBROUTINE CALRAW(vect,inf,sup,dedx) |
711 |
|
|
C------------------------------------------------ |
712 |
|
|
|
713 |
|
|
IMPLICIT NONE |
714 |
|
|
|
715 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) |
716 |
kusanagi |
1.3 |
INTEGER inf, sup |
717 |
|
|
INTEGER i,j,k, iev,iev2 |
718 |
|
|
|
719 |
|
|
C |
720 |
|
|
INTEGER NPLA, NCHA, LENSEV |
721 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
722 |
|
|
INTEGER merror(4) |
723 |
|
|
integer*2 e2(4) |
724 |
|
|
INTEGER contr |
725 |
kusanagi |
1.6 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
726 |
kusanagi |
1.3 |
|
727 |
|
|
|
728 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
729 |
|
|
& calDSPtaberr(4), calevnum(4) |
730 |
|
|
|
731 |
|
|
|
732 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
733 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
734 |
|
|
REAL calpuls(4,11,96) |
735 |
|
|
REAL dedx(11,96) |
736 |
kusanagi |
1.8 |
real perror(4) |
737 |
|
|
integer stwerr(4) |
738 |
kusanagi |
1.3 |
|
739 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr, perror, |
740 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
741 |
|
|
& calselftrig,calIItrig, |
742 |
|
|
& calstripshit,calDSPtaberr,calevnum |
743 |
|
|
|
744 |
|
|
save / evento / |
745 |
|
|
|
746 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
747 |
|
|
& calbase, |
748 |
|
|
& calvar, |
749 |
|
|
& calpuls |
750 |
|
|
|
751 |
|
|
save / calib / |
752 |
|
|
c |
753 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
754 |
kusanagi |
1.3 |
SAVE / VARIE / |
755 |
|
|
|
756 |
|
|
C |
757 |
|
|
DO I = 1,11 |
758 |
|
|
DO J = 1,96 |
759 |
|
|
DEDX(I,J) = 0. |
760 |
|
|
ENDDO |
761 |
|
|
ENDDO |
762 |
|
|
C |
763 |
|
|
k = inf |
764 |
|
|
do j = 1,96 |
765 |
|
|
do i = 1,11 |
766 |
|
|
dedx(i,j) = vect(k) |
767 |
|
|
k = k + 1 |
768 |
|
|
enddo |
769 |
|
|
enddo |
770 |
|
|
c |
771 |
|
|
RETURN |
772 |
|
|
END |
773 |
|
|
|
774 |
|
|
C------------------------------------------------ |
775 |
|
|
SUBROUTINE CALCOMPRESS(vect,inf,sup,dedx,basse) |
776 |
|
|
C------------------------------------------------ |
777 |
|
|
|
778 |
|
|
IMPLICIT NONE |
779 |
|
|
|
780 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) , st3 |
781 |
kusanagi |
1.3 |
C |
782 |
|
|
INTEGER inf, sup |
783 |
kusanagi |
1.6 |
INTEGER i,j, iev,iev2,h |
784 |
kusanagi |
1.3 |
INTEGER*2 st, st1, st2 |
785 |
|
|
C |
786 |
|
|
INTEGER ib |
787 |
|
|
INTEGER ipl, ipr, ist |
788 |
|
|
C |
789 |
|
|
C |
790 |
|
|
INTEGER NPLA, NCHA, LENSEV |
791 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
792 |
|
|
INTEGER merror(4) |
793 |
|
|
integer*2 e2(4) |
794 |
|
|
INTEGER contr |
795 |
kusanagi |
1.6 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
796 |
kusanagi |
1.3 |
|
797 |
|
|
|
798 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
799 |
|
|
& calDSPtaberr(4), calevnum(4) |
800 |
|
|
|
801 |
|
|
|
802 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
803 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
804 |
|
|
REAL calpuls(4,11,96) |
805 |
|
|
REAL dedx(11,96), basse(11,6) |
806 |
kusanagi |
1.8 |
real perror(4) |
807 |
|
|
integer stwerr(4) |
808 |
kusanagi |
1.3 |
C |
809 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
810 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
811 |
|
|
& calselftrig,calIItrig, |
812 |
|
|
& calstripshit,calDSPtaberr,calevnum |
813 |
|
|
|
814 |
|
|
save / evento / |
815 |
|
|
|
816 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
817 |
|
|
& calbase, |
818 |
|
|
& calvar, |
819 |
|
|
& calpuls |
820 |
|
|
|
821 |
|
|
save / calib / |
822 |
|
|
c |
823 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
824 |
kusanagi |
1.3 |
SAVE / VARIE / |
825 |
|
|
|
826 |
|
|
C |
827 |
|
|
DO I = 1,11 |
828 |
|
|
DO J = 1,96 |
829 |
|
|
DEDX(I,J) = 0. |
830 |
|
|
ENDDO |
831 |
|
|
do j = 1,6 |
832 |
|
|
basse(i,j) = 0. |
833 |
|
|
enddo |
834 |
|
|
ENDDO |
835 |
|
|
C |
836 |
kusanagi |
1.5 |
i = inf |
837 |
|
|
c |
838 |
kusanagi |
1.3 |
10 continue |
839 |
kusanagi |
1.6 |
if (i.gt.sup) then |
840 |
|
|
RETURN |
841 |
|
|
endif |
842 |
kusanagi |
1.3 |
C |
843 |
|
|
40 format(2x,i5,2x,'status :',1x,Z4) |
844 |
kusanagi |
1.5 |
C |
845 |
|
|
c |
846 |
|
|
st1 = 0 |
847 |
kusanagi |
1.3 |
st1 = IAND(vect(i),'0800'x) |
848 |
|
|
st1 = ISHFT(st1,-11) |
849 |
kusanagi |
1.6 |
cc 41 format(2x,'st1 = ',Z8) |
850 |
|
|
cc 42 format(2x,'st2 = ',Z8) |
851 |
|
|
cc 43 format(2x,'vect(i) = ',Z8) |
852 |
kusanagi |
1.3 |
cc 44 format(2x,'vect(i) dopo = ',Z8) |
853 |
kusanagi |
1.6 |
cc 45 format(2x,'vect(i) ib = 1 : ',Z8) |
854 |
|
|
cc 46 format(2x,'vect(i) < 0 : ',Z8) |
855 |
kusanagi |
1.3 |
if (st1.eq.1) then |
856 |
|
|
ib = 1 |
857 |
|
|
else |
858 |
kusanagi |
1.6 |
st2 = IAND(vect(i),'1000'x) |
859 |
|
|
st2 = ISHFT(st2,-12) |
860 |
|
|
if (st2.eq.1) then |
861 |
kusanagi |
1.3 |
ib = 0 |
862 |
|
|
else |
863 |
kusanagi |
1.5 |
merror(contr) = 139 |
864 |
kusanagi |
1.3 |
RETURN |
865 |
|
|
endif |
866 |
|
|
endif |
867 |
|
|
C |
868 |
|
|
if (ib.eq.1) then |
869 |
kusanagi |
1.6 |
C |
870 |
kusanagi |
1.3 |
st = IAND(vect(i),'00FF'x) |
871 |
kusanagi |
1.5 |
c |
872 |
kusanagi |
1.3 |
ipl = int(st/6) + 1 |
873 |
kusanagi |
1.5 |
ipr = st - (ipl - 1) * 6 + 1 |
874 |
kusanagi |
1.3 |
i = i + 1 |
875 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
876 |
kusanagi |
1.3 |
basse(ipl,ipr) = vect(i) |
877 |
kusanagi |
1.6 |
c |
878 |
kusanagi |
1.3 |
20 continue |
879 |
|
|
if (i.gt.sup) RETURN |
880 |
|
|
C |
881 |
|
|
i = i + 1 |
882 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
883 |
|
|
if ((vect(i)+1).gt.16.or.(vect(i)+1).lt.1) then |
884 |
|
|
goto 10 |
885 |
|
|
endif |
886 |
|
|
ist = vect(i) + 1 + 16 * (ipr - 1) |
887 |
kusanagi |
1.3 |
i = i + 1 |
888 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
889 |
kusanagi |
1.5 |
dedx(ipl,ist) = vect(i) |
890 |
kusanagi |
1.6 |
goto 20 |
891 |
kusanagi |
1.3 |
else |
892 |
|
|
C |
893 |
|
|
st = IAND(vect(i),'00FF'x) |
894 |
kusanagi |
1.6 |
ipl = int(st/6) + 1 |
895 |
kusanagi |
1.5 |
ipr = st - (ipl - 1) * 6 + 1 |
896 |
kusanagi |
1.3 |
do j = 1,16 |
897 |
|
|
i = i + 1 |
898 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
899 |
|
|
ist = j + 16 * (ipr - 1) |
900 |
|
|
dedx(ipl,ist) = vect(i) |
901 |
kusanagi |
1.3 |
enddo |
902 |
kusanagi |
1.6 |
i = i + 1 |
903 |
|
|
if (i.gt.sup) RETURN |
904 |
kusanagi |
1.3 |
goto 10 |
905 |
|
|
C |
906 |
|
|
endif |
907 |
|
|
|
908 |
|
|
|
909 |
|
|
RETURN |
910 |
|
|
END |
911 |
|
|
|
912 |
|
|
|
913 |
kusanagi |
1.5 |
C---------------------------------------------------------- |
914 |
kusanagi |
1.3 |
SUBROUTINE CALFULL(vect,inf,sup,dedx,dedxc,basse) |
915 |
kusanagi |
1.5 |
C-------------------------------------------------------------- |
916 |
kusanagi |
1.3 |
|
917 |
|
|
IMPLICIT NONE |
918 |
|
|
|
919 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) |
920 |
kusanagi |
1.3 |
C |
921 |
|
|
INTEGER inf, sup |
922 |
|
|
INTEGER i,j,k, iev,iev2 |
923 |
|
|
C |
924 |
|
|
INTEGER NPLA, NCHA, LENSEV |
925 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
926 |
|
|
INTEGER merror(4) |
927 |
|
|
integer*2 e2(4) |
928 |
|
|
INTEGER contr |
929 |
kusanagi |
1.6 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
930 |
kusanagi |
1.3 |
|
931 |
|
|
|
932 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
933 |
|
|
& calDSPtaberr(4), calevnum(4) |
934 |
|
|
|
935 |
|
|
|
936 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
937 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
938 |
|
|
REAL calpuls(4,11,96) |
939 |
|
|
REAL dedx(11,96), basse(11,6), dedxc(11,96) |
940 |
kusanagi |
1.8 |
real perror(4) |
941 |
|
|
integer stwerr(4) |
942 |
kusanagi |
1.3 |
|
943 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
944 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
945 |
|
|
& calselftrig,calIItrig, |
946 |
|
|
& calstripshit,calDSPtaberr,calevnum |
947 |
|
|
|
948 |
|
|
save / evento / |
949 |
|
|
|
950 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
951 |
|
|
& calbase, |
952 |
|
|
& calvar, |
953 |
|
|
& calpuls |
954 |
|
|
|
955 |
|
|
save / calib / |
956 |
|
|
|
957 |
|
|
c |
958 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
959 |
kusanagi |
1.3 |
SAVE / VARIE / |
960 |
|
|
|
961 |
|
|
C |
962 |
|
|
C |
963 |
|
|
C |
964 |
|
|
DO I = 1,11 |
965 |
|
|
DO J = 1,96 |
966 |
|
|
DEDX(I,J) = 0. |
967 |
|
|
ENDDO |
968 |
|
|
ENDDO |
969 |
|
|
C |
970 |
kusanagi |
1.6 |
k = inf |
971 |
kusanagi |
1.3 |
do i = 1,11 |
972 |
|
|
do j = 1,96 |
973 |
|
|
dedx(i,j) = vect(k) |
974 |
|
|
k = k + 1 |
975 |
|
|
enddo |
976 |
|
|
enddo |
977 |
|
|
C |
978 |
|
|
call CALCOMPRESS(vect,k,sup,dedxc,basse) |
979 |
kusanagi |
1.6 |
C |
980 |
|
|
10 FORMAT(2X,'Status word:',2X,Z8) |
981 |
kusanagi |
1.3 |
|
982 |
|
|
RETURN |
983 |
|
|
END |
984 |
|
|
|
985 |
|
|
|
986 |
|
|
C------------------------------------------------ |
987 |
|
|
SUBROUTINE CONTAER(ve,er) |
988 |
|
|
C------------------------------------------------ |
989 |
|
|
|
990 |
|
|
IMPLICIT NONE |
991 |
|
|
|
992 |
|
|
INTEGER*2 VE, st4 |
993 |
|
|
C |
994 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) |
995 |
kusanagi |
1.3 |
C |
996 |
|
|
INTEGER er, l, bit, bi, iev,iev2 |
997 |
|
|
C |
998 |
|
|
INTEGER NPLA, NCHA, LENSEV |
999 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1000 |
|
|
INTEGER merror(4) |
1001 |
|
|
integer*2 e2(4) |
1002 |
|
|
INTEGER contr |
1003 |
kusanagi |
1.6 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1004 |
kusanagi |
1.3 |
|
1005 |
|
|
|
1006 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
1007 |
|
|
& calDSPtaberr(4), calevnum(4) |
1008 |
|
|
|
1009 |
|
|
|
1010 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
1011 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
1012 |
|
|
REAL calpuls(4,11,96) |
1013 |
kusanagi |
1.8 |
real perror(4) |
1014 |
|
|
integer stwerr(4) |
1015 |
kusanagi |
1.3 |
|
1016 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
1017 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1018 |
|
|
& calselftrig,calIItrig, |
1019 |
|
|
& calstripshit,calDSPtaberr,calevnum |
1020 |
|
|
|
1021 |
|
|
save / evento / |
1022 |
|
|
|
1023 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
1024 |
|
|
& calbase, |
1025 |
|
|
& calvar, |
1026 |
|
|
& calpuls |
1027 |
|
|
|
1028 |
|
|
save / calib / |
1029 |
|
|
|
1030 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
1031 |
kusanagi |
1.3 |
SAVE / VARIE / |
1032 |
|
|
|
1033 |
|
|
|
1034 |
|
|
st4 = 0 |
1035 |
|
|
st4 = IAND(ve,'00FF'x) |
1036 |
|
|
if (st4.ne.0) then |
1037 |
|
|
do bit=0, 6 |
1038 |
|
|
bi = ibits(st4,bit,1) |
1039 |
|
|
if (bi.ne.0) then |
1040 |
|
|
er = er + 1 |
1041 |
|
|
endif |
1042 |
|
|
enddo |
1043 |
|
|
endif |
1044 |
|
|
|
1045 |
|
|
10 FORMAT(2X,'Status word:',2X,Z4) |
1046 |
|
|
return |
1047 |
|
|
end |
1048 |
|
|
|
1049 |
|
|
|
1050 |
|
|
C------------------------------------------------ |
1051 |
|
|
SUBROUTINE MINERR(ic,icsave,chi,min,co) |
1052 |
|
|
C------------------------------------------------ |
1053 |
|
|
|
1054 |
|
|
IMPLICIT NONE |
1055 |
|
|
C |
1056 |
|
|
INTEGER ic, icsave(1000), chi(1000) |
1057 |
|
|
integer l, st, min,co |
1058 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) |
1059 |
kusanagi |
1.3 |
C |
1060 |
|
|
INTEGER iev,iev2 |
1061 |
|
|
C |
1062 |
|
|
INTEGER NPLA, NCHA, LENSEV |
1063 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1064 |
|
|
INTEGER merror(4) |
1065 |
|
|
integer*2 e2(4) |
1066 |
|
|
INTEGER contr |
1067 |
kusanagi |
1.6 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1068 |
kusanagi |
1.3 |
|
1069 |
|
|
|
1070 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
1071 |
|
|
& calDSPtaberr(4), calevnum(4) |
1072 |
|
|
|
1073 |
|
|
|
1074 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
1075 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
1076 |
|
|
REAL calpuls(4,11,96) |
1077 |
kusanagi |
1.8 |
real perror(4) |
1078 |
|
|
integer stwerr(4) |
1079 |
kusanagi |
1.3 |
|
1080 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
1081 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1082 |
|
|
& calselftrig,calIItrig, |
1083 |
|
|
& calstripshit,calDSPtaberr,calevnum |
1084 |
|
|
|
1085 |
|
|
save / evento / |
1086 |
|
|
|
1087 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
1088 |
|
|
& calbase, |
1089 |
|
|
& calvar, |
1090 |
|
|
& calpuls |
1091 |
|
|
|
1092 |
|
|
save / calib / |
1093 |
|
|
c |
1094 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
1095 |
kusanagi |
1.3 |
SAVE / VARIE / |
1096 |
|
|
|
1097 |
|
|
st = chi(1) |
1098 |
|
|
min = 1 |
1099 |
|
|
if (co.gt.1) then |
1100 |
|
|
do l = 2, co |
1101 |
|
|
if (chi(l).lt.st) then |
1102 |
|
|
st = chi(l) |
1103 |
|
|
min = l |
1104 |
|
|
endif |
1105 |
|
|
enddo |
1106 |
|
|
endif |
1107 |
|
|
ic = icsave(min) |
1108 |
|
|
|
1109 |
|
|
return |
1110 |
|
|
end |
1111 |
kusanagi |
1.7 |
|
1112 |
|
|
C----------------------------------------------------- |
1113 |
|
|
SUBROUTINE CANCTUTTO |
1114 |
|
|
C----------------------------------------------------- |
1115 |
|
|
|
1116 |
|
|
IMPLICIT NONE |
1117 |
|
|
C |
1118 |
|
|
INTEGER iev,iev2 |
1119 |
|
|
C |
1120 |
|
|
INTEGER NPLA, NCHA, LENSEV |
1121 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1122 |
|
|
INTEGER merror(4) |
1123 |
|
|
integer*2 e2(4) |
1124 |
|
|
INTEGER contr |
1125 |
|
|
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1126 |
|
|
|
1127 |
|
|
|
1128 |
|
|
real calselftrig(4,7), calIItrig(4), calstripshit(4), |
1129 |
|
|
& calDSPtaberr(4), calevnum(4) |
1130 |
|
|
|
1131 |
|
|
|
1132 |
|
|
REAL calped(4,11,96), calgood(4,11,96), calthr(4,11,6) |
1133 |
|
|
REAL calrms(4,11,96), calbase(4,11,6), calvar(4,11,6) |
1134 |
|
|
REAL calpuls(4,11,96) |
1135 |
kusanagi |
1.8 |
real perror(4) |
1136 |
|
|
integer stwerr(4) |
1137 |
kusanagi |
1.7 |
|
1138 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
1139 |
kusanagi |
1.7 |
& dexy,dexyc,base, |
1140 |
|
|
& calselftrig,calIItrig, |
1141 |
|
|
& calstripshit,calDSPtaberr,calevnum |
1142 |
|
|
|
1143 |
|
|
save / evento / |
1144 |
|
|
|
1145 |
|
|
COMMON / calib / IEV2, calped, calgood, calthr, calrms, |
1146 |
|
|
& calbase, |
1147 |
|
|
& calvar, |
1148 |
|
|
& calpuls |
1149 |
|
|
|
1150 |
|
|
save / calib / |
1151 |
|
|
c |
1152 |
kusanagi |
1.8 |
COMMON / VARIE / merror, CONTR, e2 |
1153 |
kusanagi |
1.7 |
SAVE / VARIE / |
1154 |
|
|
C |
1155 |
|
|
call azero(calped,4*11*96) |
1156 |
|
|
call azero(calgood,4*11*96) |
1157 |
|
|
call azero(calthr,4*11*96) |
1158 |
|
|
call azero(calrms,4*11*96) |
1159 |
|
|
call azero(calbase,4*11*6) |
1160 |
|
|
call azero(calvar,4*11*6) |
1161 |
|
|
call azero(calpuls,4*11*96) |
1162 |
|
|
call azero(dexy,4*11*96) |
1163 |
|
|
call azero(dexyc,4*11*96) |
1164 |
|
|
call azero(base,4*11*6) |
1165 |
|
|
call azero(calselftrig,4*7) |
1166 |
|
|
call azero(calIItrig,4) |
1167 |
|
|
call azero(calstripshit,4) |
1168 |
|
|
call azero(calDSPtaberr,4) |
1169 |
|
|
call azero(calevnum,4) |
1170 |
|
|
c |
1171 |
|
|
return |
1172 |
|
|
end |