CMS 3D CMS Logo

Public Member Functions | Private Attributes

sistrip::FEDStripData::ChannelData Class Reference

#include <SiStripFEDBufferGenerator.h>

List of all members.

Public Member Functions

 ChannelData (bool dataIsAlreadyConvertedTo8Bit, const size_t numberOfSamples, const std::pair< uint16_t, uint16_t > medians=std::make_pair< uint16_t >(0, 0))
uint8_t get8BitSample (const uint16_t sampleNumber) const
std::pair< uint16_t, uint16_t > getMedians () const
uint16_t getSample (const uint16_t sampleNumber) const
uint16_t & operator[] (const size_t sampleNumber)
const uint16_t & operator[] (const size_t sampleNumber) const
void setMedians (const std::pair< uint16_t, uint16_t > values)
void setSample (const uint16_t sampleNumber, const uint16_t adcValue)
size_t size () const

Private Attributes

std::vector< uint16_t > data_
bool dataIs8Bit_
std::pair< uint16_t, uint16_t > medians_

Detailed Description

Definition at line 22 of file SiStripFEDBufferGenerator.h.


Constructor & Destructor Documentation

sistrip::FEDStripData::ChannelData::ChannelData ( bool  dataIsAlreadyConvertedTo8Bit,
const size_t  numberOfSamples,
const std::pair< uint16_t, uint16_t >  medians = std::make_pair<uint16_t>(0,0) 
) [inline]

Definition at line 197 of file SiStripFEDBufferGenerator.h.

    : medians_(medians),
      data_(numberOfSamples,0),
      dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
    { }

Member Function Documentation

uint8_t sistrip::FEDStripData::ChannelData::get8BitSample ( const uint16_t  sampleNumber) const [inline]

Definition at line 234 of file SiStripFEDBufferGenerator.h.

References compare_using_db::sample.

Referenced by sistrip::FEDBufferPayloadCreator::fillClusterData().

  {
    if (dataIs8Bit_) return (0xFF & getSample(sampleNumber));
    else {
      const uint16_t sample = getSample(sampleNumber);
      if (sample < 0xFE) return sample;
      else if (sample == 0x3FF) return 0xFF;
      else return 0xFE;
    }
  }
std::pair< uint16_t, uint16_t > sistrip::FEDStripData::ChannelData::getMedians ( ) const [inline]
uint16_t sistrip::FEDStripData::ChannelData::getSample ( const uint16_t  sampleNumber) const [inline]

Definition at line 220 of file SiStripFEDBufferGenerator.h.

References sistrip::FEDStripData::data_.

Referenced by sistrip::FEDBufferPayloadCreator::fillRawChannelBuffer().

  {
    //try {
    //  return data_.at(sampleNumber);
    //} catch (const std::out_of_range&) {
    //  std::ostringstream ss;
    //  ss << "Sample index out of range. "
    //     << "Requesting sample " << sampleNumber
    //     << " when channel has only " << data_.size() << " samples.";
    //  throw cms::Exception("FEDBufferGenerator") << ss.str();
    //}
    return data_[sampleNumber];
  }
const uint16_t & sistrip::FEDStripData::ChannelData::operator[] ( const size_t  sampleNumber) const [inline]

Definition at line 209 of file SiStripFEDBufferGenerator.h.

References sistrip::FEDStripData::data_.

    {
      return data_[sampleNumber];
    }
uint16_t & sistrip::FEDStripData::ChannelData::operator[] ( const size_t  sampleNumber) [inline]

Definition at line 215 of file SiStripFEDBufferGenerator.h.

    {
      return const_cast<uint16_t&>(static_cast<const ChannelData&>(*this)[sampleNumber]);
    }
void sistrip::FEDStripData::ChannelData::setMedians ( const std::pair< uint16_t, uint16_t >  values) [inline]

Definition at line 250 of file SiStripFEDBufferGenerator.h.

References makeHLTPrescaleTable::values.

    {
      medians_ = values;
    }
void sistrip::FEDStripData::ChannelData::setSample ( const uint16_t  sampleNumber,
const uint16_t  adcValue 
)

Definition at line 33 of file SiStripFEDBufferGenerator.cc.

References data_, Exception, and relativeConstraints::value.

  {
    if (value > 0x3FF) {
      std::ostringstream ss;
      ss << "Sample value (" << value << ") is too large. Maximum allowed is 1023. ";
      throw cms::Exception("FEDBufferGenerator") << ss.str();
    }
    try {
      data_.at(sampleNumber) = value;
    } catch (const std::out_of_range&) {
      std::ostringstream ss;
      ss << "Sample index out of range. "
         << "Requesting sample " << sampleNumber
         << " when channel has only " << data_.size() << " samples.";
      throw cms::Exception("FEDBufferGenerator") << ss.str();
    }
  }
size_t sistrip::FEDStripData::ChannelData::size ( void  ) const [inline]

Member Data Documentation

std::vector<uint16_t> sistrip::FEDStripData::ChannelData::data_ [private]

Definition at line 42 of file SiStripFEDBufferGenerator.h.

Referenced by setSample().

Definition at line 43 of file SiStripFEDBufferGenerator.h.

std::pair<uint16_t,uint16_t> sistrip::FEDStripData::ChannelData::medians_ [private]

Definition at line 41 of file SiStripFEDBufferGenerator.h.