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