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