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 81 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( )
inline

Definition at line 205 of file SiStripFEDBuffer.h.

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

Definition at line 212 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

213  : data_(payload),
214  currentOffset_(channelPayloadOffset),
215  currentStrip_(0),
217  channelPayloadOffset_(channelPayloadOffset),
218  channelPayloadLength_(channelPayloadLength)
219  {
221  }

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 254 of file SiStripFEDBuffer.h.

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

255  {
256  if (valuesLeftInCluster_) {
257  currentStrip_++;
258  currentOffset_++;
260  } else {
261  currentOffset_++;
262  if (hasData()) {
263  const uint8_t oldStrip = currentStrip_;
265  if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
266  }
267  }
268  return (*this);
269  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  )
inline

Definition at line 271 of file SiStripFEDBuffer.h.

272  {
273  ++(*this); return *this;
274  }
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const
inline

Definition at line 239 of file SiStripFEDBuffer.h.

References currentStrip_.

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

240  {
241  return currentStrip_;
242  }
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length)
staticprivate

Definition at line 436 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception.

Referenced by zeroSuppressedLiteModeUnpacker(), and zeroSuppressedModeUnpacker().

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

Definition at line 445 of file SiStripFEDBuffer.cc.

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

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

Definition at line 454 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception.

Referenced by operator++().

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

Definition at line 231 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().

232  {
233  uint16_t length = channel.length();
234  if (length & 0xF000) throwBadChannelLength(length);
235  FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
236  return result;
237  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 223 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().

224  {
225  uint16_t length = channel.length();
226  if (length & 0xF000) throwBadChannelLength(length);
227  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
228  return result;
229  }
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 104 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 103 of file SiStripFEDBuffer.h.

Referenced by hasData().

size_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 100 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 101 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 99 of file SiStripFEDBuffer.h.

Referenced by adc(), and readNewClusterInfo().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 102 of file SiStripFEDBuffer.h.

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