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(), HcalHTRData::isUnsuppressed(), HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

                                                                                                                                                                                                                                      {
    // set parameters
    digi.setPresamples(presamples);
    int fiber=startPoint->fiber();
    int fiberchan=startPoint->fiberChan();
    uint32_t zsmask=hhd.zsBunchMask()>>startSample;
    digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);

 //   digi.setReadoutIds(eid);
 //   setReadoutIds is missing in  CastorDataFrame class  digi.setReadoutIds(eid);
    if (expectedTime>=0 && !hhd.isUnsuppressed()) {
           // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << " fiber="<<fiber<< std::endl;
      digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
    }
    // what is my sample number?
    int myFiberChan=startPoint->fiberAndChan();
    int ncurr=0,ntaken=0;
    const HcalQIESample* qie_work=startPoint;
    while (qie_work!=limit && qie_work->fiberAndChan()==myFiberChan) {
      if (ncurr>=startSample && ncurr<=endSample) {
        digi.setSample(ntaken,*qie_work);
        ++ntaken;
      }
      ncurr++;
      qie_work++;
    }
    digi.setSize(ntaken);
    return qie_work;
  }