CMS 3D CMS Logo

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

#include <SiStripFEDBuffer.h>

Public Member Functions

uint8_t adc () const
 
uint16_t adcPreMix () const
 
 FEDZSChannelUnpacker ()
 
bool hasData () const
 
FEDZSChannelUnpackeroperator++ ()
 
FEDZSChannelUnpackeroperator++ (int)
 
uint8_t sampleNumber () const
 

Static Public Member Functions

static FEDZSChannelUnpacker preMixRawModeUnpacker (const FEDChannel &channel)
 
static FEDZSChannelUnpacker zeroSuppressedLiteModeUnpacker (const FEDChannel &channel)
 
static FEDZSChannelUnpacker zeroSuppressedModeUnpacker (const FEDChannel &channel)
 

Private Member Functions

 FEDZSChannelUnpacker (const uint8_t *payload, const size_t channelPayloadOffset, const int16_t channelPayloadLength, const size_t offsetIncrement=1)
 
void readNewClusterInfo ()
 
void throwBadClusterLength ()
 

Static Private Member Functions

static void throwBadChannelLength (const uint16_t length)
 
static void throwUnorderedData (const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
 

Private Attributes

uint16_t channelPayloadLength_
 
uint16_t channelPayloadOffset_
 
size_t currentOffset_
 
uint8_t currentStrip_
 
const uint8_t * data_
 
size_t offsetIncrement_
 
uint8_t valuesLeftInCluster_
 

Detailed Description

Definition at line 83 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( )
inline

Definition at line 210 of file SiStripFEDBuffer.h.

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( const uint8_t *  payload,
const size_t  channelPayloadOffset,
const int16_t  channelPayloadLength,
const size_t  offsetIncrement = 1 
)
inlineprivate

Definition at line 218 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

219  : data_(payload),
220  currentOffset_(channelPayloadOffset),
221  offsetIncrement_(offsetIncrement),
222  currentStrip_(0),
224  channelPayloadOffset_(channelPayloadOffset),
225  channelPayloadLength_(channelPayloadLength)
226  {
228  }

Member Function Documentation

uint8_t sistrip::FEDZSChannelUnpacker::adc ( ) const
inline

Definition at line 260 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

Referenced by ThreeThresholdAlgorithm::addFed(), and sistrip::RawToDigiUnpacker::createDigis().

261  {
262  return data_[currentOffset_^7];
263  }
uint16_t sistrip::FEDZSChannelUnpacker::adcPreMix ( ) const
inline

Definition at line 265 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

Referenced by sistrip::RawToDigiUnpacker::createDigis().

266  {
267  return ( data_[currentOffset_^7] + ((data_[(currentOffset_+1)^7]&0x03)<<8) );
268  }
bool sistrip::FEDZSChannelUnpacker::hasData ( ) const
inline
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( void  )
inline

Definition at line 275 of file SiStripFEDBuffer.h.

References currentOffset_, currentStrip_, hasData(), offsetIncrement_, readNewClusterInfo(), throwUnorderedData(), and valuesLeftInCluster_.

276  {
277  if (valuesLeftInCluster_) {
278  currentStrip_++;
281  } else {
283  if (hasData()) {
284  const uint8_t oldStrip = currentStrip_;
286  if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
287  }
288  }
289  return (*this);
290  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  )
inline

Definition at line 292 of file SiStripFEDBuffer.h.

293  {
294  ++(*this); return *this;
295  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::preMixRawModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 246 of file SiStripFEDBuffer.h.

References sistrip::FEDChannel::data(), sistrip::FEDChannel::length(), sistrip::FEDChannel::offset(), query::result, and throwBadChannelLength().

Referenced by sistrip::RawToDigiUnpacker::createDigis().

247  {
248  //CAMM - to modify more ?
249  uint16_t length = channel.length();
250  if (length & 0xF000) throwBadChannelLength(length);
251  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7,2);
252  return result;
253  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const
inline

Definition at line 255 of file SiStripFEDBuffer.h.

References currentStrip_.

Referenced by ThreeThresholdAlgorithm::addFed(), and sistrip::RawToDigiUnpacker::createDigis().

256  {
257  return currentStrip_;
258  }
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length)
staticprivate

Definition at line 441 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by preMixRawModeUnpacker(), zeroSuppressedLiteModeUnpacker(), and zeroSuppressedModeUnpacker().

442  {
443  std::ostringstream ss;
444  ss << "Channel length is longer than max allowed value. "
445  << "Channel length is " << uint16_t(length) << "."
446  << std::endl;
447  throw cms::Exception("FEDBuffer") << ss.str();
448  }
void sistrip::FEDZSChannelUnpacker::throwBadClusterLength ( )
private

Definition at line 450 of file SiStripFEDBuffer.cc.

References Exception, contentValuesCheck::ss, and valuesLeftInCluster_.

451  {
452  std::ostringstream ss;
453  ss << "Cluster does not fit into channel. "
454  << "Cluster length is " << uint16_t(valuesLeftInCluster_) << "."
455  << std::endl;
456  throw cms::Exception("FEDBuffer") << ss.str();
457  }
void sistrip::FEDZSChannelUnpacker::throwUnorderedData ( const uint8_t  currentStrip,
const uint8_t  firstStripOfNewCluster 
)
staticprivate

Definition at line 459 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by operator++().

460  {
461  std::ostringstream ss;
462  ss << "First strip of new cluster is not greater than last strip of previous cluster. "
463  << "Last strip of previous cluster is " << uint16_t(currentStrip) << ". "
464  << "First strip of new cluster is " << uint16_t(firstStripOfNewCluster) << "."
465  << std::endl;
466  throw cms::Exception("FEDBuffer") << ss.str();
467  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 238 of file SiStripFEDBuffer.h.

References sistrip::FEDChannel::data(), sistrip::FEDChannel::length(), sistrip::FEDChannel::offset(), query::result, and throwBadChannelLength().

Referenced by sistrip::RawToDigiUnpacker::createDigis().

239  {
240  uint16_t length = channel.length();
241  if (length & 0xF000) throwBadChannelLength(length);
242  FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
243  return result;
244  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 230 of file SiStripFEDBuffer.h.

References sistrip::FEDChannel::data(), sistrip::FEDChannel::length(), sistrip::FEDChannel::offset(), query::result, and throwBadChannelLength().

Referenced by sistrip::RawToDigiUnpacker::createDigis().

231  {
232  uint16_t length = channel.length();
233  if (length & 0xF000) throwBadChannelLength(length);
234  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
235  return result;
236  }
tuple result
Definition: query.py:137
static void throwBadChannelLength(const uint16_t length)

Member Data Documentation

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadLength_
private

Definition at line 109 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 108 of file SiStripFEDBuffer.h.

Referenced by hasData().

size_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 104 of file SiStripFEDBuffer.h.

Referenced by adc(), adcPreMix(), hasData(), operator++(), and readNewClusterInfo().

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 106 of file SiStripFEDBuffer.h.

Referenced by operator++(), readNewClusterInfo(), and sampleNumber().

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 103 of file SiStripFEDBuffer.h.

Referenced by adc(), adcPreMix(), and readNewClusterInfo().

size_t sistrip::FEDZSChannelUnpacker::offsetIncrement_
private

Definition at line 105 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 107 of file SiStripFEDBuffer.h.

Referenced by operator++(), readNewClusterInfo(), and throwBadClusterLength().