CMS 3D CMS Logo

HcalUnpacker.cc
Go to the documentation of this file.
11 
12 //#define DebugLog
13 
14 namespace HcalUnpacker_impl {
15  template <class DigiClass>
16  const HcalQIESample* unpack(const HcalQIESample* startPoint,
17  const HcalQIESample* limit,
18  DigiClass& digi,
19  int presamples,
20  const HcalElectronicsId& eid,
21  int startSample,
22  int endSample,
23  int expectedTime,
24  const HcalHTRData& hhd) {
25  // set parameters
26  digi.setPresamples(presamples);
27  digi.setReadoutIds(eid);
28 
29  int fiber = startPoint->fiber();
30  int fiberchan = startPoint->fiberChan();
31  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
32  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
33 
34  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
35 #ifdef DebugLog
36  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
37 #endif
38  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
39  }
40 
41  // what is my sample number?
42  int myFiberChan = startPoint->fiberAndChan();
43  int ncurr = 0, ntaken = 0;
44  const HcalQIESample* qie_work = startPoint;
45  while (qie_work != limit && qie_work->fiberAndChan() == myFiberChan) {
46  if (ncurr >= startSample && ncurr <= endSample) {
47  digi.setSample(ntaken, *qie_work);
48  ++ntaken;
49  }
50  ncurr++;
51  qie_work++;
52  }
53  digi.setSize(ntaken);
54  return qie_work;
55  }
56 
57  template <class DigiClass>
58  const unsigned short* unpack_compact(const unsigned short* startPoint,
59  const unsigned short* limit,
60  DigiClass& digi,
61  int presamples,
62  const HcalElectronicsId& eid,
63  int startSample,
64  int endSample,
65  int expectedTime,
66  const HcalHTRData& hhd) {
67  // set parameters
68  digi.setPresamples(presamples);
69  digi.setReadoutIds(eid);
70  int flavor, error_flags, capid0, channelid;
71 
72  HcalHTRData::unpack_per_channel_header(*startPoint, flavor, error_flags, capid0, channelid);
73  bool isCapRotating = !(error_flags & 0x1);
74  bool fiberErr = (error_flags & 0x2);
75  bool dataValid = !(error_flags & 0x2);
76  int fiberchan = channelid & 0x3;
77  int fiber = ((channelid >> 2) & 0x7) + 1;
78 
79  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
80  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
81 
82  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
83 #ifdef DebugLog
84  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
85 #endif
86  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
87  }
88 
89  // what is my sample number?
90  int ncurr = 0, ntaken = 0;
91  const unsigned short* qie_work = startPoint;
92  // we branch here between normal (flavor=5) and error mode (flavor=6)
93  if (flavor == 5) {
94  for (qie_work++; qie_work != limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
95  int capidn = (isCapRotating) ? ((capid0 + ncurr) % 4) : (capid0);
96  int capidn1 = (isCapRotating) ? ((capid0 + ncurr + 1) % 4) : (capid0);
97  // two samples in one...
98  HcalQIESample s0((*qie_work) & 0x7F, capidn, fiber, fiberchan, dataValid, fiberErr);
99  HcalQIESample s1(((*qie_work) >> 8) & 0x7F, capidn1, fiber, fiberchan, dataValid, fiberErr);
100 
101  if (ncurr >= startSample && ncurr <= endSample) {
102  digi.setSample(ntaken, s0);
103  ++ntaken;
104  }
105  ncurr++;
106  if (ncurr >= startSample && ncurr <= endSample) {
107  digi.setSample(ntaken, s1);
108  ++ntaken;
109  }
110  ncurr++;
111  }
112  digi.setSize(ntaken);
113  } else if (flavor == 6) {
114  for (qie_work++; qie_work != limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
115  if (ncurr >= startSample && ncurr <= endSample) {
116  HcalQIESample sample((*qie_work) & 0x7F,
117  ((*qie_work) >> 8) & 0x3,
118  fiber,
119  fiberchan,
120  ((*qie_work) >> 10) & 0x1,
121  ((*qie_work) >> 11) & 0x1);
122  digi.setSample(ntaken, sample);
123  ++ntaken;
124  }
125 
126  ncurr++;
127  }
128  digi.setSize(ntaken);
129  } else {
130  edm::LogWarning("Bad Data") << "Invalid flavor " << flavor;
131  qie_work = limit;
132  }
133  return qie_work;
134  }
135 
136  template <class DigiClass>
138  const HcalUHTRData::const_iterator& iend,
139  DigiClass& digi,
140  int presamples,
141  const HcalElectronicsId& eid,
142  int startSample,
143  int endSample) {
144  // set parameters
145  digi.setPresamples(presamples - startSample);
146  digi.setReadoutIds(eid);
147  int error_flags = i.errFlags();
148  int capid0 = i.capid0();
149  int flavor = i.flavor();
150 
151  bool isCapRotating = !(error_flags & 0x1);
152  bool fiberErr = (error_flags & 0x2);
153  bool dataValid = !(error_flags & 0x2);
154  int fiberchan = i.channelid() & 0x3;
155  int fiber = ((i.channelid() >> 2) & 0x7) + 1;
156 
157  // digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
158 
159  // what is my sample number?
160  int ncurr = 0, ntaken = 0;
161  if (flavor == 5) {
162  for (++i; i != iend && !i.isHeader(); ++i) {
163  int capidn = (isCapRotating) ? ((capid0 + ncurr) % 4) : (capid0);
164 
165  HcalQIESample s(i.adc(), capidn, fiber, fiberchan, dataValid, fiberErr);
166 
167  if (ncurr >= startSample && ncurr <= endSample) {
168  digi.setSample(ntaken, s);
169  ++ntaken;
170  }
171  ncurr++;
172  }
173  digi.setSize(ntaken);
174  } else if (flavor == 7) { //similar to VME flavor 6, used for premix in MC
175  for (++i; i != iend && !i.isHeader(); ++i) {
176  if (ncurr >= startSample && ncurr <= endSample) {
177  HcalQIESample sample(i.adc(), i.capid(), fiber, fiberchan, i.dataValid(), i.errFlags());
178  digi.setSample(ntaken, sample);
179  ++ntaken;
180  }
181  ncurr++;
182  }
183  digi.setSize(ntaken);
184  }
185  }
186 
187 } // namespace HcalUnpacker_impl
188 
189 static inline bool isTPGSOI(const HcalTriggerPrimitiveSample& s) { return (s.raw() & 0x200) != 0; }
190 
191 struct HOUnrolledTP { // parts of an HO trigger primitive, unpacked
192  bool valid, checked;
194  unsigned int databits;
196  valid = false;
197  checked = false;
198  ieta = 0;
199  iphi = 0;
200  samples = 0;
201  soi = 0;
202  databits = 0;
203  }
204  void setbit(int i) { databits |= (1 << i); }
205 };
206 
208  const HcalElectronicsMap& emap,
209  Collections& colls,
211  bool silent) {
212  if (raw.size() < 16) {
213  if (!silent)
214  edm::LogWarning("Invalid Data") << "Empty/invalid data, size = " << raw.size();
215  return;
216  }
217 
218  // get the DCC header
219  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
220 
221  if (dccHeader->BOEshouldBeZeroAlways() == 0) // also includes uTCA before the common AMC13XG firmware
222  unpackVME(raw, emap, colls, report, silent);
223  else
224  unpackUTCA(raw, emap, colls, report, silent);
225 }
226 
227 static int slb(uint16_t theSample) { return ((theSample >> 13) & 0x7); }
228 static int slbChan(uint16_t theSample) { return (theSample >> 11) & 0x3; }
229 static int slbAndChan(uint16_t theSample) { return (theSample >> 11) & 0x1F; }
230 
232  const HcalElectronicsMap& emap,
233  Collections& colls,
235  bool silent) {
236  // get the DCC header
237  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
238  const HcalDTCHeader* dtcHeader = (const HcalDTCHeader*)(raw.data());
239  bool is_VME_DCC = (dccHeader->getDCCDataFormatVersion() < 0x10) || ((mode_ & 0x1) == 0);
240 
241  int dccid =
242  (is_VME_DCC) ? (dccHeader->getSourceId() - sourceIdOffset_) : (dtcHeader->getSourceId() - sourceIdOffset_);
243 
244  // check the summary status
245 
246  // walk through the HTR data. For the uTCA, use spigot=slot+1
247  HcalHTRData htr;
248  const unsigned short *daq_first, *daq_last, *tp_first, *tp_last;
249  const HcalQIESample *qie_begin, *qie_end, *qie_work;
250  const HcalTriggerPrimitiveSample *tp_begin, *tp_end, *tp_work;
251  for (int spigot = 0; spigot < HcalDCCHeader::SPIGOT_COUNT; spigot++) {
252  if (is_VME_DCC) {
253  if (!dccHeader->getSpigotPresent(spigot))
254  continue;
255 
256  int retval = dccHeader->getSpigotData(spigot, htr, raw.size());
257  if (retval != 0) {
258  if (retval == -1) {
259  if (!silent)
260  edm::LogWarning("Invalid Data") << "Invalid HTR data (data beyond payload size) observed on spigot "
261  << spigot << " of DCC with source id " << dccHeader->getSourceId();
262  report.countSpigotFormatError();
263  }
264  continue;
265  }
266  // check
267  if (dccHeader->getSpigotCRCError(spigot)) {
268  if (!silent)
269  edm::LogWarning("Invalid Data") << "CRC Error on HTR data observed on spigot " << spigot
270  << " of DCC with source id " << dccHeader->getSourceId();
271  report.countSpigotFormatError();
272  continue;
273  }
274  } else { // is_uTCA (!is_VME_DCC)
275  int slot = spigot + 1;
276  if (slot > HcalDTCHeader::MAXIMUM_SLOT)
277  continue;
278 
279  if (!dtcHeader->getSlotPresent(slot))
280  continue;
281 
282  int retval = dtcHeader->getSlotData(slot, htr, raw.size());
283  if (retval != 0) {
284  if (retval == -1) {
285  if (!silent)
286  edm::LogWarning("Invalid Data") << "Invalid uHTR data (data beyond payload size) observed on slot " << slot
287  << " of DTC with source id " << dtcHeader->getSourceId();
288  report.countSpigotFormatError();
289  }
290  continue;
291  }
292  // check
293  if (dtcHeader->getSlotCRCError(slot)) {
294  if (!silent)
295  edm::LogWarning("Invalid Data") << "CRC Error on uHTR data observed on slot " << slot
296  << " of DTC with source id " << dtcHeader->getSourceId();
297  report.countSpigotFormatError();
298  continue;
299  }
300  }
301 
302  // check for EE
303  if (htr.isEmptyEvent()) {
304  report.countEmptyEventSpigot();
305  }
306  if (htr.isOverflowWarning()) {
307  report.countOFWSpigot();
308  }
309  if (htr.isBusy()) {
310  report.countBusySpigot();
311  }
312  if (!htr.check()) {
313  if (!silent)
314  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id "
315  << dccHeader->getSourceId();
316  report.countSpigotFormatError();
317  continue;
318  }
319  if (htr.isHistogramEvent()) {
320  if (!silent)
321  edm::LogWarning("Invalid Data") << "Histogram data passed to non-histogram unpacker on spigot " << spigot
322  << " of DCC with source id " << dccHeader->getSourceId();
323  continue;
324  }
325  if ((htr.getFirmwareFlavor() & 0xE0) == 0x80) { // some kind of TTP data
326  if (colls.ttp != nullptr) {
327  HcalTTPUnpacker ttpUnpack;
328  colls.ttp->push_back(HcalTTPDigi());
329  ttpUnpack.unpack(htr, colls.ttp->back());
330  } else {
331  LogDebug("HcalTechTrigProcessor")
332  << "Skipping data on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId()
333  << " which is from the TechTrigProcessor (use separate unpacker!)";
334  }
335  continue;
336  }
337  if (htr.getFirmwareFlavor() >= 0x80) {
338  if (!silent)
339  edm::LogWarning("HcalUnpacker") << "Skipping data on spigot " << spigot << " of DCC with source id "
340  << dccHeader->getSourceId() << " which is of unknown flavor "
341  << htr.getFirmwareFlavor();
342  continue;
343  }
344 
345  // calculate "real" number of presamples
346  int nps = htr.getNPS() - startSample_;
347 
348  // get pointers
349  htr.dataPointers(&daq_first, &daq_last, &tp_first, &tp_last);
350  unsigned int smid = htr.getSubmodule();
351  int htr_tb = smid & 0x1;
352  int htr_slot = (smid >> 1) & 0x1F;
353  int htr_cr = (smid >> 6) & 0x1F;
354 
355  tp_begin = (const HcalTriggerPrimitiveSample*)tp_first;
356  tp_end = (const HcalTriggerPrimitiveSample*)(tp_last + 1); // one beyond last..
357 
359  int currFiberChan = 0x3F; // invalid fiber+channel...
360  int ncurr = 0;
361  bool valid = false;
362 
363  bool tpgSOIbitInUse = htr.getFormatVersion() >= 3; // version 3 and later
364  bool isHOtpg = htr.getFormatVersion() >= 3 && htr.getFirmwareFlavor() == 0; // HO is flavor zero
365  /*
366  Unpack the trigger primitives
367  */
368  if (isHOtpg) {
369  HOUnrolledTP unrolled[24];
370  for (tp_work = tp_begin; tp_work != tp_end; tp_work++) {
371  if (tp_work->raw() == 0xFFFF)
372  continue; // filler word
373  int sector = slbChan(tp_work->raw());
374  if (sector > 2)
375  continue;
376 
377  for (int ibit = 0; ibit < 8; ibit++) {
378  int linear = sector * 8 + ibit;
379  if (!unrolled[linear].checked) {
380  unrolled[linear].checked = true;
381  int fiber = (linear / 3) + 1;
382  int fc = (linear % 3);
383  // electronics id (use precision match for HO TP)
384  HcalElectronicsId eid(fc, fiber, spigot, dccid);
385  eid.setHTR(htr_cr, htr_slot, htr_tb);
386  DetId did = emap.lookup(eid);
387  if (!did.null()) {
388  if (did.det() == DetId::Hcal && ((HcalSubdetector)did.subdetId()) == HcalOuter) {
389  HcalDetId hid(did);
390  unrolled[linear].valid = true;
391  unrolled[linear].ieta = hid.ieta();
392  unrolled[linear].iphi = hid.iphi();
393  }
394  } else {
395  report.countUnmappedTPDigi(eid);
396  }
397  }
398  if (unrolled[linear].valid) {
399  if (isTPGSOI(*tp_work))
400  unrolled[linear].soi = unrolled[linear].samples;
401  if (tp_work->raw() & (1 << ibit))
402  unrolled[linear].setbit(unrolled[linear].samples);
403  unrolled[linear].samples++;
404  }
405  }
406  }
407  for (int i = 0; i < 24; i++) {
408  if (unrolled[i].valid)
409  colls.tphoCont->push_back(HOTriggerPrimitiveDigi(
410  unrolled[i].ieta, unrolled[i].iphi, unrolled[i].samples, unrolled[i].soi, unrolled[i].databits));
411  }
412  } else { // regular TPs (not HO)
413  for (tp_work = tp_begin; tp_work != tp_end; tp_work++) {
414  if (tp_work->raw() == 0xFFFF)
415  continue; // filler word
416  if (slbAndChan(tp_work->raw()) != currFiberChan) { // start new set
417  currFiberChan = slbAndChan(tp_work->raw());
418  // lookup the right channel
419  HcalElectronicsId eid(slbChan(tp_work->raw()), slb(tp_work->raw()), spigot, dccid, htr_cr, htr_slot, htr_tb);
420  DetId did = emap.lookupTrigger(eid);
421  if (did.null()) {
422  report.countUnmappedTPDigi(eid);
423  if (unknownIdsTrig_.find(eid) == unknownIdsTrig_.end()) {
424  if (!silent)
425  edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
426  unknownIdsTrig_.insert(eid);
427  }
428  valid = false;
429  continue;
430  } else if (did == HcalTrigTowerDetId::Undefined || (did.det() == DetId::Hcal && did.subdetId() == 0)) {
431  // known to be unmapped
432  valid = false;
433  continue;
434  }
435  HcalTrigTowerDetId id(did);
436  colls.tpCont->push_back(HcalTriggerPrimitiveDigi(id));
437  // set the various bits
438  if (!tpgSOIbitInUse)
439  colls.tpCont->back().setPresamples(nps);
440  colls.tpCont->back().setZSInfo(htr.isUnsuppressed(),
441  htr.wasMarkAndPassZSTP(slb(tp_work->raw()), slbChan(tp_work->raw())));
442 
443  // no hits recorded for current
444  ncurr = 0;
445  valid = true;
446  }
447  // add the word (if within settings or recent firmware [recent firmware ignores startSample/endSample])
448  if (valid && ((tpgSOIbitInUse && ncurr < 10) || (ncurr >= startSample_ && ncurr <= endSample_))) {
449  colls.tpCont->back().setSample(colls.tpCont->back().size(), *tp_work);
450  colls.tpCont->back().setSize(colls.tpCont->back().size() + 1);
451  }
452  // set presamples,if SOI
453  if (valid && tpgSOIbitInUse && isTPGSOI(*tp_work)) {
454  colls.tpCont->back().setPresamples(ncurr);
455  }
456  ncurr++;
457  }
458  }
459 
462  qie_begin = (const HcalQIESample*)daq_first;
463  qie_end = (const HcalQIESample*)(daq_last + 1); // one beyond last..
464 
466 
467  for (qie_work = qie_begin; qie_work != qie_end;) {
468  if (qie_work->raw() == 0xFFFF) {
469  qie_work++;
470  continue; // filler word
471  }
472  // always at the beginning ...
473 
474  // lookup the right channel
475  HcalElectronicsId eid(qie_work->fiberChan(), qie_work->fiber(), spigot, dccid);
476  eid.setHTR(htr_cr, htr_slot, htr_tb);
477  DetId did = emap.lookup(eid);
478 
479  if (!did.null()) {
480  if (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId) {
481  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
482  qie_work = HcalUnpacker_impl::unpack<ZDCDataFrame>(qie_work,
483  qie_end,
484  colls.zdcCont->back(),
485  nps,
486  eid,
487  startSample_,
488  endSample_,
490  htr);
491  } else if (did.det() == DetId::Hcal) {
492  switch (((HcalSubdetector)did.subdetId())) {
493  case (HcalBarrel):
494  case (HcalEndcap): {
495  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
496  qie_work = HcalUnpacker_impl::unpack<HBHEDataFrame>(qie_work,
497  qie_end,
498  colls.hbheCont->back(),
499  nps,
500  eid,
501  startSample_,
502  endSample_,
504  htr);
505  } break;
506  case (HcalOuter): {
507  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
508  qie_work = HcalUnpacker_impl::unpack<HODataFrame>(qie_work,
509  qie_end,
510  colls.hoCont->back(),
511  nps,
512  eid,
513  startSample_,
514  endSample_,
516  htr);
517  } break;
518  case (HcalForward): {
519  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
520  qie_work = HcalUnpacker_impl::unpack<HFDataFrame>(qie_work,
521  qie_end,
522  colls.hfCont->back(),
523  nps,
524  eid,
525  startSample_,
526  endSample_,
528  htr);
529  } break;
530  case (HcalOther): {
531  HcalOtherDetId odid(did);
532  if (odid.subdet() == HcalCalibration) {
533  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
534  qie_work = HcalUnpacker_impl::unpack<HcalCalibDataFrame>(qie_work,
535  qie_end,
536  colls.calibCont->back(),
537  nps,
538  eid,
539  startSample_,
540  endSample_,
542  htr);
543  }
544  } break;
545  case (HcalEmpty):
546  default: {
547  for (int fiberC = qie_work->fiberAndChan(); qie_work != qie_end && qie_work->fiberAndChan() == fiberC;
548  qie_work++)
549  ;
550  } break;
551  }
552  }
553  } else {
554  report.countUnmappedDigi(eid);
555  if (unknownIds_.find(eid) == unknownIds_.end()) {
556  if (!silent)
557  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
558  unknownIds_.insert(eid);
559  }
560  for (int fiberC = qie_work->fiberAndChan(); qie_work != qie_end && qie_work->fiberAndChan() == fiberC;
561  qie_work++)
562  ;
563  }
564  }
565  } else {
566  // this is the branch for unpacking the compact data format with per-channel headers
567  const unsigned short* ptr_header = daq_first;
568  const unsigned short* ptr_end = daq_last + 1;
569  int flavor, error_flags, capid0, channelid;
570 
571  while (ptr_header != ptr_end) {
572  if (*ptr_header == 0xFFFF) { // impossible filler word
573  ptr_header++;
574  continue;
575  }
576  // unpack the header word
577  bool isheader = HcalHTRData::unpack_per_channel_header(*ptr_header, flavor, error_flags, capid0, channelid);
578  if (!isheader) {
579  ptr_header++;
580  continue;
581  }
582 
583  int fiberchan = channelid & 0x3;
584  int fiber = ((channelid >> 2) & 0x7) + 1;
585 
586  // lookup the right channel
587  HcalElectronicsId eid(fiberchan, fiber, spigot, dccid);
588  eid.setHTR(htr_cr, htr_slot, htr_tb);
589  DetId did = emap.lookup(eid);
590 
591  if (!did.null()) {
592  if (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId) {
593  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
594  ptr_header = HcalUnpacker_impl::unpack_compact<ZDCDataFrame>(ptr_header,
595  ptr_end,
596  colls.zdcCont->back(),
597  nps,
598  eid,
599  startSample_,
600  endSample_,
602  htr);
603  } else if (did.det() == DetId::Hcal) {
604  switch (((HcalSubdetector)did.subdetId())) {
605  case (HcalBarrel):
606  case (HcalEndcap): {
607  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
608  ptr_header = HcalUnpacker_impl::unpack_compact<HBHEDataFrame>(ptr_header,
609  ptr_end,
610  colls.hbheCont->back(),
611  nps,
612  eid,
613  startSample_,
614  endSample_,
616  htr);
617  } break;
618  case (HcalOuter): {
619  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
620  ptr_header = HcalUnpacker_impl::unpack_compact<HODataFrame>(ptr_header,
621  ptr_end,
622  colls.hoCont->back(),
623  nps,
624  eid,
625  startSample_,
626  endSample_,
628  htr);
629  } break;
630  case (HcalForward): {
631  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
632  ptr_header = HcalUnpacker_impl::unpack_compact<HFDataFrame>(ptr_header,
633  ptr_end,
634  colls.hfCont->back(),
635  nps,
636  eid,
637  startSample_,
638  endSample_,
640  htr);
641  } break;
642  case (HcalOther): {
643  HcalOtherDetId odid(did);
644  if (odid.subdet() == HcalCalibration) {
645  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
646  ptr_header = HcalUnpacker_impl::unpack_compact<HcalCalibDataFrame>(ptr_header,
647  ptr_end,
648  colls.calibCont->back(),
649  nps,
650  eid,
651  startSample_,
652  endSample_,
654  htr);
655  }
656  } break;
657  case (HcalEmpty):
658  default: {
659  for (ptr_header++; ptr_header != ptr_end && !HcalHTRData::is_channel_header(*ptr_header); ptr_header++)
660  ;
661  } break;
662  }
663  }
664  } else {
665  report.countUnmappedDigi(eid);
666  if (unknownIds_.find(eid) == unknownIds_.end()) {
667  if (!silent)
668  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
669  unknownIds_.insert(eid);
670  }
671  for (ptr_header++; ptr_header != ptr_end && !HcalHTRData::is_channel_header(*ptr_header); ptr_header++)
672  ;
673  }
674  }
675  }
676  }
677 }
678 
680  const HcalElectronicsMap& emap,
681  Collections& colls,
683  bool silent) {
684  const hcal::AMC13Header* amc13 = (const hcal::AMC13Header*)(raw.data());
685 
686  // how many AMC in this packet
687  int namc = amc13->NAMC();
688  for (int iamc = 0; iamc < namc; iamc++) {
689  // if not enabled, ignore
690  if (!amc13->AMCEnabled(iamc))
691  continue;
692 
693  if (!amc13->AMCDataPresent(iamc)) {
694  if (!silent)
695  edm::LogWarning("Invalid Data") << "Missing data observed on iamc " << iamc << " of AMC13 with source id "
696  << amc13->sourceId();
697  report.countSpigotFormatError();
698  continue;
699  }
700  if (!amc13->AMCCRCOk(iamc)) {
701  if (!silent)
702  edm::LogWarning("Invalid Data") << "CRC Error on uHTR data observed on iamc " << iamc
703  << " of AMC13 with source id " << amc13->sourceId();
704  report.countSpigotFormatError();
705  // continue;
706  }
707  // this unpacker cannot handle segmented data!
708  if (amc13->AMCSegmented(iamc)) {
709  if (!silent)
710  edm::LogWarning("Invalid Data") << "Unpacker cannot handle segmented data observed on iamc " << iamc
711  << " of AMC13 with source id " << amc13->sourceId();
712  report.countSpigotFormatError();
713  continue;
714  }
715 
716  // ok, now we're work-able
717  int slot = amc13->AMCSlot(iamc);
718  int crate = amc13->AMCId(iamc) & 0xFF;
719 
720  HcalUHTRData uhtr(amc13->AMCPayload(iamc), amc13->AMCSize(iamc));
721  //Check to make sure uMNio is not unpacked here
722  if (uhtr.getFormatVersion() != 1) {
723  unpackUMNio(raw, slot, colls);
724  continue;
725  }
726 #ifdef DebugLog
727  //debug printouts
728  int nwords = uhtr.getRawLengthBytes() / 2;
729  for (int iw = 0; iw < nwords; iw++)
730  printf("%04d %04x\n", iw, uhtr.getRawData16()[iw]);
731 #endif
732 
733  //use uhtr presamples since amc header not properly packed in simulation
734  int nps = uhtr.presamples();
735 
736  HcalUHTRData::const_iterator i = uhtr.begin(), iend = uhtr.end();
737  while (i != iend) {
738 #ifdef DebugLog
739  std::cout << "This data is flavored:" << i.flavor() << std::endl;
740 #endif
741 
742  if (!i.isHeader()) {
743  ++i;
744 #ifdef DebugLog
745  std::cout << "its not a header" << std::endl;
746 #endif
747  continue;
748  }
750  if (i.flavor() == 1 || i.flavor() == 0 || i.flavor() == 3) {
751  int ifiber = ((i.channelid() >> 3) & 0x1F);
752  int ichan = (i.channelid() & 0x7);
753  HcalElectronicsId eid(crate, slot, ifiber, ichan, false);
754  DetId did = emap.lookup(eid);
755  // Count from current position to next header, or equal to end
756  const uint16_t* head_pos = i.raw();
757  int ns = 0;
758  for (++i; i != iend && !i.isHeader(); ++i) {
759  ns++;
760  }
761  // Check QEI11 container exists
762  if (colls.qie11 == nullptr) {
763  colls.qie11 = new QIE11DigiCollection(ns);
764  } else if (colls.qie11->samples() != ns) {
765  // if this sample type hasn't been requested to be saved
766  // warn the user to provide a configuration that prompts it to be saved
767  if (colls.qie11Addtl.find(ns) == colls.qie11Addtl.end()) {
768  printInvalidDataMessage("QIE11", colls.qie11->samples(), ns, true);
769  }
770  }
771 
772  // Insert data
774  if (!did.null()) { // unpack and store...
775  // only fill the default collection if we have the correct number of samples
776  if (colls.qie11->samples() == ns) {
777  colls.qie11->addDataFrame(did, head_pos);
778  }
779  // fill the additional qie11 collections
780  if (colls.qie11Addtl.find(ns) != colls.qie11Addtl.end()) {
781  colls.qie11Addtl[ns]->addDataFrame(did, head_pos);
782  }
783  } else {
784  report.countUnmappedDigi(eid);
785  if (unknownIds_.find(eid) == unknownIds_.end()) {
786  if (!silent)
787  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
788  unknownIds_.insert(eid);
789 #ifdef DebugLog
790  std::cout << "HcalUnpacker: No match found for electronics id :" << eid << std::endl;
791 #endif
792  }
793 #ifdef DebugLog
794  std::cout << "OH NO! detector id is null!" << std::endl;
795 #endif
796  }
797  } else if (i.flavor() == 2) {
799 
800  int ifiber = ((i.channelid() >> 3) & 0x1F);
801  int ichan = (i.channelid() & 0x7);
802  HcalElectronicsId eid(crate, slot, ifiber, ichan, false);
803  DetId did = emap.lookup(eid);
804 
805  // Count from current position to next header, or equal to end
806  const uint16_t* head_pos = i.raw();
807  int ns = 0;
808  for (++i; i != iend && !i.isHeader(); ++i) {
809  ns++;
810  }
811 
812  bool isZDC = (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId);
813  bool isLasmon = (did.det() == DetId::Hcal && (HcalSubdetector)did.subdetId() == HcalOther &&
814  HcalCalibDetId(did).calibFlavor() == 5);
815 
816  if (isZDC) {
817  if (colls.qie10ZDC == nullptr) {
818  colls.qie10ZDC = new QIE10DigiCollection(ns);
819  } else if (colls.qie10ZDC->samples() != ns) {
820  printInvalidDataMessage("QIE10ZDC", colls.qie10ZDC->samples(), ns, false);
821  }
822  } else if (isLasmon) {
823  if (colls.qie10Lasermon == nullptr) {
824  colls.qie10Lasermon = new QIE10DigiCollection(ns);
825  } else if (colls.qie10Lasermon->samples() != ns) {
826  printInvalidDataMessage("QIE10LASMON", colls.qie10Lasermon->samples(), ns, false);
827  }
828  } else { // these are the default qie10 channels
829  if (colls.qie10 == nullptr) {
830  colls.qie10 = new QIE10DigiCollection(ns);
831  } else if (colls.qie10->samples() != ns) {
832  // if this sample type hasn't been requested to be saved
833  // warn the user to provide a configuration that prompts it to be saved
834  if (colls.qie10Addtl.find(ns) == colls.qie10Addtl.end()) {
835  printInvalidDataMessage("QIE10", colls.qie10->samples(), ns, true);
836  }
837  }
838  }
839 
840  // Insert data
842  if (!did.null()) { // unpack and store...
843  // fill the additional qie10 collections
844  if (isZDC)
845  colls.qie10ZDC->addDataFrame(did, head_pos);
846  else if (isLasmon)
847  colls.qie10Lasermon->addDataFrame(did, head_pos);
848  else {
849  // only fill the default collection if we have the correct number of samples
850  if (colls.qie10->samples() == ns) {
851  colls.qie10->addDataFrame(did, head_pos);
852  }
853 
854  // fill the additional qie10 collections
855  if (colls.qie10Addtl.find(ns) != colls.qie10Addtl.end()) {
856  colls.qie10Addtl[ns]->addDataFrame(did, head_pos);
857  }
858  }
859  } else {
860  report.countUnmappedDigi(eid);
861  if (unknownIds_.find(eid) == unknownIds_.end()) {
862  if (!silent)
863  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
864  unknownIds_.insert(eid);
865 #ifdef DebugLog
866  std::cout << "HcalUnpacker: No match found for electronics id :" << eid << std::endl;
867 #endif
868  }
869 #ifdef DebugLog
870  std::cout << "OH NO! HcalUnpacker: No match found for electronics id :" << eid << std::endl;
871 #endif
872  }
873  } else if (i.flavor() == 5 || (i.flavor() == 7 && i.technicalDataType() == 15)) { // Old-style digis
874  int ifiber = ((i.channelid() >> 2) & 0x1F);
875  int ichan = (i.channelid() & 0x3);
876  HcalElectronicsId eid(crate, slot, ifiber, ichan, false);
877  DetId did = emap.lookup(eid);
878 
879  if (!did.null()) { // unpack and store...
880  if (did.det() == DetId::Calo && did.subdetId() == HcalZDCDetId::SubdetectorId) {
881  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
882  HcalUnpacker_impl::unpack_compact<ZDCDataFrame>(
883  i, iend, colls.zdcCont->back(), nps, eid, startSample_, endSample_);
884  } else if (did.det() == DetId::Hcal) {
885  switch (((HcalSubdetector)did.subdetId())) {
886  case (HcalBarrel):
887  case (HcalEndcap): {
888  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
889  HcalUnpacker_impl::unpack_compact<HBHEDataFrame>(
890  i, iend, colls.hbheCont->back(), nps, eid, startSample_, endSample_);
891  } break;
892  case (HcalOuter): {
893  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
894  HcalUnpacker_impl::unpack_compact<HODataFrame>(
895  i, iend, colls.hoCont->back(), nps, eid, startSample_, endSample_);
896  } break;
897  case (HcalForward): {
898  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
899  HcalUnpacker_impl::unpack_compact<HFDataFrame>(
900  i, iend, colls.hfCont->back(), nps, eid, startSample_, endSample_);
901  } break;
902  case (HcalOther): {
903  HcalOtherDetId odid(did);
904  if (odid.subdet() == HcalCalibration) {
905  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
906  HcalUnpacker_impl::unpack_compact<HcalCalibDataFrame>(
907  i, iend, colls.calibCont->back(), nps, eid, startSample_, endSample_);
908  }
909  } break;
910  case (HcalEmpty):
911  default: {
912  for (++i; i != iend && !i.isHeader(); ++i)
913  ;
914  } break;
915  }
916  }
917  } else {
918  report.countUnmappedDigi(eid);
919  if (unknownIds_.find(eid) == unknownIds_.end()) {
920  if (!silent)
921  edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
922  unknownIds_.insert(eid);
923  }
924  for (++i; i != iend && !i.isHeader(); ++i)
925  ;
926  }
927  } else if (i.flavor() == 0x4) { // TP digis
928  int ilink = ((i.channelid() >> 4) & 0xF);
929  int itower = (i.channelid() & 0xF);
930  HcalElectronicsId eid(crate, slot, ilink, itower, true);
931  DetId did = emap.lookupTrigger(eid);
932 #ifdef DebugLog
933  std::cout << "Unpacking " << eid << " " << i.channelid() << std::endl;
934 #endif
935  if (did.null()) {
936  report.countUnmappedTPDigi(eid);
937  if (unknownIdsTrig_.find(eid) == unknownIdsTrig_.end()) {
938  if (!silent)
939  edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
940  unknownIdsTrig_.insert(eid);
941  }
942  // Skip it
943  for (++i; i != iend && !i.isHeader(); ++i)
944  ;
945  } else if (did == HcalTrigTowerDetId::Undefined || (did.det() == DetId::Hcal && did.subdetId() == 0)) {
946  for (++i; i != iend && !i.isHeader(); ++i)
947  ;
948  } else {
949  HcalTrigTowerDetId id(did);
950 #ifdef DebugLog
951  std::cout << "Unpacking " << id << std::endl;
952 #endif
953  colls.tpCont->push_back(HcalTriggerPrimitiveDigi(id));
954  int j = 0;
955  for (++i; i != iend && !i.isHeader(); ++i) {
956  colls.tpCont->back().setSample(j, i.value());
957  if (i.soi())
958  colls.tpCont->back().setPresamples(j);
959  j++;
960  }
961  colls.tpCont->back().setSize(j);
962  }
963  } else {
964  // consume any not-understood channel data
965  for (++i; i != iend && !i.isHeader(); ++i)
966  ;
967  }
968  }
969  }
970 }
971 
973  hbheCont = nullptr;
974  hoCont = nullptr;
975  hfCont = nullptr;
976  tpCont = nullptr;
977  zdcCont = nullptr;
978  calibCont = nullptr;
979  ttp = nullptr;
980  qie10 = nullptr;
981  qie10ZDC = nullptr;
982  qie10Lasermon = nullptr;
983  qie11 = nullptr;
984  umnio = nullptr;
985 }
986 
988  const HcalElectronicsMap& emap,
989  std::vector<HcalHistogramDigi>& histoDigis) {
990  // get the DCC header
991  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
992  int dccid = dccHeader->getSourceId() - sourceIdOffset_;
993 
994  // check the summary status
995 
996  // walk through the HTR data...
997  HcalHTRData htr;
998  for (int spigot = 0; spigot < HcalDCCHeader::SPIGOT_COUNT; spigot++) {
999  if (!dccHeader->getSpigotPresent(spigot))
1000  continue;
1001 
1002  int retval = dccHeader->getSpigotData(spigot, htr, raw.size());
1003  // check
1004  if (retval || !htr.check()) {
1005  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id "
1006  << dccHeader->getSourceId();
1007  continue;
1008  }
1009  if (!htr.isHistogramEvent()) {
1010  edm::LogWarning("Invalid Data") << "Non-histogram data passed to histogram unpacker on spigot " << spigot
1011  << " of DCC with source id " << dccHeader->getSourceId();
1012  continue;
1013  }
1014 
1015  unsigned int smid = htr.getSubmodule();
1016  int htr_tb = smid & 0x1;
1017  int htr_slot = (smid >> 1) & 0x1F;
1018  int htr_cr = (smid >> 6) & 0x1F;
1019 
1020  // find out the fibers
1021  int f[2], fc;
1022  htr.getHistogramFibers(f[0], f[1]);
1023 
1024  for (int nf = 0; nf < 2; nf++) {
1025  if (f[nf] < 0 || (nf == 1 && f[0] == f[1]))
1026  continue; // skip if invalid or the same
1027  for (fc = 0; fc <= 2; fc++) {
1028  HcalElectronicsId eid(fc, f[nf], spigot, dccid);
1029  eid.setHTR(htr_cr, htr_slot, htr_tb);
1030  DetId did = emap.lookup(eid);
1031 
1032  if (did.null() || did.det() != DetId::Hcal || did.subdetId() == 0) {
1033  if (unknownIds_.find(eid) == unknownIds_.end()) {
1034  edm::LogWarning("HCAL") << "HcalHistogramUnpacker: No match found for electronics id :" << eid;
1035  unknownIds_.insert(eid);
1036  }
1037  continue;
1038  }
1039  histoDigis.push_back(HcalHistogramDigi(HcalDetId(did))); // add it!
1040  HcalHistogramDigi& digi = histoDigis.back();
1041 
1042  // unpack the four capids
1043  for (int capid = 0; capid < 4; capid++)
1044  htr.unpackHistogram(f[nf], fc, capid, digi.getArray(capid));
1045  }
1046  }
1047  }
1048 }
1049 // Method to unpack uMNio data
1050 void HcalUnpacker::unpackUMNio(const FEDRawData& raw, int slot, Collections& colls) {
1051  const hcal::AMC13Header* amc13 = (const hcal::AMC13Header*)(raw.data());
1052  int namc = amc13->NAMC();
1053  //Find AMC corresponding to uMNio slot
1054  for (int iamc = 0; iamc < namc; iamc++) {
1055  if (amc13->AMCSlot(iamc) == slot)
1056  namc = iamc;
1057  }
1058  if (namc == amc13->NAMC()) {
1059  return;
1060  }
1061  const uint16_t* data = (const uint16_t*)(amc13->AMCPayload(namc));
1062  size_t nwords = amc13->AMCSize(namc) * (sizeof(uint64_t) / sizeof(uint16_t));
1063  *(colls.umnio) = HcalUMNioDigi(data, nwords);
1064 }
1065 
1067  int default_ns,
1068  int conflict_ns,
1069  bool extended) {
1070  nPrinted_++;
1071 
1072  constexpr int limit = 2; //print up to limit-1 messages
1073  if (nPrinted_ >= limit) {
1074  if (nPrinted_ == limit)
1075  edm::LogInfo("Invalid Data") << "Suppressing further error messages";
1076 
1077  return;
1078  }
1079 
1080  std::stringstream message;
1081 
1082  message << "The default " << coll_type << " Collection has " << default_ns
1083  << " samples per digi, while the current data has " << conflict_ns
1084  << "! This data cannot be included with the default collection.";
1085 
1086  if (extended) {
1087  message << "\nIn order to store this data in the event, it must have a unique tag. "
1088  << "To accomplish this, provide two lists to HcalRawToDigi \n"
1089  << "1) that specifies the number of samples and "
1090  << "2) that gives tags with which these data are saved.\n"
1091  << "For example in this case you might add \n"
1092  << "process.hcalDigis.save" << coll_type << "DataNSamples = cms.untracked.vint32( " << conflict_ns
1093  << ") \nprocess.hcalDigis.save" << coll_type << "DataTags = cms.untracked.vstring( \"MYDATA\" )";
1094  }
1095 
1096  edm::LogWarning("Invalid Data") << message.str();
1097 }
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:409
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:88
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&Pass ZS?
Definition: HcalHTRData.cc:379
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:83
int getSourceId() const
Definition: HcalDTCHeader.h:35
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:85
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:84
static int slbAndChan(uint16_t theSample)
void unpackUTCA(const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
std::vector< HcalTTPDigi > * ttp
Definition: HcalUnpacker.h:32
constexpr int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:55
std::vector< HFDataFrame > * hfCont
Definition: HcalUnpacker.h:27
constexpr int fiberAndChan() const
get the id channel
Definition: HcalQIESample.h:57
HcalUMNioDigi * umnio
Definition: HcalUnpacker.h:40
void addDataFrame(DetId detid, const uint16_t *data)
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
static bool isTPGSOI(const HcalTriggerPrimitiveSample &s)
int getNPS() const
Get the number of presamples in daq data.
Definition: HcalHTRData.cc:426
QIE10DigiCollection * qie10Lasermon
Definition: HcalUnpacker.h:35
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
const unsigned short * unpack_compact(const unsigned short *startPoint, const unsigned short *limit, DigiClass &digi, int presamples, const HcalElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)
Definition: HcalUnpacker.cc:58
bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned short *histogram) const
Unpack special histogramming mode data.
Definition: HcalHTRData.cc:464
std::vector< HBHEDataFrame > * hbheCont
Definition: HcalUnpacker.h:25
std::vector< HOTriggerPrimitiveDigi > * tphoCont
Definition: HcalUnpacker.h:31
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:400
static bool unpack_per_channel_header(unsigned short, int &flav, int &error_flags, int &capid0, int &channelid)
Unpack a per-channel header word (compact format)
Definition: HcalHTRData.cc:455
std::unordered_map< int, QIE11DigiCollection * > qie11Addtl
Definition: HcalUnpacker.h:39
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
int getFirmwareFlavor() const
Get the HTR firmware flavor.
Definition: HcalHTRData.cc:433
bool isOverflowWarning() const
Definition: HcalHTRData.cc:115
void printInvalidDataMessage(const std::string &coll_type, int default_ns, int conflict_ns, bool extended=false)
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
void dataPointers(const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const
Obtain the starting and ending pointers for external unpacking of the data.
Definition: HcalHTRData.cc:161
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
uint16_t raw() const
get the raw word
static bool is_channel_header(unsigned short value)
check top bit to see if this is a compact format channel header word
Definition: HcalHTRData.h:92
std::unordered_map< int, QIE10DigiCollection * > qie10Addtl
Definition: HcalUnpacker.h:38
QIE10DigiCollection * qie10ZDC
Definition: HcalUnpacker.h:34
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:86
int getSourceId() const
Definition: HcalDCCHeader.h:32
int getFormatVersion() const
Get the version number of this event.
Definition: HcalHTRData.h:36
bool wasMarkAndPassZSTP(int slb, int slbchan) const
Was this channel passed as part of Mark&Pass ZS?
Definition: HcalHTRData.cc:389
HcalSubdetector
Definition: HcalAssistant.h:31
void unpackVME(const FEDRawData &raw, const HcalElectronicsMap &emap, Collections &conts, HcalUnpackerReport &report, bool silent=false)
bool getSlotCRCError(unsigned int nslot) const
Read the "CRC-Mismatch" bit for this slot.
Definition: HcalDTCHeader.h:93
double f[11][100]
std::vector< HcalTriggerPrimitiveDigi > * tpCont
Definition: HcalUnpacker.h:30
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
bool getSlotPresent(unsigned int nslot) const
Read the "PRESENT" bit for this slot.
Definition: HcalDTCHeader.h:85
void getHistogramFibers(int &a, int &b) const
Get the fiber numbers for the data present in this event (only in histogram mode!) ...
Definition: HcalHTRData.cc:435
std::set< HcalElectronicsId > unknownIdsTrig_
Recorded to limit number of times a log message is generated.
Definition: HcalUnpacker.h:88
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
Log< level::Info, false > LogInfo
short getDCCDataFormatVersion() const
Definition: HcalDCCHeader.h:59
unsigned int databits
Definition: DetId.h:17
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
std::vector< HcalCalibDataFrame > * calibCont
Definition: HcalUnpacker.h:28
constexpr uint16_t raw() const
get the raw word
Definition: HcalQIESample.h:41
static int slb(uint16_t theSample)
unsigned long long uint64_t
Definition: Time.h:13
bool getSpigotCRCError(unsigned int nspigot) const
Read the "CRC-Mismatch" bit for this spigot.
constexpr int fiber() const
get the fiber number
Definition: HcalQIESample.h:53
bool unpack(const HcalHTRData &data, HcalTTPDigi &digi)
bool isBusy() const
Definition: HcalHTRData.cc:123
std::vector< HODataFrame > * hoCont
Definition: HcalUnpacker.h:26
QIE11DigiCollection * qie11
Definition: HcalUnpacker.h:36
void setbit(int i)
CalibDetType calibFlavor() const
get the flavor of this calibration detid
static const HcalTrigTowerDetId Undefined
static const int FORMAT_VERSION_COMPACT_DATA
Definition: HcalHTRData.h:20
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:19
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
uint16_t * getArray(int capid)
get the array for the specified capid
QIE10DigiCollection * qie10
Definition: HcalUnpacker.h:33
std::vector< ZDCDataFrame > * zdcCont
Definition: HcalUnpacker.h:29
bool getSpigotPresent(unsigned int nspigot) const
Read the "PRESENT" bit for this spigot.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:180
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:355
int getSlotData(int nslot, HcalHTRData &decodeTool, int validSize) const
bool isEmptyEvent() const
Definition: HcalHTRData.cc:107
float linear(float x)
void unpackUMNio(const FEDRawData &raw, int slot, Collections &colls)
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Log< level::Warning, false > LogWarning
short BOEshouldBeZeroAlways() const
Definition: HcalDCCHeader.h:50
Readout chain identification for Hcal.
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:63
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
HcalOtherSubdetector subdet() const
get the category
static const int MAXIMUM_SLOT
Definition: HcalDTCHeader.h:22
const HcalQIESample * unpack(const HcalQIESample *startPoint, const HcalQIESample *limit, DigiClass &digi, int presamples, const HcalElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)
Definition: HcalUnpacker.cc:16
static int slbChan(uint16_t theSample)
#define LogDebug(id)
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378