| 1 |
subroutine trkeventpkt(runerror,event_file_name) |
subroutine trkeventpkt(YODAflag,event_file_name) |
| 2 |
|
|
| 3 |
include '../commonyoda/commontracker.f' |
include '../commonyoda/commontracker.f' |
| 4 |
include '../commonyoda/dataformat.f' |
include '../commonyoda/dataformat.f' |
|
c include '../commonyoda/trk_calib_parameters.f' |
|
| 5 |
include '../commonyoda/level0.f' |
include '../commonyoda/level0.f' |
| 6 |
|
|
| 7 |
|
* --------------------------------------------------- |
| 8 |
|
* the general flag YODAflag contains information |
| 9 |
|
* about the integrity of the packet. |
| 10 |
|
* |
| 11 |
|
* It is coded in bits: |
| 12 |
|
* |
| 13 |
|
* x xxxx xxxx xxxx xxxx |
| 14 |
|
* | |||| |||| |||| |||| |
| 15 |
|
* | |||| |||| |||| |||- integrity flag of 1 st DSP packet |
| 16 |
|
* | |||| |||| |||| ||-- " " " 2 nd " " |
| 17 |
|
* | |||| |||| |||| |--- " " " 3 rd " " |
| 18 |
|
* | |||| .............. |
| 19 |
|
* | |.................. |
| 20 |
|
* | ------------------- integrity flag of 12 th DSP packet |
| 21 |
|
* | |
| 22 |
|
* --------------------- flag that indicates if more than 12 |
| 23 |
|
* packets have been found |
| 24 |
|
* |
| 25 |
|
* EXAMPLE 1. |
| 26 |
|
* If the event packet is truncated and only three DSP packets |
| 27 |
|
* are present in the fragment, the last being TRUNCATED, |
| 28 |
|
* the YODAflag will be: |
| 29 |
|
* |
| 30 |
|
* YODAflag = b#00000000000000100 = 4 |
| 31 |
|
* |
| 32 |
|
* and only the two integer packets will be stored. |
| 33 |
|
* |
| 34 |
|
* EXAMPLE 2. |
| 35 |
|
* If instead the corruption of a packet results from |
| 36 |
|
* checksum or crc, the YODAflag will be asserted as explained, |
| 37 |
|
* but the packet will be stored. |
| 38 |
|
* --------------------------------------------------- |
| 39 |
|
integer YODAflag |
| 40 |
|
|
| 41 |
|
logical DEBUG,ALARMs |
| 42 |
|
common/DEBUGflag/DEBUG,ALARMS |
| 43 |
|
|
| 44 |
|
|
| 45 |
integer ndummy |
integer ndummy |
| 46 |
data ndummy/1000/ |
data ndummy/1000/ |
| 47 |
integer lun_pkt |
|
|
parameter (lun_pkt=10) |
|
| 48 |
integer runerror !readevent error flag |
integer runerror !readevent error flag |
| 49 |
integer ffd_pkt !pkt file descriptor |
integer ffd_pkt !pkt file descriptor |
| 50 |
!(file temporaneo) |
* (file temporaneo) |
| 51 |
character*60 event_file_name !nome file |
character*60 event_file_name !nome file |
| 52 |
c print*,' lun_pkt-----',int(lun_pkt); |
|
| 53 |
|
integer lun_pkt |
| 54 |
|
data lun_pkt/20/ |
| 55 |
|
|
| 56 |
|
integer last_trigger(nviews) |
| 57 |
|
common/trigger_counter/last_trigger |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
YODAflag=0 |
| 61 |
|
|
| 62 |
open(unit=lun_pkt, |
open(unit=lun_pkt, |
| 63 |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
| 64 |
$ status='old', |
$ status='old', |
| 66 |
$ ) |
$ ) |
| 67 |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
| 68 |
|
|
|
|
|
| 69 |
call initlevel0 |
call initlevel0 |
| 70 |
|
|
| 71 |
TOTDATAlength = 0. !total length of data buffer |
TOTDATAlength = 0. !total length of data buffer |
| 72 |
do iview=1,ndummy !loop on views |
do iview=1,nviews!ndummy !loop on views |
| 73 |
call searchtrkheader(runerror,ffd_pkt) |
call searchtrkheader(runerror,ffd_pkt) |
| 74 |
c if(runerror.eq.-1) goto 24 |
if(runerror.eq.1.or.runerror.eq.-1) then |
| 75 |
if(runerror.eq.-1) goto 2222 |
* -------------------------------------------------- |
| 76 |
if(runerror.eq.1) then |
* no further DSP packet has been found ==> go to end |
| 77 |
c print*,' ' |
* -------------------------------------------------- |
| 78 |
c print*,'readraw: END OF CPU PACKET ' |
goto 2222 !go to end |
|
c print*,'______________________________________ ' |
|
|
c goto 9900 !end loop on files |
|
|
c goto 8800 !end loop on views (DSP pkt) |
|
|
goto 2222 |
|
| 79 |
endif |
endif |
| 80 |
|
|
| 81 |
if(checkheader.ne.2) then |
if(checkheader.ne.2) then |
| 82 |
c print*,'>>>> ERROR <<<< (trkeventpkt)' |
print*,'>>>> ERROR <<<< (trkeventpkt)' |
| 83 |
c print*,'>>>> CPU packet type ',!pkt_type, |
print*,'>>>> CPU packet type ',!pkt_type, |
| 84 |
c $ ' does not match DSP type ',checkheader |
$ ' does not match DSP packet type ',checkheader |
|
c goto 9909 ! next event (==> search another CPU header) |
|
| 85 |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
| 86 |
DSPnumber_temp = iand(header(1),z'000f') |
DSPnumber_temp = iand(header(1),z'000f') |
| 87 |
c print*,' -----------------------------------' |
print*,' -----------------------------------' |
| 88 |
c $ ,iview |
$ ,iview |
| 89 |
c print*,' DSP number-----',int(DSPnumber_temp) |
print*,' DSP number-----',int(DSPnumber_temp) |
| 90 |
c print*,' DAQ mode-------',int(DAQmode_temp) |
print*,' DAQ mode-------',int(DAQmode_temp) |
| 91 |
c print*,' -----------------------------------' |
print*,' -----------------------------------' |
| 92 |
goto 2525 !next view (==> search another DSP header) |
goto 2525 !next view (==> search another DSP header) |
| 93 |
endif |
endif |
| 94 |
|
|
| 95 |
call unpackdata(runerror,ffd_pkt) |
call unpackdata(runerror,ffd_pkt) |
| 96 |
c if(runerror.eq.-1) goto 24 |
if(runerror.eq.-1.or.runerror.eq.1)then |
| 97 |
if(runerror.eq.-1) goto 2222 |
* ----------------------------------------------- |
| 98 |
c if(runerror.eq.1) goto 23 |
* an error occurred while reading the packet data |
| 99 |
if(runerror.eq.1) goto 2222 |
* ===> assert packet error bit ===> go to end |
| 100 |
|
* ----------------------------------------------- |
| 101 |
c print*,' ' |
YODAflag=ior(YODAflag,int(2**(iview-1))) |
| 102 |
c print*,' -----------------------------------',iview |
goto 2222 !end |
| 103 |
c print*,' DSP number-----',DSPnumber_dat |
endif |
| 104 |
c print*,' DAQ mode-------',DAQmode_dat |
|
| 105 |
c print*,' event number ',eventn_dat |
if(ALARMs)then |
| 106 |
|
print*,' ' |
| 107 |
|
print*,' -----------------------------------',iview |
| 108 |
|
print*,' DSP number-----',DSPnumber_dat |
| 109 |
|
print*,' DAQ mode-------',DAQmode_dat |
| 110 |
|
print*,' event number ',eventn_dat |
| 111 |
|
print*,' datalength (13-bit w) ---- ',datalength_dat |
| 112 |
|
print*,' L-1 addr---',addrcluster_dat(1) |
| 113 |
|
print*,' signal-',signcluster_dat(1) |
| 114 |
|
print*,' L-2 addr---',addrcluster_dat(2) |
| 115 |
|
print*,' signal-',signcluster_dat(2) |
| 116 |
|
print*,' L-3 addr---',addrcluster_dat(3) |
| 117 |
|
print*,' signal-',signcluster_dat(3) |
| 118 |
|
print*,' FC------',fc_dat |
| 119 |
|
print*,' compression time ',compressiontime_dat |
| 120 |
|
print*,' FL1--',fl1_dat |
| 121 |
|
print*,' FL2--',fl2_dat |
| 122 |
|
print*,' FL3--',fl3_dat |
| 123 |
|
print*,' FL4--',fl4_dat |
| 124 |
|
print*,' FL5--',fl5_dat |
| 125 |
|
print*,' FL6--',fl6_dat |
| 126 |
|
|
| 127 |
|
print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
| 128 |
|
print*,'* PNUM (periferal num) ',pnum_dat |
| 129 |
|
print*,'* CMDNUM (command) ',cmdnum_dat |
| 130 |
|
print*,'* BID (board id) ',bid_dat |
| 131 |
|
print*,'* ALARM ',alarm_dat |
| 132 |
|
print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
| 133 |
|
|
| 134 |
|
DEBUG = .true. |
| 135 |
|
endif |
| 136 |
|
|
| 137 |
trk_DSP_ok(DSPnumber_dat)=1 |
trk_DSP_ok(DSPnumber_dat)=1 |
| 138 |
|
|
| 139 |
call fillview(iview) |
call fillview(iview) |
| 149 |
|
|
| 150 |
* ********************************************** |
* ********************************************** |
| 151 |
|
|
|
c subroutine trk_calib_pkt(runerror,ffd_pkt) |
|
| 152 |
subroutine trkcalibpkt(runerror,event_file_name) |
subroutine trkcalibpkt(runerror,event_file_name) |
| 153 |
|
|
| 154 |
include '../commonyoda/commontracker.f' |
include '../commonyoda/commontracker.f' |
| 163 |
!(file temporaneo) |
!(file temporaneo) |
| 164 |
character*60 event_file_name !nome file |
character*60 event_file_name !nome file |
| 165 |
|
|
| 166 |
|
logical DEBUG,ALARMs |
| 167 |
|
data DEBUG/.false./ |
| 168 |
|
|
| 169 |
|
ccc data DEBUG/.true./ |
| 170 |
|
ccc common/DEBUGflag/DEBUG |
| 171 |
|
|
| 172 |
|
|
| 173 |
|
integer lun_pkt |
| 174 |
|
data lun_pkt/10/ |
| 175 |
|
|
| 176 |
|
|
| 177 |
open(unit=lun_pkt, |
open(unit=lun_pkt, |
| 178 |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
| 179 |
$ status='old', |
$ status='old', |
| 180 |
$ form='unformatted' |
$ form='unformatted' |
| 181 |
$ ) |
$ ) |
| 182 |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
| 183 |
|
|
| 184 |
|
|
| 185 |
|
|
| 186 |
do iview=1,ndummy !loop on views (DSP pkt) |
do iview=1,ndummy !loop on views (DSP pkt) |
| 187 |
|
|
| 188 |
|
ALARMS=.false. |
| 189 |
|
|
| 190 |
call searchtrkheader(runerror,ffd_pkt) |
call searchtrkheader(runerror,ffd_pkt) |
| 191 |
c if(runerror.eq.-1) goto 24 |
c if(runerror.eq.-1) goto 24 |
| 192 |
if(runerror.eq.-1) goto 2222 |
if(runerror.eq.-1) goto 2222 |
| 197 |
goto 2222 !end loop on views (DSP pkt) |
goto 2222 !end loop on views (DSP pkt) |
| 198 |
endif |
endif |
| 199 |
if(checkheader.ne.3) then |
if(checkheader.ne.3) then |
| 200 |
c print*,'>>>> ERROR <<<< (trkcalibpkt)' |
print*,'>>>> ERROR <<<< (trkcalibpkt)' |
| 201 |
c print*,'>>>> CPU packet type ',!pkt_type, |
print*,'>>>> CPU packet type ',!pkt_type, |
| 202 |
c $ ' does not match DSP type ',checkheader |
$ ' does not match DSP type ',checkheader |
| 203 |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
| 204 |
DSPnumber_temp = iand(header(1),z'000f') |
DSPnumber_temp = iand(header(1),z'000f') |
| 205 |
c print*,' -----------------------------------' |
print*,' -----------------------------------' |
| 206 |
c $ ,iview |
$ ,iview |
| 207 |
c print*,' DSP number-----',int(DSPnumber_temp) |
print*,' DSP number-----',int(DSPnumber_temp) |
| 208 |
c print*,' DAQ mode-------',int(DAQmode_temp) |
print*,' DAQ mode-------',int(DAQmode_temp) |
| 209 |
c print*,' -----------------------------------' |
print*,' -----------------------------------' |
| 210 |
goto 2424 !next view (==> search another DSP header) |
goto 2424 !next view (==> search another DSP header) |
| 211 |
endif |
endif |
| 212 |
|
|
| 216 |
c if(runerror.eq.1) goto 23 |
c if(runerror.eq.1) goto 23 |
| 217 |
if(runerror.eq.1) goto 2222 |
if(runerror.eq.1) goto 2222 |
| 218 |
|
|
|
|
|
|
c print*,'Calibration packet ==> ',iview |
|
|
|
|
|
c print*,'---- Calibration packet ',iview,' ----' |
|
|
c print*,' DSP number ',DSPnumber_cal |
|
|
c print*,' DAQ mode ',DAQmode_cal |
|
|
c print*,' calibration run ',calibrationnumber |
|
|
c print*,' n. event used ',nused_event |
|
|
c print*,' <PED> ladder 1 ',ped_1 |
|
|
c print*,' <PED> ladder 2 ',ped_2 |
|
|
c print*,' <PED> ladder 3 ',ped_3 |
|
|
c print*,' <SIG> ladder 1 ',sig_1 |
|
|
c print*,' <SIG> ladder 2 ',sig_2 |
|
|
c print*,' <SIG> ladder 3 ',sig_3 |
|
|
c print*,' n.BAD ladder 1 ',nbad_1 |
|
|
c print*,' n.BAD ladder 2 ',nbad_2 |
|
|
c print*,' n.BAD ladder 3 ',nbad_3 |
|
|
c print*,' error flag ',ff |
|
| 219 |
if(nused_event.ne.0.or.ff.ne.0)then |
if(nused_event.ne.0.or.ff.ne.0)then |
| 220 |
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
| 221 |
c print*,'* !!! CALIBRATION FAILURE !!! *' |
print*,'* !!! CALIBRATION FAILURE !!! *' |
| 222 |
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
| 223 |
|
c ALARMS=.true. |
| 224 |
endif |
endif |
| 225 |
|
if(ALARMS)then |
| 226 |
|
|
| 227 |
|
print*,'Calibration packet ==> ',iview |
| 228 |
|
|
| 229 |
|
print*,'---- Calibration packet ',iview,' ----' |
| 230 |
|
print*,' DSP number ',DSPnumber_cal |
| 231 |
|
print*,' DAQ mode ',DAQmode_cal |
| 232 |
|
print*,' calibration run ',calibrationnumber |
| 233 |
|
print*,' n. event used ',nused_event |
| 234 |
|
print*,' <PED> ladder 1 ',ped_1 |
| 235 |
|
print*,' <PED> ladder 2 ',ped_2 |
| 236 |
|
print*,' <PED> ladder 3 ',ped_3 |
| 237 |
|
print*,' <SIG> ladder 1 ',sig_1 |
| 238 |
|
print*,' <SIG> ladder 2 ',sig_2 |
| 239 |
|
print*,' <SIG> ladder 3 ',sig_3 |
| 240 |
|
print*,' n.BAD ladder 1 ',nbad_1 |
| 241 |
|
print*,' n.BAD ladder 2 ',nbad_2 |
| 242 |
|
print*,' n.BAD ladder 3 ',nbad_3 |
| 243 |
|
print*,' error flag ',ff |
| 244 |
|
endif |
| 245 |
|
|
| 246 |
DAQmode(iview)=DAQmode_cal |
DAQmode(iview)=DAQmode_cal |
| 247 |
DSPnumber(iview)=DSPnumber_cal |
DSPnumber(iview)=DSPnumber_cal |
| 319 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 320 |
call findstart(runerror,ffd) |
call findstart(runerror,ffd) |
| 321 |
|
|
| 322 |
if(runerror.eq.1) goto 200 |
if(runerror.eq.1) goto 200 !end |
| 323 |
if(runerror.eq.-1)then |
if(runerror.eq.-1)goto 200 !end |
|
runerror=1 !in this case I dont want the |
|
|
!the program to crash |
|
|
goto 200 |
|
|
endif |
|
| 324 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 325 |
c the first word could be a DSP header first word: |
c the first word could be a DSP header first word: |
| 326 |
C reads 13 8-bit words and |
C reads 13 8-bit words and |
| 327 |
c writes them in 16 13-bit words to check for all |
c writes them in 16 13-bit words to check for all |
| 328 |
C DSP header features |
C DSP header features |
| 329 |
c-------------------------------------------------- |
c-------------------------------------------------- |
|
runerror=0 |
|
| 330 |
|
|
| 331 |
call hunpacker(header,runerror,ffd) |
call hunpacker(header,runerror,ffd) |
| 332 |
|
|
| 333 |
if(runerror.eq.1) goto 200 |
if(runerror.eq.1) goto 200 !end |
| 334 |
c if(runerror.eq.-1) goto 200 |
if(runerror.eq.-1)goto 200 !end |
|
if(runerror.eq.-1)then |
|
|
runerror=1 !in this case I dont want the |
|
|
!the program to crash |
|
|
goto 200 |
|
|
endif |
|
| 335 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 336 |
c extracts and controls header: |
c extracts and controls header: |
| 337 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 339 |
c |0001|1100|0000|0000| for acquisition |
c |0001|1100|0000|0000| for acquisition |
| 340 |
c |0001|1111|1111|1111| for calibration |
c |0001|1111|1111|1111| for calibration |
| 341 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 342 |
if(iand(header(16),z'ffff').eq.z'1c00') then !last header |
if(iand(header(16),z'ffff').eq.z'1c00') then |
| 343 |
checkheader=2 ! event |
checkheader=2 ! event packet |
| 344 |
elseif(iand(header(16),z'ffff').eq.z'1fff') then !last header |
elseif(iand(header(16),z'ffff').eq.z'1fff') then |
| 345 |
checkheader=3 ! calibration packet |
checkheader=3 ! calibration packet |
| 346 |
else |
else |
| 347 |
checkheader=1 ! not a valid DSP header |
checkheader=1 ! not a valid DSP header |
| 367 |
c try again |
c try again |
| 368 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 369 |
if(checkheader.eq.1) then |
if(checkheader.eq.1) then |
| 370 |
call skipbyte(ffd) |
call skipbyte(ffd) !new search |
| 371 |
goto 9100 |
goto 9100 |
| 372 |
endif |
endif |
| 373 |
200 continue |
200 continue |
| 491 |
integer runerror !readevent error flag |
integer runerror !readevent error flag |
| 492 |
integer l_tra |
integer l_tra |
| 493 |
|
|
| 494 |
|
logical DEBUG,ALARMs |
| 495 |
|
common/DEBUGflag/DEBUG,ALARMs |
| 496 |
|
c data ALARMs/.false./ |
| 497 |
|
|
| 498 |
|
|
| 499 |
|
ALARMs = .false. |
| 500 |
|
|
| 501 |
12 format(z4) |
12 format(z4) |
| 502 |
|
|
| 503 |
*----------------------------------------------------------- |
*----------------------------------------------------------- |
| 512 |
c NB: data are packed from 13-bit to 16-bit words, |
c NB: data are packed from 13-bit to 16-bit words, |
| 513 |
c so the stream is complited with zeros in order to have |
c so the stream is complited with zeros in order to have |
| 514 |
c a number of bits multiple of 16 |
c a number of bits multiple of 16 |
| 515 |
|
C ------------------------------------------------------ |
| 516 |
l_tra = ior(ishft(iand(header(2),z'03ff') |
l_tra = ior(ishft(iand(header(2),z'03ff') |
| 517 |
$ ,10),iand(header(3),z'03ff')) |
$ ,10),iand(header(3),z'03ff')) |
| 518 |
l_tra=l_tra-13 |
l_tra=l_tra-13 |
| 537 |
fl1_dat = iand(header(14),z'0300') |
fl1_dat = iand(header(14),z'0300') |
| 538 |
fl6_dat = ishft(iand(header(15),z'0300'),-8) |
fl6_dat = ishft(iand(header(15),z'0300'),-8) |
| 539 |
checksum_dat = iand(header(15),z'00ff') |
checksum_dat = iand(header(15),z'00ff') |
| 540 |
|
|
| 541 |
|
if( |
| 542 |
|
$ fc_dat.ne.0.or. |
| 543 |
|
$ fl1_dat.ne.0.or. |
| 544 |
|
$ fl2_dat.ne.0.or. |
| 545 |
|
$ fl3_dat.ne.0.or. |
| 546 |
|
$ fl4_dat.ne.0.or. |
| 547 |
|
$ fl5_dat.ne.0.or. |
| 548 |
|
$ fl6_dat.ne.0.or. |
| 549 |
|
$ .false.)ALARMs=.true. |
| 550 |
c----------------------------------------------------------- |
c----------------------------------------------------------- |
| 551 |
c the cheacksum is a 8-bit word calculated as the |
c the cheacksum is a 8-bit word calculated as the |
| 552 |
c XOR of the 16-bit data words, |
c XOR of the 16-bit data words, |
| 553 |
c hence the XOR between the two halfs |
c hence the XOR between the two halfs |
| 554 |
C---------------------------------------------------------- |
C---------------------------------------------------------- |
| 555 |
runerror=0 |
runerror=0 |
| 556 |
|
nqualcosa=0 |
| 557 |
|
if(l_tra.eq.0)then |
| 558 |
|
ALARMs=.true. |
| 559 |
|
goto 18 !empty buffer |
| 560 |
|
endif |
| 561 |
call dunpacker(l_tra,b_tra,runerror,ffd) |
call dunpacker(l_tra,b_tra,runerror,ffd) |
| 562 |
|
if(runerror.eq.1.or.runerror.eq.-1) then |
| 563 |
|
goto 50 !go to end |
| 564 |
|
endif |
| 565 |
|
|
| 566 |
nqualcosa = (real(l_tra))/13*16 |
nqualcosa = (real(l_tra))/13*16 |
| 567 |
xx = b_tra(nqualcosa) |
xx = b_tra(nqualcosa) |
| 568 |
if (xx.eq.0) nqualcosa=nqualcosa -1 |
if (xx.eq.0) nqualcosa=nqualcosa -1 |
| 569 |
datalength_dat= nqualcosa |
|
| 570 |
c$$$ TOTDATAlength = TOTDATAlength + datalength_dat |
18 datalength_dat= nqualcosa |
| 571 |
c$$$ do i=1,datalength_dat |
|
|
c$$$ id = id + 1 |
|
|
c$$$ datatracker(id) = b_tra(i) |
|
|
c$$$ enddo |
|
|
|
|
|
|
|
|
|
|
| 572 |
11 format(i1,' ',z4) |
11 format(i1,' ',z4) |
|
c write(*,11)il,word |
|
| 573 |
call readtrailer(trailer,runerror,ffd) |
call readtrailer(trailer,runerror,ffd) |
|
c$$$ do i=1,3 |
|
|
c$$$ write(*,12)trailer(i) |
|
|
c$$$ enddo |
|
| 574 |
|
|
| 575 |
*************************************************************** |
*************************************************************** |
| 576 |
* TRAILER * |
* TRAILER * |
| 595 |
|
|
| 596 |
bid_dat = bid_dat_sum/7 |
bid_dat = bid_dat_sum/7 |
| 597 |
|
|
| 598 |
if (bid_dat.ne.1.and.bid_dat.ne.2) then |
if ((bid_dat.ne.1.and.bid_dat.ne.2).or. |
| 599 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
$ (mod(bid_dat_sum,7).ne.0).or. |
| 600 |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
$ .false.) then |
| 601 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** *** *** ***' |
| 602 |
endif |
write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED - BID ' |
| 603 |
if (mod(bid_dat_sum,7).ne.0) then |
$ ,bid_dat |
| 604 |
bid_dat = 0 |
write(*,*) '*** *** *** *** *** *** *** *** *** *** *** ***' |
| 605 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
ALARMs=.true. |
|
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
|
|
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
|
| 606 |
endif |
endif |
| 607 |
|
|
| 608 |
|
|
| 609 |
if (alarm_dat.eq.3) then |
if (alarm_dat.eq.3) then |
| 610 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** *** ***' |
| 611 |
c write(*,*) 'unpack_data: AQUISITION ALARM' |
write(*,*) 'unpack_data: TRAILER --- AQUISITION ALARM!!!' |
| 612 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** *** ***' |
| 613 |
|
write(*,*) alarm_dat |
| 614 |
|
ALARMs=.true. |
| 615 |
|
|
| 616 |
endif |
endif |
| 617 |
|
|
| 618 |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
| 619 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** *** *** *** **' |
| 620 |
c write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED - ALARM ' |
| 621 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
$ ,alarm_dat |
| 622 |
|
write(*,*) '*** *** *** *** *** *** *** *** *** *** *** *** **' |
| 623 |
|
ALARMs=.true. |
| 624 |
endif |
endif |
| 625 |
|
|
| 626 |
|
|
| 627 |
return |
50 return |
| 628 |
end |
end |
| 629 |
|
|
| 630 |
|
|
| 631 |
*............................................................................. |
*............................................................................. |
| 632 |
subroutine initlevel0 |
subroutine initlevel0 |
| 633 |
|
|
| 634 |
include '../commonyoda/level0.f' |
include '../commonyoda/commontracker.f' |
| 635 |
|
include '../commonyoda/level0.f' |
| 636 |
|
|
| 637 |
|
|
| 638 |
do i=1, nviews |
do i=1, nviews |
| 725 |
alarm(i)= alarm_dat |
alarm(i)= alarm_dat |
| 726 |
aswr(i) = aswr_dat |
aswr(i) = aswr_dat |
| 727 |
|
|
|
c print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
|
|
c print*,'* PNUM (periferal num) ',pnum_dat |
|
|
c print*,'* CMDNUM (command) ',cmdnum_dat |
|
|
c print*,'* BID (board id) ',bid_dat |
|
|
c print*,'* ALARM ',alarm_dat |
|
|
c print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
|
|
|
|
| 728 |
do idat=1,datalength_dat |
do idat=1,datalength_dat |
| 729 |
id = TOTDATAlength + idat |
id = TOTDATAlength + idat |
| 730 |
datatracker(id) = b_tra(idat) |
datatracker(id) = b_tra(idat) |
| 731 |
enddo |
enddo |
| 732 |
TOTDATAlength = TOTDATAlength + datalength_dat |
TOTDATAlength = TOTDATAlength + datalength_dat |
| 733 |
|
|
| 734 |
return |
return |
| 735 |
end |
end |
| 736 |
|
|