CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
sistrip::FEDZSChannelUnpacker Class Reference

#include <SiStripFEDBuffer.h>

Public Member Functions

uint8_t adc () const
 
 FEDZSChannelUnpacker ()
 
bool hasData () const
 
FEDZSChannelUnpackeroperator++ ()
 
FEDZSChannelUnpackeroperator++ (int)
 
uint8_t sampleNumber () const
 

Static Public Member Functions

static FEDZSChannelUnpacker zeroSuppressedLiteModeUnpacker (const FEDChannel &channel)
 
static FEDZSChannelUnpacker zeroSuppressedModeUnpacker (const FEDChannel &channel)
 

Private Member Functions

 FEDZSChannelUnpacker (const uint8_t *payload, const size_t channelPayloadOffset, const int16_t channelPayloadLength)
 
void readNewClusterInfo ()
 
void throwBadClusterLength ()
 

Static Private Member Functions

static void throwBadChannelLength (const uint16_t length)
 
static void throwUnorderedData (const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
 

Private Attributes

uint16_t channelPayloadLength_
 
uint16_t channelPayloadOffset_
 
size_t currentOffset_
 
uint8_t currentStrip_
 
const uint8_t * data_
 
uint8_t valuesLeftInCluster_
 

Detailed Description

Definition at line 80 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( )
inline

Definition at line 199 of file SiStripFEDBuffer.h.

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( const uint8_t *  payload,
const size_t  channelPayloadOffset,
const int16_t  channelPayloadLength 
)
inlineprivate

Definition at line 206 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

207  : data_(payload),
208  currentOffset_(channelPayloadOffset),
209  currentStrip_(0),
211  channelPayloadOffset_(channelPayloadOffset),
212  channelPayloadLength_(channelPayloadLength)
213  {
215  }

Member Function Documentation

uint8_t sistrip::FEDZSChannelUnpacker::adc ( ) const
inline
bool sistrip::FEDZSChannelUnpacker::hasData ( ) const
inline
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( void  )
inline

Definition at line 248 of file SiStripFEDBuffer.h.

References currentOffset_, currentStrip_, hasData(), readNewClusterInfo(), throwUnorderedData(), and valuesLeftInCluster_.

249  {
250  if (valuesLeftInCluster_) {
251  currentStrip_++;
252  currentOffset_++;
254  } else {
255  currentOffset_++;
256  if (hasData()) {
257  const uint8_t oldStrip = currentStrip_;
259  if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
260  }
261  }
262  return (*this);
263  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  )
inline

Definition at line 265 of file SiStripFEDBuffer.h.

266  {
267  ++(*this); return *this;
268  }
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const
inline

Definition at line 233 of file SiStripFEDBuffer.h.

References currentStrip_.

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and sistrip::RawToClustersLazyUnpacker::fill().

234  {
235  return currentStrip_;
236  }
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length)
staticprivate

Definition at line 434 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception.

Referenced by zeroSuppressedLiteModeUnpacker(), and zeroSuppressedModeUnpacker().

435  {
436  std::ostringstream ss;
437  ss << "Channel length is longer than max allowed value. "
438  << "Channel length is " << uint16_t(length) << "."
439  << std::endl;
440  throw cms::Exception("FEDBuffer") << ss.str();
441  }
void sistrip::FEDZSChannelUnpacker::throwBadClusterLength ( )
private

Definition at line 443 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception, and valuesLeftInCluster_.

444  {
445  std::ostringstream ss;
446  ss << "Cluster does not fit into channel. "
447  << "Cluster length is " << uint16_t(valuesLeftInCluster_) << "."
448  << std::endl;
449  throw cms::Exception("FEDBuffer") << ss.str();
450  }
void sistrip::FEDZSChannelUnpacker::throwUnorderedData ( const uint8_t  currentStrip,
const uint8_t  firstStripOfNewCluster 
)
staticprivate

Definition at line 452 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception.

Referenced by operator++().

453  {
454  std::ostringstream ss;
455  ss << "First strip of new cluster is not greater than last strip of previous cluster. "
456  << "Last strip of previous cluster is " << uint16_t(currentStrip) << ". "
457  << "First strip of new cluster is " << uint16_t(firstStripOfNewCluster) << "."
458  << std::endl;
459  throw cms::Exception("FEDBuffer") << ss.str();
460  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 225 of file SiStripFEDBuffer.h.

References sistrip::FEDChannel::data(), sistrip::FEDChannel::length(), sistrip::FEDChannel::offset(), query::result, and throwBadChannelLength().

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and sistrip::RawToClustersLazyUnpacker::fill().

226  {
227  uint16_t length = channel.length();
228  if (length & 0xF000) throwBadChannelLength(length);
229  FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
230  return result;
231  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 217 of file SiStripFEDBuffer.h.

References sistrip::FEDChannel::data(), sistrip::FEDChannel::length(), sistrip::FEDChannel::offset(), query::result, and throwBadChannelLength().

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and sistrip::RawToClustersLazyUnpacker::fill().

218  {
219  uint16_t length = channel.length();
220  if (length & 0xF000) throwBadChannelLength(length);
221  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
222  return result;
223  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)

Member Data Documentation

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadLength_
private

Definition at line 103 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 102 of file SiStripFEDBuffer.h.

Referenced by hasData().

size_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 99 of file SiStripFEDBuffer.h.

Referenced by adc(), hasData(), operator++(), and readNewClusterInfo().

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 100 of file SiStripFEDBuffer.h.

Referenced by operator++(), readNewClusterInfo(), and sampleNumber().

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 98 of file SiStripFEDBuffer.h.

Referenced by adc(), and readNewClusterInfo().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 101 of file SiStripFEDBuffer.h.

Referenced by operator++(), readNewClusterInfo(), and throwBadClusterLength().