1 |
subroutine trkeventpkt(runerror,event_file_name) |
2 |
|
3 |
include '../commonyoda/commontracker.f' |
4 |
include '../commonyoda/dataformat.f' |
5 |
c include '../commonyoda/trk_calib_parameters.f' |
6 |
include '../commonyoda/level0.f' |
7 |
|
8 |
|
9 |
integer ndummy |
10 |
data ndummy/1000/ |
11 |
integer lun_pkt |
12 |
parameter (lun_pkt=10) |
13 |
integer runerror !readevent error flag |
14 |
integer ffd_pkt !pkt file descriptor |
15 |
!(file temporaneo) |
16 |
character*60 event_file_name !nome file |
17 |
c print*,' lun_pkt-----',int(lun_pkt); |
18 |
open(unit=lun_pkt, |
19 |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
20 |
$ status='old', |
21 |
$ form='unformatted' |
22 |
$ ) |
23 |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
24 |
|
25 |
|
26 |
call initlevel0 |
27 |
|
28 |
TOTDATAlength = 0. !total length of data buffer |
29 |
do iview=1,ndummy !loop on views |
30 |
call searchtrkheader(runerror,ffd_pkt) |
31 |
c if(runerror.eq.-1) goto 24 |
32 |
if(runerror.eq.-1) goto 2222 |
33 |
if(runerror.eq.1) then |
34 |
c print*,' ' |
35 |
c print*,'readraw: END OF CPU PACKET ' |
36 |
c print*,'______________________________________ ' |
37 |
c goto 9900 !end loop on files |
38 |
c goto 8800 !end loop on views (DSP pkt) |
39 |
goto 2222 |
40 |
endif |
41 |
|
42 |
if(checkheader.ne.2) then |
43 |
c print*,'>>>> ERROR <<<< (trkeventpkt)' |
44 |
c print*,'>>>> CPU packet type ',!pkt_type, |
45 |
c $ ' does not match DSP type ',checkheader |
46 |
c goto 9909 ! next event (==> search another CPU header) |
47 |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
48 |
DSPnumber_temp = iand(header(1),z'000f') |
49 |
c print*,' -----------------------------------' |
50 |
c $ ,iview |
51 |
c print*,' DSP number-----',int(DSPnumber_temp) |
52 |
c print*,' DAQ mode-------',int(DAQmode_temp) |
53 |
c print*,' -----------------------------------' |
54 |
goto 2525 !next view (==> search another DSP header) |
55 |
endif |
56 |
|
57 |
call unpackdata(runerror,ffd_pkt) |
58 |
c if(runerror.eq.-1) goto 24 |
59 |
if(runerror.eq.-1) goto 2222 |
60 |
c if(runerror.eq.1) goto 23 |
61 |
if(runerror.eq.1) goto 2222 |
62 |
|
63 |
c print*,' ' |
64 |
c print*,' -----------------------------------',iview |
65 |
c print*,' DSP number-----',DSPnumber_dat |
66 |
c print*,' DAQ mode-------',DAQmode_dat |
67 |
c print*,' event number ',eventn_dat |
68 |
|
69 |
trk_DSP_ok(DSPnumber_dat)=1 |
70 |
|
71 |
call fillview(iview) |
72 |
|
73 |
2525 continue |
74 |
enddo !end loop on views |
75 |
|
76 |
2222 continue |
77 |
|
78 |
close (lun_pkt) |
79 |
return |
80 |
end |
81 |
|
82 |
* ********************************************** |
83 |
|
84 |
c subroutine trk_calib_pkt(runerror,ffd_pkt) |
85 |
subroutine trkcalibpkt(runerror,event_file_name) |
86 |
|
87 |
include '../commonyoda/commontracker.f' |
88 |
include '../commonyoda/dataformat.f' |
89 |
include '../commonyoda/trk_calib_parameters.f' |
90 |
|
91 |
integer ndummy |
92 |
data ndummy/1000/ |
93 |
|
94 |
integer runerror !readevent error flag |
95 |
integer ffd_pkt !pkt file descriptor |
96 |
!(file temporaneo) |
97 |
character*60 event_file_name !nome file |
98 |
integer lun_pkt |
99 |
parameter (lun_pkt=10) |
100 |
open(unit=lun_pkt, |
101 |
$ name=EVENT_FILE_NAME(1:lnblnk(EVENT_FILE_NAME)), |
102 |
$ status='old', |
103 |
$ form='unformatted' |
104 |
$ ) |
105 |
ffd_pkt = FNum(lun_pkt) !reads unix file descriptor |
106 |
|
107 |
|
108 |
do iview=1,ndummy !loop on views (DSP pkt) |
109 |
call searchtrkheader(runerror,ffd_pkt) |
110 |
c if(runerror.eq.-1) goto 24 |
111 |
if(runerror.eq.-1) goto 2222 |
112 |
if(runerror.eq.1) then |
113 |
c print*,' ' |
114 |
c print*,'readraw: END OF CPU PACKET ' |
115 |
c print*,'______________________________________ ' |
116 |
goto 2222 !end loop on views (DSP pkt) |
117 |
endif |
118 |
if(checkheader.ne.3) then |
119 |
c print*,'>>>> ERROR <<<< (trkcalibpkt)' |
120 |
c print*,'>>>> CPU packet type ',!pkt_type, |
121 |
c $ ' does not match DSP type ',checkheader |
122 |
DAQmode_temp = ishft(iand(header(1),z'03f0'),-4) |
123 |
DSPnumber_temp = iand(header(1),z'000f') |
124 |
c print*,' -----------------------------------' |
125 |
c $ ,iview |
126 |
c print*,' DSP number-----',int(DSPnumber_temp) |
127 |
c print*,' DAQ mode-------',int(DAQmode_temp) |
128 |
c print*,' -----------------------------------' |
129 |
goto 2424 !next view (==> search another DSP header) |
130 |
endif |
131 |
|
132 |
call unpackcalibration(runerror,ffd_pkt) |
133 |
c if(runerror.eq.-1) goto 24 |
134 |
if(runerror.eq.-1) goto 2222 |
135 |
c if(runerror.eq.1) goto 23 |
136 |
if(runerror.eq.1) goto 2222 |
137 |
|
138 |
|
139 |
c print*,'Calibration packet ==> ',iview |
140 |
|
141 |
c print*,'---- Calibration packet ',iview,' ----' |
142 |
c print*,' DSP number ',DSPnumber_cal |
143 |
c print*,' DAQ mode ',DAQmode_cal |
144 |
c print*,' calibration run ',calibrationnumber |
145 |
c print*,' n. event used ',nused_event |
146 |
c print*,' <PED> ladder 1 ',ped_1 |
147 |
c print*,' <PED> ladder 2 ',ped_2 |
148 |
c print*,' <PED> ladder 3 ',ped_3 |
149 |
c print*,' <SIG> ladder 1 ',sig_1 |
150 |
c print*,' <SIG> ladder 2 ',sig_2 |
151 |
c print*,' <SIG> ladder 3 ',sig_3 |
152 |
c print*,' n.BAD ladder 1 ',nbad_1 |
153 |
c print*,' n.BAD ladder 2 ',nbad_2 |
154 |
c print*,' n.BAD ladder 3 ',nbad_3 |
155 |
c print*,' error flag ',ff |
156 |
if(nused_event.ne.0.or.ff.ne.0)then |
157 |
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
158 |
c print*,'* !!! CALIBRATION FAILURE !!! *' |
159 |
c print*,'*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*' |
160 |
endif |
161 |
|
162 |
|
163 |
DAQmode(iview)=DAQmode_cal |
164 |
DSPnumber(iview)=DSPnumber_cal |
165 |
calibnumber(iview)=calibrationnumber |
166 |
ncalib_event(iview)=nused_event |
167 |
ped_l1(iview)=ped_1 |
168 |
ped_l2(iview)=ped_2 |
169 |
ped_l3(iview)=ped_3 |
170 |
sig_l1(iview)=sig_1 |
171 |
sig_l2(iview)=sig_2 |
172 |
sig_l3(iview)=sig_3 |
173 |
nbad_l1(iview)=nbad_1 |
174 |
nbad_l2(iview)=nbad_2 |
175 |
nbad_l3(iview)=nbad_3 |
176 |
cal_flag(iview)=ff |
177 |
|
178 |
do is=1,nstrips_view |
179 |
DSPbad_par(iview,is)=DSPbad_o(DSPnumber_cal,is) |
180 |
DSPped_par(iview,is)=DSPped_o(DSPnumber_cal,is) |
181 |
DSPsig_par(iview,is)=DSPsig_o(DSPnumber_cal,is) |
182 |
enddo |
183 |
c |
184 |
trk_DSP_ok(DSPnumber_cal)=1 |
185 |
c---------------------------------------------------------- |
186 |
c NVIEWS calibration packets should have been found |
187 |
c---------------------------------------------------------- |
188 |
c if(n_cal_pkt.eq.nviews)then |
189 |
c found_cal_pkt = .true. |
190 |
c n_cal_pkt = 0 |
191 |
c endif |
192 |
2424 continue |
193 |
enddo ! end loop on views (calibration pkt) |
194 |
2222 continue |
195 |
|
196 |
close (lun_pkt) |
197 |
|
198 |
return |
199 |
end |
200 |
|
201 |
***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...*** |
202 |
* |
203 |
* |
204 |
* |
205 |
* |
206 |
* |
207 |
* |
208 |
* |
209 |
* |
210 |
***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...*** |
211 |
|
212 |
subroutine searchtrkheader(runerror,ffd) |
213 |
C............................................................. |
214 |
C Search for a valid tracker DSP header (=>one view) |
215 |
C and return the type of header |
216 |
C............................................................. |
217 |
|
218 |
include '../commonyoda/commontracker.f' |
219 |
include '../commonyoda/dataformat.f' |
220 |
|
221 |
integer ffd !input file descriptor |
222 |
integer runerror !readevent error flag |
223 |
|
224 |
c-------------------------------------------------- |
225 |
c N.B.13 bit packing is done for each DSP header+datablock, |
226 |
C so each DSP 13 bit |
227 |
c first word starts at the beginnig of a 16 bit word |
228 |
c-------------------------------------------------- |
229 |
9100 continue |
230 |
runerror=0 !error flag initialization |
231 |
checkheader=0 |
232 |
|
233 |
c-------------------------------------------------- |
234 |
c looks for a DSP header beginning |
235 |
C (a word beginning with 1110) |
236 |
c-------------------------------------------------- |
237 |
call findstart(runerror,ffd) |
238 |
|
239 |
if(runerror.eq.1) goto 200 |
240 |
if(runerror.eq.-1)then |
241 |
runerror=1 !in this case I dont want the |
242 |
!the program to crash |
243 |
goto 200 |
244 |
endif |
245 |
c-------------------------------------------------- |
246 |
c the first word could be a DSP header first word: |
247 |
C reads 13 8-bit words and |
248 |
c writes them in 16 13-bit words to check for all |
249 |
C DSP header features |
250 |
c-------------------------------------------------- |
251 |
runerror=0 |
252 |
|
253 |
call hunpacker(header,runerror,ffd) |
254 |
|
255 |
if(runerror.eq.1) goto 200 |
256 |
c if(runerror.eq.-1) goto 200 |
257 |
if(runerror.eq.-1)then |
258 |
runerror=1 !in this case I dont want the |
259 |
!the program to crash |
260 |
goto 200 |
261 |
endif |
262 |
c-------------------------------------------------- |
263 |
c extracts and controls header: |
264 |
c-------------------------------------------------- |
265 |
C last header word must be: |
266 |
c |0001|1100|0000|0000| for acquisition |
267 |
c |0001|1111|1111|1111| for calibration |
268 |
c-------------------------------------------------- |
269 |
if(iand(header(16),z'ffff').eq.z'1c00') then !last header |
270 |
checkheader=2 ! event |
271 |
elseif(iand(header(16),z'ffff').eq.z'1fff') then !last header |
272 |
checkheader=3 ! calibration packet |
273 |
else |
274 |
checkheader=1 ! not a valid DSP header |
275 |
endif |
276 |
c-------------------------------------------------- |
277 |
c first header word must be: |
278 |
c |0001|110x|xxxx|xxxx| |
279 |
c-------------------------------------------------- |
280 |
if(iand(header(1),z'fe00').ne.z'1c00') |
281 |
$ checkheader=1 !not a valid DSP header |
282 |
c-------------------------------------------------- |
283 |
c intermediate header words must be: |
284 |
c |0001|010x|xxxx|xxxx| |
285 |
c-------------------------------------------------- |
286 |
do i=2,15 |
287 |
if(iand(header(i),z'fc00').ne.z'1400') |
288 |
$ checkheader=1 !not a valid DSP header |
289 |
enddo |
290 |
c-------------------------------------------------- |
291 |
c if checkheader = 1 |
292 |
c then this is not a DSP header (or some |
293 |
c noise lurks around) so go a word ahead and |
294 |
c try again |
295 |
c-------------------------------------------------- |
296 |
if(checkheader.eq.1) then |
297 |
call skipbyte(ffd) |
298 |
goto 9100 |
299 |
endif |
300 |
200 continue |
301 |
end |
302 |
|
303 |
*............................................................. |
304 |
|
305 |
|
306 |
*............................................................. |
307 |
|
308 |
subroutine unpackcalibration(runerror,ffd) |
309 |
*............................................................. |
310 |
* decode calibration data |
311 |
* header + data(PED SIG BAD) + trailer |
312 |
*............................................................ |
313 |
include '../commonyoda/commontracker.f' |
314 |
include '../commonyoda/dataformat.f' |
315 |
|
316 |
integer ffd !input file descriptor |
317 |
integer runerror !readevent error flag |
318 |
c buffer temporanei |
319 |
integer*2 templ(nstrips_ladder) |
320 |
real*4 tempf(nstrips_ladder) |
321 |
|
322 |
|
323 |
12 format(z4) |
324 |
|
325 |
*----------------------------------------------------------- |
326 |
* HEADER |
327 |
* (N.B. during test 2003 the header of calibration packets |
328 |
* was only partially filled) |
329 |
* |
330 |
* the following is the final calibration header |
331 |
*----------------------------------------------------------- |
332 |
DAQmode_cal = ishft(iand(header(1),z'03f0'),-4) |
333 |
DSPnumber_cal = iand(header(1),z'000f') |
334 |
dataword = ior(ishft(iand(header(2),z'03ff') |
335 |
$ ,10),iand(header(3),z'03ff')) |
336 |
c calibrationnumber = ior(ishft(iand(header(4) |
337 |
c $ ,z'03ff'),10),iand(header(5),z'03ff')) |
338 |
calibrationnumber = iand(header(4),z'03ff') |
339 |
nused_event = iand(header(5),z'03ff') |
340 |
ped_1 = iand(header(6),z'03ff') |
341 |
ped_2 = iand(header(7),z'03ff') |
342 |
ped_3 = iand(header(8),z'03ff') |
343 |
ped_1 = ped_1 * 4 |
344 |
ped_2 = ped_2 * 4 |
345 |
ped_3 = ped_3 * 4 |
346 |
sig_1 = iand(header(9),z'03ff') |
347 |
sig_2 = iand(header(10),z'03ff') |
348 |
sig_3 = iand(header(11),z'03ff') |
349 |
nbad_1 = iand(header(12),z'03ff') |
350 |
nbad_2 = iand(header(13),z'03ff') |
351 |
nbad_3 = iand(header(14),z'03ff') |
352 |
ff = ishft(iand(header(15),z'0300'),-8) |
353 |
checksum_cal = iand(header(15),z'00ff') |
354 |
|
355 |
runerror=0 |
356 |
call readtrailer(trailer,runerror,ffd) |
357 |
c$$$ do i=1,3 |
358 |
c$$$ write(*,12)trailer(i) |
359 |
c$$$ enddo |
360 |
c----------------------------------------------------------- |
361 |
c the checksum is a 8-bit word calculated as the |
362 |
c XOR of the 16-bit data words, |
363 |
c hence the XOR between the two halfs |
364 |
C---------------------------------------------------------- |
365 |
do il=1,3 !loop on ladders |
366 |
|
367 |
call readped(tempf,runerror,ffd) |
368 |
do is=1,nstrips_ladder |
369 |
iss=is+nstrips_ladder*(il-1) |
370 |
DSPped_o(DSPnumber_cal,iss)=tempf(is) |
371 |
c print*,il,iss,DSPped_o(DSPnumber,iss) |
372 |
c print *,DSPnumber_cal,iss,tempf(is) |
373 |
|
374 |
enddo |
375 |
|
376 |
call readsig(tempf,runerror,ffd) |
377 |
do is=1,nstrips_ladder |
378 |
iss=is+nstrips_ladder*(il-1) |
379 |
DSPsig_o(DSPnumber_cal,iss)=tempf(is) |
380 |
c print*,DSPsig_o(DSPnumber,iss) |
381 |
enddo |
382 |
|
383 |
call readbad(templ,runerror,ffd) |
384 |
do is=1,nstrips_ladder |
385 |
iss=is+nstrips_ladder*(il-1) |
386 |
DSPbad_o(DSPnumber_cal,iss)=templ(is) |
387 |
c print*,il,is,iss,DSPbad_o(DSPnumber,iss) |
388 |
enddo |
389 |
|
390 |
C//// CAPIRE PERCHE` NON C'E` LA PAROLA DI FINE LADDER \\\\ |
391 |
c call readeol(word,runerror,ffd) |
392 |
11 format(i1,' ',z4) |
393 |
c write(*,11)il,word |
394 |
call readtrailer(trailer,runerror,ffd) |
395 |
c$$$ do i=1,3 |
396 |
c$$$ write(*,12)trailer(i) |
397 |
c$$$ enddo |
398 |
|
399 |
c print*,'fine ladder' !??? |
400 |
|
401 |
enddo !end loop on ladders |
402 |
|
403 |
return |
404 |
end |
405 |
*............................................................. |
406 |
|
407 |
|
408 |
subroutine unpackdata(runerror,ffd) |
409 |
*............................................................. |
410 |
* decode event data |
411 |
* header + data + trailer |
412 |
*............................................................ |
413 |
include '../commonyoda/commontracker.f' |
414 |
include '../commonyoda/dataformat.f' |
415 |
include '../commonyoda/level0.f' |
416 |
|
417 |
integer ffd !input file descriptor |
418 |
integer runerror !readevent error flag |
419 |
integer l_tra |
420 |
|
421 |
|
422 |
12 format(z4) |
423 |
|
424 |
*----------------------------------------------------------- |
425 |
* HEADER |
426 |
*----------------------------------------------------------- |
427 |
|
428 |
DAQmode_dat = ishft(iand(header(1),z'03f0'),-4) |
429 |
DSPnumber_dat = iand(header(1),z'000f') |
430 |
C ------------------------------------------------------ |
431 |
c words 2 and 3 give tshe number of transmitted 16-bit |
432 |
c words ( 13 header words + data ) |
433 |
c NB: data are packed from 13-bit to 16-bit words, |
434 |
c so the stream is complited with zeros in order to have |
435 |
c a number of bits multiple of 16 |
436 |
l_tra = ior(ishft(iand(header(2),z'03ff') |
437 |
$ ,10),iand(header(3),z'03ff')) |
438 |
l_tra=l_tra-13 |
439 |
C ------------------------------------------------------ |
440 |
eventn_dat = ior(ishft(iand(header(4),z'03ff') |
441 |
$ ,10),iand(header(5),z'03ff')) |
442 |
nclust_dat = ishft(iand(header(6),z'0380'),-7) |
443 |
cutc_dat = ishft(iand(header(6),z'0070'),-4) |
444 |
cutcl_dat = iand(header(6),z'000f') |
445 |
addrcluster_dat(1) = iand(header(7),z'03ff') |
446 |
signcluster_dat(1) = iand(header(8),z'03ff') |
447 |
addrcluster_dat(2) = iand(header(9),z'03ff') |
448 |
signcluster_dat(2) = iand(header(10),z'03ff') |
449 |
addrcluster_dat(3) = iand(header(11),z'03ff') |
450 |
signcluster_dat(3) = iand(header(12),z'03ff') |
451 |
fc_dat = ishft(iand(header(13),z'0300'),-8) |
452 |
compressiontime_dat = iand(header(13),z'00ff') |
453 |
fl5_dat = ishft(iand(header(14),z'0300'),-8) |
454 |
fl4_dat = ishft(iand(header(14),z'0300'),-6) |
455 |
fl3_dat = ishft(iand(header(14),z'0300'),-4) |
456 |
fl2_dat = ishft(iand(header(14),z'0300'),-2) |
457 |
fl1_dat = iand(header(14),z'0300') |
458 |
fl6_dat = ishft(iand(header(15),z'0300'),-8) |
459 |
checksum_dat = iand(header(15),z'00ff') |
460 |
c----------------------------------------------------------- |
461 |
c the cheacksum is a 8-bit word calculated as the |
462 |
c XOR of the 16-bit data words, |
463 |
c hence the XOR between the two halfs |
464 |
C---------------------------------------------------------- |
465 |
runerror=0 |
466 |
call dunpacker(l_tra,b_tra,runerror,ffd) |
467 |
nqualcosa = (real(l_tra))/13*16 |
468 |
xx = b_tra(nqualcosa) |
469 |
if (xx.eq.0) nqualcosa=nqualcosa -1 |
470 |
datalength_dat= nqualcosa |
471 |
c$$$ TOTDATAlength = TOTDATAlength + datalength_dat |
472 |
c$$$ do i=1,datalength_dat |
473 |
c$$$ id = id + 1 |
474 |
c$$$ datatracker(id) = b_tra(i) |
475 |
c$$$ enddo |
476 |
|
477 |
|
478 |
|
479 |
11 format(i1,' ',z4) |
480 |
c write(*,11)il,word |
481 |
call readtrailer(trailer,runerror,ffd) |
482 |
c$$$ do i=1,3 |
483 |
c$$$ write(*,12)trailer(i) |
484 |
c$$$ enddo |
485 |
|
486 |
*************************************************************** |
487 |
* TRAILER * |
488 |
*************************************************************** |
489 |
|
490 |
pnum_dat=ishft(iand(trailer(1),z'f000'),-12) |
491 |
cmdnum_dat=ishft(iand(trailer(1),z'0f00'),-8) |
492 |
bid1_dat=ishft(iand(trailer(1),z'00c0'),-6) |
493 |
bid2_dat=ishft(iand(trailer(1),z'0030'),-4) |
494 |
bid3_dat=ishft(iand(trailer(1),z'000c'),-2) |
495 |
bid4_dat=iand(trailer(1),z'0003') |
496 |
bid5_dat=ishft(iand(trailer(2),z'c000'),-14) |
497 |
bid6_dat=ishft(iand(trailer(2),z'3000'),-12) |
498 |
bid7_dat=ishft(iand(trailer(2),z'0c00'),-10) |
499 |
alarm_dat=ishft(iand(trailer(2),z'0300'),-8) |
500 |
aswr_dat=ior(ishft(iand(trailer(2),z'00ff'),8) |
501 |
$ ,ishft(iand(trailer(3),z'ff00'),-8)) |
502 |
crc_dat=iand(trailer(3),z'00ff') |
503 |
|
504 |
bid_dat_sum = (bid1_dat + bid2_dat + bid3_dat + bid4_dat + |
505 |
& bid5_dat + bid6_dat + bid7_dat) |
506 |
|
507 |
bid_dat = bid_dat_sum/7 |
508 |
|
509 |
if (bid_dat.ne.1.and.bid_dat.ne.2) then |
510 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
511 |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
512 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
513 |
endif |
514 |
if (mod(bid_dat_sum,7).ne.0) then |
515 |
bid_dat = 0 |
516 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
517 |
c write (*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
518 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
519 |
endif |
520 |
|
521 |
if (alarm_dat.eq.3) then |
522 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
523 |
c write(*,*) 'unpack_data: AQUISITION ALARM' |
524 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
525 |
|
526 |
endif |
527 |
|
528 |
if (alarm_dat.ne.3.and.alarm_dat.ne.0) then |
529 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
530 |
c write(*,*) 'unpack_data: TRAILER PACKET CORRUPTED' |
531 |
c write(*,*) '*** *** *** *** *** *** *** *** *** ***' |
532 |
|
533 |
endif |
534 |
|
535 |
|
536 |
return |
537 |
end |
538 |
|
539 |
|
540 |
*............................................................................. |
541 |
subroutine initlevel0 |
542 |
|
543 |
include '../commonyoda/level0.f' |
544 |
|
545 |
|
546 |
do i=1, nviews |
547 |
|
548 |
DAQmode(i) = 0 |
549 |
DSPnumber(i) = 0 |
550 |
eventn(i) = 0 |
551 |
nclust(i) = 0 |
552 |
cutc(i) = 0 |
553 |
cutcl(i) = 0 |
554 |
addrcluster(i,1) = 0 |
555 |
signcluster(i,1) = 0 |
556 |
addrcluster(i,2) = 0 |
557 |
signcluster(i,2) = 0 |
558 |
addrcluster(i,3) = 0 |
559 |
signcluster(i,3) = 0 |
560 |
fc(i) = 0 |
561 |
compressiontime(i) = 0 |
562 |
fl5(i) = 0 |
563 |
fl4(i) = 0 |
564 |
fl3(i) = 0 |
565 |
fl2(i) = 0 |
566 |
fl1(i) = 0 |
567 |
fl6(i) = 0 |
568 |
checksum(i) = 0 |
569 |
DATAlength(i) = 0 |
570 |
pnum(i)= 0 |
571 |
cmdnum(i)= 0 |
572 |
bid(i) = 1 |
573 |
alarm(i)= 0 |
574 |
aswr(i) = 0 |
575 |
enddo |
576 |
|
577 |
TOTDATAlength = 0 |
578 |
good0=.true. |
579 |
|
580 |
return |
581 |
end |
582 |
|
583 |
|
584 |
* *** *** *** *** *** *** *** *** *** |
585 |
* |
586 |
* |
587 |
* |
588 |
* |
589 |
* |
590 |
* |
591 |
* *** *** *** *** *** *** *** *** *** |
592 |
subroutine fillview(i) |
593 |
c ----------------------------------------------------- |
594 |
c fill variables related to view i |
595 |
c which will be stored in the level0 nt-ple |
596 |
c at the end of loop on views |
597 |
c ---------------------------------------------------- |
598 |
|
599 |
include '../commonyoda/commontracker.f' |
600 |
include '../commonyoda/level0.f' |
601 |
include '../commonyoda/dataformat.f' |
602 |
|
603 |
DAQmode(i) = DAQmode_dat |
604 |
DSPnumber(i) = DSPnumber_dat |
605 |
eventn(i) = eventn_dat |
606 |
nclust(i) = nclust_dat |
607 |
cutc(i) = cutc_dat |
608 |
cutcl(i) = cutcl_dat |
609 |
addrcluster(i,1) = addrcluster_dat(1) |
610 |
signcluster(i,1) = signcluster_dat(1) |
611 |
addrcluster(i,2) = addrcluster_dat(2) |
612 |
signcluster(i,2) = signcluster_dat(2) |
613 |
addrcluster(i,3) = addrcluster_dat(3) |
614 |
signcluster(i,3) = signcluster_dat(3) |
615 |
fc(i) = fc_dat |
616 |
compressiontime(i) = compressiontime_dat |
617 |
fl5(i) = fl5_dat |
618 |
fl4(i) = fl4_dat |
619 |
fl3(i) = fl3_dat |
620 |
fl2(i) = fl2_dat |
621 |
fl1(i) = fl1_dat |
622 |
fl6(i) = fl6_dat |
623 |
checksum(i) = checksum_dat |
624 |
DATAlength(i) = datalength_dat |
625 |
|
626 |
c ----------------------------------------------------------------------- |
627 |
c filling TRAILER variables |
628 |
c ---------------------------------------------------------------------- |
629 |
|
630 |
pnum(i)= pnum_dat |
631 |
cmdnum(i)= cmdnum_dat |
632 |
bid(i) = bid_dat |
633 |
alarm(i)= alarm_dat |
634 |
aswr(i) = aswr_dat |
635 |
|
636 |
c print*,'*-*-*-*-*-*-TRAILER-*-*-*-*-*-*' |
637 |
c print*,'* PNUM (periferal num) ',pnum_dat |
638 |
c print*,'* CMDNUM (command) ',cmdnum_dat |
639 |
c print*,'* BID (board id) ',bid_dat |
640 |
c print*,'* ALARM ',alarm_dat |
641 |
c print*,'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*' |
642 |
|
643 |
do idat=1,datalength_dat |
644 |
id = TOTDATAlength + idat |
645 |
datatracker(id) = b_tra(idat) |
646 |
enddo |
647 |
TOTDATAlength = TOTDATAlength + datalength_dat |
648 |
|
649 |
return |
650 |
end |
651 |
|