#include <RecoLocalCalo/HcalLaserReco/src/HcalLaserUnpacker.h>
Public Member Functions | |
HcalLaserUnpacker () | |
void | unpack (const FEDRawData &raw, HcalLaserDigi &digi) const |
Definition at line 7 of file HcalLaserUnpacker.h.
HcalLaserUnpacker::HcalLaserUnpacker | ( | ) |
void HcalLaserUnpacker::unpack | ( | const FEDRawData & | raw, | |
HcalLaserDigi & | digi | |||
) | const |
Definition at line 15 of file HcalLaserUnpacker.cc.
References HcalLaserDigi::addTDCHit(), FEDRawData::data(), Exception, i, CombinedTDCQDCDataFormat::n_qdc_hits, CombinedTDCQDCDataFormat::n_tdc_hits, CombinedTDCQDCDataFormat::qdc_values, HcalLaserDigi::setQADC(), and FEDRawData::size().
Referenced by HcalLaserReco::produce().
00016 { 00017 00018 if (raw.size()<3*8) { 00019 throw cms::Exception("Missing Data") << "No data in the block"; 00020 } 00021 00022 const CombinedTDCQDCDataFormat* qdctdc=(const CombinedTDCQDCDataFormat*)raw.data(); 00023 00024 // first, we do the QADC 00025 std::vector<uint16_t> qadcvals; 00026 for (unsigned int i=0;i<qdctdc->n_qdc_hits;i++) { 00027 qadcvals.push_back(qdctdc->qdc_values[i]&0xFFF); 00028 } 00029 digi.setQADC(qadcvals); 00030 00031 // next, we do the TDC 00032 const unsigned int* hitbase=(&(qdctdc->n_tdc_hits))+1; // base is one beyond 00033 unsigned int totalhits=0; 00034 00035 hitbase+=qdctdc->n_qdc_hits/2; // two unsigned short per unsigned long 00036 totalhits=qdctdc->n_tdc_hits&0xFFFF; // mask off high bits 00037 00038 for (unsigned int i=0; i<totalhits; i++) { 00039 int channel=(hitbase[i]&0x7FC00000)>>22; // hardcode channel assignment 00040 int time=(hitbase[i]&0xFFFFF); 00041 if (channel==0 && time==0 && i==(totalhits-1)) continue; // ignore "filler" hit 00042 digi.addTDCHit(channel,time); 00043 } 00044 }