CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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, i, CombinedTDCQDCDataFormat::n_qdc_hits, CombinedTDCQDCDataFormat::n_tdc_hits, CombinedTDCQDCDataFormat::qdc_values, HcalLaserDigi::setQADC(), and FEDRawData::size().

Referenced by HcalLaserReco::produce().

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