5 |
c include '../commonyoda/trk_calib_parameters.f' |
c include '../commonyoda/trk_calib_parameters.f' |
6 |
include '../commonyoda/level0.f' |
include '../commonyoda/level0.f' |
7 |
|
|
8 |
|
logical DEBUG |
9 |
|
common/DEBUGflag/DEBUG |
10 |
|
c data DEBUG/.true./ |
11 |
|
data DEBUG/.false./ |
12 |
|
|
13 |
|
|
14 |
integer ndummy |
integer ndummy |
15 |
data ndummy/1000/ |
data ndummy/1000/ |
16 |
integer lun_pkt |
|
|
parameter (lun_pkt=10) |
|
17 |
integer runerror !readevent error flag |
integer runerror !readevent error flag |
18 |
integer ffd_pkt !pkt file descriptor |
integer ffd_pkt !pkt file descriptor |
19 |
!(file temporaneo) |
!(file temporaneo) |
20 |
character*60 event_file_name !nome file |
character*60 event_file_name !nome file |
21 |
c print*,' lun_pkt-----',int(lun_pkt); |
|
22 |
|
integer lun_pkt |
23 |
|
data lun_pkt/10/ |
24 |
|
|
25 |
|
|
26 |
open(unit=lun_pkt, |
open(unit=lun_pkt, |
27 |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
28 |
$ status='old', |
$ status='old', |
44 |
c print*,'______________________________________ ' |
c print*,'______________________________________ ' |
45 |
c goto 9900 !end loop on files |
c goto 9900 !end loop on files |
46 |
c goto 8800 !end loop on views (DSP pkt) |
c goto 8800 !end loop on views (DSP pkt) |
47 |
goto 2222 |
goto 2222 |
48 |
endif |
endif |
49 |
|
|
50 |
if(checkheader.ne.2) then |
if(checkheader.ne.2) then |
67 |
if(runerror.eq.-1) goto 2222 |
if(runerror.eq.-1) goto 2222 |
68 |
c if(runerror.eq.1) goto 23 |
c if(runerror.eq.1) goto 23 |
69 |
if(runerror.eq.1) goto 2222 |
if(runerror.eq.1) goto 2222 |
70 |
|
|
71 |
c print*,' ' |
if(DEBUG)then |
72 |
c print*,' -----------------------------------',iview |
print*,' ' |
73 |
c print*,' DSP number-----',DSPnumber_dat |
print*,' -----------------------------------',iview |
74 |
c print*,' DAQ mode-------',DAQmode_dat |
print*,' DSP number-----',DSPnumber_dat |
75 |
c print*,' event number ',eventn_dat |
print*,' DAQ mode-------',DAQmode_dat |
76 |
|
print*,' event number ',eventn_dat |
77 |
|
print*,' datalength (13-bit w) ---- ',datalength_dat |
78 |
|
c print*,' NCLUST---',nclust_dat |
79 |
|
c print*,' CUTC-----',cutc_dat |
80 |
|
c print*,' CUTCL----',cutcl_dat |
81 |
|
print*,' L-1 addr---',addrcluster_dat(1) |
82 |
|
print*,' signal-',signcluster_dat(1) |
83 |
|
print*,' L-2 addr---',addrcluster_dat(2) |
84 |
|
print*,' signal-',signcluster_dat(2) |
85 |
|
print*,' L-3 addr---',addrcluster_dat(3) |
86 |
|
print*,' signal-',signcluster_dat(3) |
87 |
|
print*,' FC------',fc_dat |
88 |
|
print*,' compression time ',compressiontime_dat |
89 |
|
print*,' FL1--',fl1_dat |
90 |
|
print*,' FL2--',fl2_dat |
91 |
|
print*,' FL3--',fl3_dat |
92 |
|
print*,' FL4--',fl4_dat |
93 |
|
print*,' FL5--',fl5_dat |
94 |
|
print*,' FL6--',fl6_dat |
95 |
|
c print*,' checksum-',checksum_dat |
96 |
|
endif |
97 |
|
|
98 |
trk_DSP_ok(DSPnumber_dat)=1 |
trk_DSP_ok(DSPnumber_dat)=1 |
99 |
|
|
100 |
call fillview(iview) |
call fillview(iview) |
124 |
integer ffd_pkt !pkt file descriptor |
integer ffd_pkt !pkt file descriptor |
125 |
!(file temporaneo) |
!(file temporaneo) |
126 |
character*60 event_file_name !nome file |
character*60 event_file_name !nome file |
127 |
|
|
128 |
|
logical DEBUG |
129 |
|
c data DEBUG/.true./ |
130 |
|
data DEBUG/.false./ |
131 |
|
ccc common/DEBUGflag/DEBUG |
132 |
|
|
133 |
|
|
134 |
integer lun_pkt |
integer lun_pkt |
135 |
parameter (lun_pkt=10) |
data lun_pkt/10/ |
136 |
|
|
137 |
|
|
138 |
open(unit=lun_pkt, |
open(unit=lun_pkt, |
139 |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
140 |
$ status='old', |
$ status='old', |
141 |
$ form='unformatted' |
$ form='unformatted' |
142 |
$ ) |
$ ) |
143 |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
do iview=1,ndummy !loop on views (DSP pkt) |
do iview=1,ndummy !loop on views (DSP pkt) |
174 |
c if(runerror.eq.1) goto 23 |
c if(runerror.eq.1) goto 23 |
175 |
if(runerror.eq.1) goto 2222 |
if(runerror.eq.1) goto 2222 |
176 |
|
|
177 |
|
if(DEBUG)then |
|
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 |
|
|
if(nused_event.ne.0.or.ff.ne.0)then |
|
|
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
|
|
c print*,'* !!! CALIBRATION FAILURE !!! *' |
|
|
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
|
|
endif |
|
178 |
|
|
179 |
|
print*,'Calibration packet ==> ',iview |
180 |
|
|
181 |
|
print*,'---- Calibration packet ',iview,' ----' |
182 |
|
print*,' DSP number ',DSPnumber_cal |
183 |
|
print*,' DAQ mode ',DAQmode_cal |
184 |
|
print*,' calibration run ',calibrationnumber |
185 |
|
print*,' n. event used ',nused_event |
186 |
|
print*,' <PED> ladder 1 ',ped_1 |
187 |
|
print*,' <PED> ladder 2 ',ped_2 |
188 |
|
print*,' <PED> ladder 3 ',ped_3 |
189 |
|
print*,' <SIG> ladder 1 ',sig_1 |
190 |
|
print*,' <SIG> ladder 2 ',sig_2 |
191 |
|
print*,' <SIG> ladder 3 ',sig_3 |
192 |
|
print*,' n.BAD ladder 1 ',nbad_1 |
193 |
|
print*,' n.BAD ladder 2 ',nbad_2 |
194 |
|
print*,' n.BAD ladder 3 ',nbad_3 |
195 |
|
print*,' error flag ',ff |
196 |
|
if(nused_event.ne.0.or.ff.ne.0)then |
197 |
|
print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
198 |
|
print*,'* !!! CALIBRATION FAILURE !!! *' |
199 |
|
print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
200 |
|
endif |
201 |
|
endif |
202 |
|
|
203 |
DAQmode(iview)=DAQmode_cal |
DAQmode(iview)=DAQmode_cal |
204 |
DSPnumber(iview)=DSPnumber_cal |
DSPnumber(iview)=DSPnumber_cal |
503 |
c hence the XOR between the two halfs |
c hence the XOR between the two halfs |
504 |
C---------------------------------------------------------- |
C---------------------------------------------------------- |
505 |
runerror=0 |
runerror=0 |
506 |
|
nqualcosa=0 |
507 |
|
if(l_tra.eq.0)then |
508 |
|
c call skipbyte(ffd) |
509 |
|
goto 18 !empty buffer |
510 |
|
endif |
511 |
call dunpacker(l_tra,b_tra,runerror,ffd) |
call dunpacker(l_tra,b_tra,runerror,ffd) |
512 |
nqualcosa = (real(l_tra))/13*16 |
nqualcosa = (real(l_tra))/13*16 |
513 |
xx = b_tra(nqualcosa) |
xx = b_tra(nqualcosa) |
514 |
if (xx.eq.0) nqualcosa=nqualcosa -1 |
if (xx.eq.0) nqualcosa=nqualcosa -1 |
515 |
datalength_dat= nqualcosa |
|
516 |
|
18 datalength_dat= nqualcosa |
517 |
|
|
518 |
c$$$ TOTDATAlength = TOTDATAlength + datalength_dat |
c$$$ TOTDATAlength = TOTDATAlength + datalength_dat |
519 |
c$$$ do i=1,datalength_dat |
c$$$ do i=1,datalength_dat |
520 |
c$$$ id = id + 1 |
c$$$ id = id + 1 |
554 |
bid_dat = bid_dat_sum/7 |
bid_dat = bid_dat_sum/7 |
555 |
|
|
556 |
if (bid_dat.ne.1.and.bid_dat.ne.2) then |
if (bid_dat.ne.1.and.bid_dat.ne.2) then |
557 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
558 |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED - BID ' |
559 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
$ ,bid_dat |
560 |
|
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
561 |
endif |
endif |
562 |
if (mod(bid_dat_sum,7).ne.0) then |
if (mod(bid_dat_sum,7).ne.0) then |
563 |
bid_dat = 0 |
bid_dat = 0 |
564 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
565 |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED - BID ' |
566 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
$ ,bid_dat |
567 |
|
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
568 |
endif |
endif |
569 |
|
|
570 |
if (alarm_dat.eq.3) then |
if (alarm_dat.eq.3) then |
571 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
572 |
c write(*,*) 'unpack_data: AQUISITION ALARM' |
write(*,*) 'unpack_data: AQUISITION ALARM' |
573 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
574 |
|
|
575 |
endif |
endif |
576 |
|
|
577 |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
578 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
579 |
c write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED - ALARM ' |
580 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
$ ,alarm_dat |
581 |
|
write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
582 |
|
|
583 |
endif |
endif |
584 |
|
|
650 |
include '../commonyoda/level0.f' |
include '../commonyoda/level0.f' |
651 |
include '../commonyoda/dataformat.f' |
include '../commonyoda/dataformat.f' |
652 |
|
|
653 |
|
logical DEBUG |
654 |
|
common/DEBUGflag/DEBUG |
655 |
|
|
656 |
|
|
657 |
DAQmode(i) = DAQmode_dat |
DAQmode(i) = DAQmode_dat |
658 |
DSPnumber(i) = DSPnumber_dat |
DSPnumber(i) = DSPnumber_dat |
659 |
eventn(i) = eventn_dat |
eventn(i) = eventn_dat |
687 |
alarm(i)= alarm_dat |
alarm(i)= alarm_dat |
688 |
aswr(i) = aswr_dat |
aswr(i) = aswr_dat |
689 |
|
|
690 |
c print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
if(DEBUG)then |
691 |
c print*,'* PNUM (periferal num) ',pnum_dat |
|
692 |
c print*,'* CMDNUM (command) ',cmdnum_dat |
print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
693 |
c print*,'* BID (board id) ',bid_dat |
print*,'* PNUM (periferal num) ',pnum_dat |
694 |
c print*,'* ALARM ',alarm_dat |
print*,'* CMDNUM (command) ',cmdnum_dat |
695 |
c print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
print*,'* BID (board id) ',bid_dat |
696 |
|
print*,'* ALARM ',alarm_dat |
697 |
|
print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
698 |
|
|
699 |
|
endif |
700 |
|
|
701 |
do idat=1,datalength_dat |
do idat=1,datalength_dat |
702 |
id = TOTDATAlength + idat |
id = TOTDATAlength + idat |
703 |
datatracker(id) = b_tra(idat) |
datatracker(id) = b_tra(idat) |
704 |
enddo |
enddo |
705 |
TOTDATAlength = TOTDATAlength + datalength_dat |
TOTDATAlength = TOTDATAlength + datalength_dat |
706 |
|
|
707 |
|
c print*,'TOTDATALENGTH ',TOTDATAlength |
708 |
|
|
709 |
|
|
710 |
return |
return |
711 |
end |
end |
712 |
|
|