1 |
kusanagi |
1.8 |
C |
2 |
kusanagi |
2.2 |
C Written by Emiliano Mocchiutti and Mirko Boezio |
3 |
kusanagi |
1.8 |
C |
4 |
kusanagi |
2.5 |
C * Version: 3.4.01 * |
5 |
kusanagi |
1.9 |
C |
6 |
kusanagi |
2.2 |
C Changelog: |
7 |
|
|
C |
8 |
kusanagi |
2.6 |
C 3.4.01 - 3.4.02: (2004-12-10) cleanup of the code and changed sections order. |
9 |
|
|
C |
10 |
kusanagi |
2.5 |
C 3.4.00 - 3.4.01: (2004-11-26) CA50 comes after Strips Hit, fixed. |
11 |
|
|
C |
12 |
|
|
C 3.3.03 - 3.4.00: (2004-11-08) changed the DSP program hence changed calunpack |
13 |
|
|
C to better find the calorimeter sections. |
14 |
|
|
C |
15 |
|
|
C 3.3.02 - 3.3.03: (2004-11-08) changes in the commons (one more common for |
16 |
|
|
C calpulse and from calstripshit to calstriphit). |
17 |
|
|
C |
18 |
|
|
C 3.3.01 - 3.3.02: (2004-10-19) italian name of subroutines translated to |
19 |
|
|
C english. Forgot to clear vector in case of CRC errors, |
20 |
|
|
C fixed. stwerr is integer not real! fixed |
21 |
|
|
C |
22 |
kusanagi |
2.4 |
C 3.3.00 - 3.3.01: (2004-10-18) forgot to clear stwerr if no sections are found |
23 |
|
|
C fixed. |
24 |
|
|
C |
25 |
kusanagi |
2.2 |
C 3.2.00 - 3.3.00: (2004-10-15) enanched search of sections in case of one or |
26 |
|
|
C more missing sections. |
27 |
|
|
C Switched to c function "fillin" to create calorimeter words |
28 |
|
|
C instead of fortran function "riempi": great improvement in |
29 |
|
|
C time processing!! |
30 |
|
|
C |
31 |
|
|
C 3.1.00 - 3.2.00: (2004-10-13) forget to clean some variables, fixed. |
32 |
|
|
C Reprocess event in the case we have CRC errors and a high |
33 |
|
|
C number of error trying to understand the kind of event |
34 |
|
|
C we are processing (raw, compress, full mode) in order to |
35 |
kusanagi |
2.4 |
C distinguish better the four section.The reprocessing happens |
36 |
kusanagi |
2.2 |
C on about the 30% of events with CRC errors (in the case of |
37 |
|
|
C file 040827_005 the reprocessing is done on about 2% of all |
38 |
|
|
C the events). |
39 |
|
|
C |
40 |
|
|
C 3.0.00 - 3.1.00: (2004-10-12) cleanup and speedup of the code, less loops |
41 |
|
|
C same strength in finding the calorimeter sections. |
42 |
|
|
C |
43 |
|
|
C 2.18.4 - 3.0.00: (2004-10-07) major changes in the procedure to find the |
44 |
|
|
C calorimeter sections and enhanced search in the case of |
45 |
|
|
c CRC errors (to fix a bug which made the misunderstanding |
46 |
|
|
C some kind of CRC errors with missing sections). |
47 |
|
|
C Clean up unused variables, speeded up some loops. |
48 |
|
|
C Zero length input vector error added. |
49 |
|
|
C Enhanced search of the first section recorded since the |
50 |
|
|
C starting point is very important to correctly find and |
51 |
|
|
C interpret all the other sections. |
52 |
|
|
C If section length is absurd and the CRC header bit = 0 |
53 |
|
|
C then search again for that section (needed to make a |
54 |
|
|
C better search of section when in presence of CRC errors) |
55 |
|
|
C Search all the sections and if you reach the end of vector |
56 |
|
|
C (EOV) continue searching if you haven't find all the four |
57 |
|
|
C section (and go out without looping if no section is |
58 |
|
|
C present). |
59 |
kusanagi |
2.1 |
C |
60 |
|
|
C 2.18.3 - 2.18.4: consider a bad thing if you find a section in the wrong |
61 |
|
|
C position of the vector and try again to |
62 |
|
|
C find the real data (if they exist). |
63 |
|
|
C |
64 |
|
|
C 2.18.2 - 2.18.3: vectors belonging to common must be cleared if the calo |
65 |
|
|
C isn't found. Fixed. |
66 |
kusanagi |
1.8 |
C |
67 |
kusanagi |
2.1 |
C 2.18.1 - 2.18.2: fixed unclearing error codes if the program doesn't find |
68 |
|
|
C the calorimeter where it should be but shifted somewhere |
69 |
kusanagi |
2.2 |
C else forgotten to clear st2c variable: fixed |
70 |
kusanagi |
2.1 |
C exit error code wrong in some cases: fixed |
71 |
kusanagi |
2.2 |
C self trigger data not saved: fixed. |
72 |
kusanagi |
2.1 |
C |
73 |
|
|
C 2.18.0 - 2.18.1: small changes in the common varie to fix a memory leak; |
74 |
kusanagi |
2.2 |
C fixed an error in reporting error codes (stwerr,pwerror). |
75 |
kusanagi |
2.1 |
C |
76 |
kusanagi |
2.2 |
C 2.17.0 - 2.18.0: corrected bug which made unable the program to find CRC |
77 |
|
|
C errors in the last section of the calorimeter; |
78 |
|
|
C added a "debugging" option to dump to standard output |
79 |
|
|
C the whole packet in hexadecimal format and other |
80 |
|
|
C useful informations. To activate it the dump variable |
81 |
|
|
C in the common varie must be passed with the value |
82 |
|
|
C of iev you want to check. Do nothing if you don't want |
83 |
|
|
C any output. |
84 |
kusanagi |
1.9 |
C |
85 |
kusanagi |
1.3 |
C------------------------------------------------ |
86 |
kusanagi |
1.7 |
SUBROUTINE CALUNPACK(vecta,lung,me) |
87 |
kusanagi |
1.3 |
C------------------------------------------------ |
88 |
|
|
|
89 |
|
|
IMPLICIT NONE |
90 |
|
|
C |
91 |
kusanagi |
2.2 |
C PARAMETERS DEFINITION |
92 |
|
|
C |
93 |
|
|
C START = WHERE TO START TO LOOK FOR THE CALORIMETER, IN WORDS |
94 |
|
|
C 1STSEC = MAXIMUM POSITION, IN BYTES, WHERE WE SUPPOSE TO FIND THE |
95 |
|
|
C HEADER OF THE FIRST SECTION |
96 |
kusanagi |
1.3 |
C |
97 |
kusanagi |
2.2 |
INTEGER START, SEC1ST |
98 |
kusanagi |
1.3 |
INTEGER NPLA, NCHA, LENSEV |
99 |
kusanagi |
2.2 |
INTEGER*2 ival |
100 |
|
|
C |
101 |
|
|
PARAMETER (START=50,SEC1ST=1200) |
102 |
kusanagi |
1.3 |
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
103 |
kusanagi |
2.2 |
PARAMETER (ival='FFFF'x) |
104 |
kusanagi |
1.3 |
C |
105 |
kusanagi |
2.2 |
C Normal variables definition |
106 |
kusanagi |
1.3 |
C |
107 |
kusanagi |
2.2 |
integer lung, SOGLIA0, SEC2ND |
108 |
kusanagi |
1.7 |
INTEGER*1 VECTA(lung) |
109 |
kusanagi |
1.9 |
INTEGER*2 vect(60000), test |
110 |
kusanagi |
1.6 |
integer*2 check, crc, e2(4) |
111 |
kusanagi |
2.2 |
INTEGER*2 length, length2 |
112 |
|
|
integer me, m, dumpo, finoa |
113 |
|
|
INTEGER merror(4), headcor, ichc, coco |
114 |
kusanagi |
2.6 |
INTEGER i, j, iev, min, st2c, bit, bi, lleng |
115 |
kusanagi |
2.2 |
INTEGER ic, k,l, ke, ic0, icsave, chi |
116 |
|
|
INTEGER hcchi(1000), hcic(1000),hcco |
117 |
|
|
INTEGER contr, isfull, israw, iscomp |
118 |
|
|
INTEGER inf, sup, em, icb |
119 |
kusanagi |
2.6 |
INTEGER XO, YO, XE, YE, icold |
120 |
kusanagi |
2.2 |
integer st1b, st2b, lunga, pari |
121 |
|
|
integer stwerr(4),yescbra, chis, esci, icprima |
122 |
|
|
integer seemcomp, seemfull, cberaw, yesisco, yesisfu,yesisra |
123 |
kusanagi |
2.5 |
integer ca50, ca50a, ca50b |
124 |
kusanagi |
2.2 |
C |
125 |
kusanagi |
1.3 |
real dedx1(11,96),dedx2(11,96),dedx3(11,96),dedx4(11,96) |
126 |
|
|
real dedx1c(11,96),dedx2c(11,96),dedx3c(11,96),dedx4c(11,96) |
127 |
|
|
real base1(11,6),base2(11,6),base3(11,6),base4(11,6) |
128 |
kusanagi |
2.2 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
129 |
kusanagi |
1.3 |
real auto(7) |
130 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
131 |
kusanagi |
1.3 |
& calDSPtaberr(4), calevnum(4) |
132 |
kusanagi |
2.2 |
real perror(4) |
133 |
|
|
C |
134 |
kusanagi |
2.5 |
DATA YE/246/ ! CODE_EV_R YE = 111 10110 |
135 |
kusanagi |
1.3 |
DATA YO/237/ ! CODE_EV_R YO = 111 01101 |
136 |
|
|
DATA XE/234/ ! CODE_EV_R XE = 111 01010 |
137 |
kusanagi |
2.5 |
DATA XO/241/ ! CODE_EV_R XO = 111 10001 |
138 |
kusanagi |
2.2 |
C |
139 |
kusanagi |
2.6 |
COMMON / evento / iev, stwerr, perror, |
140 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
141 |
|
|
& calselftrig,calIItrig, |
142 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
143 |
kusanagi |
1.3 |
save / evento / |
144 |
kusanagi |
2.2 |
C |
145 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
146 |
kusanagi |
2.2 |
SAVE / VARIE / |
147 |
kusanagi |
1.3 |
C |
148 |
|
|
C Begin ! |
149 |
|
|
C |
150 |
kusanagi |
2.2 |
SOGLIA0 = 70 |
151 |
|
|
C |
152 |
|
|
C input length must be > 0, if not go out with error code 142 |
153 |
|
|
C |
154 |
kusanagi |
2.5 |
if (lung.le.0) then |
155 |
kusanagi |
2.2 |
if (dumpo.eq.iev) print *,'lung = ',lung |
156 |
|
|
do i=1,4 |
157 |
|
|
merror(i)=142 |
158 |
|
|
enddo |
159 |
|
|
goto 999 |
160 |
|
|
endif |
161 |
|
|
C |
162 |
|
|
C no debug informations |
163 |
|
|
C |
164 |
kusanagi |
2.1 |
if (dumpo.eq.0) dumpo=-1 |
165 |
kusanagi |
2.2 |
C |
166 |
|
|
C DEBUG: PRINT OUT THE INPUT VECTOR |
167 |
|
|
C |
168 |
kusanagi |
2.1 |
if (iev.eq.dumpo) then |
169 |
kusanagi |
1.9 |
do l=1,lung |
170 |
|
|
write(*,17)l,vecta(l) |
171 |
|
|
enddo |
172 |
|
|
endif |
173 |
kusanagi |
2.2 |
C |
174 |
|
|
C DETERMINE LENGTH IN WORDS FROM LENGTH IN BYTES |
175 |
|
|
C |
176 |
kusanagi |
1.7 |
IF (MOD(LUNG,2).EQ.0) THEN |
177 |
|
|
lunga = lung / 2 |
178 |
|
|
pari = 1 |
179 |
|
|
else |
180 |
|
|
lunga = int(lung/2) + 1 |
181 |
|
|
endif |
182 |
kusanagi |
2.2 |
SEC2ND = LUNGA |
183 |
|
|
C |
184 |
|
|
C IS LENGTH IS TOO LONG? |
185 |
|
|
C |
186 |
kusanagi |
2.1 |
if (lunga.gt.60000.and.dumpo.gt.0) then |
187 |
kusanagi |
1.9 |
print *,'Calorimeter WARNING: more than 60000 words!' |
188 |
|
|
lunga = 60000 |
189 |
kusanagi |
1.6 |
endif |
190 |
kusanagi |
2.2 |
C |
191 |
|
|
C PRE-CLEAR VARIABLES |
192 |
|
|
C |
193 |
|
|
yesisco = 0 |
194 |
|
|
yesisfu = 0 |
195 |
|
|
yesisra = 0 |
196 |
|
|
yescbra = 0 |
197 |
|
|
C |
198 |
|
|
1 CONTINUE |
199 |
kusanagi |
1.5 |
c |
200 |
kusanagi |
2.2 |
C CLEAR VARIABLES |
201 |
|
|
C |
202 |
|
|
if (iev.lt.0.or.iev.gt.90000000) iev = 0 |
203 |
|
|
esci = 0 |
204 |
|
|
chi = 0 |
205 |
|
|
chis = 0 |
206 |
|
|
min = 0 |
207 |
|
|
lleng = 0 |
208 |
|
|
m = 0 |
209 |
|
|
pari = 0 |
210 |
|
|
icb = 0 |
211 |
|
|
em = 0 |
212 |
|
|
coco = 0 |
213 |
|
|
me = 1 |
214 |
|
|
contr = 1 |
215 |
|
|
ic = 1 |
216 |
|
|
icsave = 0 |
217 |
|
|
C |
218 |
kusanagi |
2.5 |
call clearall |
219 |
kusanagi |
1.6 |
call azero(dedx1,11*96) |
220 |
|
|
call azero(dedx2,11*96) |
221 |
|
|
call azero(dedx3,11*96) |
222 |
|
|
call azero(dedx4,11*96) |
223 |
|
|
call azero(dedx1c,11*96) |
224 |
|
|
call azero(dedx2c,11*96) |
225 |
|
|
call azero(dedx3c,11*96) |
226 |
|
|
call azero(dedx4c,11*96) |
227 |
|
|
call azero(base1,11*6) |
228 |
|
|
call azero(base2,11*6) |
229 |
|
|
call azero(base3,11*6) |
230 |
|
|
call azero(base4,11*6) |
231 |
|
|
C |
232 |
kusanagi |
1.5 |
do l = 1,4 |
233 |
kusanagi |
2.1 |
e2(l) = 0 |
234 |
kusanagi |
1.8 |
perror(l) = 0. |
235 |
|
|
stwerr(l) = 0 |
236 |
kusanagi |
1.5 |
merror(l) = 0 |
237 |
|
|
enddo |
238 |
kusanagi |
2.2 |
C |
239 |
|
|
C DETERMINE WHERE TO START TO FIND THE CALORIMETER IN THE INBUT BUFFER |
240 |
|
|
C |
241 |
|
|
length2 = start |
242 |
kusanagi |
1.3 |
c |
243 |
|
|
20 continue |
244 |
kusanagi |
2.2 |
C |
245 |
kusanagi |
1.5 |
if (length2.ge.-2) then |
246 |
|
|
ic = ic + (2 * (length2 + 2)) |
247 |
|
|
else |
248 |
kusanagi |
2.1 |
if (dumpo.gt.0) |
249 |
kusanagi |
2.2 |
& print *,'Calorimeter WARNING: length errors ',ic,length2 |
250 |
kusanagi |
1.5 |
endif |
251 |
kusanagi |
2.2 |
C |
252 |
|
|
headcor = 0 |
253 |
|
|
ichc = ic |
254 |
|
|
icprima = ic |
255 |
|
|
hcco = 0 |
256 |
|
|
do i=1,1000 |
257 |
|
|
hcchi(i) = 0 |
258 |
|
|
hcic(i) = 0 |
259 |
|
|
enddo |
260 |
kusanagi |
1.5 |
c |
261 |
|
|
32 continue |
262 |
kusanagi |
2.2 |
C |
263 |
kusanagi |
1.3 |
ke = 0 |
264 |
kusanagi |
2.2 |
chis = chi |
265 |
kusanagi |
2.1 |
icold = ic |
266 |
kusanagi |
1.3 |
do while (ke.eq.0) |
267 |
|
|
C |
268 |
kusanagi |
2.2 |
C if (iev.eq.dumpo) print *,'parto da ',ic,contr |
269 |
|
|
C |
270 |
kusanagi |
1.3 |
C Check consistency of header. |
271 |
|
|
C it is composed by CODE+D# (8 bits) and by SATUS WORD (8 bits) |
272 |
|
|
c so we must split vect into the two components: |
273 |
|
|
C |
274 |
kusanagi |
1.5 |
st1b = 0 |
275 |
|
|
st2b = 0 |
276 |
kusanagi |
2.2 |
C |
277 |
|
|
C A CALORIMETER SECTION IS MADE OF AT LEAST 4 BYTES |
278 |
|
|
C IF WE HAVE NO ROOM FOR A SECTION GO OUT |
279 |
|
|
C |
280 |
|
|
if ((ic+4).gt.lung.or.esci.eq.1) then |
281 |
|
|
if (headcor.eq.1.and.contr.lt.5) then |
282 |
|
|
headcor=-1 |
283 |
|
|
ic=ichc |
284 |
|
|
goto 32 |
285 |
|
|
else |
286 |
|
|
if (headcor.eq.0.or.headcor.eq.2) then |
287 |
|
|
chi = chi + 8 * (5 - contr) |
288 |
|
|
endif |
289 |
|
|
merror(contr) = 129 |
290 |
kusanagi |
2.6 |
if (iev.eq.dumpo) print *,'put to zero here ',headcor |
291 |
kusanagi |
2.2 |
if (esci.eq.0) then |
292 |
|
|
ic = icsave |
293 |
|
|
else |
294 |
|
|
ic = icprima |
295 |
|
|
endif |
296 |
|
|
if (headcor.eq.2) then |
297 |
|
|
chi = chis |
298 |
|
|
endif |
299 |
|
|
esci = 0 |
300 |
|
|
headcor = 0 |
301 |
|
|
hcco = 0 |
302 |
|
|
ichc = 0 |
303 |
|
|
do i=1,1000 |
304 |
|
|
hcchi(i) = 0 |
305 |
|
|
hcic(i) = 0 |
306 |
|
|
enddo |
307 |
|
|
length2 = -2 |
308 |
|
|
lleng = 0 |
309 |
|
|
length = 0 |
310 |
|
|
goto 150 |
311 |
|
|
endif |
312 |
kusanagi |
1.7 |
endif |
313 |
kusanagi |
2.2 |
C |
314 |
|
|
C ST1B IS "CODE", ST2B IS "D#" |
315 |
|
|
C |
316 |
kusanagi |
1.5 |
do bit = 0, 7 |
317 |
|
|
bi = ibits(vecta(ic),bit,1) |
318 |
|
|
if (bi.eq.1) st1b = ibset(st1b,bit) |
319 |
|
|
bi = ibits(vecta(ic+1),bit,1) |
320 |
|
|
if (bi.eq.1) st2b = ibset(st2b,bit) |
321 |
|
|
enddo |
322 |
kusanagi |
1.6 |
c |
323 |
kusanagi |
2.2 |
C IC+2 AND IC+3 CONTAINS THE LENGTH OF THE CALORIMETER SECTION |
324 |
kusanagi |
1.6 |
c |
325 |
kusanagi |
1.5 |
length2 = 0 |
326 |
|
|
do bit=0, 7 |
327 |
|
|
bi = ibits(vecta(ic+3),bit,1) |
328 |
|
|
if (bi.eq.1) length2 = ibset(length2,bit) |
329 |
|
|
bi = ibits(vecta(ic+2),bit,1) |
330 |
|
|
if (bi.eq.1) length2 = ibset(length2,bit+8) |
331 |
kusanagi |
2.5 |
enddo |
332 |
|
|
C |
333 |
|
|
C calorimeter signature in DSP mode (CA50 CA50): |
334 |
|
|
C |
335 |
|
|
ca50 = 0 |
336 |
|
|
if (ic+24.lt.lung) then |
337 |
|
|
ca50a = 0 |
338 |
|
|
do bit=0, 7 |
339 |
|
|
bi = ibits(vecta(ic+23),bit,1) |
340 |
|
|
if (bi.eq.1) ca50a = ibset(ca50a,bit) |
341 |
|
|
bi = ibits(vecta(ic+22),bit,1) |
342 |
|
|
if (bi.eq.1) ca50a = ibset(ca50a,bit+8) |
343 |
|
|
enddo |
344 |
|
|
ca50b = 0 |
345 |
|
|
do bit=0, 7 |
346 |
|
|
bi = ibits(vecta(ic+25),bit,1) |
347 |
|
|
if (bi.eq.1) ca50b = ibset(ca50b,bit) |
348 |
|
|
bi = ibits(vecta(ic+24),bit,1) |
349 |
|
|
if (bi.eq.1) ca50b = ibset(ca50b,bit+8) |
350 |
|
|
enddo |
351 |
|
|
if (ca50a.eq.ca50b.and.ca50a.eq.51792) ca50 = 1 |
352 |
|
|
endif |
353 |
|
|
|
354 |
kusanagi |
2.2 |
C |
355 |
kusanagi |
1.3 |
c the crc should be at vect(length) with |
356 |
kusanagi |
2.2 |
C |
357 |
kusanagi |
1.5 |
length = length2 + 1 |
358 |
kusanagi |
1.3 |
C |
359 |
kusanagi |
2.2 |
c some checks to be sure we have found the calorimeter data: |
360 |
kusanagi |
1.3 |
c status word is always less then 129 |
361 |
|
|
c |
362 |
kusanagi |
1.5 |
if (st2b.gt.128) then |
363 |
|
|
length = 0 |
364 |
kusanagi |
2.2 |
length2 = 0 |
365 |
kusanagi |
1.5 |
goto 100 |
366 |
|
|
endif |
367 |
kusanagi |
1.3 |
c |
368 |
kusanagi |
2.2 |
c length of the packet IN WORDS must be less then HALF OF THE |
369 |
|
|
C LENGTH IN BYTES if noT THERE ARE SOME errors |
370 |
kusanagi |
1.3 |
c |
371 |
kusanagi |
2.2 |
bi = ibits(st2b,0,1) |
372 |
|
|
if (length2.gt.lunga.OR.LENGTH2.LE.0) then |
373 |
|
|
if (headcor.eq.2) then |
374 |
|
|
chi = chi + 4 |
375 |
|
|
endif |
376 |
kusanagi |
1.5 |
length = 0 |
377 |
kusanagi |
2.2 |
length2 = 0 |
378 |
kusanagi |
1.5 |
goto 100 |
379 |
|
|
endif |
380 |
|
|
c |
381 |
kusanagi |
1.3 |
e2(contr) = 0 |
382 |
|
|
C |
383 |
kusanagi |
2.2 |
if (CONTR.eq.1) then |
384 |
kusanagi |
1.3 |
c |
385 |
|
|
c is it the first section? |
386 |
|
|
c |
387 |
kusanagi |
2.5 |
if (st1b.eq.XE.and.(ca50.eq.1.or.length2.eq.1064)) then |
388 |
kusanagi |
1.3 |
c if so go out of this loop and go on recording data |
389 |
|
|
ke = 1 |
390 |
kusanagi |
2.2 |
icsave = ic |
391 |
|
|
m = ic |
392 |
|
|
call fillin(m,lunga,lleng,lung,pari,vect,vecta) |
393 |
|
|
C |
394 |
kusanagi |
1.5 |
icb = 1 |
395 |
kusanagi |
2.2 |
E2(contr) = vect(icb) |
396 |
|
|
if (headcor.eq.2) then |
397 |
|
|
if (coco.ne.1) then |
398 |
|
|
coco = 1 |
399 |
|
|
else |
400 |
|
|
coco = -1 |
401 |
|
|
endif |
402 |
|
|
if (st2b.ne.0) then |
403 |
kusanagi |
2.5 |
call counter(e2(contr),chi) |
404 |
kusanagi |
2.2 |
endif |
405 |
kusanagi |
1.3 |
endif |
406 |
kusanagi |
2.2 |
goto 100 |
407 |
kusanagi |
1.3 |
endif |
408 |
|
|
ENDIF |
409 |
|
|
C |
410 |
|
|
c the same for the second section, ... |
411 |
|
|
c |
412 |
|
|
if (CONTR.eq.2) then |
413 |
kusanagi |
2.5 |
if (st1b.eq.XO.and.(ca50.eq.1.or.length2.eq.1064)) then |
414 |
kusanagi |
2.2 |
ke = 2 |
415 |
|
|
icsave = ic |
416 |
kusanagi |
1.5 |
m = ic |
417 |
kusanagi |
2.2 |
call fillin(m,lunga,lleng,lung,pari,vect,vecta) |
418 |
kusanagi |
1.5 |
icb = 1 |
419 |
kusanagi |
2.2 |
E2(contr) = vect(icb) |
420 |
|
|
if (headcor.eq.2) then |
421 |
|
|
if (coco.ne.2) then |
422 |
|
|
coco = 2 |
423 |
|
|
else |
424 |
|
|
coco = -1 |
425 |
|
|
endif |
426 |
|
|
if ((ic-icold).ne.0) chi=chi+abs(ic-icold) |
427 |
|
|
if (st2b.ne.0) then |
428 |
kusanagi |
2.5 |
call counter(e2(contr),chi) |
429 |
kusanagi |
1.3 |
endif |
430 |
|
|
endif |
431 |
kusanagi |
2.2 |
goto 100 |
432 |
kusanagi |
1.3 |
endif |
433 |
|
|
ENDIF |
434 |
|
|
c |
435 |
|
|
C ... for the third,... |
436 |
|
|
c |
437 |
|
|
if (CONTR.eq.3) then |
438 |
kusanagi |
2.5 |
if (st1b.eq.YE.and.(ca50.eq.1.or.length2.eq.1064)) then |
439 |
kusanagi |
2.2 |
ke = 3 |
440 |
|
|
icsave = ic |
441 |
|
|
m = ic |
442 |
|
|
if (iev.eq.dumpo) then |
443 |
|
|
print *,'m,lunga,lleng,lung,pari',m,lunga,lleng,lung, |
444 |
|
|
& pari |
445 |
kusanagi |
1.3 |
endif |
446 |
kusanagi |
2.2 |
call fillin(m,lunga,lleng,lung,pari,vect,vecta) |
447 |
kusanagi |
1.5 |
icb = 1 |
448 |
kusanagi |
2.2 |
E2(contr) = vect(icb) |
449 |
|
|
if (iev.eq.dumpo) then |
450 |
|
|
print *,'headcor ',headcor |
451 |
|
|
write(*,22)vect(icb) |
452 |
|
|
print *,'m,lunga,lleng,lung,pari',m,lunga,lleng,lung, |
453 |
|
|
& pari |
454 |
kusanagi |
1.3 |
endif |
455 |
kusanagi |
2.2 |
if (headcor.eq.2) then |
456 |
|
|
if (coco.eq.3) then |
457 |
|
|
coco = 3 |
458 |
|
|
else |
459 |
|
|
coco = -1 |
460 |
|
|
endif |
461 |
|
|
if (ic-icold.ne.0) chi = chi + abs(ic-icold) |
462 |
|
|
if (st2b.ne.0) then |
463 |
kusanagi |
2.5 |
call counter(e2(contr),chi) |
464 |
kusanagi |
1.3 |
endif |
465 |
|
|
endif |
466 |
kusanagi |
2.2 |
goto 100 |
467 |
kusanagi |
1.3 |
endif |
468 |
|
|
ENDIF |
469 |
|
|
C |
470 |
|
|
c ...and for the last section. |
471 |
|
|
c |
472 |
|
|
if (CONTR.eq.4) then |
473 |
kusanagi |
2.5 |
if (st1b.eq.YO.and.(ca50.eq.1.or.length2.eq.1064)) then |
474 |
kusanagi |
2.2 |
ke = 4 |
475 |
|
|
icsave = ic |
476 |
kusanagi |
1.5 |
m = ic |
477 |
kusanagi |
2.2 |
call fillin(m,lunga,lleng,lung,pari,vect,vecta) |
478 |
kusanagi |
1.5 |
icb = 1 |
479 |
kusanagi |
2.2 |
E2(contr) = vect(icb) |
480 |
|
|
if (headcor.eq.2) then |
481 |
|
|
if (coco.eq.4) then |
482 |
|
|
coco = 4 |
483 |
|
|
else |
484 |
|
|
coco = -1 |
485 |
|
|
endif |
486 |
|
|
if ((ic-icold).ne.0) chi = chi + abs(ic-icold) |
487 |
|
|
if (st2b.ne.0) then |
488 |
kusanagi |
2.5 |
call counter(e2(contr),chi) |
489 |
kusanagi |
2.2 |
endif |
490 |
kusanagi |
1.3 |
endif |
491 |
kusanagi |
1.5 |
goto 100 |
492 |
kusanagi |
1.3 |
endif |
493 |
|
|
endif |
494 |
kusanagi |
2.2 |
C |
495 |
|
|
if (contr.gt.4) then |
496 |
kusanagi |
2.6 |
if (iev.eq.dumpo) print *,'go out here' |
497 |
kusanagi |
2.2 |
headcor = 0 |
498 |
|
|
hcco = 0 |
499 |
|
|
ichc = 0 |
500 |
|
|
do i=1,1000 |
501 |
|
|
hcchi(i) = 0 |
502 |
|
|
hcic(i) = 0 |
503 |
|
|
enddo |
504 |
|
|
goto 200 |
505 |
|
|
endif |
506 |
kusanagi |
1.3 |
C |
507 |
|
|
100 CONTINUE |
508 |
|
|
c |
509 |
|
|
c increment vector of one searching for the next section |
510 |
|
|
c |
511 |
|
|
ic = ic + 1 |
512 |
|
|
c |
513 |
|
|
enddo |
514 |
|
|
C |
515 |
|
|
c format not used |
516 |
|
|
c |
517 |
kusanagi |
1.7 |
10 FORMAT(2X,'Error for view:',2X,I1,2X,'Status word:',2X,Z4) |
518 |
|
|
11 FORMAT(2X,'View or command not recognized for view:',2X,I1,2X, |
519 |
|
|
& 'Status word:',2X,Z4) |
520 |
|
|
12 FORMAT(2X,'Error - did NOT find view:',2X,I1) |
521 |
|
|
13 FORMAT(2X,'Error - eof reached, exiting') |
522 |
|
|
14 FORMAT(2X,I8,2X,I10) |
523 |
|
|
15 FORMAT(2X,I8,2X,Z8) |
524 |
kusanagi |
2.5 |
17 FORMAT(2X,'Element:',2X,I6,2X,' word:',2X,Z8) |
525 |
|
|
18 FORMAT(2X,'Element:',2X,I6,2X,' word:',2X,Z2,Z2) |
526 |
kusanagi |
1.9 |
21 FORMAT(2X,'CRC: ',2X,Z8) |
527 |
kusanagi |
2.2 |
22 FORMAT(2X,'vect(icb): ',2X,Z8) |
528 |
kusanagi |
1.9 |
C |
529 |
kusanagi |
1.3 |
c go on recording data |
530 |
kusanagi |
1.7 |
ic = ic - 1 |
531 |
kusanagi |
2.2 |
c |
532 |
kusanagi |
1.7 |
c |
533 |
|
|
K = CONTR |
534 |
|
|
ic0 = icb |
535 |
|
|
icb = icb + 1 |
536 |
|
|
length = vect(icb) + 2 |
537 |
|
|
length2 = vect(icb) |
538 |
kusanagi |
1.8 |
lleng = (length*2) - 1 |
539 |
kusanagi |
1.3 |
C |
540 |
kusanagi |
2.2 |
C Check consistency of CRCs. |
541 |
|
|
C |
542 |
|
|
C |
543 |
|
|
C IF THE STATUS WORD HAS THE CRC BIT ON AND WE ARE NOT IN THE |
544 |
|
|
C HEADCOR CASE 0 (WE WERE BELIEVING THE SECTION FOUND WAS FINE) |
545 |
|
|
C |
546 |
|
|
if ((ibits(e2(contr),0,1).ne.0.or. |
547 |
|
|
& (ibits(e2(contr),3,1).eq.1.and.length2.ne.1064)) |
548 |
|
|
& .and.headcor.EQ.0) then |
549 |
|
|
headcor = 1 |
550 |
|
|
ichc = ic - 1 |
551 |
|
|
if (iev.eq.dumpo) print *,'crc st word wrong',ic,ichc,headcor |
552 |
|
|
endif |
553 |
|
|
C |
554 |
|
|
C HEADOCR = 1 MEANS SEARCH AGAIN FOR THAT SECTION |
555 |
kusanagi |
1.3 |
C |
556 |
kusanagi |
2.2 |
if (headcor.eq.1) then |
557 |
|
|
hcco = hcco + 1 |
558 |
|
|
if (st2b.ne.0) then |
559 |
kusanagi |
2.5 |
call counter(e2(contr),hcchi(hcco)) |
560 |
kusanagi |
2.2 |
endif |
561 |
|
|
C |
562 |
|
|
if (contr.gt.1.or.yesisco.ne.0.or.yesisfu.ne.0 |
563 |
|
|
& .or.yesisra.ne.0.or.yescbra.ne.0) then |
564 |
|
|
iscomp = 0 |
565 |
|
|
isfull = 0 |
566 |
|
|
israw = 0 |
567 |
|
|
if (yesisco.ne.0.or.yesisfu.ne.0 |
568 |
|
|
& .or.yesisra.ne.0.or.yescbra.ne.0) then |
569 |
|
|
if (yesisra.ne.0.or.yescbra.ne.0) israw = 2 |
570 |
|
|
if (yesisco.ne.0) iscomp = 2 |
571 |
|
|
if (yesisfu.ne.0) isfull = 2 |
572 |
|
|
else |
573 |
|
|
i = 1 |
574 |
|
|
do while(iscomp.eq.0.and.isfull.eq.0.and.israw.eq.0.and. |
575 |
|
|
& i.lt.(contr-1)) |
576 |
|
|
if (ibits(stwerr(i),16,1).eq.1) iscomp = iscomp + 1 |
577 |
|
|
if (ibits(stwerr(i),17,1).eq.1) isfull = isfull + 1 |
578 |
|
|
if (ibits(e2(i),3,1).eq.1.and.merror(i).eq.0) |
579 |
|
|
& israw = israw + 1 |
580 |
|
|
i = i + 1 |
581 |
|
|
enddo |
582 |
|
|
endif |
583 |
|
|
c |
584 |
|
|
c how does this section look like? (note that in case of crc errors |
585 |
|
|
c this test has no value...) |
586 |
|
|
c |
587 |
kusanagi |
2.5 |
test = vect(icb+12) |
588 |
kusanagi |
2.2 |
seemcomp = 0 |
589 |
|
|
seemfull = 0 |
590 |
|
|
if (test.eq.ival) then |
591 |
|
|
seemcomp = 1 |
592 |
|
|
elseif (test.eq.0) then |
593 |
|
|
seemfull = 1 |
594 |
|
|
endif |
595 |
|
|
c |
596 |
|
|
c if a previous good section was raw and this header we are analyzing |
597 |
|
|
c is not raw something strange is happening, add a weight. |
598 |
|
|
c |
599 |
|
|
if ((israw.ne.0.and.ibits(e2(contr),3,1).ne.1) |
600 |
|
|
& .or.(israw.ne.0.and.length2.ne.1064)) then |
601 |
|
|
hcco = hcco - 1 |
602 |
|
|
length=0 |
603 |
|
|
length2=0 |
604 |
|
|
lleng=0 |
605 |
|
|
ic = ic + 1 |
606 |
|
|
if (iev.eq.dumpo) |
607 |
|
|
& print *,'not raw, search again ',ic,ichc,headcor |
608 |
|
|
goto 32 |
609 |
|
|
endif |
610 |
|
|
c |
611 |
|
|
c the same with compress and full mode |
612 |
|
|
c |
613 |
|
|
if ((iscomp.ne.0.or.isfull.ne.0) |
614 |
|
|
& .and.ibits(e2(contr),3,1).eq.1) then |
615 |
|
|
hcco = hcco - 1 |
616 |
|
|
length=0 |
617 |
|
|
length2=0 |
618 |
|
|
lleng=0 |
619 |
|
|
ic = ic + 1 |
620 |
|
|
if (iev.eq.dumpo) |
621 |
|
|
& print *,'raw in full or compress mode, search again ',ic,ichc, |
622 |
|
|
& headcor |
623 |
|
|
goto 32 |
624 |
|
|
endif |
625 |
|
|
|
626 |
|
|
if (iscomp.ne.0.and.(ibits(e2(contr),3,1).eq.1.or. |
627 |
|
|
& seemcomp.eq.0)) hcchi(hcco) = hcchi(hcco) + 2 |
628 |
|
|
if (isfull.ne.0.and.(ibits(e2(contr),3,1).eq.1.or. |
629 |
|
|
& seemfull.eq.0)) hcchi(hcco) = hcchi(hcco) + 2 |
630 |
|
|
endif |
631 |
|
|
C |
632 |
|
|
if (ibits(e2(contr),3,1).eq.1.and.length2.eq.1064) then |
633 |
|
|
hcchi(hcco) = hcchi(hcco) - 2 |
634 |
|
|
elseif ((ibits(e2(contr),3,1).eq.1.or.israw.ne.0) |
635 |
|
|
& .and.length2.ne.1064) then |
636 |
|
|
hcco = hcco - 1 |
637 |
|
|
length=0 |
638 |
|
|
length2=0 |
639 |
|
|
lleng=0 |
640 |
|
|
ic = ic + 1 |
641 |
|
|
if (iev.eq.dumpo) |
642 |
|
|
& print *,'raw bit not raw length, search again ',ic,ichc,headcor |
643 |
|
|
goto 32 |
644 |
|
|
endif |
645 |
|
|
C |
646 |
|
|
hcic(hcco) = ic |
647 |
|
|
ic = ic + 1 |
648 |
|
|
length=0 |
649 |
|
|
length2=0 |
650 |
|
|
lleng=0 |
651 |
|
|
if (iev.eq.dumpo) print *,'search again ',ic,ichc,headcor |
652 |
|
|
goto 32 |
653 |
|
|
endif |
654 |
|
|
C |
655 |
|
|
C HEADCOR = - 1 MEANS STOP SEARCHING FOR THAT SECTION, SELECT |
656 |
|
|
C THE CASE WITH LESS ERRORS, FOUND THAT SECTION AND GIVE |
657 |
|
|
C HEADCOR = 2 (I.E. GO OUT OF THE LOOP) |
658 |
|
|
C |
659 |
|
|
if (headcor.eq.-1) then |
660 |
kusanagi |
2.6 |
if (iev.eq.dumpo) print *,'enter -1, ',hcco,ke |
661 |
kusanagi |
2.2 |
headcor = 2 |
662 |
|
|
if (ke.le.2.and.hcco.ge.1) then |
663 |
|
|
finoa = 0 |
664 |
|
|
do i = 1, hcco |
665 |
|
|
if (ke.eq.1.and.hcic(i).lt.SEC1ST) finoa = i |
666 |
|
|
if (ke.eq.2.and.hcic(i).lt.SEC2ND) finoa = i |
667 |
|
|
enddo |
668 |
|
|
if (finoa.eq.0) then |
669 |
|
|
esci = 1 |
670 |
|
|
if (iev.eq.dumpo) |
671 |
|
|
& print *,'finoa=0! no possible solutions ' |
672 |
|
|
else |
673 |
|
|
if (iev.eq.dumpo) print *,'ke = ',ke,' and hcco>1 ',finoa |
674 |
|
|
call minerr(ic,hcic,hcchi,min,finoa) |
675 |
|
|
endif |
676 |
|
|
else |
677 |
|
|
if (hcco.eq.0) then |
678 |
|
|
esci = 1 |
679 |
|
|
if (iev.eq.dumpo) |
680 |
|
|
& print *,'hcco=0! no possible solutions' |
681 |
|
|
else |
682 |
|
|
call minerr(ic,hcic,hcchi,min,hcco) |
683 |
|
|
endif |
684 |
|
|
endif |
685 |
|
|
e2(contr) = 0 |
686 |
|
|
if (iev.eq.dumpo) then |
687 |
|
|
print *,'stop searching' |
688 |
|
|
print *,'ic,hcic(min),min,... ',ic,hcic(min),min, |
689 |
|
|
& hcchi(min),hcco,coco |
690 |
|
|
do i=1,hcco |
691 |
|
|
print *,'i, hcchi ',i,hcchi(i) |
692 |
|
|
enddo |
693 |
|
|
endif |
694 |
|
|
c |
695 |
|
|
length=0 |
696 |
|
|
length2=0 |
697 |
|
|
lleng=0 |
698 |
|
|
goto 32 |
699 |
|
|
endif |
700 |
|
|
C |
701 |
|
|
C determine the type of data if not raw (compress or full) |
702 |
|
|
C |
703 |
|
|
if (headcor.eq.0.or.headcor.eq.2 |
704 |
|
|
& .and.ibits(e2(contr),3,1).ne.1) then |
705 |
kusanagi |
2.5 |
test = vect(icb+12) |
706 |
kusanagi |
2.2 |
seemcomp = 0 |
707 |
|
|
seemfull = 0 |
708 |
|
|
if (test.eq.ival) then |
709 |
kusanagi |
2.5 |
C |
710 |
kusanagi |
2.2 |
C compress mode |
711 |
kusanagi |
2.5 |
C |
712 |
kusanagi |
2.2 |
stwerr(contr) = ibset(stwerr(contr),16) |
713 |
|
|
elseif (test.eq.0) then |
714 |
|
|
C |
715 |
kusanagi |
2.5 |
C full mode |
716 |
|
|
C |
717 |
kusanagi |
2.2 |
stwerr(contr) = ibset(stwerr(contr),17) |
718 |
|
|
endif |
719 |
|
|
endif |
720 |
|
|
C |
721 |
|
|
hcco = 0 |
722 |
|
|
ichc = 0 |
723 |
kusanagi |
2.1 |
check = 0 |
724 |
kusanagi |
2.2 |
do i=1,1000 |
725 |
|
|
hcchi(i) = 0 |
726 |
|
|
hcic(i) = 0 |
727 |
|
|
enddo |
728 |
kusanagi |
1.7 |
inf = ic0 |
729 |
|
|
sup = length - 1 |
730 |
|
|
do i = inf,sup |
731 |
|
|
check=crc(check,vect(i)) |
732 |
|
|
enddo |
733 |
kusanagi |
2.2 |
C |
734 |
kusanagi |
2.1 |
if (iev.eq.dumpo) write(*,21)vect(length) |
735 |
|
|
if (iev.eq.dumpo) write(*,21)check |
736 |
kusanagi |
2.2 |
C |
737 |
kusanagi |
1.7 |
if (check.ne.vect(length)) then |
738 |
|
|
merror(contr) = 132 |
739 |
kusanagi |
2.2 |
chi = chi + 4 |
740 |
kusanagi |
1.7 |
lleng = 0 |
741 |
kusanagi |
2.2 |
length2 = 0 |
742 |
|
|
length = 0 |
743 |
kusanagi |
2.5 |
C |
744 |
|
|
C clear vectors of that section in the common |
745 |
|
|
C |
746 |
|
|
call clearsec |
747 |
|
|
C |
748 |
kusanagi |
2.2 |
if (ke.eq.1.and.headcor.ne.2) then |
749 |
|
|
ic = 10 |
750 |
|
|
elseif (headcor.eq.2) then |
751 |
|
|
contr = contr + 1 |
752 |
kusanagi |
1.8 |
endif |
753 |
kusanagi |
2.2 |
headcor = 1 |
754 |
|
|
ichc = ic - 1 |
755 |
|
|
if (iev.eq.dumpo) |
756 |
kusanagi |
2.6 |
& print *,'crc is wrong ',ic, |
757 |
|
|
& ' search section ',contr,' coco = ',coco |
758 |
kusanagi |
2.2 |
goto 32 |
759 |
|
|
else |
760 |
|
|
chi = chi - 4 |
761 |
|
|
if (chi.lt.0) chi = 0 |
762 |
kusanagi |
1.7 |
endif |
763 |
kusanagi |
2.2 |
C |
764 |
|
|
headcor = 0 |
765 |
kusanagi |
1.3 |
C |
766 |
kusanagi |
1.8 |
19 CONTINUE |
767 |
kusanagi |
2.2 |
C |
768 |
|
|
C Process data. |
769 |
|
|
C |
770 |
kusanagi |
2.5 |
call clearsec |
771 |
kusanagi |
2.2 |
do i = 1, 7 |
772 |
|
|
icb = icb + 1 |
773 |
|
|
auto(i) = vect(icb) |
774 |
|
|
enddo |
775 |
|
|
C |
776 |
|
|
st2c = 0 |
777 |
|
|
if (st2b.ne.0) then |
778 |
|
|
do bit=0, 6 |
779 |
|
|
bi = ibits(st2b,bit,1) |
780 |
|
|
if (bit.eq.3.and.bi.ne.0) st2c = 8 |
781 |
kusanagi |
1.3 |
enddo |
782 |
kusanagi |
2.2 |
endif |
783 |
kusanagi |
1.7 |
C |
784 |
kusanagi |
2.2 |
if (st2c.eq.8) then |
785 |
|
|
if (length2.ne.1064) then |
786 |
|
|
merror(contr) = 133 |
787 |
|
|
chi = chi + 4 |
788 |
|
|
if (iev.eq.dumpo) |
789 |
|
|
& print *,'raw lung 4' |
790 |
|
|
lleng = 0 |
791 |
|
|
goto 150 |
792 |
|
|
else |
793 |
kusanagi |
2.5 |
if (k.eq.1) call CALRAW(vect,icb+1,length-1,dedx1) |
794 |
kusanagi |
2.2 |
if (k.eq.2) call CALRAW(vect,icb+1,length-1,dedx2) |
795 |
|
|
if (k.eq.3) call CALRAW(vect,icb+1,length-1,dedx3) |
796 |
|
|
if (k.eq.4) call CALRAW(vect,icb+1,length-1,dedx4) |
797 |
kusanagi |
1.5 |
endif |
798 |
kusanagi |
2.2 |
goto 50 |
799 |
|
|
endif |
800 |
kusanagi |
1.7 |
C |
801 |
kusanagi |
2.2 |
41 FORMAT(2X,I2,2X,'word :',1x,z4) |
802 |
kusanagi |
2.5 |
test = vect(icb+5) |
803 |
kusanagi |
2.2 |
c |
804 |
|
|
if (test.eq.ival) then |
805 |
|
|
if (length2.gt.1201) then |
806 |
|
|
merror(contr) = 134 |
807 |
|
|
chi = chi + 4 |
808 |
|
|
if (iev.eq.dumpo) |
809 |
|
|
& print *,'compr lung 4' |
810 |
|
|
lleng = 0 |
811 |
|
|
goto 150 |
812 |
|
|
else |
813 |
|
|
icb = icb + 1 |
814 |
|
|
calIItrig(k) = vect(icb) |
815 |
|
|
icb = icb + 1 |
816 |
kusanagi |
2.5 |
calstriphit(k) = vect(icb) |
817 |
|
|
icb = icb + 1 |
818 |
|
|
C FIRST CALORIMETER SIGNATURE: CA50 |
819 |
kusanagi |
2.2 |
icb = icb + 1 |
820 |
kusanagi |
2.5 |
C SECOND CALORIMETER SIGNATURE: CA50 |
821 |
|
|
icb = icb + 1 |
822 |
|
|
C test is here! |
823 |
kusanagi |
2.2 |
icb = icb + 1 |
824 |
|
|
calDSPtaberr(k) = vect(icb) |
825 |
|
|
icb = icb + 1 |
826 |
|
|
calevnum(k) = vect(icb) |
827 |
kusanagi |
2.5 |
if (k.eq.1) call CALCOMPRESS(vect,icb+1,length-1,dedx1c, |
828 |
|
|
& base1) |
829 |
kusanagi |
2.2 |
if (k.eq.2) call CALCOMPRESS(vect,icb+1,length-1,dedx2c, |
830 |
|
|
& base2) |
831 |
|
|
if (k.eq.3) call CALCOMPRESS(vect,icb+1,length-1,dedx3c, |
832 |
|
|
& base3) |
833 |
|
|
if (k.eq.4) call CALCOMPRESS(vect,icb+1,length-1,dedx4c, |
834 |
|
|
& base4) |
835 |
kusanagi |
1.5 |
goto 50 |
836 |
kusanagi |
1.3 |
endif |
837 |
kusanagi |
2.2 |
else if (test.eq.0) then |
838 |
|
|
if (length2.gt.2257) then |
839 |
|
|
merror(contr) = 135 |
840 |
|
|
chi = chi + 4 |
841 |
|
|
if (iev.eq.dumpo) |
842 |
|
|
& print *,'full lung 4' |
843 |
|
|
lleng = 0 |
844 |
|
|
goto 150 |
845 |
|
|
else |
846 |
|
|
icb = icb + 1 |
847 |
|
|
calIItrig(k) = vect(icb) |
848 |
|
|
icb = icb + 1 |
849 |
kusanagi |
2.5 |
calstriphit(k) = vect(icb) |
850 |
|
|
icb = icb + 1 |
851 |
|
|
C FIRST CALORIMETER SIGNATURE: CA50 |
852 |
kusanagi |
2.2 |
icb = icb + 1 |
853 |
kusanagi |
2.5 |
C SECOND CALORIMETER SIGNATURE: CA50 |
854 |
|
|
icb = icb + 1 |
855 |
|
|
C test is here! |
856 |
kusanagi |
2.2 |
icb = icb + 1 |
857 |
|
|
calDSPtaberr(k) = vect(icb) |
858 |
|
|
icb = icb + 1 |
859 |
|
|
calevnum(k) = vect(icb) |
860 |
kusanagi |
2.5 |
if (k.eq.1) call CALFULL(vect,icb+1,length-1,dedx1, |
861 |
|
|
& dedx1c,base1) |
862 |
kusanagi |
2.2 |
if (k.eq.2) call CALFULL(vect,icb+1,length-1,dedx2, |
863 |
|
|
& dedx2c,base2) |
864 |
|
|
if (k.eq.3) call CALFULL(vect,icb+1,length-1,dedx3, |
865 |
|
|
& dedx3c,base3) |
866 |
|
|
if (k.eq.4) call CALFULL(vect,icb+1,length-1,dedx4, |
867 |
|
|
& dedx4c,base4) |
868 |
|
|
goto 50 |
869 |
kusanagi |
1.3 |
endif |
870 |
kusanagi |
2.2 |
else |
871 |
|
|
merror(contr) = 136 |
872 |
|
|
chi = chi + 4 |
873 |
|
|
if (iev.eq.dumpo) |
874 |
|
|
& print *,'decoding problems 4' |
875 |
|
|
lleng = 0 |
876 |
|
|
goto 150 |
877 |
|
|
endif |
878 |
kusanagi |
2.1 |
c |
879 |
kusanagi |
2.2 |
50 continue |
880 |
kusanagi |
2.1 |
c |
881 |
kusanagi |
1.7 |
C |
882 |
kusanagi |
2.2 |
do i = 1,7 |
883 |
|
|
calselftrig(k,i) = auto(i) |
884 |
|
|
enddo |
885 |
|
|
C |
886 |
|
|
DO I = 1,11 |
887 |
|
|
DO J = 1,96 |
888 |
kusanagi |
2.5 |
DEXY(2,2*I-1,J) = DEDX2(I,J) |
889 |
|
|
DEXY(1,2*I-1,J) = DEDX4(I,J) |
890 |
|
|
DEXY(2,2*I,97-J) = DEDX1(I,J) |
891 |
|
|
DEXY(1,2*I,J) = DEDX3(I,J) |
892 |
|
|
DEXYC(2,2*I-1,J) = DEDX2C(I,J) |
893 |
|
|
DEXYC(1,2*I-1,J) = DEDX4C(I,J) |
894 |
|
|
DEXYC(2,2*I,97-J) = DEDX1C(I,J) |
895 |
|
|
DEXYC(1,2*I,J) = DEDX3C(I,J) |
896 |
kusanagi |
1.3 |
enddo |
897 |
kusanagi |
2.2 |
do j = 1,6 |
898 |
kusanagi |
2.5 |
base(2,2*i-1,j) = base2(i,j) |
899 |
|
|
base(1,2*i-1,j) = base4(i,j) |
900 |
|
|
base(2,2*i,7-j) = base1(i,j) |
901 |
|
|
base(1,2*i,j) = base3(i,j) |
902 |
kusanagi |
1.3 |
enddo |
903 |
kusanagi |
2.2 |
enddo |
904 |
kusanagi |
1.3 |
C |
905 |
|
|
150 continue |
906 |
|
|
C |
907 |
|
|
contr = contr + 1 |
908 |
|
|
C |
909 |
|
|
c go on till we have found all the four sections |
910 |
|
|
c |
911 |
kusanagi |
1.5 |
if (contr.lt.5) goto 20 |
912 |
kusanagi |
1.3 |
c |
913 |
kusanagi |
1.8 |
200 continue |
914 |
|
|
C |
915 |
kusanagi |
2.2 |
iscomp = 0 |
916 |
|
|
isfull = 0 |
917 |
|
|
israw = 0 |
918 |
|
|
do i = 1, 4 |
919 |
|
|
if (ibits(stwerr(i),16,1).eq.1) iscomp = iscomp + 1 |
920 |
|
|
if (ibits(stwerr(i),17,1).eq.1) isfull = isfull + 1 |
921 |
|
|
if (ibits(e2(i),3,1).eq.1) israw = israw + 1 |
922 |
|
|
enddo |
923 |
|
|
if (iscomp.ne.0) chi = chi + 8 * (4 - iscomp) |
924 |
|
|
if (israw.ne.0) chi = chi + 8 * (4 - israw) |
925 |
|
|
if (isfull.ne.0) chi = chi + 8 * (4 - isfull) |
926 |
|
|
C |
927 |
|
|
C if chi>10 and we have information enough to understand the physic event |
928 |
|
|
C was acquired in a certain mode (RAW, FULL or COMPRESS) then reprocess |
929 |
|
|
C the event using this information, sometimes we miss a section due to |
930 |
|
|
C CRC errors in the previous one but if we know what we are looking for |
931 |
|
|
C then it is possible to save this kind of events. |
932 |
|
|
C |
933 |
|
|
if (chi.gt.5.and.yesisco.eq.0.and.yesisfu.eq.0 |
934 |
|
|
& .and.yesisra.eq.0.and.yescbra.eq.0) then |
935 |
|
|
israw = 0 |
936 |
|
|
cberaw = 0 |
937 |
|
|
do i = 1, 4 |
938 |
|
|
if (ibits(e2(i),3,1).eq.1.and.merror(i).eq.0) |
939 |
|
|
& israw = israw + 1 |
940 |
|
|
if (ibits(e2(i),3,1).eq.1.and.merror(i).eq.132) |
941 |
|
|
& cberaw = cberaw + 1 |
942 |
|
|
enddo |
943 |
|
|
yesisco = 0 |
944 |
|
|
yesisfu = 0 |
945 |
|
|
yesisra = 0 |
946 |
|
|
yescbra = 0 |
947 |
|
|
if (iscomp.ne.0) yesisco = 1 |
948 |
|
|
if (isfull.ne.0) yesisfu = 1 |
949 |
|
|
if (israw.ne.0) yesisra = 1 |
950 |
|
|
if (cberaw.ne.0) yescbra = 1 |
951 |
|
|
if ((yesisco+yesisfu+yesisra).eq.1.or. |
952 |
|
|
& ((yesisco+yesisfu+yesisra).eq.0.and.yescbra.eq.1)) then |
953 |
|
|
if (iev.eq.dumpo) then |
954 |
|
|
print *,'************************' |
955 |
|
|
if (iscomp.ne.0) print *,'is a compress acq.' |
956 |
|
|
if (isfull.ne.0) print *,'is a full acq.' |
957 |
|
|
if (israw.ne.0) print *,'is a raw acq.' |
958 |
|
|
if (israw.eq.0.and.cberaw.ne.0) |
959 |
|
|
& print *,'could be a raw acq.' |
960 |
|
|
print *,'so, SGARBUF, do it again! ',chi |
961 |
|
|
print *,'************************' |
962 |
kusanagi |
1.8 |
endif |
963 |
kusanagi |
2.2 |
SOGLIA0 = SOGLIA0 - ISCOMP - ISFULL - ISRAW |
964 |
|
|
goto 1 |
965 |
kusanagi |
1.8 |
endif |
966 |
kusanagi |
2.2 |
if ((yesisco+yesisfu+yesisra+yescbra).eq.0) chi = 1000 |
967 |
kusanagi |
1.8 |
endif |
968 |
kusanagi |
2.2 |
C |
969 |
|
|
if (iev.eq.dumpo) |
970 |
|
|
& print *,'chi <= soglia0 ?',chi,soglia0 |
971 |
|
|
if (chi.lt.soglia0) then |
972 |
|
|
me = 0 |
973 |
|
|
else |
974 |
|
|
me = 1 |
975 |
|
|
do i = 1, 4 |
976 |
|
|
merror(i) = 129 |
977 |
|
|
e2(i) = 0 |
978 |
kusanagi |
2.5 |
stwerr(i) = 0 |
979 |
kusanagi |
2.1 |
enddo |
980 |
kusanagi |
2.5 |
call clearall |
981 |
kusanagi |
2.2 |
goto 999 |
982 |
kusanagi |
1.8 |
endif |
983 |
kusanagi |
1.3 |
C |
984 |
|
|
C if all section are missing clear vectors and go out |
985 |
|
|
C |
986 |
|
|
if (merror(1).eq.129.and.merror(2).eq.129 |
987 |
kusanagi |
2.2 |
& .and.merror(3).eq.129.and.merror(4).eq.129) then |
988 |
kusanagi |
1.3 |
do l = 1,4 |
989 |
|
|
e2(l) = 0 |
990 |
kusanagi |
2.4 |
stwerr(l) = 0 |
991 |
kusanagi |
1.3 |
enddo |
992 |
kusanagi |
2.5 |
call clearall |
993 |
kusanagi |
1.3 |
endif |
994 |
|
|
c |
995 |
|
|
999 continue |
996 |
kusanagi |
2.1 |
c |
997 |
kusanagi |
1.8 |
do l = 1, 4 |
998 |
|
|
do bit=0, 31 |
999 |
|
|
if (bit.lt.16) then |
1000 |
|
|
bi = ibits(E2(L),bit,1) |
1001 |
kusanagi |
2.2 |
elseif (bit.gt.17) then |
1002 |
kusanagi |
1.8 |
bi = 0 |
1003 |
kusanagi |
2.2 |
elseif (bit.ge.16.and.bit.le.17) then |
1004 |
|
|
bi = 2 |
1005 |
kusanagi |
1.8 |
endif |
1006 |
kusanagi |
2.1 |
if (bi.eq.1) then |
1007 |
|
|
stwerr(l) = ibset(stwerr(l),bit) |
1008 |
kusanagi |
2.2 |
elseif (bi.eq.0) then |
1009 |
kusanagi |
2.1 |
stwerr(l) = ibclr(stwerr(l),bit) |
1010 |
|
|
endif |
1011 |
kusanagi |
1.8 |
enddo |
1012 |
|
|
perror(l) = float(merror(l)) |
1013 |
kusanagi |
1.7 |
enddo |
1014 |
kusanagi |
2.1 |
c |
1015 |
kusanagi |
1.8 |
iev = iev + 1 |
1016 |
kusanagi |
1.3 |
RETURN |
1017 |
|
|
END |
1018 |
|
|
|
1019 |
|
|
|
1020 |
|
|
C------------------------------------------------ |
1021 |
|
|
SUBROUTINE CALRAW(vect,inf,sup,dedx) |
1022 |
|
|
C------------------------------------------------ |
1023 |
|
|
|
1024 |
|
|
IMPLICIT NONE |
1025 |
kusanagi |
2.2 |
C |
1026 |
|
|
INTEGER NPLA, NCHA, LENSEV |
1027 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1028 |
|
|
C |
1029 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) |
1030 |
kusanagi |
1.3 |
INTEGER inf, sup |
1031 |
kusanagi |
2.6 |
INTEGER i,j,k, iev |
1032 |
kusanagi |
2.2 |
INTEGER contr |
1033 |
|
|
integer stwerr(4), dumpo |
1034 |
kusanagi |
1.3 |
C |
1035 |
kusanagi |
2.2 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1036 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
1037 |
kusanagi |
1.3 |
& calDSPtaberr(4), calevnum(4) |
1038 |
|
|
REAL dedx(11,96) |
1039 |
kusanagi |
2.6 |
real perror(4) |
1040 |
kusanagi |
2.2 |
C |
1041 |
kusanagi |
2.6 |
COMMON / evento / iev, stwerr, perror, |
1042 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1043 |
|
|
& calselftrig,calIItrig, |
1044 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
1045 |
kusanagi |
1.3 |
|
1046 |
|
|
save / evento / |
1047 |
|
|
c |
1048 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
1049 |
kusanagi |
1.3 |
SAVE / VARIE / |
1050 |
kusanagi |
2.2 |
c |
1051 |
kusanagi |
1.3 |
k = inf |
1052 |
|
|
do j = 1,96 |
1053 |
|
|
do i = 1,11 |
1054 |
kusanagi |
2.2 |
DEDX(I,J) = 0. |
1055 |
kusanagi |
1.3 |
dedx(i,j) = vect(k) |
1056 |
|
|
k = k + 1 |
1057 |
|
|
enddo |
1058 |
|
|
enddo |
1059 |
|
|
c |
1060 |
|
|
RETURN |
1061 |
|
|
END |
1062 |
|
|
|
1063 |
|
|
C------------------------------------------------ |
1064 |
|
|
SUBROUTINE CALCOMPRESS(vect,inf,sup,dedx,basse) |
1065 |
|
|
C------------------------------------------------ |
1066 |
|
|
|
1067 |
|
|
IMPLICIT NONE |
1068 |
|
|
|
1069 |
kusanagi |
2.2 |
INTEGER NPLA, NCHA, LENSEV |
1070 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1071 |
kusanagi |
1.3 |
C |
1072 |
kusanagi |
2.2 |
INTEGER*2 VECT(30000) |
1073 |
|
|
INTEGER*2 st, st1, st2 |
1074 |
kusanagi |
1.3 |
INTEGER inf, sup |
1075 |
kusanagi |
2.6 |
INTEGER i,j, iev |
1076 |
kusanagi |
1.3 |
INTEGER ib |
1077 |
|
|
INTEGER ipl, ipr, ist |
1078 |
|
|
INTEGER merror(4) |
1079 |
|
|
INTEGER contr |
1080 |
kusanagi |
2.2 |
integer stwerr(4),dumpo |
1081 |
|
|
C |
1082 |
|
|
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1083 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
1084 |
kusanagi |
1.3 |
& calDSPtaberr(4), calevnum(4) |
1085 |
|
|
REAL dedx(11,96), basse(11,6) |
1086 |
kusanagi |
2.6 |
real perror(4) |
1087 |
kusanagi |
1.3 |
C |
1088 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
1089 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1090 |
|
|
& calselftrig,calIItrig, |
1091 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
1092 |
kusanagi |
1.3 |
|
1093 |
|
|
save / evento / |
1094 |
|
|
c |
1095 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
1096 |
kusanagi |
1.3 |
SAVE / VARIE / |
1097 |
|
|
|
1098 |
|
|
C |
1099 |
|
|
DO I = 1,11 |
1100 |
|
|
DO J = 1,96 |
1101 |
kusanagi |
2.2 |
if (j.le.6) basse(i,j) = 0. |
1102 |
kusanagi |
1.3 |
DEDX(I,J) = 0. |
1103 |
|
|
ENDDO |
1104 |
|
|
ENDDO |
1105 |
|
|
C |
1106 |
kusanagi |
1.5 |
i = inf |
1107 |
|
|
c |
1108 |
kusanagi |
1.3 |
10 continue |
1109 |
kusanagi |
1.6 |
if (i.gt.sup) then |
1110 |
|
|
RETURN |
1111 |
|
|
endif |
1112 |
kusanagi |
1.3 |
C |
1113 |
|
|
40 format(2x,i5,2x,'status :',1x,Z4) |
1114 |
kusanagi |
1.5 |
C |
1115 |
|
|
c |
1116 |
|
|
st1 = 0 |
1117 |
kusanagi |
1.3 |
st1 = IAND(vect(i),'0800'x) |
1118 |
|
|
st1 = ISHFT(st1,-11) |
1119 |
kusanagi |
1.9 |
43 format(2x,'vect(i) = ',Z8) |
1120 |
kusanagi |
1.3 |
if (st1.eq.1) then |
1121 |
|
|
ib = 1 |
1122 |
|
|
else |
1123 |
kusanagi |
1.6 |
st2 = IAND(vect(i),'1000'x) |
1124 |
|
|
st2 = ISHFT(st2,-12) |
1125 |
|
|
if (st2.eq.1) then |
1126 |
kusanagi |
1.3 |
ib = 0 |
1127 |
|
|
else |
1128 |
kusanagi |
2.1 |
if (iev.eq.dumpo) then |
1129 |
kusanagi |
1.9 |
print *,'i ',i |
1130 |
|
|
write(*,43)vect(i) |
1131 |
|
|
endif |
1132 |
kusanagi |
1.5 |
merror(contr) = 139 |
1133 |
kusanagi |
1.3 |
RETURN |
1134 |
|
|
endif |
1135 |
|
|
endif |
1136 |
|
|
C |
1137 |
|
|
if (ib.eq.1) then |
1138 |
kusanagi |
1.6 |
C |
1139 |
kusanagi |
1.3 |
st = IAND(vect(i),'00FF'x) |
1140 |
kusanagi |
1.5 |
c |
1141 |
kusanagi |
1.3 |
ipl = int(st/6) + 1 |
1142 |
kusanagi |
1.5 |
ipr = st - (ipl - 1) * 6 + 1 |
1143 |
kusanagi |
1.3 |
i = i + 1 |
1144 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
1145 |
kusanagi |
1.3 |
basse(ipl,ipr) = vect(i) |
1146 |
kusanagi |
1.6 |
c |
1147 |
kusanagi |
1.3 |
20 continue |
1148 |
|
|
if (i.gt.sup) RETURN |
1149 |
|
|
C |
1150 |
|
|
i = i + 1 |
1151 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
1152 |
|
|
if ((vect(i)+1).gt.16.or.(vect(i)+1).lt.1) then |
1153 |
|
|
goto 10 |
1154 |
|
|
endif |
1155 |
|
|
ist = vect(i) + 1 + 16 * (ipr - 1) |
1156 |
kusanagi |
1.3 |
i = i + 1 |
1157 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
1158 |
kusanagi |
1.5 |
dedx(ipl,ist) = vect(i) |
1159 |
kusanagi |
1.6 |
goto 20 |
1160 |
kusanagi |
1.3 |
else |
1161 |
|
|
C |
1162 |
|
|
st = IAND(vect(i),'00FF'x) |
1163 |
kusanagi |
1.6 |
ipl = int(st/6) + 1 |
1164 |
kusanagi |
1.5 |
ipr = st - (ipl - 1) * 6 + 1 |
1165 |
kusanagi |
1.3 |
do j = 1,16 |
1166 |
|
|
i = i + 1 |
1167 |
kusanagi |
1.6 |
if (i.gt.sup) RETURN |
1168 |
|
|
ist = j + 16 * (ipr - 1) |
1169 |
|
|
dedx(ipl,ist) = vect(i) |
1170 |
kusanagi |
1.3 |
enddo |
1171 |
kusanagi |
1.6 |
i = i + 1 |
1172 |
|
|
if (i.gt.sup) RETURN |
1173 |
kusanagi |
1.3 |
goto 10 |
1174 |
|
|
C |
1175 |
|
|
endif |
1176 |
|
|
|
1177 |
|
|
|
1178 |
|
|
RETURN |
1179 |
|
|
END |
1180 |
|
|
|
1181 |
|
|
|
1182 |
kusanagi |
1.5 |
C---------------------------------------------------------- |
1183 |
kusanagi |
1.3 |
SUBROUTINE CALFULL(vect,inf,sup,dedx,dedxc,basse) |
1184 |
kusanagi |
1.5 |
C-------------------------------------------------------------- |
1185 |
kusanagi |
1.3 |
|
1186 |
|
|
IMPLICIT NONE |
1187 |
|
|
|
1188 |
kusanagi |
2.2 |
INTEGER NPLA, NCHA, LENSEV |
1189 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1190 |
|
|
C |
1191 |
kusanagi |
1.7 |
INTEGER*2 VECT(30000) |
1192 |
kusanagi |
1.3 |
INTEGER inf, sup |
1193 |
kusanagi |
2.6 |
INTEGER i,j,k, iev |
1194 |
kusanagi |
2.2 |
INTEGER contr |
1195 |
|
|
integer stwerr(4),dumpo |
1196 |
kusanagi |
1.3 |
C |
1197 |
kusanagi |
2.2 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1198 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
1199 |
kusanagi |
1.3 |
& calDSPtaberr(4), calevnum(4) |
1200 |
|
|
REAL dedx(11,96), basse(11,6), dedxc(11,96) |
1201 |
kusanagi |
2.6 |
real perror(4) |
1202 |
kusanagi |
2.2 |
C |
1203 |
kusanagi |
2.6 |
COMMON / evento / iev, stwerr,perror, |
1204 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1205 |
|
|
& calselftrig,calIItrig, |
1206 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
1207 |
kusanagi |
1.3 |
|
1208 |
|
|
save / evento / |
1209 |
|
|
c |
1210 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
1211 |
kusanagi |
1.3 |
SAVE / VARIE / |
1212 |
|
|
C |
1213 |
kusanagi |
1.6 |
k = inf |
1214 |
kusanagi |
1.3 |
do i = 1,11 |
1215 |
|
|
do j = 1,96 |
1216 |
kusanagi |
2.2 |
DEDX(I,J) = 0. |
1217 |
kusanagi |
1.3 |
dedx(i,j) = vect(k) |
1218 |
|
|
k = k + 1 |
1219 |
|
|
enddo |
1220 |
|
|
enddo |
1221 |
|
|
C |
1222 |
|
|
call CALCOMPRESS(vect,k,sup,dedxc,basse) |
1223 |
kusanagi |
1.6 |
C |
1224 |
|
|
10 FORMAT(2X,'Status word:',2X,Z8) |
1225 |
kusanagi |
1.3 |
|
1226 |
|
|
RETURN |
1227 |
|
|
END |
1228 |
|
|
|
1229 |
|
|
|
1230 |
|
|
C------------------------------------------------ |
1231 |
kusanagi |
2.5 |
SUBROUTINE COUNTER(ve,er) |
1232 |
kusanagi |
1.3 |
C------------------------------------------------ |
1233 |
|
|
|
1234 |
|
|
IMPLICIT NONE |
1235 |
|
|
|
1236 |
|
|
INTEGER NPLA, NCHA, LENSEV |
1237 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1238 |
kusanagi |
2.2 |
C |
1239 |
|
|
INTEGER*2 VE, st4 |
1240 |
kusanagi |
2.6 |
INTEGER er, bit, bi, iev |
1241 |
kusanagi |
1.3 |
INTEGER contr |
1242 |
kusanagi |
2.2 |
integer stwerr(4),dumpo |
1243 |
|
|
C |
1244 |
|
|
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1245 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
1246 |
kusanagi |
2.2 |
& calDSPtaberr(4), calevnum(4) |
1247 |
kusanagi |
2.6 |
real perror(4) |
1248 |
kusanagi |
2.2 |
C |
1249 |
kusanagi |
1.8 |
COMMON / evento / IEV, stwerr,perror, |
1250 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1251 |
|
|
& calselftrig,calIItrig, |
1252 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
1253 |
kusanagi |
1.3 |
|
1254 |
|
|
save / evento / |
1255 |
|
|
|
1256 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
1257 |
kusanagi |
1.3 |
SAVE / VARIE / |
1258 |
|
|
|
1259 |
|
|
|
1260 |
|
|
st4 = 0 |
1261 |
|
|
st4 = IAND(ve,'00FF'x) |
1262 |
|
|
if (st4.ne.0) then |
1263 |
|
|
do bit=0, 6 |
1264 |
|
|
bi = ibits(st4,bit,1) |
1265 |
|
|
if (bi.ne.0) then |
1266 |
kusanagi |
2.2 |
er = er + 2 |
1267 |
kusanagi |
1.3 |
endif |
1268 |
|
|
enddo |
1269 |
|
|
endif |
1270 |
|
|
|
1271 |
|
|
10 FORMAT(2X,'Status word:',2X,Z4) |
1272 |
|
|
return |
1273 |
|
|
end |
1274 |
|
|
|
1275 |
|
|
|
1276 |
|
|
C------------------------------------------------ |
1277 |
|
|
SUBROUTINE MINERR(ic,icsave,chi,min,co) |
1278 |
|
|
C------------------------------------------------ |
1279 |
|
|
|
1280 |
|
|
IMPLICIT NONE |
1281 |
|
|
C |
1282 |
kusanagi |
2.2 |
INTEGER NPLA, NCHA, LENSEV |
1283 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1284 |
|
|
C |
1285 |
kusanagi |
1.3 |
INTEGER ic, icsave(1000), chi(1000) |
1286 |
|
|
integer l, st, min,co |
1287 |
kusanagi |
2.6 |
INTEGER iev |
1288 |
kusanagi |
2.2 |
INTEGER contr |
1289 |
|
|
integer stwerr(4),dumpo |
1290 |
kusanagi |
1.3 |
C |
1291 |
kusanagi |
2.2 |
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1292 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
1293 |
kusanagi |
2.2 |
& calDSPtaberr(4), calevnum(4) |
1294 |
kusanagi |
2.6 |
real perror(4) |
1295 |
kusanagi |
2.2 |
C |
1296 |
kusanagi |
2.6 |
COMMON / evento / iev, stwerr,perror, |
1297 |
kusanagi |
1.3 |
& dexy,dexyc,base, |
1298 |
|
|
& calselftrig,calIItrig, |
1299 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
1300 |
kusanagi |
1.3 |
|
1301 |
|
|
save / evento / |
1302 |
kusanagi |
2.6 |
C |
1303 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
1304 |
kusanagi |
1.3 |
SAVE / VARIE / |
1305 |
|
|
|
1306 |
|
|
st = chi(1) |
1307 |
|
|
min = 1 |
1308 |
|
|
if (co.gt.1) then |
1309 |
|
|
do l = 2, co |
1310 |
|
|
if (chi(l).lt.st) then |
1311 |
|
|
st = chi(l) |
1312 |
|
|
min = l |
1313 |
|
|
endif |
1314 |
|
|
enddo |
1315 |
|
|
endif |
1316 |
|
|
ic = icsave(min) |
1317 |
|
|
|
1318 |
|
|
return |
1319 |
|
|
end |
1320 |
kusanagi |
1.7 |
|
1321 |
|
|
C----------------------------------------------------- |
1322 |
kusanagi |
2.5 |
SUBROUTINE CLEARSEC |
1323 |
kusanagi |
1.7 |
C----------------------------------------------------- |
1324 |
|
|
|
1325 |
|
|
IMPLICIT NONE |
1326 |
|
|
C |
1327 |
|
|
INTEGER NPLA, NCHA, LENSEV |
1328 |
|
|
PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) |
1329 |
kusanagi |
2.2 |
C |
1330 |
kusanagi |
2.6 |
INTEGER iev |
1331 |
kusanagi |
2.5 |
INTEGER contr, i,j |
1332 |
kusanagi |
2.2 |
integer stwerr(4),dumpo |
1333 |
|
|
C |
1334 |
|
|
REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6) |
1335 |
kusanagi |
2.5 |
real calselftrig(4,7), calIItrig(4), calstriphit(4), |
1336 |
kusanagi |
1.7 |
& calDSPtaberr(4), calevnum(4) |
1337 |
kusanagi |
2.6 |
real perror(4) |
1338 |
kusanagi |
2.2 |
C |
1339 |
kusanagi |
2.6 |
COMMON / evento / iev, stwerr,perror, |
1340 |
kusanagi |
1.7 |
& dexy,dexyc,base, |
1341 |
|
|
& calselftrig,calIItrig, |
1342 |
kusanagi |
2.5 |
& calstriphit,calDSPtaberr,calevnum |
1343 |
kusanagi |
1.7 |
|
1344 |
|
|
save / evento / |
1345 |
|
|
c |
1346 |
kusanagi |
2.1 |
COMMON / VARIE / dumpo, CONTR |
1347 |
kusanagi |
2.5 |
SAVE / VARIE / |
1348 |
kusanagi |
1.7 |
C |
1349 |
kusanagi |
2.5 |
DO I = 1,11 |
1350 |
|
|
DO J = 1,96 |
1351 |
|
|
if (contr.eq.1) then |
1352 |
|
|
DEXY(1,2*I,J) = 0. |
1353 |
|
|
DEXYC(1,2*I,J) = 0. |
1354 |
|
|
endif |
1355 |
|
|
if (contr.eq.2) then |
1356 |
|
|
DEXY(1,2*I-1,J) = 0. |
1357 |
|
|
DEXYC(1,2*I-1,J) = 0. |
1358 |
|
|
endif |
1359 |
|
|
if (contr.eq.3) then |
1360 |
|
|
DEXY(2,2*I-1,97-J) = 0. |
1361 |
|
|
DEXYC(2,2*I-1,97-J) = 0. |
1362 |
|
|
endif |
1363 |
|
|
if (contr.eq.4) then |
1364 |
|
|
DEXY(2,2*I,J) = 0. |
1365 |
|
|
DEXYC(2,2*I,J) = 0. |
1366 |
|
|
endif |
1367 |
|
|
enddo |
1368 |
|
|
do j = 1,6 |
1369 |
|
|
if (contr.eq.3) base(2,2*i-1,7-j) = 0. |
1370 |
|
|
if (contr.eq.2) base(1,2*i-1,j) = 0. |
1371 |
|
|
if (contr.eq.4) base(2,2*i,j) = 0. |
1372 |
|
|
if (contr.eq.1) base(1,2*i,j) = 0. |
1373 |
|
|
enddo |
1374 |
|
|
if (i.le.7) calselftrig(contr,i) = 0. |
1375 |
|
|
enddo |
1376 |
|
|
calIItrig(contr) = 0. |
1377 |
|
|
calstriphit(contr) = 0. |
1378 |
|
|
calDSPtaberr(contr) = 0. |
1379 |
|
|
calevnum(contr) = 0. |
1380 |
|
|
return |
1381 |
kusanagi |
1.7 |
end |
1382 |
kusanagi |
2.5 |
C |