CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

sistrip::FEDZSChannelUnpacker Class Reference

#include <SiStripFEDBuffer.h>

List of all members.

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]
sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( const uint8_t *  payload,
const size_t  channelPayloadOffset,
const int16_t  channelPayloadLength 
) [inline, private]

Definition at line 212 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

    : data_(payload),
      currentOffset_(channelPayloadOffset),
      currentStrip_(0),
      valuesLeftInCluster_(0),
      channelPayloadOffset_(channelPayloadOffset),
      channelPayloadLength_(channelPayloadLength)
    {
      if (channelPayloadLength_) readNewClusterInfo();
    }

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_.

    {
      if (valuesLeftInCluster_) {
        currentStrip_++;
        currentOffset_++;
        valuesLeftInCluster_--;
      } else {
        currentOffset_++;
        if (hasData()) {
          const uint8_t oldStrip = currentStrip_;
          readNewClusterInfo();
          if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
        }
      }
      return (*this);
    }
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  ) [inline]

Definition at line 271 of file SiStripFEDBuffer.h.

    {
      ++(*this); return *this;
    }
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( ) [inline, private]
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const [inline]
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length) [static, private]

Definition at line 436 of file SiStripFEDBuffer.cc.

References Exception.

Referenced by zeroSuppressedLiteModeUnpacker(), and zeroSuppressedModeUnpacker().

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

Definition at line 445 of file SiStripFEDBuffer.cc.

References Exception, and valuesLeftInCluster_.

  {
    std::ostringstream ss;
    ss << "Cluster does not fit into channel. "
       << "Cluster length is " << uint16_t(valuesLeftInCluster_) << "."
       << std::endl;
    throw cms::Exception("FEDBuffer") << ss.str();
  }
void sistrip::FEDZSChannelUnpacker::throwUnorderedData ( const uint8_t  currentStrip,
const uint8_t  firstStripOfNewCluster 
) [static, private]

Definition at line 454 of file SiStripFEDBuffer.cc.

References Exception.

Referenced by operator++().

  {
    std::ostringstream ss;
    ss << "First strip of new cluster is not greater than last strip of previous cluster. "
       << "Last strip of previous cluster is " << uint16_t(currentStrip) << ". "
       << "First strip of new cluster is " << uint16_t(firstStripOfNewCluster) << "."
       << std::endl;
    throw cms::Exception("FEDBuffer") << ss.str();
  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel) [inline, static]

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().

    {
      uint16_t length = channel.length();
      if (length & 0xF000) throwBadChannelLength(length);
      FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
      return result;
    }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel) [inline, static]

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().

    {
      uint16_t length = channel.length();
      if (length & 0xF000) throwBadChannelLength(length);
      FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
      return result;
    }

Member Data Documentation

Definition at line 104 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

Definition at line 103 of file SiStripFEDBuffer.h.

Referenced by hasData().

Definition at line 100 of file SiStripFEDBuffer.h.

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

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().

Definition at line 102 of file SiStripFEDBuffer.h.

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