CMS 3D CMS Logo

Functions
CastorUnpacker_impl Namespace Reference

Functions

template<class DigiClass >
const HcalQIESampleunpack (const HcalQIESample *startPoint, const HcalQIESample *limit, DigiClass &digi, int presamples, const CastorElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)
 

Function Documentation

◆ unpack()

template<class DigiClass >
const HcalQIESample* CastorUnpacker_impl::unpack ( const HcalQIESample startPoint,
const HcalQIESample limit,
DigiClass &  digi,
int  presamples,
const CastorElectronicsId eid,
int  startSample,
int  endSample,
int  expectedTime,
const HcalHTRData hhd 
)

Definition at line 14 of file CastorUnpacker.cc.

References HcalQIESample::fiber(), HcalQIESample::fiberAndChan(), HcalQIESample::fiberChan(), HcalHTRData::getFibOrbMsgBCN(), HcalHTRData::isUnsuppressed(), remoteMonitoring_LASER_era2018_cfg::limit, hcalTTPDigis_cfi::presamples, HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

22  {
23  // set parameters
24  digi.setPresamples(presamples);
25  int fiber = startPoint->fiber();
26  int fiberchan = startPoint->fiberChan();
27  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
28  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
29 
30  // digi.setReadoutIds(eid);
31  // setReadoutIds is missing in CastorDataFrame class digi.setReadoutIds(eid);
32  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
33  // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << " fiber="<<fiber<< std::endl;
34  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
35  }
36  // what is my sample number?
37  int myFiberChan = startPoint->fiberAndChan();
38  int ncurr = 0, ntaken = 0;
39  const HcalQIESample* qie_work = startPoint;
40  while (qie_work != limit && qie_work->fiberAndChan() == myFiberChan) {
41  if (ncurr >= startSample && ncurr <= endSample) {
42  digi.setSample(ntaken, *qie_work);
43  ++ntaken;
44  }
45  ncurr++;
46  qie_work++;
47  }
48  digi.setSize(ntaken);
49  return qie_work;
50  }
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&Pass ZS?
Definition: HcalHTRData.cc:379
constexpr int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:55
constexpr int fiberAndChan() const
get the id channel
Definition: HcalQIESample.h:57
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:400
constexpr int fiber() const
get the fiber number
Definition: HcalQIESample.h:53
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:180
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378