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