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

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(), isTPGSOI(), HcalHTRData::isUnsuppressed(), HcalTriggerPrimitiveSample::raw(), alignCSCRings::s, HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

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