CMS 3D CMS Logo

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
 
uint16_t adcPreMix () const
 
 FEDZSChannelUnpacker ()
 
bool hasData () const
 
FEDZSChannelUnpackeroperator++ ()
 
FEDZSChannelUnpackeroperator++ (int)
 
uint8_t sampleNumber () const
 

Static Public Member Functions

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

Private Member Functions

 FEDZSChannelUnpacker (const uint8_t *payload, const uint16_t channelPayloadOffset, const int16_t channelPayloadLength, const uint16_t offsetIncrement=1)
 
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_
 
uint16_t currentOffset_
 
uint8_t currentStrip_
 
const uint8_t * data_
 
uint16_t offsetIncrement_
 
uint8_t valuesLeftInCluster_
 

Detailed Description

Definition at line 89 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( )
inline
sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( const uint8_t *  payload,
const uint16_t  channelPayloadOffset,
const int16_t  channelPayloadLength,
const uint16_t  offsetIncrement = 1 
)
inlineprivate

Definition at line 375 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

379  : data_(payload),
380  currentOffset_(channelPayloadOffset),
381  offsetIncrement_(offsetIncrement),
382  currentStrip_(0),
384  channelPayloadOffset_(channelPayloadOffset),
385  channelPayloadLength_(channelPayloadLength) {
388  }

Member Function Documentation

uint8_t sistrip::FEDZSChannelUnpacker::adc ( ) const
inline
uint16_t sistrip::FEDZSChannelUnpacker::adcPreMix ( ) const
inline

Definition at line 419 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

Referenced by sistrip::RawToDigiUnpacker::createDigis().

419  {
420  return (data_[currentOffset_ ^ 7] + ((data_[(currentOffset_ + 1) ^ 7] & 0x03) << 8));
421  }
bool sistrip::FEDZSChannelUnpacker::hasData ( ) const
inline
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( void  )
inline

Definition at line 427 of file SiStripFEDBuffer.h.

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

427  {
428  if (valuesLeftInCluster_) {
429  currentStrip_++;
432  } else {
434  if (hasData()) {
435  const uint8_t oldStrip = currentStrip_;
437  if (!(currentStrip_ > oldStrip))
439  }
440  }
441  return (*this);
442  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  )
inline

Definition at line 444 of file SiStripFEDBuffer.h.

444  {
445  ++(*this);
446  return *this;
447  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::preMixRawModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 406 of file SiStripFEDBuffer.h.

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

Referenced by sistrip::RawToDigiUnpacker::createDigis().

406  {
407  //CAMM - to modify more ?
408  uint16_t length = channel.length();
409  if (length & 0xF000)
410  throwBadChannelLength(length);
411  FEDZSChannelUnpacker result(channel.data(), channel.offset() + 7, length - 7, 2);
412  return result;
413  }
static void throwBadChannelLength(const uint16_t length)
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const
inline
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length)
staticprivate

Definition at line 457 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by preMixRawModeUnpacker(), zeroSuppressedLiteModeUnpacker(), and zeroSuppressedModeUnpacker().

457  {
458  std::ostringstream ss;
459  ss << "Channel length is longer than max allowed value. "
460  << "Channel length is " << uint16_t(length) << "." << std::endl;
461  throw cms::Exception("FEDBuffer") << ss.str();
462  }
void sistrip::FEDZSChannelUnpacker::throwBadClusterLength ( )
private

Definition at line 464 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

464  {
465  std::ostringstream ss;
466  ss << "Cluster does not fit into channel. "
467  << "Cluster length is " << uint16_t(valuesLeftInCluster_) << "." << std::endl;
468  throw cms::Exception("FEDBuffer") << ss.str();
469  }
void sistrip::FEDZSChannelUnpacker::throwUnorderedData ( const uint8_t  currentStrip,
const uint8_t  firstStripOfNewCluster 
)
staticprivate

Definition at line 471 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by operator++().

471  {
472  std::ostringstream ss;
473  ss << "First strip of new cluster is not greater than last strip of previous cluster. "
474  << "Last strip of previous cluster is " << uint16_t(currentStrip) << ". "
475  << "First strip of new cluster is " << uint16_t(firstStripOfNewCluster) << "." << std::endl;
476  throw cms::Exception("FEDBuffer") << ss.str();
477  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 398 of file SiStripFEDBuffer.h.

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

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and SiStripClusterizerFromRaw::run().

398  {
399  uint16_t length = channel.length();
400  if (length & 0xF000)
401  throwBadChannelLength(length);
402  FEDZSChannelUnpacker result(channel.data(), channel.offset() + 2, length - 2);
403  return result;
404  }
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 390 of file SiStripFEDBuffer.h.

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

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and SiStripClusterizerFromRaw::run().

390  {
391  uint16_t length = channel.length();
392  if (length & 0xF000)
393  throwBadChannelLength(length);
394  FEDZSChannelUnpacker result(channel.data(), channel.offset() + 7, length - 7);
395  return result;
396  }
static void throwBadChannelLength(const uint16_t length)

Member Data Documentation

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadLength_
private

Definition at line 118 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 117 of file SiStripFEDBuffer.h.

Referenced by hasData().

uint16_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 113 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 115 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 112 of file SiStripFEDBuffer.h.

Referenced by adc(), adcPreMix(), and readNewClusterInfo().

uint16_t sistrip::FEDZSChannelUnpacker::offsetIncrement_
private

Definition at line 114 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 116 of file SiStripFEDBuffer.h.

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