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

200  : medians_(medians),
202  dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
203  { }
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 dataIs8Bit_, getSample(), and simplePhotonAnalyzer_cfi::sample.

Referenced by sistrip::FEDBufferPayloadCreator::fillClusterData(), and 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,
uint16_t  nBotBitsToDrop 
) const
inline

Definition at line 235 of file SiStripFEDBufferGenerator.h.

References dataIs8Bit_, getSample(), and simplePhotonAnalyzer_cfi::sample.

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

236  {
237  uint16_t sample = getSample(sampleNumber) >> nBotBitsToDrop;
238  if (dataIs8Bit_) {
239  return (0xFF & sample);
240  }
241  else {
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 221 of file SiStripFEDBufferGenerator.h.

References data_.

Referenced by sistrip::FEDBufferPayloadCreator::fillRawChannelBuffer(), get10BitSample(), and get8BitSample().

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

Definition at line 216 of file SiStripFEDBufferGenerator.h.

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

References data_.

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

Definition at line 265 of file SiStripFEDBufferGenerator.h.

References medians_, and MuonErrorMatrixValues_cff::values.

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

Definition at line 34 of file SiStripFEDBufferGenerator.cc.

References sistrip::FEDStripData::data_, Exception, and relativeConstraints::value.

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

Member Data Documentation

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

Definition at line 44 of file SiStripFEDBufferGenerator.h.

Referenced by get10BitSample(), and get8BitSample().

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

Definition at line 42 of file SiStripFEDBufferGenerator.h.

Referenced by getMedians(), and setMedians().