#include <HcalLaserUnpacker.h>
Public Member Functions | |
HcalLaserUnpacker () | |
void | unpack (const FEDRawData &raw, HcalLaserDigi &digi) const |
Definition at line 7 of file HcalLaserUnpacker.h.
HcalLaserUnpacker::HcalLaserUnpacker | ( | ) |
Definition at line 7 of file HcalLaserUnpacker.cc.
{}
void HcalLaserUnpacker::unpack | ( | const FEDRawData & | raw, |
HcalLaserDigi & | digi | ||
) | const |
Definition at line 16 of file HcalLaserUnpacker.cc.
References HcalLaserDigi::addTDCHit(), FEDRawData::data(), Exception, i, CombinedTDCQDCDataFormat::n_qdc_hits, CombinedTDCQDCDataFormat::n_tdc_hits, CombinedTDCQDCDataFormat::qdc_values, HcalLaserDigi::setQADC(), FEDRawData::size(), and cond::rpcobgas::time.
Referenced by HcalLaserReco::produce().
{ if (raw.size()<3*8) { throw cms::Exception("Missing Data") << "No data in the block"; } const CombinedTDCQDCDataFormat* qdctdc=(const CombinedTDCQDCDataFormat*)raw.data(); // first, we do the QADC std::vector<uint16_t> qadcvals; for (unsigned int i=0;i<qdctdc->n_qdc_hits;i++) { qadcvals.push_back(qdctdc->qdc_values[i]&0xFFF); } digi.setQADC(qadcvals); // next, we do the TDC const unsigned int* hitbase=(&(qdctdc->n_tdc_hits))+1; // base is one beyond unsigned int totalhits=0; hitbase+=qdctdc->n_qdc_hits/2; // two unsigned short per unsigned long totalhits=qdctdc->n_tdc_hits&0xFFFF; // mask off high bits for (unsigned int i=0; i<totalhits; i++) { int channel=(hitbase[i]&0x7FC00000)>>22; // hardcode channel assignment int time=(hitbase[i]&0xFFFFF); if (channel==0 && time==0 && i==(totalhits-1)) continue; // ignore "filler" hit digi.addTDCHit(channel,time); } }