CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
sistrip::FEDStripData::ChannelData Class Reference

#include <SiStripFEDBufferGenerator.h>

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.

199  : medians_(medians),
200  data_(numberOfSamples,0),
201  dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
202  { }
std::pair< uint16_t, uint16_t > medians_

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

235  {
236  if (dataIs8Bit_) return (0xFF & getSample(sampleNumber));
237  else {
238  const uint16_t sample = getSample(sampleNumber);
239  if (sample < 0xFE) return sample;
240  else if (sample == 0x3FF) return 0xFF;
241  else return 0xFE;
242  }
243  }
uint16_t getSample(const uint16_t sampleNumber) const
std::pair< uint16_t, uint16_t > sistrip::FEDStripData::ChannelData::getMedians ( ) const
inline

Definition at line 245 of file SiStripFEDBufferGenerator.h.

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

246  {
247  return medians_;
248  }
std::pair< uint16_t, uint16_t > medians_
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().

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

Definition at line 215 of file SiStripFEDBufferGenerator.h.

216  {
217  return const_cast<uint16_t&>(static_cast<const ChannelData&>(*this)[sampleNumber]);
218  }
ChannelData(bool dataIsAlreadyConvertedTo8Bit, const size_t numberOfSamples, const std::pair< uint16_t, uint16_t > medians=std::make_pair< uint16_t >(0, 0))
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_.

210  {
211  return data_[sampleNumber];
212  }
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.

251  {
252  medians_ = values;
253  }
std::pair< uint16_t, uint16_t > medians_
void sistrip::FEDStripData::ChannelData::setSample ( const uint16_t  sampleNumber,
const uint16_t  adcValue 
)

Definition at line 33 of file SiStripFEDBufferGenerator.cc.

References data_, edm::hlt::Exception, and relativeConstraints::value.

34  {
35  if (value > 0x3FF) {
36  std::ostringstream ss;
37  ss << "Sample value (" << value << ") is too large. Maximum allowed is 1023. ";
38  throw cms::Exception("FEDBufferGenerator") << ss.str();
39  }
40  try {
41  data_.at(sampleNumber) = value;
42  } catch (const std::out_of_range&) {
43  std::ostringstream ss;
44  ss << "Sample index out of range. "
45  << "Requesting sample " << sampleNumber
46  << " when channel has only " << data_.size() << " samples.";
47  throw cms::Exception("FEDBufferGenerator") << ss.str();
48  }
49  }
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().

bool sistrip::FEDStripData::ChannelData::dataIs8Bit_
private

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.