ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
ZdcPpmCompression Class Reference

#include <ZdcPpmCompression.h>

Collaboration diagram for ZdcPpmCompression:

Public Member Functions

 ZdcPpmCompression ()
 
 ~ZdcPpmCompression ()
 

Static Public Member Functions

static bool pack (ZdcPpmSubBlock &subBlock)
 Pack data. More...
 
static bool unpack (ZdcPpmSubBlock &subBlock)
 Unpack data. More...
 

Static Private Member Functions

static bool unpackV100 (ZdcPpmSubBlock &subBlock)
 
static bool unpackV101 (ZdcPpmSubBlock &subBlock)
 
static bool unpackV104 (ZdcPpmSubBlock &subBlock)
 

Static Private Attributes

static const int s_formatsV0 = 6
 
static const int s_lowerRange = 12
 
static const int s_upperRange = 3
 
static const int s_formats = 7
 
static const int s_fadcRange = 15
 
static const int s_peakOnly = 4
 
static const int s_lutDataBits = 8
 
static const int s_lutBcidBits = 3
 
static const int s_fadcDataBits = 10
 
static const int s_glinkPins = 16
 
static const int s_statusBits = 5
 
static const int s_errorBits = 6
 
static const int s_statusMask = 0x1f
 

Detailed Description

Definition at line 20 of file ZdcPpmCompression.h.

Constructor & Destructor Documentation

◆ ZdcPpmCompression()

ZdcPpmCompression::ZdcPpmCompression ( )

◆ ~ZdcPpmCompression()

ZdcPpmCompression::~ZdcPpmCompression ( )

Member Function Documentation

◆ pack()

bool ZdcPpmCompression::pack ( ZdcPpmSubBlock subBlock)
static

Pack data.

Definition at line 32 of file ZdcPpmCompression.cxx.

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 }

◆ unpack()

bool ZdcPpmCompression::unpack ( ZdcPpmSubBlock subBlock)
static

Unpack data.

Definition at line 216 of file ZdcPpmCompression.cxx.

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 }

◆ unpackV100()

bool ZdcPpmCompression::unpackV100 ( ZdcPpmSubBlock subBlock)
staticprivate

Definition at line 241 of file ZdcPpmCompression.cxx.

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 }

◆ unpackV101()

bool ZdcPpmCompression::unpackV101 ( ZdcPpmSubBlock subBlock)
staticprivate

Definition at line 343 of file ZdcPpmCompression.cxx.

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 }

◆ unpackV104()

bool ZdcPpmCompression::unpackV104 ( ZdcPpmSubBlock subBlock)
staticprivate

Definition at line 479 of file ZdcPpmCompression.cxx.

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 }

Member Data Documentation

◆ s_errorBits

const int ZdcPpmCompression::s_errorBits = 6
staticprivate

Definition at line 43 of file ZdcPpmCompression.h.

◆ s_fadcDataBits

const int ZdcPpmCompression::s_fadcDataBits = 10
staticprivate

Definition at line 40 of file ZdcPpmCompression.h.

◆ s_fadcRange

const int ZdcPpmCompression::s_fadcRange = 15
staticprivate

Definition at line 36 of file ZdcPpmCompression.h.

◆ s_formats

const int ZdcPpmCompression::s_formats = 7
staticprivate

Definition at line 35 of file ZdcPpmCompression.h.

◆ s_formatsV0

const int ZdcPpmCompression::s_formatsV0 = 6
staticprivate

Definition at line 32 of file ZdcPpmCompression.h.

◆ s_glinkPins

const int ZdcPpmCompression::s_glinkPins = 16
staticprivate

Definition at line 41 of file ZdcPpmCompression.h.

◆ s_lowerRange

const int ZdcPpmCompression::s_lowerRange = 12
staticprivate

Definition at line 33 of file ZdcPpmCompression.h.

◆ s_lutBcidBits

const int ZdcPpmCompression::s_lutBcidBits = 3
staticprivate

Definition at line 39 of file ZdcPpmCompression.h.

◆ s_lutDataBits

const int ZdcPpmCompression::s_lutDataBits = 8
staticprivate

Definition at line 38 of file ZdcPpmCompression.h.

◆ s_peakOnly

const int ZdcPpmCompression::s_peakOnly = 4
staticprivate

Definition at line 37 of file ZdcPpmCompression.h.

◆ s_statusBits

const int ZdcPpmCompression::s_statusBits = 5
staticprivate

Definition at line 42 of file ZdcPpmCompression.h.

◆ s_statusMask

const int ZdcPpmCompression::s_statusMask = 0x1f
staticprivate

Definition at line 44 of file ZdcPpmCompression.h.

◆ s_upperRange

const int ZdcPpmCompression::s_upperRange = 3
staticprivate

Definition at line 34 of file ZdcPpmCompression.h.


