--- calo/unpacking/calunpack.for 2006/06/29 07:50:54 1.2 +++ calo/unpacking/calunpack.for 2006/09/28 19:44:06 1.4 @@ -1,10 +1,14 @@ C C Written by Emiliano Mocchiutti and Mirko Boezio C -C * Version: 3.4.07 * +C * Version: 3.4.09 * C C Changelog: C +C 3.4.08 - 3.4.09: (2006-09-28) XE is not always correctly found, fixed. +C +C 3.4.07 - 3.4.08: (2006-06-29) XO is rotated, not XE!! fixed. +C 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 C C 3.4.05 - 3.4.06: (2005-01-12) section order wrong in CLEARSEC, fixed. @@ -110,7 +114,10 @@ INTEGER NPLA, NCHA, LENSEV INTEGER*2 ival C - PARAMETER (START=50,SEC1ST=1200) +c PARAMETER (START=50,SEC1ST=1200) +c PARAMETER (START=300,SEC1ST=1200) +c PARAMETER (START=500,SEC1ST=1200) + PARAMETER (SEC1ST=1200) PARAMETER (NPLA=22,NCHA=96,LENSEV=NPLA*NCHA) PARAMETER (ival='FFFF'x) C @@ -133,6 +140,7 @@ integer stwerr(4),yescbra, chis, esci, icprima integer seemcomp, seemfull, cberaw, yesisco, yesisfu,yesisra integer ca50, ca50a, ca50b + integer firsttime C real dedx1(11,96),dedx2(11,96),dedx3(11,96),dedx4(11,96) real dedx1c(11,96),dedx2c(11,96),dedx3c(11,96),dedx4c(11,96) @@ -159,7 +167,10 @@ C C Begin ! C + start = 320 + firsttime = 1 SOGLIA0 = 70 + 2 continue C C input length must be > 0, if not go out with error code 142 C @@ -182,6 +193,7 @@ write(*,17)l,vecta(l) enddo endif +C dumpo = iev C C DETERMINE LENGTH IN WORDS FROM LENGTH IN BYTES C @@ -293,6 +305,13 @@ C IF WE HAVE NO ROOM FOR A SECTION GO OUT C if ((ic+4).gt.lung.or.esci.eq.1) then + if (contr.eq.1.and.firsttime.eq.1) then + if (iev.eq.dumpo) + & print *,' first section not found retry from zero' + firsttime = 0 + start = 1 + goto 1 + endif if (headcor.eq.1.and.contr.lt.5) then headcor=-1 ic=ichc @@ -776,11 +795,6 @@ endif C if (check.ne.vect(length)) then - merror(contr) = 132 - chi = chi + 4 - lleng = 0 - length2 = 0 - length = 0 C C clear vectors of that section in the common C @@ -788,6 +802,12 @@ C calselftrig(k,1) = check calselftrig(k,2) = vect(length) +c + merror(contr) = 132 + chi = chi + 4 + lleng = 0 + length2 = 0 + length = 0 c if (ke.eq.1.and.headcor.ne.2) then ic = 10 @@ -929,19 +949,19 @@ C DO I = 1,11 DO J = 1,96 - DEXY(2,2*I,J) = DEDX2(I,J) + DEXY(2,2*I,97-J) = DEDX2(I,J) DEXY(1,2*I-1,J) = DEDX4(I,J) - DEXY(2,2*I-1,97-J) = DEDX1(I,J) + DEXY(2,2*I-1,J) = DEDX1(I,J) DEXY(1,2*I,J) = DEDX3(I,J) - DEXYC(2,2*I,J) = DEDX2C(I,J) + DEXYC(2,2*I,97-J) = DEDX2C(I,J) DEXYC(1,2*I-1,J) = DEDX4C(I,J) - DEXYC(2,2*I-1,97-J) = DEDX1C(I,J) + DEXYC(2,2*I-1,J) = DEDX1C(I,J) DEXYC(1,2*I,J) = DEDX3C(I,J) enddo do j = 1,6 - base(2,2*i,j) = base2(i,j) + base(2,2*i,7-j) = base2(i,j) base(1,2*i-1,j) = base4(i,j) - base(2,2*i-1,7-j) = base1(i,j) + base(2,2*i-1,j) = base1(i,j) base(1,2*i,j) = base3(i,j) enddo enddo @@ -1057,6 +1077,10 @@ enddo c if ( iev.eq.dumpo ) then + do i = 1, 4 + print *,' perror(',i,') = ',perror(i) + print *,' stwerr(',i,') = ',stwerr(i) + enddo if (perror(3).eq.132.and.perror(4).eq.129) then do i = 1, 2 do j = 1, 22 @@ -1065,10 +1089,10 @@ enddo enddo enddo - do l=1,lung - write(*,17)l,vecta(l) - enddo endif + do l=1,lung + write(*,17)l,vecta(l) + enddo endif iev = iev + 1 RETURN @@ -1417,12 +1441,12 @@ DEXYC(1,2*I-1,J) = 0. endif if (contr.eq.1) then - DEXY(2,2*I-1,97-J) = 0. - DEXYC(2,2*I-1,97-J) = 0. + DEXY(2,2*I-1,J) = 0. + DEXYC(2,2*I-1,J) = 0. endif if (contr.eq.2) then - DEXY(2,2*I,J) = 0. - DEXYC(2,2*I,J) = 0. + DEXY(2,2*I,97-J) = 0. + DEXYC(2,2*I,97-J) = 0. endif enddo do j = 1,6