CMS 3D CMS Logo

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))
 
uint16_t get10BitSample (const uint16_t sampleNumber) const
 
uint8_t get8BitSample (const uint16_t sampleNumber, uint16_t nBotBitsToDrop) 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 21 of file SiStripFEDBufferGenerator.h.

Constructor & Destructor Documentation

◆ ChannelData()

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 213 of file SiStripFEDBufferGenerator.h.

Member Function Documentation

◆ get10BitSample()

uint16_t sistrip::FEDStripData::ChannelData::get10BitSample ( const uint16_t  sampleNumber) const
inline

Definition at line 256 of file SiStripFEDBufferGenerator.h.

References ecalGpuTask_cfi::sample.

256  {
257  if (dataIs8Bit_) {
258  return (0xFF & getSample(sampleNumber));
259  } else {
260  const uint16_t sample = getSample(sampleNumber);
261  if (sample < 0x3FF)
262  return sample;
263  else
264  return 0x3FF;
265  }
266  }
uint16_t getSample(const uint16_t sampleNumber) const

◆ get8BitSample()

uint8_t sistrip::FEDStripData::ChannelData::get8BitSample ( const uint16_t  sampleNumber,
uint16_t  nBotBitsToDrop 
) const
inline

Definition at line 242 of file SiStripFEDBufferGenerator.h.

References ecalGpuTask_cfi::sample.

242  {
243  uint16_t sample = getSample(sampleNumber) >> nBotBitsToDrop;
244  if (dataIs8Bit_) {
245  return (0xFF & sample);
246  } else {
247  if (sample < 0xFE)
248  return sample;
249  else if (sample == 0x3FF)
250  return 0xFF;
251  else
252  return 0xFE;
253  }
254  }
uint16_t getSample(const uint16_t sampleNumber) const

◆ getMedians()

std::pair< uint16_t, uint16_t > sistrip::FEDStripData::ChannelData::getMedians ( ) const
inline

Definition at line 268 of file SiStripFEDBufferGenerator.h.

268 { return medians_; }
std::pair< uint16_t, uint16_t > medians_

◆ getSample()

uint16_t sistrip::FEDStripData::ChannelData::getSample ( const uint16_t  sampleNumber) const
inline

Definition at line 229 of file SiStripFEDBufferGenerator.h.

References sistrip::FEDStripData::data_.

229  {
230  //try {
231  // return data_.at(sampleNumber);
232  //} catch (const std::out_of_range&) {
233  // std::ostringstream ss;
234  // ss << "Sample index out of range. "
235  // << "Requesting sample " << sampleNumber
236  // << " when channel has only " << data_.size() << " samples.";
237  // throw cms::Exception("FEDBufferGenerator") << ss.str();
238  //}
239  return data_[sampleNumber];
240  }

◆ operator[]() [1/2]

uint16_t & sistrip::FEDStripData::ChannelData::operator[] ( const size_t  sampleNumber)
inline

Definition at line 225 of file SiStripFEDBufferGenerator.h.

225  {
226  return const_cast<uint16_t&>(std::as_const(*this)[sampleNumber]);
227  }

◆ operator[]() [2/2]

const uint16_t & sistrip::FEDStripData::ChannelData::operator[] ( const size_t  sampleNumber) const
inline

Definition at line 220 of file SiStripFEDBufferGenerator.h.

References sistrip::FEDStripData::data_.

220  {
221  return data_[sampleNumber];
222  }

◆ setMedians()

void sistrip::FEDStripData::ChannelData::setMedians ( const std::pair< uint16_t, uint16_t >  values)
inline

Definition at line 270 of file SiStripFEDBufferGenerator.h.

References contentValuesCheck::values.

◆ setSample()

void sistrip::FEDStripData::ChannelData::setSample ( const uint16_t  sampleNumber,
const uint16_t  adcValue 
)

Definition at line 32 of file SiStripFEDBufferGenerator.cc.

References data_, Exception, contentValuesCheck::ss, and relativeConstraints::value.

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

◆ size()

size_t sistrip::FEDStripData::ChannelData::size ( void  ) const
inline

Member Data Documentation

◆ data_

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

Definition at line 44 of file SiStripFEDBufferGenerator.h.

Referenced by setSample().

◆ dataIs8Bit_

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

Definition at line 45 of file SiStripFEDBufferGenerator.h.

◆ medians_

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

Definition at line 43 of file SiStripFEDBufferGenerator.h.