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

Constructor & Destructor Documentation

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( )
inline

Definition at line 207 of file SiStripFEDBuffer.h.

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

Definition at line 214 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

215  : data_(payload),
216  currentOffset_(channelPayloadOffset),
217  currentStrip_(0),
219  channelPayloadOffset_(channelPayloadOffset),
220  channelPayloadLength_(channelPayloadLength)
221  {
223  }

Member Function Documentation

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

Definition at line 246 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

Referenced by ThreeThresholdAlgorithm::addFed(), and sistrip::RawToDigiUnpacker::createDigis().

247  {
248  return data_[currentOffset_^7];
249  }
bool sistrip::FEDZSChannelUnpacker::hasData ( ) const
inline
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( void  )
inline

Definition at line 256 of file SiStripFEDBuffer.h.

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

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

Definition at line 273 of file SiStripFEDBuffer.h.

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

Definition at line 241 of file SiStripFEDBuffer.h.

References currentStrip_.

Referenced by ThreeThresholdAlgorithm::addFed(), and sistrip::RawToDigiUnpacker::createDigis().

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

Definition at line 439 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception, and contentValuesCheck::ss.

Referenced by zeroSuppressedLiteModeUnpacker(), and zeroSuppressedModeUnpacker().

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

Definition at line 448 of file SiStripFEDBuffer.cc.

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

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

Definition at line 457 of file SiStripFEDBuffer.cc.

References edm::hlt::Exception, and contentValuesCheck::ss.

Referenced by operator++().

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

Definition at line 233 of file SiStripFEDBuffer.h.

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

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

234  {
235  uint16_t length = channel.length();
236  if (length & 0xF000) throwBadChannelLength(length);
237  FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
238  return result;
239  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( 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().

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

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 105 of file SiStripFEDBuffer.h.

Referenced by hasData().

size_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 102 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 103 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 101 of file SiStripFEDBuffer.h.

Referenced by adc(), and readNewClusterInfo().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 104 of file SiStripFEDBuffer.h.

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