4 |
* instead raw-data-file |
* instead raw-data-file |
5 |
* 29/11/2005 modified by david fedele to include crc control |
* 29/11/2005 modified by david fedele to include crc control |
6 |
* 24/06/2006 modified by elena vannuccini |
* 24/06/2006 modified by elena vannuccini |
7 |
|
* 25/06/2006 modified by david fedele |
8 |
************************************************************************* |
************************************************************************* |
9 |
|
|
10 |
subroutine trkeventpkt(YODAflag,buffer,length_buffer,curpos) |
subroutine trkeventpkt(YODAflag,buffer,length_buffer,curpos) |
37 |
|
|
38 |
* =================================== |
* =================================== |
39 |
if(length_buffer.gt.MAXBUFFLEN)then |
if(length_buffer.gt.MAXBUFFLEN)then |
40 |
print*,'trkeventpkt: buffer() size must be at least ' |
c print*,'trkeventpkt: buffer() size must be at least ' |
41 |
$ ,length_buffer,' !!!!' |
c $ ,length_buffer,' !!!!' |
42 |
goto 2222 |
goto 2222 |
43 |
endif |
endif |
44 |
* =================================== |
* =================================== |
71 |
call unpackdata(runerror,buffer,length_buffer,curpos, |
call unpackdata(runerror,buffer,length_buffer,curpos, |
72 |
$ startcrc,stopcrc,crctemp) |
$ startcrc,stopcrc,crctemp) |
73 |
if(runerror.eq.-1.or.runerror.eq.1)then |
if(runerror.eq.-1.or.runerror.eq.1)then |
74 |
goto 2222 !go to end |
goto 2222 !go to end |
75 |
|
else if(runerror.eq.2) then |
76 |
|
crc_dat=2 !flag for corrupted packet |
77 |
endif |
endif |
78 |
|
|
79 |
npkt = npkt + 1 |
npkt = npkt + 1 |
80 |
call fillview(iview) |
call fillview(iview) |
81 |
*-------- CRC check |
*--------CRC check |
82 |
if(crc(iview).eq.0) then !OK |
if(crc(iview).eq.0.or.crc(iview).eq.2) then !OK |
83 |
*----------- ALARMS |
*----------- ALARMS |
84 |
if( |
if( |
85 |
$ fl1(iview).ne.0.or. |
$ fl1(iview).ne.0.or. |
86 |
$ fl2(iview).ne.0.or. |
$ fl2(iview).ne.0.or. |
87 |
$ fl3(iview).ne.0.or. |
$ fl3(iview).ne.0.or. |
88 |
$ fl4(iview).ne.0.or. |
$ fl4(iview).ne.0.or. |
89 |
$ fl5(iview).ne.0.or. |
$ fl5(iview).ne.0.or. |
90 |
$ fl6(iview).ne.0.or. |
$ fl6(iview).ne.0.or. |
91 |
$ fc(iview).ne.0.or. |
$ fc(iview).ne.0.or. |
92 |
$ DATAlength(iview).eq.0.or. |
$ DATAlength(iview).eq.0.or. |
93 |
$ .false.)ALARMS=.true. |
$ .false.)ALARMS=.true. |
94 |
endif |
endif |
95 |
|
|
96 |
2525 continue |
2525 continue |
97 |
enddo !end loop on views |
enddo !end loop on views |
98 |
|
|
141 |
crctemp=0 |
crctemp=0 |
142 |
* ------------------- |
* ------------------- |
143 |
|
|
144 |
|
* =================================== |
145 |
|
if(length_buffer.gt.MAXBUFFLEN)then |
146 |
|
c print*,'trkeventpkt: buffer() size must be at least ' |
147 |
|
c $ ,length_buffer,' !!!!' |
148 |
|
goto 2222 |
149 |
|
endif |
150 |
|
* =================================== |
151 |
|
|
152 |
do iview=1,nplanes !loop on views (DSP pkt) |
do iview=1,nplanes !loop on views (DSP pkt) |
|
|
|
153 |
call searchtrkheader(runerror,buffer,length_buffer,curpos, |
call searchtrkheader(runerror,buffer,length_buffer,curpos, |
154 |
$ startcrc) |
$ startcrc) |
155 |
|
|
195 |
2424 continue |
2424 continue |
196 |
enddo ! end loop on views (calibration pkt) |
enddo ! end loop on views (calibration pkt) |
197 |
|
|
198 |
|
2222 continue |
199 |
|
|
200 |
if(npkt.eq.nplanes)YODAflag=0 |
if(npkt.eq.nplanes)YODAflag=0 |
201 |
if(YODAflag.eq.0.and.(ALARMS.eqv..false.))good0=1 |
if(YODAflag.eq.0.and.(ALARMS.eqv..false.))good0=1 |
202 |
|
|
|
2222 continue |
|
|
|
|
203 |
return |
return |
204 |
end |
end |
205 |
|
|
499 |
C---------------------------------------------------------- |
C---------------------------------------------------------- |
500 |
runerror=0 |
runerror=0 |
501 |
nqualcosa=0 |
nqualcosa=0 |
502 |
if(l_tra.eq.0)then |
c if(l_tra.eq.0)then |
503 |
|
if(l_tra.le.0)then |
504 |
goto 18 !empty buffer |
goto 18 !empty buffer |
505 |
endif |
endif |
506 |
|
|
507 |
if(l_tra.gt.MAXBTRALEN .or.(curpos+l_tra-1).ge.MAXBUFFLEN )then |
if(l_tra.gt.MAXBUFFLEN .or.(curpos+l_tra-1).ge.MAXBUFFLEN )then |
508 |
print*,'unpackdata: ' |
c print*,'unpackdata: ' |
509 |
$ ,'tracker buffer length l_tra ',l_tra |
c $ ,'tracker buffer length l_tra ',l_tra |
510 |
$ ,' exceeds tracker buffer dimensions ' |
c $ ,' exceeds tracker buffer dimensions ' |
511 |
print*,'(packet corrupted)' |
c print*,'(packet corrupted)' |
512 |
runerror=1 |
cc runerror=1 |
513 |
|
runerror=2 |
514 |
goto 50 |
goto 50 |
515 |
endif |
endif |
516 |
call dunpacker(l_tra,b_tra,runerror,buffer,length_buffer,curpos) |
call dunpacker(l_tra,b_tra,runerror,buffer,length_buffer,curpos) |