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))
 
uint16_t get10BitSample (const uint16_t sampleNumber) const
 
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 200 of file SiStripFEDBufferGenerator.h.

202  : medians_(medians),
203  data_(numberOfSamples,0),
204  dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
205  { }
std::pair< uint16_t, uint16_t > medians_

Member Function Documentation

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

Definition at line 248 of file SiStripFEDBufferGenerator.h.

References compare_using_db::sample.

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

249  {
250  if (dataIs8Bit_) {
251  return (0xFF & getSample(sampleNumber));
252  }
253  else {
254  const uint16_t sample = getSample(sampleNumber);
255  if (sample < 0x3FF) return sample;
256  else return 0x3FF;
257  }
258  }
uint16_t getSample(const uint16_t sampleNumber) const
uint8_t sistrip::FEDStripData::ChannelData::get8BitSample ( const uint16_t  sampleNumber) const
inline

Definition at line 237 of file SiStripFEDBufferGenerator.h.

References compare_using_db::sample.

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

238  {
239  if (dataIs8Bit_) return (0xFF & getSample(sampleNumber));
240  else {
241  const uint16_t sample = getSample(sampleNumber);
242  if (sample < 0xFE) return sample;
243  else if (sample == 0x3FF) return 0xFF;
244  else return 0xFE;
245  }
246  }
uint16_t getSample(const uint16_t sampleNumber) const
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 223 of file SiStripFEDBufferGenerator.h.

References sistrip::FEDStripData::data_.

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

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

Definition at line 218 of file SiStripFEDBufferGenerator.h.

219  {
220  return const_cast<uint16_t&>(static_cast<const ChannelData&>(*this)[sampleNumber]);
221  }
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 212 of file SiStripFEDBufferGenerator.h.

References sistrip::FEDStripData::data_.

213  {
214  return data_[sampleNumber];
215  }
void sistrip::FEDStripData::ChannelData::setMedians ( const std::pair< uint16_t, uint16_t >  values)
inline

Definition at line 265 of file SiStripFEDBufferGenerator.h.

References makeHLTPrescaleTable::values.

266  {
267  medians_ = values;
268  }
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, contentValuesCheck::ss, 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 43 of file SiStripFEDBufferGenerator.h.

Referenced by setSample().

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

Definition at line 44 of file SiStripFEDBufferGenerator.h.

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

Definition at line 42 of file SiStripFEDBufferGenerator.h.