/[PAMELA software]/calo/unpacking/calunpack.for
ViewVC logotype

Contents of /calo/unpacking/calunpack.for

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Sep 28 19:44:06 2006 UTC (18 years, 4 months ago) by mocchiut
Branch: MAIN
Changes since 1.3: +26 -5 lines
New version of calunpack.for

1 C
2 C Written by Emiliano Mocchiutti and Mirko Boezio
3 C
4 C * Version: 3.4.09 *
5 C
6 C Changelog:
7 C
8 C 3.4.08 - 3.4.09: (2006-09-28) XE is not always correctly found, fixed.
9 C
10 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 C 3.4.05 - 3.4.06: (2005-01-12) section order wrong in CLEARSEC, fixed.
15 C
16 C 3.4.04 - 3.4.05: (2005-01-05) XE is section y odd not even, fixed.
17 C
18 C 3.4.03 - 3.4.04: (2004-12-21) bug in recognising decoding errors, fixed.
19 C
20 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 C 3.4.01 - 3.4.02: (2004-12-10) cleanup of the code and changed sections order.
25 C
26 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 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 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 C distinguish better the four section.The reprocessing happens
52 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 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 C
83 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 C else forgotten to clear st2c variable: fixed
86 C exit error code wrong in some cases: fixed
87 C self trigger data not saved: fixed.
88 C
89 C 2.18.0 - 2.18.1: small changes in the common varie to fix a memory leak;
90 C fixed an error in reporting error codes (stwerr,pwerror).
91 C
92 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 C
101 C------------------------------------------------
102 SUBROUTINE CALUNPACK(vecta,lung,me)
103 C------------------------------------------------
104
105 IMPLICIT NONE
106 C
107 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 C
113 INTEGER START, SEC1ST
114 INTEGER NPLA, NCHA, LENSEV
115 INTEGER*2 ival
116 C
117 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 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
122 PARAMETER (ival='FFFF'x)
123 C
124 C Normal variables definition
125 C
126 integer lung, SOGLIA0, SEC2ND
127 INTEGER*1 VECTA(lung)
128 INTEGER*2 vect(60000), test
129 integer*2 check, crc, e2(4)
130 INTEGER*2 length, length2
131 integer me, m, dumpo, finoa
132 INTEGER merror(4), headcor, ichc, coco
133 INTEGER i, j, iev, min, st2c, bit, bi, lleng
134 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 INTEGER XO, YO, XE, YE, icold
139 integer st1b, st2b, lunga, pari
140 integer stwerr(4),yescbra, chis, esci, icprima
141 integer seemcomp, seemfull, cberaw, yesisco, yesisfu,yesisra
142 integer ca50, ca50a, ca50b
143 integer firsttime
144 C
145 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 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
149 real auto(7)
150 real calselftrig(4,7), calIItrig(4), calstriphit(4),
151 & calDSPtaberr(4), calevnum(4)
152 real perror(4)
153 C
154 DATA YE/246/ ! CODE_EV_R YE = 111 10110
155 DATA YO/237/ ! CODE_EV_R YO = 111 01101
156 DATA XE/234/ ! CODE_EV_R XE = 111 01010
157 DATA XO/241/ ! CODE_EV_R XO = 111 10001
158 C
159 COMMON / evento / iev, stwerr, perror,
160 & dexy,dexyc,base,
161 & calselftrig,calIItrig,
162 & calstriphit,calDSPtaberr,calevnum
163 save / evento /
164 C
165 COMMON / VARIE / dumpo, CONTR, merror
166 SAVE / VARIE /
167 C
168 C Begin !
169 C
170 start = 320
171 firsttime = 1
172 SOGLIA0 = 70
173 2 continue
174 C
175 C input length must be > 0, if not go out with error code 142
176 C
177 if (lung.le.0) then
178 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 if (dumpo.eq.0) dumpo=-1
188 C
189 C DEBUG: PRINT OUT THE INPUT VECTOR
190 C
191 if (iev.eq.dumpo) then
192 do l=1,lung
193 write(*,17)l,vecta(l)
194 enddo
195 endif
196 C dumpo = iev
197 C
198 C DETERMINE LENGTH IN WORDS FROM LENGTH IN BYTES
199 C
200 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 SEC2ND = LUNGA
207 C
208 C IS LENGTH IS TOO LONG?
209 C
210 if (lunga.gt.60000.and.dumpo.gt.0) then
211 print *,'Calorimeter WARNING: more than 60000 words!'
212 lunga = 60000
213 endif
214 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 c
224 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 call clearall
243 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 do l = 1,4
257 e2(l) = 0
258 perror(l) = 0.
259 stwerr(l) = 0
260 merror(l) = 0
261 enddo
262 C
263 C DETERMINE WHERE TO START TO FIND THE CALORIMETER IN THE INBUT BUFFER
264 C
265 length2 = start
266 c
267 20 continue
268 C
269 if (length2.ge.-2) then
270 ic = ic + (2 * (length2 + 2))
271 else
272 if (dumpo.gt.0)
273 & print *,'Calorimeter WARNING: length errors ',ic,length2
274 endif
275 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 c
285 32 continue
286 C
287 ke = 0
288 chis = chi
289 icold = ic
290 DO i = 1, 60000
291 vect(i) = 0
292 enddo
293 do while (ke.eq.0)
294 C
295 C if (iev.eq.dumpo) print *,'parto da ',ic,contr
296 C
297 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 st1b = 0
302 st2b = 0
303 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 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 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 stwerr(contr) = 0
325 if (iev.eq.dumpo) print *,'put to zero here ',headcor
326 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 endif
348 C
349 C ST1B IS "CODE", ST2B IS "D#"
350 C
351 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 c
358 C IC+2 AND IC+3 CONTAINS THE LENGTH OF THE CALORIMETER SECTION
359 c
360 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 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 C
390 c the crc should be at vect(length) with
391 C
392 length = length2 + 1
393 C
394 c some checks to be sure we have found the calorimeter data:
395 c status word is always less then 129
396 c
397 if (st2b.gt.128) then
398 length = 0
399 length2 = 0
400 goto 100
401 endif
402 c
403 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 c
406 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 length = 0
412 length2 = 0
413 goto 100
414 endif
415 c
416 e2(contr) = 0
417 C
418 if (CONTR.eq.1) then
419 c
420 c is it the first section?
421 c
422 if (st1b.eq.XE.and.(ca50.eq.1.or.length2.eq.1064)) then
423 c if so go out of this loop and go on recording data
424 ke = 1
425 icsave = ic
426 m = ic
427 if (iev.eq.dumpo) then
428 print *,'1m,lunga,lleng,lung,pari',m,lunga,lleng,lung,
429 & pari
430 endif
431 call fillin(m,lunga,lleng,lung,pari,vect,vecta)
432 C
433 icb = 1
434 E2(contr) = vect(icb)
435 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 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 call counter(e2(contr),chi)
449 endif
450 endif
451 goto 100
452 endif
453 ENDIF
454 C
455 c the same for the second section, ...
456 c
457 if (CONTR.eq.2) then
458 if (st1b.eq.XO.and.(ca50.eq.1.or.length2.eq.1064)) then
459 ke = 2
460 icsave = ic
461 m = ic
462 if (iev.eq.dumpo) then
463 print *,'2m,lunga,lleng,lung,pari',m,lunga,lleng,lung,
464 & pari
465 endif
466 call fillin(m,lunga,lleng,lung,pari,vect,vecta)
467 icb = 1
468 E2(contr) = vect(icb)
469 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 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 call counter(e2(contr),chi)
484 endif
485 endif
486 goto 100
487 endif
488 ENDIF
489 c
490 C ... for the third,...
491 c
492 if (CONTR.eq.3) then
493 if (st1b.eq.YE.and.(ca50.eq.1.or.length2.eq.1064)) then
494 ke = 3
495 icsave = ic
496 m = ic
497 if (iev.eq.dumpo) then
498 print *,'3m,lunga,lleng,lung,pari',m,lunga,lleng,lung,
499 & pari
500 endif
501 call fillin(m,lunga,lleng,lung,pari,vect,vecta)
502 icb = 1
503 E2(contr) = vect(icb)
504 if (iev.eq.dumpo) then
505 print *,'headcor ',headcor
506 write(*,22)vect(icb)
507 print *,'3m,lunga,lleng,lung,pari',m,lunga,lleng,lung,
508 & pari
509 endif
510 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 call counter(e2(contr),chi)
519 endif
520 endif
521 goto 100
522 endif
523 ENDIF
524 C
525 c ...and for the last section.
526 c
527 if (CONTR.eq.4) then
528 if (st1b.eq.YO.and.(ca50.eq.1.or.length2.eq.1064)) then
529 ke = 4
530 icsave = ic
531 m = ic
532 call fillin(m,lunga,lleng,lung,pari,vect,vecta)
533 icb = 1
534 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 call counter(e2(contr),chi)
544 endif
545 endif
546 goto 100
547 endif
548 endif
549 C
550 if (contr.gt.4) then
551 if (iev.eq.dumpo) print *,'go out here'
552 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 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 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 17 FORMAT(2X,'Element:',2X,I6,2X,' word:',2X,Z8)
580 18 FORMAT(2X,'Element:',2X,I6,2X,' word:',2X,Z2,Z2)
581 21 FORMAT(2X,'CRC: ',2X,Z8)
582 22 FORMAT(2X,'vect(icb): ',2X,Z8)
583 C
584 c go on recording data
585 ic = ic - 1
586 c
587 c
588 K = CONTR
589 ic0 = icb
590 icb = icb + 1
591 length = vect(icb) + 2
592 length2 = vect(icb)
593 lleng = (length*2) - 1
594 C
595 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 C
611 if (headcor.eq.1) then
612 hcco = hcco + 1
613 if (st2b.ne.0) then
614 call counter(e2(contr),hcchi(hcco))
615 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 test = vect(icb+12)
643 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 if (iev.eq.dumpo) print *,'enter -1, ',hcco,ke
716 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 esci = 0
754 MERROR(contr) = 0
755 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 test = vect(icb+12)
763 seemcomp = 0
764 seemfull = 0
765 if (test.eq.ival) then
766 C
767 C compress mode
768 C
769 stwerr(contr) = ibset(stwerr(contr),16)
770 elseif (test.eq.0) then
771 C
772 C full mode
773 C
774 stwerr(contr) = ibset(stwerr(contr),17)
775 endif
776 endif
777 C
778 hcco = 0
779 ichc = 0
780 check = 0
781 do i=1,1000
782 hcchi(i) = 0
783 hcic(i) = 0
784 enddo
785 inf = ic0
786 sup = length - 1
787 do i = inf,sup
788 check=crc(check,vect(i))
789 enddo
790 C
791 if (iev.eq.dumpo) then
792 write(*,21)vect(length)
793 print *,' CRC position ',length
794 write(*,21)check
795 endif
796 C
797 if (check.ne.vect(length)) then
798 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 merror(contr) = 132
807 chi = chi + 4
808 lleng = 0
809 length2 = 0
810 length = 0
811 c
812 if (ke.eq.1.and.headcor.ne.2) then
813 ic = 10
814 elseif (headcor.eq.2) then
815 contr = contr + 1
816 endif
817 headcor = 1
818 ichc = ic - 1
819 if (iev.eq.dumpo)
820 & print *,'crc is wrong ',ic,
821 & ' search section ',contr,' coco = ',coco
822 goto 32
823 else
824 chi = chi - 4
825 if (chi.lt.0) chi = 0
826 endif
827 C
828 headcor = 0
829 C
830 19 CONTINUE
831 C
832 C Process data.
833 C
834 call clearsec
835 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 enddo
846 endif
847 C
848 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 if (k.eq.1) call CALRAW(vect,icb+1,length-1,dedx1)
858 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 endif
862 goto 50
863 endif
864 C
865 41 FORMAT(2X,I2,2X,'word :',1x,z4)
866 test = vect(icb+5)
867 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 calstriphit(k) = vect(icb)
881 icb = icb + 1
882 C FIRST CALORIMETER SIGNATURE: CA50
883 icb = icb + 1
884 C SECOND CALORIMETER SIGNATURE: CA50
885 icb = icb + 1
886 C test is here!
887 icb = icb + 1
888 calDSPtaberr(k) = vect(icb)
889 icb = icb + 1
890 calevnum(k) = vect(icb)
891 if (k.eq.1) call CALCOMPRESS(vect,icb+1,length-1,dedx1c,
892 & base1)
893 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 goto 50
900 endif
901 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 calstriphit(k) = vect(icb)
914 icb = icb + 1
915 C FIRST CALORIMETER SIGNATURE: CA50
916 icb = icb + 1
917 C SECOND CALORIMETER SIGNATURE: CA50
918 icb = icb + 1
919 C test is here!
920 icb = icb + 1
921 calDSPtaberr(k) = vect(icb)
922 icb = icb + 1
923 calevnum(k) = vect(icb)
924 if (k.eq.1) call CALFULL(vect,icb+1,length-1,dedx1,
925 & dedx1c,base1)
926 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 endif
934 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 c
943 50 continue
944 c
945 C
946 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 DEXY(2,2*I,97-J) = DEDX2(I,J)
953 DEXY(1,2*I-1,J) = DEDX4(I,J)
954 DEXY(2,2*I-1,J) = DEDX1(I,J)
955 DEXY(1,2*I,J) = DEDX3(I,J)
956 DEXYC(2,2*I,97-J) = DEDX2C(I,J)
957 DEXYC(1,2*I-1,J) = DEDX4C(I,J)
958 DEXYC(2,2*I-1,J) = DEDX1C(I,J)
959 DEXYC(1,2*I,J) = DEDX3C(I,J)
960 enddo
961 do j = 1,6
962 base(2,2*i,7-j) = base2(i,j)
963 base(1,2*i-1,j) = base4(i,j)
964 base(2,2*i-1,j) = base1(i,j)
965 base(1,2*i,j) = base3(i,j)
966 enddo
967 enddo
968 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 if (contr.lt.5) goto 20
976 c
977 200 continue
978 C
979 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 endif
1027 SOGLIA0 = SOGLIA0 - ISCOMP - ISFULL - ISRAW
1028 goto 1
1029 endif
1030 if ((yesisco+yesisfu+yesisra+yescbra).eq.0) chi = 1000
1031 endif
1032 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 stwerr(i) = 0
1043 enddo
1044 call clearall
1045 goto 999
1046 endif
1047 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 & .and.merror(3).eq.129.and.merror(4).eq.129) then
1052 do l = 1,4
1053 e2(l) = 0
1054 stwerr(l) = 0
1055 enddo
1056 call clearall
1057 endif
1058 c
1059 999 continue
1060 c
1061 do l = 1, 4
1062 do bit=0, 31
1063 if (bit.lt.16) then
1064 bi = ibits(E2(L),bit,1)
1065 elseif (bit.gt.17) then
1066 bi = 0
1067 elseif (bit.ge.16.and.bit.le.17) then
1068 bi = 2
1069 endif
1070 if (bi.eq.1) then
1071 stwerr(l) = ibset(stwerr(l),bit)
1072 elseif (bi.eq.0) then
1073 stwerr(l) = ibclr(stwerr(l),bit)
1074 endif
1075 enddo
1076 perror(l) = float(merror(l))
1077 enddo
1078 c
1079 if ( iev.eq.dumpo ) then
1080 do i = 1, 4
1081 print *,' perror(',i,') = ',perror(i)
1082 print *,' stwerr(',i,') = ',stwerr(i)
1083 enddo
1084 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 do l=1,lung
1094 write(*,17)l,vecta(l)
1095 enddo
1096 endif
1097 iev = iev + 1
1098 RETURN
1099 END
1100
1101
1102 C------------------------------------------------
1103 SUBROUTINE CALRAW(vect,inf,sup,dedx)
1104 C------------------------------------------------
1105
1106 IMPLICIT NONE
1107 C
1108 INTEGER NPLA, NCHA, LENSEV
1109 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
1110 C
1111 INTEGER*2 VECT(30000)
1112 INTEGER inf, sup
1113 INTEGER i,j,k, iev
1114 INTEGER contr
1115 integer stwerr(4), dumpo, merror(4)
1116 C
1117 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
1118 real calselftrig(4,7), calIItrig(4), calstriphit(4),
1119 & calDSPtaberr(4), calevnum(4)
1120 REAL dedx(11,96)
1121 real perror(4)
1122 C
1123 COMMON / evento / iev, stwerr, perror,
1124 & dexy,dexyc,base,
1125 & calselftrig,calIItrig,
1126 & calstriphit,calDSPtaberr,calevnum
1127
1128 save / evento /
1129 c
1130 COMMON / VARIE / dumpo, CONTR, merror
1131 SAVE / VARIE /
1132 c
1133 k = inf
1134 do j = 1,96
1135 do i = 1,11
1136 DEDX(I,J) = 0.
1137 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 INTEGER NPLA, NCHA, LENSEV
1152 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
1153 C
1154 INTEGER*2 VECT(30000)
1155 INTEGER*2 st, st1
1156 INTEGER inf, sup
1157 INTEGER i,j, iev
1158 INTEGER ib
1159 INTEGER ipl, ipr, ist
1160 INTEGER merror(4)
1161 INTEGER contr
1162 integer stwerr(4),dumpo
1163 integer bit,bi
1164 C
1165 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
1166 real calselftrig(4,7), calIItrig(4), calstriphit(4),
1167 & calDSPtaberr(4), calevnum(4)
1168 REAL dedx(11,96), basse(11,6)
1169 real perror(4)
1170 C
1171 COMMON / evento / IEV, stwerr,perror,
1172 & dexy,dexyc,base,
1173 & calselftrig,calIItrig,
1174 & calstriphit,calDSPtaberr,calevnum
1175
1176 save / evento /
1177 c
1178 COMMON / VARIE / dumpo, CONTR, merror
1179 SAVE / VARIE /
1180
1181 C
1182 DO I = 1,11
1183 DO J = 1,96
1184 if (j.le.6) basse(i,j) = 0.
1185 DEDX(I,J) = 0.
1186 ENDDO
1187 ENDDO
1188 C
1189 i = inf
1190 c
1191 10 continue
1192 if (i.gt.sup) then
1193 RETURN
1194 endif
1195 C
1196 40 format(2x,i5,2x,'status :',1x,Z4)
1197 C
1198 c
1199 st1 = 0
1200 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 ib = 1
1207 else
1208 if (st1.eq.16) then
1209 ib = 0
1210 else
1211 if (iev.eq.dumpo) then
1212 print *,'i ',i
1213 write(*,43)vect(i)
1214 endif
1215 merror(contr) = 139
1216 RETURN
1217 endif
1218 endif
1219 C
1220 if (ib.eq.1) then
1221 C
1222 st = IAND(vect(i),'00FF'x)
1223 c
1224 ipl = int(st/6) + 1
1225 ipr = st - (ipl - 1) * 6 + 1
1226 i = i + 1
1227 if (i.gt.sup) RETURN
1228 basse(ipl,ipr) = vect(i)
1229 c
1230 20 continue
1231 if (i.gt.sup) RETURN
1232 C
1233 i = i + 1
1234 if (i.gt.sup) RETURN
1235 if ((vect(i)+1).gt.16.or.(vect(i)+1).lt.1) then
1236
1237 goto 10
1238 endif
1239 ist = vect(i) + 1 + 16 * (ipr - 1)
1240 i = i + 1
1241 if (i.gt.sup) RETURN
1242 dedx(ipl,ist) = vect(i)
1243 goto 20
1244 else
1245 C
1246 st = IAND(vect(i),'00FF'x)
1247 ipl = int(st/6) + 1
1248 ipr = st - (ipl - 1) * 6 + 1
1249 do j = 1,16
1250 i = i + 1
1251 if (i.gt.sup) RETURN
1252 ist = j + 16 * (ipr - 1)
1253 dedx(ipl,ist) = vect(i)
1254 enddo
1255 i = i + 1
1256 if (i.gt.sup) RETURN
1257 goto 10
1258 C
1259 endif
1260
1261
1262 RETURN
1263 END
1264
1265
1266 C----------------------------------------------------------
1267 SUBROUTINE CALFULL(vect,inf,sup,dedx,dedxc,basse)
1268 C--------------------------------------------------------------
1269
1270 IMPLICIT NONE
1271
1272 INTEGER NPLA, NCHA, LENSEV
1273 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
1274 C
1275 INTEGER*2 VECT(30000)
1276 INTEGER inf, sup
1277 INTEGER i,j,k, iev
1278 INTEGER contr
1279 integer stwerr(4),dumpo,merror(4)
1280 C
1281 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
1282 real calselftrig(4,7), calIItrig(4), calstriphit(4),
1283 & calDSPtaberr(4), calevnum(4)
1284 REAL dedx(11,96), basse(11,6), dedxc(11,96)
1285 real perror(4)
1286 C
1287 COMMON / evento / iev, stwerr,perror,
1288 & dexy,dexyc,base,
1289 & calselftrig,calIItrig,
1290 & calstriphit,calDSPtaberr,calevnum
1291
1292 save / evento /
1293 c
1294 COMMON / VARIE / dumpo, CONTR, merror
1295 SAVE / VARIE /
1296 C
1297 k = inf
1298 do i = 1,11
1299 do j = 1,96
1300 DEDX(I,J) = 0.
1301 dedx(i,j) = vect(k)
1302 k = k + 1
1303 enddo
1304 enddo
1305 C
1306 call CALCOMPRESS(vect,k,sup,dedxc,basse)
1307 C
1308 10 FORMAT(2X,'Status word:',2X,Z8)
1309
1310 RETURN
1311 END
1312
1313
1314 C------------------------------------------------
1315 SUBROUTINE COUNTER(ve,er)
1316 C------------------------------------------------
1317
1318 IMPLICIT NONE
1319
1320 INTEGER NPLA, NCHA, LENSEV
1321 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
1322 C
1323 INTEGER*2 VE, st4
1324 INTEGER er, bit, bi, iev
1325 INTEGER contr
1326 integer stwerr(4),dumpo, merror(4)
1327 C
1328 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
1329 real calselftrig(4,7), calIItrig(4), calstriphit(4),
1330 & calDSPtaberr(4), calevnum(4)
1331 real perror(4)
1332 C
1333 COMMON / evento / IEV, stwerr,perror,
1334 & dexy,dexyc,base,
1335 & calselftrig,calIItrig,
1336 & calstriphit,calDSPtaberr,calevnum
1337
1338 save / evento /
1339
1340 COMMON / VARIE / dumpo, CONTR, merror
1341 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 er = er + 2
1351 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 INTEGER NPLA, NCHA, LENSEV
1367 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
1368 C
1369 INTEGER ic, icsave(1000), chi(1000)
1370 integer l, st, min,co
1371 INTEGER iev
1372 INTEGER contr
1373 integer stwerr(4),dumpo, merror(4)
1374 C
1375 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
1376 real calselftrig(4,7), calIItrig(4), calstriphit(4),
1377 & calDSPtaberr(4), calevnum(4)
1378 real perror(4)
1379 C
1380 COMMON / evento / iev, stwerr,perror,
1381 & dexy,dexyc,base,
1382 & calselftrig,calIItrig,
1383 & calstriphit,calDSPtaberr,calevnum
1384
1385 save / evento /
1386 C
1387 COMMON / VARIE / dumpo, CONTR, merror
1388 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
1405 C-----------------------------------------------------
1406 SUBROUTINE CLEARSEC
1407 C-----------------------------------------------------
1408
1409 IMPLICIT NONE
1410 C
1411 INTEGER NPLA, NCHA, LENSEV
1412 PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA)
1413 C
1414 INTEGER iev
1415 INTEGER contr, i,j
1416 integer stwerr(4),dumpo, merror(4)
1417 C
1418 REAL DEXY(2,NPLA,NCHA), dexyc(2,npla,ncha), base(2,npla,6)
1419 real calselftrig(4,7), calIItrig(4), calstriphit(4),
1420 & calDSPtaberr(4), calevnum(4)
1421 real perror(4)
1422 C
1423 COMMON / evento / iev, stwerr,perror,
1424 & dexy,dexyc,base,
1425 & calselftrig,calIItrig,
1426 & calstriphit,calDSPtaberr,calevnum
1427
1428 save / evento /
1429 c
1430 COMMON / VARIE / dumpo, CONTR, merror
1431 SAVE / VARIE /
1432 C
1433 DO I = 1,11
1434 DO J = 1,96
1435 if (contr.eq.3) then
1436 DEXY(1,2*I,J) = 0.
1437 DEXYC(1,2*I,J) = 0.
1438 endif
1439 if (contr.eq.4) then
1440 DEXY(1,2*I-1,J) = 0.
1441 DEXYC(1,2*I-1,J) = 0.
1442 endif
1443 if (contr.eq.1) then
1444 DEXY(2,2*I-1,J) = 0.
1445 DEXYC(2,2*I-1,J) = 0.
1446 endif
1447 if (contr.eq.2) then
1448 DEXY(2,2*I,97-J) = 0.
1449 DEXYC(2,2*I,97-J) = 0.
1450 endif
1451 enddo
1452 do j = 1,6
1453 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 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 end
1466 C

  ViewVC Help
Powered by ViewVC 1.1.23