The documentation for this class was generated from the following files:
ZdcPpmSubBlock::channelsPerSubBlock
static int channelsPerSubBlock(int version, int format)
Return the number of channels per sub-block.
Definition: ZdcPpmSubBlock.cxx:464
ZdcSubBlock::unpackerInit
void unpackerInit()
Initialise unpacker.
Definition: ZdcSubBlock.cxx:352
ZdcPpmSubBlock::pedestal
int pedestal() const
Definition: ZdcPpmSubBlock.h:369
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
ZdcPpmSubBlock::lutOffset
int lutOffset() const
Definition: ZdcPpmSubBlock.h:359
header
Definition: hcg.cxx:526
ZdcSubBlock::setUnpackErrorCode
void setUnpackErrorCode(int code)
Set the unpacking error code.
Definition: ZdcSubBlock.h:340
vtune_athena.format
format
Definition: vtune_athena.py:14
ZdcPpmSubBlock::fillPpmData
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.
Definition: ZdcPpmSubBlock.cxx:129
ZdcSubBlock::SUPERCOMPRESSED
@ SUPERCOMPRESSED
Definition: ZdcSubBlock.h:44
ZdcSubBlock::UNPACK_DATA_TRUNCATED
@ UNPACK_DATA_TRUNCATED
Definition: ZdcSubBlock.h:51
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ZdcPpmCompression::unpackV101
static bool unpackV101(ZdcPpmSubBlock &subBlock)
Definition: ZdcPpmCompression.cxx:343
ZdcPpmCompression::s_fadcDataBits
static const int s_fadcDataBits
Definition: ZdcPpmCompression.h:40
ZdcSubBlock::UNPACK_FORMAT
@ UNPACK_FORMAT
Definition: ZdcSubBlock.h:48
ZdcSubBlock::minBits
static int minBits(uint32_t datum)
Return the minimum number of bits needed for given data.
Definition: ZdcSubBlock.cxx:245
ZdcPpmSubBlock::slicesFadc
int slicesFadc() const
Definition: ZdcPpmSubBlock.cxx:108
ZdcSubBlock::seqno
int seqno() const
Definition: ZdcSubBlock.h:255
ZdcSubBlock::COMPRESSED
@ COMPRESSED
Definition: ZdcSubBlock.h:43
ZdcSubBlock::packerFlush
void packerFlush()
Flush the current data word padded with zeros.
Definition: ZdcSubBlock.cxx:296
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
ZdcPpmSubBlock::runNumber
int runNumber() const
Definition: ZdcPpmSubBlock.h:384
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
ZdcPpmCompression::s_formatsV0
static const int s_formatsV0
Definition: ZdcPpmCompression.h:32
ZdcPpmCompression::s_glinkPins
static const int s_glinkPins
Definition: ZdcPpmCompression.h:41
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
ZdcSubBlock::format
int format() const
Definition: ZdcSubBlock.h:250
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
ZdcPpmSubBlock::fadcThreshold
int fadcThreshold() const
Definition: ZdcPpmSubBlock.h:379
ZdcSubBlock::UNPACK_COMPRESSION_VERSION
@ UNPACK_COMPRESSION_VERSION
Definition: ZdcSubBlock.h:49
ZdcPpmSubBlock::fadcOffset
int fadcOffset() const
Definition: ZdcPpmSubBlock.h:364
ZdcPpmCompression::s_statusBits
static const int s_statusBits
Definition: ZdcPpmCompression.h:42
run
Definition: run.py:1
ZdcPpmSubBlock::ppmPinError
int ppmPinError(int pin) const
Return the error word for a G-Link pin.
Definition: ZdcPpmSubBlock.cxx:246
ZdcSubBlock::UNPACK_COMPRESSION_SLICES
@ UNPACK_COMPRESSION_SLICES
Definition: ZdcSubBlock.h:50
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
ZdcPpmCompression::s_lutBcidBits
static const int s_lutBcidBits
Definition: ZdcPpmCompression.h:39
ZdcPpmSubBlock::fillPpmPinError
void fillPpmPinError(int pin, int errorWord)
Store an error word corresponding to a G-Link pin.
Definition: ZdcPpmSubBlock.cxx:220
ZdcPpmCompression::unpackV104
static bool unpackV104(ZdcPpmSubBlock &subBlock)
Definition: ZdcPpmCompression.cxx:479
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
ZdcPpmSubBlock::ppmData
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.
Definition: ZdcPpmSubBlock.cxx:167
ZdcPpmSubBlock::fadcBaseline
int fadcBaseline() const
Definition: ZdcPpmSubBlock.h:374
ZdcSubBlock::unpacker
uint32_t unpacker(int nbits)
Unpack given number of bits of data.
Definition: ZdcSubBlock.cxx:309
ZdcSubBlock::packer
void packer(uint32_t datum, int nbits)
Pack given data into given number of bits.
Definition: ZdcSubBlock.cxx:271
ZdcPpmCompression::s_peakOnly
static const int s_peakOnly
Definition: ZdcPpmCompression.h:37
ZdcPpmSubBlock::slicesLut
int slicesLut() const
Definition: ZdcPpmSubBlock.cxx:120
ZdcSubBlock::unpackerSuccess
bool unpackerSuccess() const
Return unpacker success flag.
Definition: ZdcSubBlock.h:356
ZdcPpmCompression::s_statusMask
static const int s_statusMask
Definition: ZdcPpmCompression.h:44
ZdcPpmSubBlock::setCompStats
void setCompStats(const std::vector< uint32_t > &stats)
Set compression stats.
Definition: ZdcPpmSubBlock.h:394
ZdcPpmCompression::s_lowerRange
static const int s_lowerRange
Definition: ZdcPpmCompression.h:33
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
ZdcPpmCompression::s_formats
static const int s_formats
Definition: ZdcPpmCompression.h:35
merge.status
status
Definition: merge.py:17
get_generator_info.error
error
Definition: get_generator_info.py:40
error
Definition: IImpactPoint3dEstimator.h:70
ZdcSubBlock::setStreamed
void setStreamed()
Set continuous bit streaming for compressed formats.
Definition: ZdcSubBlock.h:350
ZdcPpmCompression::s_lutDataBits
static const int s_lutDataBits
Definition: ZdcPpmCompression.h:38
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:355
ZdcPpmCompression::s_fadcRange
static const int s_fadcRange
Definition: ZdcPpmCompression.h:36
ZdcPpmCompression::s_errorBits
static const int s_errorBits
Definition: ZdcPpmCompression.h:43
ZdcPpmCompression::unpackV100
static bool unpackV100(ZdcPpmSubBlock &subBlock)
Definition: ZdcPpmCompression.cxx:241