3 |
* 10/9/2005 modified by david fedele to read buffer-data |
* 10/9/2005 modified by david fedele to read buffer-data |
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 |
7 |
************************************************************************* |
************************************************************************* |
8 |
|
|
9 |
subroutine trkeventpkt(YODAflag,buffer,length_buffer,curpos |
subroutine trkeventpkt(YODAflag,buffer,length_buffer,curpos) |
|
$ ) |
|
10 |
|
|
11 |
include '../common/commontracker.f' |
include '../common/commontracker.f' |
12 |
include '../common/common_readraw.f' |
include '../common/common_readraw.f' |
13 |
include '../common/level0.f' |
include '../common/level0.f' |
14 |
|
|
15 |
|
logical ALARMS |
16 |
|
integer runerror !readevent error flag |
17 |
|
integer*1 crctemp |
18 |
|
|
19 |
|
* ------------------- |
20 |
|
* initializations |
21 |
* --------------------------------------------------- |
* --------------------------------------------------- |
22 |
* the general flag YODAflag contains information |
* the general flag YODAflag contains information |
23 |
* about the integrity of the DSP packets. |
* about the integrity of the DSP packets. |
25 |
* If some packets are missing or the crc check fails, |
* If some packets are missing or the crc check fails, |
26 |
* YODAflag is asserted |
* YODAflag is asserted |
27 |
* --------------------------------------------------- |
* --------------------------------------------------- |
|
|
|
|
c$$$ integer YODAflag |
|
|
|
|
|
|
|
|
logical ALARMS |
|
|
|
|
|
|
|
|
integer runerror !readevent error flag |
|
|
|
|
|
c$$$ parameter (MAXBUFFLEN=z'172c8') |
|
|
c$$$ integer*4 length_buffer |
|
|
c$$$ integer*1 buffer(MAXBUFFLEN) |
|
|
c$$$ integer curpos !current position in buffer |
|
|
c$$$ integer startcrc |
|
|
c$$$ integer stopcrc |
|
|
integer*1 crctemp |
|
|
|
|
|
* ------------------- |
|
|
* initializations |
|
28 |
YODAflag=1 !bad by default |
YODAflag=1 !bad by default |
29 |
call initlevel0 |
call initlevel0 |
30 |
ALARMS=.false. |
ALARMS=.false. |
34 |
crctemp=0 |
crctemp=0 |
35 |
* ------------------- |
* ------------------- |
36 |
|
|
37 |
* =================================== |
* =================================== |
38 |
if(length_buffer.gt.MAXBUFFLEN)then |
if(length_buffer.gt.MAXBUFFLEN)then |
39 |
print*,'trkeventpkt: buffer() size must be at least ',length_buffer,' !!!!' |
print*,'trkeventpkt: buffer() size must be at least ' |
40 |
goto 2222 |
$ ,length_buffer,' !!!!' |
41 |
endif |
goto 2222 |
42 |
* =================================== |
endif |
43 |
|
* =================================== |
44 |
|
|
45 |
|
|
46 |
do iview=1,nviews !loop on DSPs |
do iview=1,nviews !loop on DSPs |
47 |
call searchtrkheader(runerror,buffer,length_buffer,curpos, |
call searchtrkheader(runerror,buffer,length_buffer,curpos, |
48 |
$ startcrc) |
$ startcrc) |
115 |
include '../common/commontracker.f' |
include '../common/commontracker.f' |
116 |
include '../common/common_readraw.f' |
include '../common/common_readraw.f' |
117 |
include '../common/trk_calib_parameters.f' |
include '../common/trk_calib_parameters.f' |
118 |
|
|
119 |
|
logical ALARMs |
120 |
|
integer runerror !readevent error flag |
121 |
|
integer*1 crctemp |
122 |
|
|
123 |
|
* ------------------- |
124 |
|
* initializations |
125 |
* --------------------------------------------------- |
* --------------------------------------------------- |
126 |
* the general flag YODAflag contains information |
* the general flag YODAflag contains information |
127 |
* about the integrity of the DSP packets. |
* about the integrity of the DSP packets. |
129 |
* If some packets are missing or the crc check fails, |
* If some packets are missing or the crc check fails, |
130 |
* YODAflag is asserted |
* YODAflag is asserted |
131 |
* --------------------------------------------------- |
* --------------------------------------------------- |
|
|
|
|
c$$$ integer YODAflag |
|
|
|
|
|
logical ALARMs |
|
|
|
|
|
integer runerror !readevent error flag |
|
|
c$$$ parameter (MAXBUFFLEN=z'172c8') |
|
|
c$$$ integer*4 length_buffer |
|
|
c$$$ integer*1 buffer(MAXBUFFLEN) |
|
|
c$$$ integer curpos !current position in buffer |
|
|
c$$$ integer startcrc |
|
|
c$$$ integer stopcrc |
|
|
integer*1 crctemp |
|
|
|
|
|
* ------------------- |
|
|
* initializations |
|
132 |
YODAflag = 1 !bad by default |
YODAflag = 1 !bad by default |
133 |
call initcalib |
call initcalib |
134 |
ALARMS=.false. |
ALARMS=.false. |
211 |
include '../common/commontracker.f' |
include '../common/commontracker.f' |
212 |
include '../common/common_readraw.f' |
include '../common/common_readraw.f' |
213 |
|
|
|
c$$$ parameter (MAXBUFFLEN=z'172c8') |
|
|
c$$$ integer*4 length_buffer |
|
|
c$$$ integer*1 buffer(MAXBUFFLEN) |
|
|
c$$$ integer curpos !current position in buffer |
|
|
c$$$ integer startcrc |
|
|
|
|
214 |
integer runerror !readevent error flag |
integer runerror !readevent error flag |
215 |
|
|
216 |
c-------------------------------------------------- |
c-------------------------------------------------- |
304 |
include '../common/commontracker.f' |
include '../common/commontracker.f' |
305 |
include '../common/common_readraw.f' |
include '../common/common_readraw.f' |
306 |
|
|
|
c$$$ parameter (MAXBUFFLEN=z'172c8') |
|
|
c$$$ integer*4 length_buffer |
|
|
c$$$ integer*1 buffer(MAXBUFFLEN) |
|
|
c$$$ integer curpos !current position in buffer |
|
|
c$$$ integer startcrc |
|
|
c$$$ integer stopcrc |
|
307 |
integer*1 crctemp |
integer*1 crctemp |
308 |
integer*1 crc_trail |
integer*1 crc_trail |
309 |
|
|
426 |
include '../common/common_readraw.f' |
include '../common/common_readraw.f' |
427 |
include '../common/level0.f' |
include '../common/level0.f' |
428 |
|
|
|
c$$$ parameter (MAXBUFFLEN=z'172c8') |
|
|
c$$$ integer*4 length_buffer |
|
|
c$$$ integer*1 buffer(MAXBUFFLEN) |
|
|
c$$$ integer curpos !current position in buffer |
|
|
c$$$ integer startcrc |
|
|
c$$$ integer stopcrc |
|
429 |
integer*1 crctemp |
integer*1 crctemp |
430 |
integer*1 crcdat |
integer*1 crcdat |
431 |
|
|
493 |
goto 18 !empty buffer |
goto 18 !empty buffer |
494 |
endif |
endif |
495 |
|
|
496 |
if(l_tra.gt.MAXBTRALEN)then |
if(l_tra.gt.MAXBTRALEN .or.(curpos+l_tra-1).ge.MAXBUFFLEN )then |
497 |
print*,'unpackdata: ' |
print*,'unpackdata: ' |
498 |
$ ,'tracker buffer length l_tra exceeds buffer dimension ' |
$ ,'tracker buffer length l_tra ',l_tra |
499 |
$ ,l_tra,MAXBTRALEN |
$ ,' exceeds tracker buffer dimensions ' |
500 |
|
print*,'(packet corrupted)' |
501 |
runerror=1 |
runerror=1 |
502 |
goto 50 |
goto 50 |
503 |
endif |
endif |