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

References channelPayloadLength_, and readNewClusterInfo().

372  : data_(payload),
373  currentOffset_(channelPayloadOffset),
374  offsetIncrement_(offsetIncrement),
375  currentStrip_(0),
377  channelPayloadOffset_(channelPayloadOffset),
378  channelPayloadLength_(channelPayloadLength)
379  {
381  }

Member Function Documentation

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

Definition at line 413 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

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

414  {
415  return data_[currentOffset_^7];
416  }
uint16_t sistrip::FEDZSChannelUnpacker::adcPreMix ( ) const
inline

Definition at line 418 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 428 of file SiStripFEDBuffer.h.

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

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

Definition at line 445 of file SiStripFEDBuffer.h.

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

Definition at line 399 of file SiStripFEDBuffer.h.

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

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

400  {
401  //CAMM - to modify more ?
402  uint16_t length = channel.length();
403  if (length & 0xF000) throwBadChannelLength(length);
404  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7,2);
405  return result;
406  }
static void throwBadChannelLength(const uint16_t length)
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const
inline

Definition at line 408 of file SiStripFEDBuffer.h.

References currentStrip_.

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

409  {
410  return currentStrip_;
411  }
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length)
staticprivate

Definition at line 452 of file SiStripFEDBuffer.cc.

References Exception.

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

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

Definition at line 461 of file SiStripFEDBuffer.cc.

References Exception.

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

Definition at line 470 of file SiStripFEDBuffer.cc.

References Exception.

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) << "."
476  << std::endl;
477  throw cms::Exception("FEDBuffer") << ss.str();
478  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 391 of file SiStripFEDBuffer.h.

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

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

392  {
393  uint16_t length = channel.length();
394  if (length & 0xF000) throwBadChannelLength(length);
395  FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
396  return result;
397  }
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 383 of file SiStripFEDBuffer.h.

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

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

384  {
385  uint16_t length = channel.length();
386  if (length & 0xF000) throwBadChannelLength(length);
387  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
388  return result;
389  }
static void throwBadChannelLength(const uint16_t length)

Member Data Documentation

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadLength_
private

Definition at line 115 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 114 of file SiStripFEDBuffer.h.

Referenced by hasData().

uint16_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 110 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 112 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 109 of file SiStripFEDBuffer.h.

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

uint16_t sistrip::FEDZSChannelUnpacker::offsetIncrement_
private

Definition at line 111 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 113 of file SiStripFEDBuffer.h.

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