CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalUnpacker.cc
Go to the documentation of this file.
8 
9 namespace HcalUnpacker_impl {
10  template <class DigiClass>
11  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) {
12  // set parameters
13  digi.setPresamples(presamples);
14  digi.setReadoutIds(eid);
15 
16  int fiber=startPoint->fiber();
17  int fiberchan=startPoint->fiberChan();
18  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
19  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
20 
21  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
22  // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
23  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
24  }
25 
26  // what is my sample number?
27  int myFiberChan=startPoint->fiberAndChan();
28  int ncurr=0,ntaken=0;
29  const HcalQIESample* qie_work=startPoint;
30  while (qie_work!=limit && qie_work->fiberAndChan()==myFiberChan) {
31  if (ncurr>=startSample && ncurr<=endSample) {
32  digi.setSample(ntaken,*qie_work);
33  ++ntaken;
34  }
35  ncurr++;
36  qie_work++;
37  }
38  digi.setSize(ntaken);
39  return qie_work;
40  }
41 
42 
43  template <class DigiClass>
44  const unsigned short* unpack_compact(const unsigned short* startPoint, const unsigned short* limit, DigiClass& digi,
45  int presamples, const HcalElectronicsId& eid, int startSample, int endSample, int expectedTime, const HcalHTRData& hhd) {
46  // set parameters
47  digi.setPresamples(presamples);
48  digi.setReadoutIds(eid);
49  int flavor, error_flags, capid0, channelid;
50 
51  HcalHTRData::unpack_per_channel_header(*startPoint,flavor,error_flags,capid0,channelid);
52  bool isCapRotating=!(error_flags&0x1);
53  bool fiberErr=(error_flags&0x2);
54  bool dataValid=!(error_flags&0x2);
55  int fiberchan=channelid&0x3;
56  int fiber=((channelid>>2)&0x7)+1;
57 
58  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
59  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
60 
61  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
62  // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
63  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
64  }
65 
66  // what is my sample number?
67  int ncurr=0,ntaken=0;
68  const unsigned short* qie_work=startPoint;
69  for (qie_work++; qie_work!=limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
70  int capidn=(isCapRotating)?((capid0+ncurr)%4):(capid0);
71  int capidn1=(isCapRotating)?((capid0+ncurr+1)%4):(capid0);
72  // two samples in one...
73  HcalQIESample s0((*qie_work)&0x7F,capidn,fiber,fiberchan,dataValid,fiberErr);
74  HcalQIESample s1(((*qie_work)>>8)&0x7F,capidn1,fiber,fiberchan,dataValid,fiberErr);
75 
76  if (ncurr>=startSample && ncurr<=endSample) {
77  digi.setSample(ntaken,s0);
78  ++ntaken;
79  }
80  ncurr++;
81  if (ncurr>=startSample && ncurr<=endSample) {
82  digi.setSample(ntaken,s1);
83  ++ntaken;
84  }
85  ncurr++;
86  }
87  digi.setSize(ntaken);
88  return qie_work;
89  }
90 
91 }
92 
93 static inline bool isTPGSOI(const HcalTriggerPrimitiveSample& s) {
94  return (s.raw()&0x200)!=0;
95 }
96 
97 
98 struct HOUnrolledTP { // parts of an HO trigger primitive, unpacked
99  bool valid, checked;
101  unsigned int databits;
103  valid=false;
104  checked=false;
105  ieta=0;
106  iphi=0;
107  samples=0;
108  soi=0;
109  databits=0;
110  }
111  void setbit(int i) { databits|=(1<<i); }
112 };
113 
115  Collections& colls, HcalUnpackerReport& report, bool silent) {
116 
117  if (raw.size()<16) {
118  if (!silent) edm::LogWarning("Invalid Data") << "Empty/invalid DCC data, size = " << raw.size();
119  return;
120  }
121 
122  // get the DCC header
123  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
124  int dccid=dccHeader->getSourceId()-sourceIdOffset_;
125 
126  // check the summary status
127 
128  // walk through the HTR data...
129  HcalHTRData htr;
130  const unsigned short* daq_first, *daq_last, *tp_first, *tp_last;
131  const HcalQIESample* qie_begin, *qie_end, *qie_work;
132  const HcalTriggerPrimitiveSample *tp_begin, *tp_end, *tp_work;
133  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
134  if (!dccHeader->getSpigotPresent(spigot)) continue;
135 
136  int retval=dccHeader->getSpigotData(spigot,htr,raw.size());
137  if (retval!=0) {
138  if (retval==-1) {
139  if (!silent) edm::LogWarning("Invalid Data") << "Invalid HTR data (data beyond payload size) observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
140  report.countSpigotFormatError();
141  }
142  continue;
143  }
144  // check
145  if (dccHeader->getSpigotCRCError(spigot)) {
146  if (!silent)
147  edm::LogWarning("Invalid Data") << "CRC Error on HTR data observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
148  report.countSpigotFormatError();
149  continue;
150  }
151  // check for EE
152  if (htr.isEmptyEvent()) {
153  report.countEmptyEventSpigot();
154  }
155  if (htr.isOverflowWarning()) {
156  report.countOFWSpigot();
157  }
158  if (htr.isBusy()) {
159  report.countBusySpigot();
160  }
161  if (!htr.check()) {
162  if (!silent)
163  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
164  report.countSpigotFormatError();
165  continue;
166  }
167  if (htr.isHistogramEvent()) {
168  if (!silent) edm::LogWarning("Invalid Data") << "Histogram data passed to non-histogram unpacker on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
169  continue;
170  }
171  if ((htr.getFirmwareFlavor()&0xE0)==0x80) { // some kind of TTP data
172  if (colls.ttp!=0) {
173  HcalTTPUnpacker ttpUnpack;
174  colls.ttp->push_back(HcalTTPDigi());
175  ttpUnpack.unpack(htr,colls.ttp->back());
176  } else {
177  LogDebug("HcalTechTrigProcessor") << "Skipping data on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId() << " which is from the TechTrigProcessor (use separate unpacker!)";
178  }
179  continue;
180  }
181  if (htr.getFirmwareFlavor()>=0x80) {
182  if (!silent) edm::LogWarning("HcalUnpacker") << "Skipping data on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId() << " which is of unknown flavor " << htr.getFirmwareFlavor();
183  continue;
184  }
185 
186  // calculate "real" number of presamples
187  int nps=htr.getNPS()-startSample_;
188 
189  // get pointers
190  htr.dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
191  unsigned int smid=htr.getSubmodule();
192  int htr_tb=smid&0x1;
193  int htr_slot=(smid>>1)&0x1F;
194  int htr_cr=(smid>>6)&0x1F;
195 
196  tp_begin=(HcalTriggerPrimitiveSample*)tp_first;
197  tp_end=(HcalTriggerPrimitiveSample*)(tp_last+1); // one beyond last..
198 
200  int currFiberChan=0x3F; // invalid fiber+channel...
201  int ncurr=0;
202  bool valid=false;
203 
204  bool tpgSOIbitInUse=htr.getFormatVersion()>=3; // version 3 and later
205  bool isHOtpg=htr.getFormatVersion()>=3 && htr.getFirmwareFlavor()==0; // HO is flavor zero
206  int npre=0;
207  /*
208  Unpack the trigger primitives
209  */
210  if (isHOtpg) {
211  HOUnrolledTP unrolled[24];
212  for (tp_work=tp_begin; tp_work!=tp_end; tp_work++) {
213  if (tp_work->raw()==0xFFFF) continue; // filler word
214  int sector=tp_work->slbChan();
215  if (sector>2) continue;
216 
217  for (int ibit=0; ibit<8; ibit++) {
218  int linear=sector*8+ibit;
219  if (!unrolled[linear].checked) {
220  unrolled[linear].checked=true;
221  int fiber=(linear/3)+1;
222  int fc=(linear%3);
223  // electronics id (use precision match for HO TP)
224  HcalElectronicsId eid(fc,fiber,spigot,dccid);
225  eid.setHTR(htr_cr,htr_slot,htr_tb);
226  DetId did=emap.lookup(eid);
227  if (!did.null()) {
228  if (did.det()==DetId::Hcal && ((HcalSubdetector)did.subdetId())==HcalOuter ) {
229  HcalDetId hid(did);
230  unrolled[linear].valid=true;
231  unrolled[linear].ieta=hid.ieta();
232  unrolled[linear].iphi=hid.iphi();
233  }
234  } else {
235  report.countUnmappedTPDigi(eid);
236  }
237  }
238  if (unrolled[linear].valid) {
239  if (isTPGSOI(*tp_work)) unrolled[linear].soi=unrolled[linear].samples;
240  if (tp_work->raw()&(1<<ibit)) unrolled[linear].setbit(unrolled[linear].samples);
241  unrolled[linear].samples++;
242  }
243  }
244  }
245  for (int i=0; i<24; i++) {
246  if (unrolled[i].valid)
247  colls.tphoCont->push_back(HOTriggerPrimitiveDigi(
248  unrolled[i].ieta,
249  unrolled[i].iphi,
250  unrolled[i].samples,
251  unrolled[i].soi,
252  unrolled[i].databits));
253  }
254  } else { // regular TPs (not HO)
255  for (tp_work=tp_begin; tp_work!=tp_end; tp_work++) {
256  if (tp_work->raw()==0xFFFF) continue; // filler word
257  if (tp_work->slbAndChan()!=currFiberChan) { // start new set
258  npre=0;
259  currFiberChan=tp_work->slbAndChan();
260  // lookup the right channel
261  HcalElectronicsId eid(tp_work->slbChan(),tp_work->slb(),spigot,dccid,htr_cr,htr_slot,htr_tb);
262  DetId did=emap.lookupTrigger(eid);
263  if (did.null()) {
264  report.countUnmappedTPDigi(eid);
265  if (unknownIdsTrig_.find(eid)==unknownIdsTrig_.end()) {
266  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
267  unknownIdsTrig_.insert(eid);
268  }
269  valid=false;
270  continue;
271  } else if (did==HcalTrigTowerDetId::Undefined ||
272  (did.det()==DetId::Hcal && did.subdetId()==0)) {
273  // known to be unmapped
274  valid=false;
275  continue;
276  }
277  HcalTrigTowerDetId id(did);
278  colls.tpCont->push_back(HcalTriggerPrimitiveDigi(id));
279  // set the various bits
280  if (!tpgSOIbitInUse) colls.tpCont->back().setPresamples(nps);
281  colls.tpCont->back().setZSInfo(htr.isUnsuppressed(),htr.wasMarkAndPassZSTP(tp_work->slb(),tp_work->slbChan()));
282 
283  // no hits recorded for current
284  ncurr=0;
285  valid=true;
286  }
287  // add the word (if within settings or recent firmware [recent firmware ignores startSample/endSample])
288  if (valid && ((tpgSOIbitInUse && ncurr<10) || (ncurr>=startSample_ && ncurr<=endSample_))) {
289  colls.tpCont->back().setSample(colls.tpCont->back().size(),*tp_work);
290  colls.tpCont->back().setSize(colls.tpCont->back().size()+1);
291  }
292  // set presamples,if SOI
293  if (valid && tpgSOIbitInUse && isTPGSOI(*tp_work)) {
294  colls.tpCont->back().setPresamples(ncurr);
295  }
296  ncurr++;
297  npre++;
298  }
299  }
300 
303 
304  qie_begin=(HcalQIESample*)daq_first;
305  qie_end=(HcalQIESample*)(daq_last+1); // one beyond last..
306 
308  currFiberChan=0x3F; // invalid fiber+channel...
309  ncurr=0;
310  valid=false;
311 
312 
313  for (qie_work=qie_begin; qie_work!=qie_end; ) {
314  if (qie_work->raw()==0xFFFF) {
315  qie_work++;
316  continue; // filler word
317  }
318  // always at the beginning ...
319  currFiberChan=qie_work->fiberAndChan();
320 
321  // lookup the right channel
322  HcalElectronicsId eid(qie_work->fiberChan(),qie_work->fiber(),spigot,dccid);
323  eid.setHTR(htr_cr,htr_slot,htr_tb);
324  DetId did=emap.lookup(eid);
325 
326  if (!did.null()) {
327  if (did.det()==DetId::Calo && did.subdetId()==HcalZDCDetId::SubdetectorId) {
328  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
329  qie_work=HcalUnpacker_impl::unpack<ZDCDataFrame>(qie_work, qie_end, colls.zdcCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
330  } else if (did.det()==DetId::Hcal) {
331  switch (((HcalSubdetector)did.subdetId())) {
332  case (HcalBarrel):
333  case (HcalEndcap): {
334  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
335  qie_work=HcalUnpacker_impl::unpack<HBHEDataFrame>(qie_work, qie_end, colls.hbheCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
336  } break;
337  case (HcalOuter): {
338  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
339  qie_work=HcalUnpacker_impl::unpack<HODataFrame>(qie_work, qie_end, colls.hoCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
340  } break;
341  case (HcalForward): {
342  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
343  qie_work=HcalUnpacker_impl::unpack<HFDataFrame>(qie_work, qie_end, colls.hfCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
344  } break;
345  case (HcalOther) : {
346  HcalOtherDetId odid(did);
347  if (odid.subdet()==HcalCalibration) {
348  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
349  qie_work=HcalUnpacker_impl::unpack<HcalCalibDataFrame>(qie_work, qie_end, colls.calibCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
350  }
351  } break;
352  case (HcalEmpty):
353  default: {
354  for (int fiberC=qie_work->fiberAndChan();
355  qie_work!=qie_end && qie_work->fiberAndChan()==fiberC;
356  qie_work++);
357  }
358  break;
359  }
360  }
361  } else {
362  report.countUnmappedDigi(eid);
363  if (unknownIds_.find(eid)==unknownIds_.end()) {
364  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
365  unknownIds_.insert(eid);
366  }
367  for (int fiberC=qie_work->fiberAndChan();
368  qie_work!=qie_end && qie_work->fiberAndChan()==fiberC;
369  qie_work++);
370  }
371  }
372  } else {
373  // this is the branch for unpacking the compact data format with per-channel headers
374  const unsigned short* ptr_header=daq_first;
375  const unsigned short* ptr_end=daq_last+1;
376  int flavor, error_flags, capid0, channelid;
377 
378  while (ptr_header!=ptr_end) {
379  if (*ptr_header==0xFFFF) { // impossible filler word
380  ptr_header++;
381  continue;
382  }
383  // unpack the header word
384  bool isheader=HcalHTRData::unpack_per_channel_header(*ptr_header,flavor,error_flags,capid0,channelid);
385  if (!isheader) {
386  ptr_header++;
387  continue;
388  }
389 
390  int fiberchan=channelid&0x3;
391  int fiber=((channelid>>2)&0x7)+1;
392 
393  // lookup the right channel
394  HcalElectronicsId eid(fiberchan,fiber,spigot,dccid);
395  eid.setHTR(htr_cr,htr_slot,htr_tb);
396  DetId did=emap.lookup(eid);
397 
398  if (!did.null()) {
399  if (did.det()==DetId::Calo && did.subdetId()==HcalZDCDetId::SubdetectorId) {
400  colls.zdcCont->push_back(ZDCDataFrame(HcalZDCDetId(did)));
401  ptr_header=HcalUnpacker_impl::unpack_compact<ZDCDataFrame>(ptr_header, ptr_end, colls.zdcCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
402  } else if (did.det()==DetId::Hcal) {
403  switch (((HcalSubdetector)did.subdetId())) {
404  case (HcalBarrel):
405  case (HcalEndcap): {
406  colls.hbheCont->push_back(HBHEDataFrame(HcalDetId(did)));
407  ptr_header=HcalUnpacker_impl::unpack_compact<HBHEDataFrame>(ptr_header, ptr_end, colls.hbheCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
408  } break;
409  case (HcalOuter): {
410  colls.hoCont->push_back(HODataFrame(HcalDetId(did)));
411  ptr_header=HcalUnpacker_impl::unpack_compact<HODataFrame>(ptr_header, ptr_end, colls.hoCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
412  } break;
413  case (HcalForward): {
414  colls.hfCont->push_back(HFDataFrame(HcalDetId(did)));
415  ptr_header=HcalUnpacker_impl::unpack_compact<HFDataFrame>(ptr_header, ptr_end, colls.hfCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
416  } break;
417  case (HcalOther) : {
418  HcalOtherDetId odid(did);
419  if (odid.subdet()==HcalCalibration) {
420  colls.calibCont->push_back(HcalCalibDataFrame(HcalCalibDetId(did)));
421  ptr_header=HcalUnpacker_impl::unpack_compact<HcalCalibDataFrame>(ptr_header, ptr_end, colls.calibCont->back(), nps, eid, startSample_, endSample_, expectedOrbitMessageTime_, htr);
422  }
423  } break;
424  case (HcalEmpty):
425  default: {
426  for (ptr_header++;
427  ptr_header!=ptr_end && !HcalHTRData::is_channel_header(*ptr_header);
428  ptr_header++);
429  }
430  break;
431  }
432  }
433  } else {
434  report.countUnmappedDigi(eid);
435  if (unknownIds_.find(eid)==unknownIds_.end()) {
436  if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No match found for electronics id :" << eid;
437  unknownIds_.insert(eid);
438  }
439  for (ptr_header++;
440  ptr_header!=ptr_end && !HcalHTRData::is_channel_header(*ptr_header);
441  ptr_header++);
442  }
443  }
444 
445  }
446  }
447 }
448 
450  hbheCont=0;
451  hoCont=0;
452  hfCont=0;
453  tpCont=0;
454  zdcCont=0;
455  calibCont=0;
456  ttp=0;
457 }
458 
459 void HcalUnpacker::unpack(const FEDRawData& raw, const HcalElectronicsMap& emap, std::vector<HBHEDataFrame>& container, std::vector<HcalTriggerPrimitiveDigi>& tp) {
460  Collections c;
461  c.hbheCont=&container;
462  c.tpCont=&tp;
464  unpack(raw,emap,c,r);
465 }
466 
467 void HcalUnpacker::unpack(const FEDRawData& raw, const HcalElectronicsMap& emap, std::vector<HODataFrame>& container, std::vector<HcalTriggerPrimitiveDigi>& tp) {
468  Collections c;
469  c.hoCont=&container;
470  c.tpCont=&tp;
472  unpack(raw,emap,c,r);
473 }
474 
475 void HcalUnpacker::unpack(const FEDRawData& raw, const HcalElectronicsMap& emap, std::vector<HFDataFrame>& container, std::vector<HcalTriggerPrimitiveDigi>& tp) {
476  Collections c;
477  c.hfCont=&container;
478  c.tpCont=&tp;
480  unpack(raw,emap,c,r);
481 }
482 
483 void HcalUnpacker::unpack(const FEDRawData& raw, const HcalElectronicsMap& emap, std::vector<HcalHistogramDigi>& histoDigis) {
484 
485  // get the DCC header
486  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
487  int dccid=dccHeader->getSourceId()-sourceIdOffset_;
488 
489  // check the summary status
490 
491  // walk through the HTR data...
492  HcalHTRData htr;
493  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
494  if (!dccHeader->getSpigotPresent(spigot)) continue;
495 
496  int retval=dccHeader->getSpigotData(spigot,htr,raw.size());
497  // check
498  if (retval || !htr.check()) {
499  edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
500  continue;
501  }
502  if (!htr.isHistogramEvent()) {
503  edm::LogWarning("Invalid Data") << "Non-histogram data passed to histogram unpacker on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId();
504  continue;
505  }
506 
507  unsigned int smid=htr.getSubmodule();
508  int htr_tb=smid&0x1;
509  int htr_slot=(smid>>1)&0x1F;
510  int htr_cr=(smid>>6)&0x1F;
511 
512  // find out the fibers
513  int f[2],fc;
514  htr.getHistogramFibers(f[0],f[1]);
515 
516  for (int nf=0; nf<2; nf++) {
517  if (f[nf]<0 || (nf==1 && f[0]==f[1])) continue; // skip if invalid or the same
518  for (fc=0; fc<=2; fc++) {
519  HcalElectronicsId eid(fc,f[nf],spigot,dccid);
520  eid.setHTR(htr_cr,htr_slot,htr_tb);
521  DetId did=emap.lookup(eid);
522 
523  if (did.null() || did.det()!=DetId::Hcal || did.subdetId()==0) {
524  if (unknownIds_.find(eid)==unknownIds_.end()) {
525  edm::LogWarning("HCAL") << "HcalHistogramUnpacker: No match found for electronics id :" << eid;
526  unknownIds_.insert(eid);
527  }
528  continue;
529  }
530  histoDigis.push_back(HcalHistogramDigi(HcalDetId(did))); // add it!
531  HcalHistogramDigi& digi=histoDigis.back();
532 
533  // unpack the four capids
534  for (int capid=0; capid<4; capid++)
535  htr.unpackHistogram(f[nf],fc,capid,digi.getArray(capid));
536 
537  }
538  }
539  }
540 }
541 
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::set< HcalElectronicsId > unknownIds_
Definition: HcalUnpacker.h:52
int sourceIdOffset_
number to subtract from the source id to get the dcc id
Definition: HcalUnpacker.h:48
int endSample_
last sample from fed raw data to copy (if present)
Definition: HcalUnpacker.h:50
int startSample_
first sample from fed raw data to copy
Definition: HcalUnpacker.h:49
uint16_t raw() const
get the raw word
Definition: HcalQIESample.h:22
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:64
std::vector< HcalTTPDigi > * ttp
Definition: HcalUnpacker.h:31
std::vector< HFDataFrame > * hfCont
Definition: HcalUnpacker.h:26
int fiberAndChan() const
get the id channel
Definition: HcalQIESample.h:38
int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:36
bool getSpigotCRCError(unsigned int nspigot) const
Read the &quot;CRC-Mismatch&quot; bit for this spigot.
static bool isTPGSOI(const HcalTriggerPrimitiveSample &s)
Definition: HcalUnpacker.cc:93
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:44
std::vector< HBHEDataFrame > * hbheCont
Definition: HcalUnpacker.h:24
std::vector< HOTriggerPrimitiveDigi > * tphoCont
Definition: HcalUnpacker.h:30
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:358
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:179
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:435
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:415
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
int slbChan() const
get the slb channel number
int getFormatVersion() const
Get the version number of this event.
Definition: HcalHTRData.h:35
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:355
tuple report
Definition: zeeHLT_cff.py:9
bool isOverflowWarning() const
Definition: HcalHTRData.cc:111
bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned short *histogram) const
Unpack special histogramming mode data.
Definition: HcalHTRData.cc:443
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
int slbAndChan() const
get the id channel
int expectedOrbitMessageTime_
Expected orbit bunch time (needed to evaluate time differences)
Definition: HcalUnpacker.h:51
bool isEmptyEvent() const
Definition: HcalHTRData.cc:102
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
HcalSubdetector
Definition: HcalAssistant.h:32
uint16_t raw() const
get the raw word
double f[11][100]
std::vector< HcalTriggerPrimitiveDigi > * tpCont
Definition: HcalUnpacker.h:29
int fiber() const
get the fiber number
Definition: HcalQIESample.h:34
bool getSpigotPresent(unsigned int nspigot) const
Read the &quot;PRESENT&quot; bit for this spigot.
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::set< HcalElectronicsId > unknownIdsTrig_
Recorded to limit number of times a log message is generated.
Definition: HcalUnpacker.h:52
int getSourceId() const
Definition: HcalDCCHeader.h:34
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
unsigned int databits
Definition: DetId.h:20
void setHTR(int crate, int slot, int tb)
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
static const int SubdetectorId
Definition: HcalZDCDetId.h:22
std::vector< HcalCalibDataFrame > * calibCont
Definition: HcalUnpacker.h:27
HcalOtherSubdetector subdet() const
get the category
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:155
bool unpack(const HcalHTRData &data, HcalTTPDigi &digi)
bool null() const
is this a null id ?
Definition: DetId.h:47
std::vector< HODataFrame > * hoCont
Definition: HcalUnpacker.h:25
void setbit(int i)
int getNPS() const
Get the number of presamples in daq data.
Definition: HcalHTRData.cc:402
static const HcalTrigTowerDetId Undefined
static const int FORMAT_VERSION_COMPACT_DATA
Definition: HcalHTRData.h:22
int getFirmwareFlavor() const
Get the HTR firmware flavor.
Definition: HcalHTRData.cc:411
int slb() const
get the slb site number
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:21
bool wasMarkAndPassZSTP(int slb, int slbchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:366
uint16_t * getArray(int capid)
get the array for the specified capid
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:375
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
std::vector< ZDCDataFrame > * zdcCont
Definition: HcalUnpacker.h:28
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:333
bool isBusy() const
Definition: HcalHTRData.cc:119
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:387
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:11