ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcPpmCompression.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6#include <algorithm>
7#include <cstdint>
8#include <vector>
9
10//#include "ZdcByteStream/ZdcSubBlock.h"
13
14// Static constants
15
29
30// Pack data
31
33{
34 const int dataFormat = subBlock.format();
35 if (dataFormat != ZdcSubBlock::COMPRESSED &&
36 dataFormat != ZdcSubBlock::SUPERCOMPRESSED) return false;
37 const int sliceL = subBlock.slicesLut();
38 const int sliceF = subBlock.slicesFadc();
39 if (sliceL != 1 || sliceF != 5) return false;
40 const int trigOffset = subBlock.fadcOffset() - subBlock.lutOffset();
41 const int fadcBaseline = subBlock.fadcBaseline();
42 const int fadcThreshold = subBlock.fadcThreshold();
43 const int channels = subBlock.channelsPerSubBlock();
44 subBlock.setStreamed();
45 std::vector<uint32_t> compStats(s_formats);
46 std::vector<int> fadcDout(sliceF-1);
47 std::vector<int> fadcLens(sliceF-1);
48 for (int chan = 0; chan < channels; ++chan) {
49 std::vector<int> lutData;
50 std::vector<int> lutBcid;
51 std::vector<int> fadcData;
52 std::vector<int> fadcBcid;
53 subBlock.ppmData(chan, lutData, fadcData, lutBcid, fadcBcid);
54 if (dataFormat == ZdcSubBlock::SUPERCOMPRESSED) {
55 int dataPresent = lutData[0] || lutBcid[0];
56 if ( !dataPresent ) {
57 for (int sl = 0; sl < sliceF; ++sl) {
58 if (fadcData[sl] >= fadcThreshold || fadcBcid[sl]) {
59 dataPresent = 1;
60 break;
61 }
62 }
63 }
64 subBlock.packer(dataPresent, 1);
65 if ( !dataPresent ) continue;
66 }
67 const int lutLen = ZdcPpmSubBlock::minBits(lutData[0]);
68 int minFadc = 0;
69 int minOffset = 0;
70 bool fadcSame = true;
71 for (int sl = 0; sl < sliceF; ++sl) {
72 if (sl == 0) minFadc = fadcData[sl];
73 if (fadcData[sl] < minFadc) {
74 minFadc = fadcData[sl];
75 minOffset = sl;
76 }
77 if (fadcData[sl] != fadcData[0] || fadcBcid[sl] != 0) fadcSame = false;
78 }
79 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
80
81 int format = 0;
82 if (lutData[0] == 0 && lutBcid[0] == 0 && fadcSame) { // format 6
83 const int header = 15;
84 subBlock.packer(header, 4);
85 if (fadcData[0]) {
86 subBlock.packer(1, 1);
87 subBlock.packer(fadcData[0], s_fadcDataBits);
88 } else subBlock.packer(0, 1);
89 format = 6;
90 } else {
91 const bool minFadcInRange = minFadc >= fadcBaseline &&
92 minFadc <= fadcBaseline + s_fadcRange;
93 int anyFadcBcid = 0;
94 int maxFadcLen = 0;
95 int idx = 0;
96 for (int sl = 0; sl < sliceF; ++sl) {
97 if (sl != 0) {
98 fadcDout[idx] = fadcData[sl] - minFadc;
99 fadcLens[idx] = ZdcPpmSubBlock::minBits(fadcDout[idx]);
100 if (idx == 0 || fadcLens[idx] > maxFadcLen) {
101 maxFadcLen = fadcLens[idx];
102 }
103 ++idx;
104 }
105 if (sl != trigOffset) anyFadcBcid |= fadcBcid[sl];
106 else if (fadcBcid[sl] != (lutBcid[0] & 0x1)) anyFadcBcid |= 1;
107 }
108 if (lutData[0] == 0 && lutBcid[0] == 0 &&
109 !anyFadcBcid && minFadcInRange && maxFadcLen < 4) {
110 // formats 0,1
111 int header = minOffset;
112 if (maxFadcLen == 3) header += 5;
113 subBlock.packer(header, 4);
114 minFadc -= fadcBaseline;
115 subBlock.packer(minFadc, 4);
116 if (maxFadcLen < 2) maxFadcLen = 2;
117 for (int idx = 0; idx < sliceF-1; ++idx) {
118 subBlock.packer(fadcDout[idx], maxFadcLen);
119 }
120 format = maxFadcLen - 2;
121 } else if (lutLen <= 3 && ((lutData[0] == 0 && lutBcid[0] == 0) ||
122 (lutData[0] > 0 && lutBcid[0] == s_peakOnly))
123 && !anyFadcBcid && minFadcInRange && maxFadcLen <= 4) {
124 // format 2
125 const int header = minOffset + 10;
126 subBlock.packer(header, 4);
127 format = 2;
128 subBlock.packer(format - 2, 2);
129 if (lutData[0]) {
130 subBlock.packer(1, 1);
131 subBlock.packer(lutData[0], 3);
132 } else subBlock.packer(0, 1);
133 minFadc -= fadcBaseline;
134 subBlock.packer(minFadc, 4);
135 for (int idx = 0; idx < sliceF-1; ++idx) {
136 subBlock.packer(fadcDout[idx], 4);
137 }
138 } else {
139 // formats 3,4,5
140 const int header = minOffset + 10;
141 subBlock.packer(header, 4);
142 if ( !minFadcInRange) {
143 const int minFadcLen = ZdcPpmSubBlock::minBits(minFadc);
144 if (minFadcLen > maxFadcLen) maxFadcLen = minFadcLen;
145 }
146 format = 5;
147 if (maxFadcLen <= 8) format = 4;
148 if (maxFadcLen <= 6) format = 3;
149 subBlock.packer(format - 2, 2);
150 if (lutData[0] || lutBcid[0]) subBlock.packer(1, 1);
151 else subBlock.packer(0, 1);
152 subBlock.packer(anyFadcBcid, 1);
153 if (lutData[0] || lutBcid[0]) {
154 subBlock.packer(lutData[0], s_lutDataBits);
155 subBlock.packer(lutBcid[0], s_lutBcidBits);
156 }
157 if (anyFadcBcid) {
158 for (int idx = 0; idx < sliceF; ++idx) {
159 subBlock.packer(fadcBcid[idx], 1);
160 }
161 }
162 if (minFadcInRange) {
163 subBlock.packer(0, 1);
164 minFadc -= fadcBaseline;
165 subBlock.packer(minFadc, 4);
166 } else {
167 subBlock.packer(1, 1);
168 subBlock.packer(minFadc, format * 2);
169 }
170 for (int idx = 0; idx < sliceF-1; ++idx) {
171 if (fadcLens[idx] <= 4) {
172 subBlock.packer(0, 1);
173 subBlock.packer(fadcDout[idx], 4);
174 } else {
175 subBlock.packer(1, 1);
176 subBlock.packer(fadcDout[idx], format * 2);
177 }
178 }
179 }
180 }
181 ++compStats[format];
182 }
183 // Errors
184 std::vector<int> status(s_glinkPins);
185 std::vector<int> error(s_glinkPins);
186 int statusBit = 0;
187 int errorBit = 0;
188 for (int pin = 0; pin < s_glinkPins; ++pin) {
189 const int errorWord = subBlock.ppmPinError(pin);
190 status[pin] = errorWord & s_statusMask;
191 error[pin] = errorWord >> s_statusBits;
192 if (status[pin]) statusBit = 1;
193 if (error[pin]) errorBit = 1;
194 }
195 subBlock.packer(statusBit, 1);
196 subBlock.packer(errorBit, 1);
197 if (statusBit || errorBit) {
198 for (int pin = 0; pin < s_glinkPins; ++pin) {
199 if (status[pin] || error[pin]) subBlock.packer(1, 1);
200 else subBlock.packer(0, 1);
201 }
202 for (int pin = 0; pin < s_glinkPins; ++pin) {
203 if (status[pin] || error[pin]) {
204 if (statusBit) subBlock.packer(status[pin], s_statusBits);
205 if (errorBit) subBlock.packer(error[pin], s_errorBits);
206 }
207 }
208 }
209 subBlock.packerFlush();
210 subBlock.setCompStats(compStats);
211 return true;
212}
213
214// Unpack data
215
217{
218 bool rc = false;
219 switch (subBlock.seqno()) {
220 case 0:
221 rc = unpackV100(subBlock);
222 break;
223 case 1:
224 rc = unpackV101(subBlock);
225 break;
226 case 2:
227 case 3:
228 case 4:
229 case 5: // runs 88701-24 only
230 rc = unpackV104(subBlock);
231 break;
232 default:
234 break;
235 }
236 return rc;
237}
238
239// Unpack data - version 1.00
240
242{
243 if (subBlock.format() != ZdcSubBlock::COMPRESSED) {
245 return false;
246 }
247 const int sliceL = subBlock.slicesLut();
248 const int sliceF = subBlock.slicesFadc();
249 if (sliceL != 1 || sliceF != 5) {
251 return false;
252 }
253 const int trigOffset = subBlock.fadcOffset();
254 const int pedestal = subBlock.pedestal();
255 const int channels = subBlock.channelsPerSubBlock();
256 subBlock.setStreamed();
257 subBlock.unpackerInit();
258 std::vector<uint32_t> compStats(s_formatsV0);
259 for (int chan = 0; chan < channels; ++chan) {
260 std::vector<int> lutData;
261 std::vector<int> lutBcid;
262 std::vector<int> fadcData;
263 std::vector<int> fadcBcid;
264 int format = 0;
265 const int header = subBlock.unpacker(4);
266 if (header < 10) {
267 // formats 0,1 - LUT zero, FADC around pedestal
268 const int minOffset = header % 5;
269 format = header / 5;
270 // LUT = 0
271 lutData.push_back(0);
272 lutBcid.push_back(0);
273 // FADC
274 const uint32_t minFadc = subBlock.unpacker(4) + pedestal - s_lowerRange;
275 for (int sl = 0; sl < sliceF; ++sl) {
276 if (sl == minOffset) fadcData.push_back(minFadc);
277 else fadcData.push_back(subBlock.unpacker(format + 2) + minFadc);
278 fadcBcid.push_back(0);
279 }
280 } else {
281 // formats 2-5
282 const int minOffset = header - 10;
283 format = subBlock.unpacker(2) + 2;
284 const int anyLut = subBlock.unpacker(1);
285 int lut = 0;
286 int bcid = 0;
287 if (format == 2) {
288 // LUT
289 if (anyLut) {
290 lut = subBlock.unpacker(3);
291 bcid = s_peakOnly; // just peak-finding BCID set
292 }
293 lutData.push_back(lut);
294 lutBcid.push_back(bcid);
295 // FADC as formats 0,1
296 const int minFadc = subBlock.unpacker(4) + pedestal - s_lowerRange;
297 for (int sl = 0; sl < sliceF; ++sl) {
298 if (sl == minOffset) fadcData.push_back(minFadc);
299 else fadcData.push_back(subBlock.unpacker(format + 2) + minFadc);
300 fadcBcid.push_back(0);
301 }
302 } else {
303 // formats 3,4,5 - full LUT word, variable FADC
304 const int anyBcid = subBlock.unpacker(1);
305 // LUT
306 if (anyLut) {
307 lut = subBlock.unpacker(s_lutDataBits);
308 bcid = subBlock.unpacker(s_lutBcidBits);
309 }
310 lutData.push_back(lut);
311 lutBcid.push_back(bcid);
312 // FADC
313 for (int sl = 0; sl < sliceF; ++sl) {
314 int fbcid = 0;
315 if (sl == trigOffset) fbcid = bcid & 0x1; // take from LUT word
316 else if (anyBcid) fbcid = subBlock.unpacker(1);
317 fadcBcid.push_back(fbcid);
318 }
319 int minFadc = 0;
320 if (subBlock.unpacker(1)) minFadc = subBlock.unpacker(format * 2);
321 else minFadc = subBlock.unpacker(4) + pedestal - s_lowerRange;
322 for (int sl = 0; sl < sliceF; ++sl) {
323 int fadc = minFadc;
324 if (sl != minOffset) {
325 if (subBlock.unpacker(1)) fadc += subBlock.unpacker(format * 2);
326 else fadc += subBlock.unpacker(4);
327 }
328 fadcData.push_back(fadc);
329 }
330 }
331 }
332 subBlock.fillPpmData(chan, lutData, fadcData, lutBcid, fadcBcid);
333 ++compStats[format];
334 }
335 subBlock.setCompStats(compStats);
336 const bool rc = subBlock.unpackerSuccess();
338 return rc;
339}
340
341// Unpack data - version 1.01
342
344{
345 if (subBlock.format() != ZdcSubBlock::COMPRESSED) {
347 return false;
348 }
349 const int sliceL = subBlock.slicesLut();
350 const int sliceF = subBlock.slicesFadc();
351 if (sliceL != 1 || sliceF != 5) {
353 return false;
354 }
355 const int trigOffset = subBlock.fadcOffset();
356 const int pedestal = subBlock.pedestal();
357 const int channels = subBlock.channelsPerSubBlock();
358 subBlock.setStreamed();
359 subBlock.unpackerInit();
360 std::vector<uint32_t> compStats(s_formats);
361 for (int chan = 0; chan < channels; ++chan) {
362 std::vector<int> lutData;
363 std::vector<int> lutBcid;
364 std::vector<int> fadcData;
365 std::vector<int> fadcBcid;
366 int format = 0;
367 const int header = subBlock.unpacker(4);
368 if (header < 10) {
369 // formats 0,1 - LUT zero, FADC around pedestal
370 const int minOffset = header % 5;
371 format = header / 5;
372 // LUT = 0
373 lutData.push_back(0);
374 lutBcid.push_back(0);
375 // FADC
376 const int minFadc = subBlock.unpacker(4) + pedestal - s_lowerRange;
377 fadcData.push_back(minFadc);
378 fadcBcid.push_back(0);
379 for (int sl = 1; sl < sliceF; ++sl) {
380 fadcData.push_back(subBlock.unpacker(format + 2) + minFadc);
381 fadcBcid.push_back(0);
382 }
383 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
384 } else if (header < 15) {
385 // formats 2-5
386 const int minOffset = header - 10;
387 format = subBlock.unpacker(2) + 2;
388 const int anyLut = subBlock.unpacker(1);
389 int lut = 0;
390 int bcid = 0;
391 if (format == 2) {
392 // LUT
393 if (anyLut) {
394 lut = subBlock.unpacker(3);
395 bcid = s_peakOnly; // just peak-finding BCID set
396 }
397 lutData.push_back(lut);
398 lutBcid.push_back(bcid);
399 // FADC as formats 0,1
400 const int minFadc = subBlock.unpacker(4) + pedestal - s_lowerRange;
401 fadcData.push_back(minFadc);
402 fadcBcid.push_back(0);
403 for (int sl = 1; sl < sliceF; ++sl) {
404 fadcData.push_back(subBlock.unpacker(format + 2) + minFadc);
405 fadcBcid.push_back(0);
406 }
407 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
408 } else {
409 // formats 3,4,5 - full LUT word, variable FADC
410 const int anyBcid = subBlock.unpacker(1);
411 // LUT
412 if (anyLut) {
413 lut = subBlock.unpacker(s_lutDataBits);
414 bcid = subBlock.unpacker(s_lutBcidBits);
415 }
416 lutData.push_back(lut);
417 lutBcid.push_back(bcid);
418 // FADC
419 for (int sl = 0; sl < sliceF; ++sl) {
420 int fbcid = 0;
421 if (sl == trigOffset) fbcid = bcid & 0x1; // take from LUT word
422 else if (anyBcid) fbcid = subBlock.unpacker(1);
423 fadcBcid.push_back(fbcid);
424 }
425 int minFadc = 0;
426 if (subBlock.unpacker(1)) minFadc = subBlock.unpacker(format * 2);
427 else minFadc = subBlock.unpacker(4) + pedestal - s_lowerRange;
428 fadcData.push_back(minFadc);
429 for (int sl = 1; sl < sliceF; ++sl) {
430 int len = 4;
431 if (subBlock.unpacker(1)) len = format * 2;
432 fadcData.push_back(subBlock.unpacker(len) + minFadc);
433 }
434 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
435 }
436 } else {
437 // format 6 - LUT zero, FADC all equal
438 format = 6;
439 // LUT
440 lutData.push_back(0);
441 lutBcid.push_back(0);
442 // FADC
443 int fadc = 0;
444 if (subBlock.unpacker(1)) fadc = subBlock.unpacker(s_fadcDataBits);
445 for (int sl = 0; sl < sliceF; ++sl) {
446 fadcData.push_back(fadc);
447 fadcBcid.push_back(0);
448 }
449 }
450 subBlock.fillPpmData(chan, lutData, fadcData, lutBcid, fadcBcid);
451 ++compStats[format];
452 }
453 // Errors
454 const int statusBit = subBlock.unpacker(1);
455 const int errorBit = subBlock.unpacker(1);
456 if (statusBit || errorBit) {
457 std::vector<int> err(s_glinkPins);
458 for (int pin = 0; pin < s_glinkPins; ++pin) {
459 err[pin] = subBlock.unpacker(1);
460 }
461 for (int pin = 0; pin < s_glinkPins; ++pin) {
462 if (err[pin]) {
463 int status = 0;
464 int error = 0;
465 if (statusBit) status = subBlock.unpacker(s_statusBits-1);
466 if (errorBit) error = subBlock.unpacker(s_errorBits+1);
467 subBlock.fillPpmPinError(pin, (error << (s_statusBits-1)) | status);
468 }
469 }
470 }
471 subBlock.setCompStats(compStats);
472 const bool rc = subBlock.unpackerSuccess();
474 return rc;
475}
476
477// Unpack data - versions 1.02, 1.03, 1.04, 1.05 (by mistake for a few runs)
478
480{
481 const int dataFormat = subBlock.format();
482 if (dataFormat != ZdcSubBlock::COMPRESSED &&
483 dataFormat != ZdcSubBlock::SUPERCOMPRESSED) {
485 return false;
486 }
487 const int compressionVersion = subBlock.seqno();
488 if (compressionVersion == 2 && dataFormat != ZdcSubBlock::COMPRESSED) {
490 return false;
491 }
492 if (compressionVersion == 5) {
493 const int run = subBlock.runNumber();
494 if (run < 88701 || run > 88724) {
496 return false;
497 }
498 }
499 const int sliceL = subBlock.slicesLut();
500 const int sliceF = subBlock.slicesFadc();
501 if (sliceL != 1 || sliceF != 5) {
503 return false;
504 }
505 const int trigOffset = subBlock.fadcOffset() - subBlock.lutOffset();
506 const int fadcBaseline = subBlock.fadcBaseline();
507 const int channels = subBlock.channelsPerSubBlock();
508 subBlock.setStreamed();
509 subBlock.unpackerInit();
510 std::vector<uint32_t> compStats(s_formats);
511 for (int chan = 0; chan < channels; ++chan) {
512 if (dataFormat == ZdcSubBlock::SUPERCOMPRESSED) {
513 if ( !subBlock.unpacker(1) ) continue;
514 }
515 std::vector<int> lutData;
516 std::vector<int> lutBcid;
517 std::vector<int> fadcData;
518 std::vector<int> fadcBcid;
519 int format = 0;
520 const int header = subBlock.unpacker(4);
521 if (header < 10) {
522 // formats 0,1 - LUT zero, FADC around pedestal
523 const int minOffset = header % 5;
524 format = header / 5;
525 // LUT = 0
526 lutData.push_back(0);
527 lutBcid.push_back(0);
528 // FADC
529 const int minFadc = subBlock.unpacker(4) + fadcBaseline;
530 fadcData.push_back(minFadc);
531 fadcBcid.push_back(0);
532 for (int sl = 1; sl < sliceF; ++sl) {
533 fadcData.push_back(subBlock.unpacker(format + 2) + minFadc);
534 fadcBcid.push_back(0);
535 }
536 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
537 } else if (header < 15) {
538 // formats 2-5
539 const int minOffset = header - 10;
540 format = subBlock.unpacker(2) + 2;
541 const int anyLut = subBlock.unpacker(1);
542 int lut = 0;
543 int bcid = 0;
544 if (format == 2) {
545 // LUT
546 if (anyLut) {
547 lut = subBlock.unpacker(3);
548 bcid = s_peakOnly; // just peak-finding BCID set
549 }
550 lutData.push_back(lut);
551 lutBcid.push_back(bcid);
552 // FADC as formats 0,1
553 const int minFadc = subBlock.unpacker(4) + fadcBaseline;
554 fadcData.push_back(minFadc);
555 fadcBcid.push_back(0);
556 for (int sl = 1; sl < sliceF; ++sl) {
557 fadcData.push_back(subBlock.unpacker(format + 2) + minFadc);
558 fadcBcid.push_back(0);
559 }
560 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
561 } else {
562 // formats 3,4,5 - full LUT word, variable FADC
563 const int anyBcid = subBlock.unpacker(1);
564 // LUT
565 if (anyLut) {
566 lut = subBlock.unpacker(s_lutDataBits);
567 bcid = subBlock.unpacker(s_lutBcidBits);
568 }
569 lutData.push_back(lut);
570 lutBcid.push_back(bcid);
571 // FADC
572 for (int sl = 0; sl < sliceF; ++sl) {
573 int fbcid = 0;
574 if (anyBcid) fbcid = subBlock.unpacker(1);
575 else if (sl == trigOffset) fbcid = bcid & 0x1; // take from LUT word
576 fadcBcid.push_back(fbcid);
577 }
578 int minFadc = 0;
579 if (subBlock.unpacker(1)) minFadc = subBlock.unpacker(format * 2);
580 else minFadc = subBlock.unpacker(4) + fadcBaseline;
581 fadcData.push_back(minFadc);
582 for (int sl = 1; sl < sliceF; ++sl) {
583 int len = 4;
584 if (subBlock.unpacker(1)) len = format * 2;
585 fadcData.push_back(subBlock.unpacker(len) + minFadc);
586 }
587 if (minOffset) std::swap(fadcData[0], fadcData[minOffset]);
588 }
589 } else {
590 // format 6 - LUT zero, FADC all equal
591 format = 6;
592 // LUT
593 lutData.push_back(0);
594 lutBcid.push_back(0);
595 // FADC
596 int fadc = 0;
597 if (subBlock.unpacker(1)) fadc = subBlock.unpacker(s_fadcDataBits);
598 for (int sl = 0; sl < sliceF; ++sl) {
599 fadcData.push_back(fadc);
600 fadcBcid.push_back(0);
601 }
602 }
603 subBlock.fillPpmData(chan, lutData, fadcData, lutBcid, fadcBcid);
604 ++compStats[format];
605 }
606 // Errors
607 const int statusBit = subBlock.unpacker(1);
608 const int errorBit = subBlock.unpacker(1);
609 const bool mcmAbsentIsError = compressionVersion < 4;
610 const int sBits = (mcmAbsentIsError) ? s_statusBits - 1 : s_statusBits;
611 const int eBits = (mcmAbsentIsError) ? s_errorBits + 1 : s_errorBits;
612 if (statusBit || errorBit) {
613 std::vector<int> err(s_glinkPins);
614 for (int pin = 0; pin < s_glinkPins; ++pin) {
615 err[pin] = subBlock.unpacker(1);
616 }
617 for (int pin = 0; pin < s_glinkPins; ++pin) {
618 if (err[pin]) {
619 int status = 0;
620 int error = 0;
621 if (statusBit) status = subBlock.unpacker(sBits);
622 if (errorBit) error = subBlock.unpacker(eBits);
623 subBlock.fillPpmPinError(pin, (error << sBits) | status);
624 }
625 }
626 // There is a bug in versions < 4 but if I've understood it correctly
627 // it is not possible to detect it reliably in data.
628 }
629 subBlock.setCompStats(compStats);
630 const bool rc = subBlock.unpackerSuccess();
632 return rc;
633}
634
static Double_t rc
static const int s_lowerRange
static const int s_fadcRange
static const int s_upperRange
static const int s_formatsV0
static bool unpack(ZdcPpmSubBlock &subBlock)
Unpack data.
static const int s_errorBits
static bool unpackV104(ZdcPpmSubBlock &subBlock)
static const int s_lutBcidBits
static bool unpackV100(ZdcPpmSubBlock &subBlock)
static const int s_statusMask
static const int s_statusBits
static const int s_formats
static const int s_fadcDataBits
static const int s_peakOnly
static bool unpackV101(ZdcPpmSubBlock &subBlock)
static bool pack(ZdcPpmSubBlock &subBlock)
Pack data.
static const int s_lutDataBits
static const int s_glinkPins
Sub-Block class for PPM data.
void fillPpmData(int chan, const std::vector< int > &lut, const std::vector< int > &fadc, const std::vector< int > &bcidLut, const std::vector< int > &bcidFadc)
Store PPM data for later packing.
void setCompStats(const std::vector< uint32_t > &stats)
Set compression stats.
int pedestal() const
int fadcOffset() const
int ppmPinError(int pin) const
Return the error word for a G-Link pin.
void ppmData(int chan, std::vector< int > &lut, std::vector< int > &fadc, std::vector< int > &bcidLut, std::vector< int > &bcidFadc) const
Return unpacked data for given channel.
void fillPpmPinError(int pin, int errorWord)
Store an error word corresponding to a G-Link pin.
int fadcBaseline() const
int slicesFadc() const
static int channelsPerSubBlock(int version, int format)
Return the number of channels per sub-block.
int runNumber() const
int fadcThreshold() const
int lutOffset() const
int slicesLut() const
void unpackerInit()
Initialise unpacker.
uint32_t unpacker(int nbits)
Unpack given number of bits of data.
@ UNPACK_COMPRESSION_VERSION
Definition ZdcSubBlock.h:49
@ UNPACK_COMPRESSION_SLICES
Definition ZdcSubBlock.h:50
@ UNPACK_DATA_TRUNCATED
Definition ZdcSubBlock.h:51
bool unpackerSuccess() const
Return unpacker success flag.
static int minBits(uint32_t datum)
Return the minimum number of bits needed for given data.
int format() const
void setUnpackErrorCode(int code)
Set the unpacking error code.
void packer(uint32_t datum, int nbits)
Pack given data into given number of bits.
void packerFlush()
Flush the current data word padded with zeros.
void setStreamed()
Set continuous bit streaming for compressed formats.
int seqno() const
Definition run.py:1
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)