| 8 |
|
|
| 9 |
integer ndummy |
integer ndummy |
| 10 |
data ndummy/1000/ |
data ndummy/1000/ |
| 11 |
|
integer lun_pkt |
| 12 |
|
parameter (lun_pkt=10) |
| 13 |
integer runerror !readevent error flag |
integer runerror !readevent error flag |
| 14 |
integer ffd_pkt !pkt file descriptor |
integer ffd_pkt !pkt file descriptor |
| 15 |
!(file temporaneo) |
!(file temporaneo) |
| 31 |
c if(runerror.eq.-1) goto 24 |
c if(runerror.eq.-1) goto 24 |
| 32 |
if(runerror.eq.-1) goto 2222 |
if(runerror.eq.-1) goto 2222 |
| 33 |
if(runerror.eq.1) then |
if(runerror.eq.1) then |
| 34 |
print*,' ' |
c print*,' ' |
| 35 |
print*,'readraw: END OF CPU PACKET ' |
c print*,'readraw: END OF CPU PACKET ' |
| 36 |
print*,'______________________________________ ' |
c print*,'______________________________________ ' |
| 37 |
c goto 9900 !end loop on files |
c goto 9900 !end loop on files |
| 38 |
c goto 8800 !end loop on views (DSP pkt) |
c goto 8800 !end loop on views (DSP pkt) |
| 39 |
goto 2222 |
goto 2222 |
| 40 |
endif |
endif |
| 41 |
|
|
| 42 |
if(checkheader.ne.2) then |
if(checkheader.ne.2) then |
| 43 |
print*,'>>>> ERROR <<<< (trkeventpkt)' |
c print*,'>>>> ERROR <<<< (trkeventpkt)' |
| 44 |
print*,'>>>> CPU packet type ',!pkt_type, |
c print*,'>>>> CPU packet type ',!pkt_type, |
| 45 |
$ ' does not match DSP type ',checkheader |
c $ ' does not match DSP type ',checkheader |
| 46 |
c goto 9909 ! next event (==> search another CPU header) |
c goto 9909 ! next event (==> search another CPU header) |
| 47 |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
| 48 |
DSPnumber_temp = iand(header(1),z'000f') |
DSPnumber_temp = iand(header(1),z'000f') |
| 49 |
print*,' -----------------------------------' |
c print*,' -----------------------------------' |
| 50 |
$ ,iview |
c $ ,iview |
| 51 |
print*,' DSP number-----',int(DSPnumber_temp) |
c print*,' DSP number-----',int(DSPnumber_temp) |
| 52 |
print*,' DAQ mode-------',int(DAQmode_temp) |
c print*,' DAQ mode-------',int(DAQmode_temp) |
| 53 |
print*,' -----------------------------------' |
c print*,' -----------------------------------' |
| 54 |
goto 2525 !next view (==> search another DSP header) |
goto 2525 !next view (==> search another DSP header) |
| 55 |
endif |
endif |
| 56 |
|
|
| 60 |
c if(runerror.eq.1) goto 23 |
c if(runerror.eq.1) goto 23 |
| 61 |
if(runerror.eq.1) goto 2222 |
if(runerror.eq.1) goto 2222 |
| 62 |
|
|
| 63 |
print*,' ' |
c print*,' ' |
| 64 |
print*,' -----------------------------------',iview |
c print*,' -----------------------------------',iview |
| 65 |
print*,' DSP number-----',DSPnumber_dat |
c print*,' DSP number-----',DSPnumber_dat |
| 66 |
print*,' DAQ mode-------',DAQmode_dat |
c print*,' DAQ mode-------',DAQmode_dat |
| 67 |
print*,' event number ',eventn_dat |
c print*,' event number ',eventn_dat |
| 68 |
|
|
| 69 |
trk_DSP_ok(DSPnumber_dat)=1 |
trk_DSP_ok(DSPnumber_dat)=1 |
| 70 |
|
|
| 109 |
c if(runerror.eq.-1) goto 24 |
c if(runerror.eq.-1) goto 24 |
| 110 |
if(runerror.eq.-1) goto 2222 |
if(runerror.eq.-1) goto 2222 |
| 111 |
if(runerror.eq.1) then |
if(runerror.eq.1) then |
| 112 |
print*,' ' |
c print*,' ' |
| 113 |
print*,'readraw: END OF CPU PACKET ' |
c print*,'readraw: END OF CPU PACKET ' |
| 114 |
print*,'______________________________________ ' |
c print*,'______________________________________ ' |
| 115 |
goto 2222 !end loop on views (DSP pkt) |
goto 2222 !end loop on views (DSP pkt) |
| 116 |
endif |
endif |
| 117 |
if(checkheader.ne.3) then |
if(checkheader.ne.3) then |
| 118 |
print*,'>>>> ERROR <<<< (trkcalibpkt)' |
c print*,'>>>> ERROR <<<< (trkcalibpkt)' |
| 119 |
print*,'>>>> CPU packet type ',!pkt_type, |
c print*,'>>>> CPU packet type ',!pkt_type, |
| 120 |
$ ' does not match DSP type ',checkheader |
c $ ' does not match DSP type ',checkheader |
| 121 |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
| 122 |
DSPnumber_temp = iand(header(1),z'000f') |
DSPnumber_temp = iand(header(1),z'000f') |
| 123 |
print*,' -----------------------------------' |
c print*,' -----------------------------------' |
| 124 |
$ ,iview |
c $ ,iview |
| 125 |
print*,' DSP number-----',int(DSPnumber_temp) |
c print*,' DSP number-----',int(DSPnumber_temp) |
| 126 |
print*,' DAQ mode-------',int(DAQmode_temp) |
c print*,' DAQ mode-------',int(DAQmode_temp) |
| 127 |
print*,' -----------------------------------' |
c print*,' -----------------------------------' |
| 128 |
goto 2424 !next view (==> search another DSP header) |
goto 2424 !next view (==> search another DSP header) |
| 129 |
endif |
endif |
| 130 |
|
|
| 135 |
if(runerror.eq.1) goto 2222 |
if(runerror.eq.1) goto 2222 |
| 136 |
|
|
| 137 |
|
|
| 138 |
print*,'Calibration packet ==> ',iview |
c print*,'Calibration packet ==> ',iview |
| 139 |
|
|
| 140 |
print*,'---- Calibration packet ',iview,' ----' |
c print*,'---- Calibration packet ',iview,' ----' |
| 141 |
print*,' DSP number ',DSPnumber_cal |
c print*,' DSP number ',DSPnumber_cal |
| 142 |
print*,' DAQ mode ',DAQmode_cal |
c print*,' DAQ mode ',DAQmode_cal |
| 143 |
print*,' calibration run ',calibrationnumber |
c print*,' calibration run ',calibrationnumber |
| 144 |
print*,' n. event used ',nused_event |
c print*,' n. event used ',nused_event |
| 145 |
print*,' <PED> ladder 1 ',ped_1 |
c print*,' <PED> ladder 1 ',ped_1 |
| 146 |
print*,' <PED> ladder 2 ',ped_2 |
c print*,' <PED> ladder 2 ',ped_2 |
| 147 |
print*,' <PED> ladder 3 ',ped_3 |
c print*,' <PED> ladder 3 ',ped_3 |
| 148 |
print*,' <SIG> ladder 1 ',sig_1 |
c print*,' <SIG> ladder 1 ',sig_1 |
| 149 |
print*,' <SIG> ladder 2 ',sig_2 |
c print*,' <SIG> ladder 2 ',sig_2 |
| 150 |
print*,' <SIG> ladder 3 ',sig_3 |
c print*,' <SIG> ladder 3 ',sig_3 |
| 151 |
print*,' n.BAD ladder 1 ',nbad_1 |
c print*,' n.BAD ladder 1 ',nbad_1 |
| 152 |
print*,' n.BAD ladder 2 ',nbad_2 |
c print*,' n.BAD ladder 2 ',nbad_2 |
| 153 |
print*,' n.BAD ladder 3 ',nbad_3 |
c print*,' n.BAD ladder 3 ',nbad_3 |
| 154 |
print*,' error flag ',ff |
c print*,' error flag ',ff |
| 155 |
if(nused_event.ne.0.or.ff.ne.0)then |
if(nused_event.ne.0.or.ff.ne.0)then |
| 156 |
print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
| 157 |
print*,'* !!! CALIBRATION FAILURE !!! *' |
c print*,'* !!! CALIBRATION FAILURE !!! *' |
| 158 |
print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
| 159 |
endif |
endif |
| 160 |
|
|
| 161 |
|
|
| 506 |
bid_dat = bid_dat_sum/7 |
bid_dat = bid_dat_sum/7 |
| 507 |
|
|
| 508 |
if (bid_dat.ne.1.and.bid_dat.ne.2) then |
if (bid_dat.ne.1.and.bid_dat.ne.2) then |
| 509 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 510 |
write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
| 511 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 512 |
endif |
endif |
| 513 |
if (mod(bid_dat_sum,7).ne.0) then |
if (mod(bid_dat_sum,7).ne.0) then |
| 514 |
bid_dat = 0 |
bid_dat = 0 |
| 515 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 516 |
write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
| 517 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 518 |
endif |
endif |
| 519 |
|
|
| 520 |
if (alarm_dat.eq.3) then |
if (alarm_dat.eq.3) then |
| 521 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 522 |
write(*,*) 'unpack_data: AQUISITION ALARM' |
c write(*,*) 'unpack_data: AQUISITION ALARM' |
| 523 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 524 |
|
|
| 525 |
endif |
endif |
| 526 |
|
|
| 527 |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
| 528 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 529 |
write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
c write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
| 530 |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
| 531 |
|
|
| 532 |
endif |
endif |
| 533 |
|
|
| 632 |
alarm(i)= alarm_dat |
alarm(i)= alarm_dat |
| 633 |
aswr(i) = aswr_dat |
aswr(i) = aswr_dat |
| 634 |
|
|
| 635 |
print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
c print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
| 636 |
print*,'* PNUM (periferal num) ',pnum_dat |
c print*,'* PNUM (periferal num) ',pnum_dat |
| 637 |
print*,'* CMDNUM (command) ',cmdnum_dat |
c print*,'* CMDNUM (command) ',cmdnum_dat |
| 638 |
print*,'* BID (board id) ',bid_dat |
c print*,'* BID (board id) ',bid_dat |
| 639 |
print*,'* ALARM ',alarm_dat |
c print*,'* ALARM ',alarm_dat |
| 640 |
print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
c print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
| 641 |
|
|
| 642 |
do idat=1,datalength_dat |
do idat=1,datalength_dat |
| 643 |
id = TOTDATAlength + idat |
id = TOTDATAlength + idat |
| 644 |
datatracker(id) = b_tra(idat) |
datatracker(id) = b_tra(idat) |
| 645 |
enddo |
enddo |
| 646 |
TOTDATAlength = TOTDATAlength + datalength_dat |
TOTDATAlength = TOTDATAlength + datalength_dat |
| 647 |
|
|
| 648 |
return |
return |
| 649 |
end |
end |
| 650 |
|
|