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) |
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 |
|
print*,'trkeventpkt: buffer() size must be at least ' |
147 |
|
$ ,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 |
|
|
154 |
call searchtrkheader(runerror,buffer,length_buffer,curpos, |
call searchtrkheader(runerror,buffer,length_buffer,curpos, |
196 |
2424 continue |
2424 continue |
197 |
enddo ! end loop on views (calibration pkt) |
enddo ! end loop on views (calibration pkt) |
198 |
|
|
199 |
|
2222 continue |
200 |
|
|
201 |
if(npkt.eq.nplanes)YODAflag=0 |
if(npkt.eq.nplanes)YODAflag=0 |
202 |
if(YODAflag.eq.0.and.(ALARMS.eqv..false.))good0=1 |
if(YODAflag.eq.0.and.(ALARMS.eqv..false.))good0=1 |
203 |
|
|
|
2222 continue |
|
|
|
|
204 |
return |
return |
205 |
end |
end |
206 |
|
|
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: ' |
print*,'unpackdata: ' |
509 |
$ ,'tracker buffer length l_tra ',l_tra |
$ ,'tracker buffer length l_tra ',l_tra |
510 |
$ ,' exceeds tracker buffer dimensions ' |
$ ,' exceeds tracker buffer dimensions ' |
511 |
print*,'(packet corrupted)' |
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) |