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, const FEDReadoutMode mode) 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),
201  dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
202  { }
numberOfSamples
threshold for setting fine grain bit
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 264 of file SiStripFEDBufferGenerator.h.

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

Referenced by sistrip::FEDBufferPayloadCreator::fillClusterData(), and sistrip::FEDBufferPayloadCreator::fillClusterDataPreMixMode().

265  {
266  if (dataIs8Bit_) {
267  return (0xFF & getSample(sampleNumber));
268  }
269  else {
270  const uint16_t sample = getSample(sampleNumber);
271  if (sample < 0x3FF) return sample;
272  else return 0x3FF;
273  }
274  }
uint16_t getSample(const uint16_t sampleNumber) const
uint8_t sistrip::FEDStripData::ChannelData::get8BitSample ( const uint16_t  sampleNumber,
const FEDReadoutMode  mode 
) const
inline

Definition at line 234 of file SiStripFEDBufferGenerator.h.

References dataIs8Bit_, Exception, getSample(), sistrip::READOUT_MODE_ZERO_SUPPRESSED, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT_CMOVERRIDE, and simplePhotonAnalyzer_cfi::sample.

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

235  {
236  uint16_t sample = getSample(sampleNumber);
237  // one start shifting the word
238  switch (mode) {
242  break;
245  sample = (sample>>1);
246  break;
249  sample = (sample>>2);
250  break;
251  default:
252  throw cms::Exception("FEDBufferGenerator") << "Invalid readout mode requested for 8-bit sample retrieval";
253  }
254  if (dataIs8Bit_) {
255  return (0xFF & sample);
256  }
257  else {
258  if (sample < 0xFE) return sample;
259  else if (sample == 0x3FF) return 0xFF;
260  else return 0xFE;
261  }
262  }
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 220 of file SiStripFEDBufferGenerator.h.

References data_.

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

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 data_.

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

Definition at line 281 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 33 of file SiStripFEDBufferGenerator.cc.

References sistrip::FEDStripData::data_, 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  }
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().