CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
HcalLaserUnpacker Class Reference

#include <HcalLaserUnpacker.h>

Public Member Functions

 HcalLaserUnpacker ()
 
void unpack (const FEDRawData &raw, HcalLaserDigi &digi) const
 

Detailed Description

Definition at line 7 of file HcalLaserUnpacker.h.

Constructor & Destructor Documentation

HcalLaserUnpacker::HcalLaserUnpacker ( )

Definition at line 7 of file HcalLaserUnpacker.cc.

7 {}

Member Function Documentation

void HcalLaserUnpacker::unpack ( const FEDRawData raw,
HcalLaserDigi digi 
) const

Definition at line 16 of file HcalLaserUnpacker.cc.

References HcalLaserDigi::addTDCHit(), FEDRawData::data(), Exception, mps_fire::i, CombinedTDCQDCDataFormat::n_qdc_hits, CombinedTDCQDCDataFormat::n_tdc_hits, CombinedTDCQDCDataFormat::qdc_values, HcalLaserDigi::setQADC(), and FEDRawData::size().

Referenced by HcalLaserReco::produce().

16  {
17  if (raw.size() < 3 * 8) {
18  throw cms::Exception("Missing Data") << "No data in the block";
19  }
20 
21  const CombinedTDCQDCDataFormat* qdctdc = (const CombinedTDCQDCDataFormat*)raw.data();
22 
23  // first, we do the QADC
24  std::vector<uint16_t> qadcvals;
25  for (unsigned int i = 0; i < qdctdc->n_qdc_hits; i++) {
26  qadcvals.push_back(qdctdc->qdc_values[i] & 0xFFF);
27  }
28  digi.setQADC(qadcvals);
29 
30  // next, we do the TDC
31  const unsigned int* hitbase = (&(qdctdc->n_tdc_hits)) + 1; // base is one beyond
32  unsigned int totalhits = 0;
33 
34  hitbase += qdctdc->n_qdc_hits / 2; // two unsigned short per unsigned long
35  totalhits = qdctdc->n_tdc_hits & 0xFFFF; // mask off high bits
36 
37  for (unsigned int i = 0; i < totalhits; i++) {
38  int channel = (hitbase[i] & 0x7FC00000) >> 22; // hardcode channel assignment
39  int time = (hitbase[i] & 0xFFFFF);
40  if (channel == 0 && time == 0 && i == (totalhits - 1))
41  continue; // ignore "filler" hit
42  digi.addTDCHit(channel, time);
43  }
44 }
void addTDCHit(int channel, int hittime)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
unsigned short qdc_values[4]
void setQADC(const std::vector< uint16_t > &values)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24