CMS 3D CMS Logo

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::HcalLaserUnpacker ( )

Definition at line 7 of file HcalLaserUnpacker.cc.

7 {}

Member Function Documentation

◆ unpack()

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

Definition at line 16 of file HcalLaserUnpacker.cc.

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 }

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

Referenced by HcalLaserReco::produce().

mps_fire.i
i
Definition: mps_fire.py:428
CombinedTDCQDCDataFormat::qdc_values
unsigned short qdc_values[4]
Definition: HcalLaserUnpacker.cc:13
CombinedTDCQDCDataFormat
Definition: HcalLaserUnpacker.cc:9
protons_cff.time
time
Definition: protons_cff.py:39
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
HcalLaserDigi::addTDCHit
void addTDCHit(int channel, int hittime)
Definition: HcalLaserDigi.cc:16
CombinedTDCQDCDataFormat::n_qdc_hits
unsigned int n_qdc_hits
Definition: HcalLaserUnpacker.cc:11
HcalLaserDigi::setQADC
void setQADC(const std::vector< uint16_t > &values)
Definition: HcalLaserDigi.cc:11
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
Exception
Definition: hltDiff.cc:245
CombinedTDCQDCDataFormat::n_tdc_hits
unsigned int n_tdc_hits
Definition: HcalLaserUnpacker.cc:12