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 uint16_t channelPayloadOffset, const int16_t channelPayloadLength, const uint16_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_
 
uint16_t currentOffset_
 
uint8_t currentStrip_
 
const uint8_t * data_
 
uint16_t offsetIncrement_
 
uint8_t valuesLeftInCluster_
 

Detailed Description

Definition at line 86 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDZSChannelUnpacker::FEDZSChannelUnpacker ( )
inline

Definition at line 349 of file SiStripFEDBuffer.h.

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

Definition at line 357 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

358  : data_(payload),
359  currentOffset_(channelPayloadOffset),
360  offsetIncrement_(offsetIncrement),
361  currentStrip_(0),
363  channelPayloadOffset_(channelPayloadOffset),
364  channelPayloadLength_(channelPayloadLength)
365  {
367  }

Member Function Documentation

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

Definition at line 399 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

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

400  {
401  return data_[currentOffset_^7];
402  }
uint16_t sistrip::FEDZSChannelUnpacker::adcPreMix ( ) const
inline

Definition at line 404 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

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

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

Definition at line 414 of file SiStripFEDBuffer.h.

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

415  {
416  if (valuesLeftInCluster_) {
417  currentStrip_++;
420  } else {
422  if (hasData()) {
423  const uint8_t oldStrip = currentStrip_;
425  if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
426  }
427  }
428  return (*this);
429  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  )
inline

Definition at line 431 of file SiStripFEDBuffer.h.

432  {
433  ++(*this); return *this;
434  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::preMixRawModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 385 of file SiStripFEDBuffer.h.

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

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

386  {
387  //CAMM - to modify more ?
388  uint16_t length = channel.length();
389  if (length & 0xF000) throwBadChannelLength(length);
390  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7,2);
391  return result;
392  }
tuple result
Definition: mps_fire.py:95
static void throwBadChannelLength(const uint16_t length)
void sistrip::FEDZSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDZSChannelUnpacker::sampleNumber ( ) const
inline

Definition at line 394 of file SiStripFEDBuffer.h.

References currentStrip_.

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

395  {
396  return currentStrip_;
397  }
void sistrip::FEDZSChannelUnpacker::throwBadChannelLength ( const uint16_t  length)
staticprivate

Definition at line 452 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

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

453  {
454  std::ostringstream ss;
455  ss << "Channel length is longer than max allowed value. "
456  << "Channel length is " << uint16_t(length) << "."
457  << std::endl;
458  throw cms::Exception("FEDBuffer") << ss.str();
459  }
void sistrip::FEDZSChannelUnpacker::throwBadClusterLength ( )
private

Definition at line 461 of file SiStripFEDBuffer.cc.

References Exception, contentValuesCheck::ss, and valuesLeftInCluster_.

462  {
463  std::ostringstream ss;
464  ss << "Cluster does not fit into channel. "
465  << "Cluster length is " << uint16_t(valuesLeftInCluster_) << "."
466  << std::endl;
467  throw cms::Exception("FEDBuffer") << ss.str();
468  }
void sistrip::FEDZSChannelUnpacker::throwUnorderedData ( const uint8_t  currentStrip,
const uint8_t  firstStripOfNewCluster 
)
staticprivate

Definition at line 470 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by operator++().

471  {
472  std::ostringstream ss;
473  ss << "First strip of new cluster is not greater than last strip of previous cluster. "
474  << "Last strip of previous cluster is " << uint16_t(currentStrip) << ". "
475  << "First strip of new cluster is " << uint16_t(firstStripOfNewCluster) << "."
476  << std::endl;
477  throw cms::Exception("FEDBuffer") << ss.str();
478  }
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 377 of file SiStripFEDBuffer.h.

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

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

378  {
379  uint16_t length = channel.length();
380  if (length & 0xF000) throwBadChannelLength(length);
381  FEDZSChannelUnpacker result(channel.data(),channel.offset()+2,length-2);
382  return result;
383  }
tuple result
Definition: mps_fire.py:95
static void throwBadChannelLength(const uint16_t length)
FEDZSChannelUnpacker sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel)
inlinestatic

Definition at line 369 of file SiStripFEDBuffer.h.

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

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

370  {
371  uint16_t length = channel.length();
372  if (length & 0xF000) throwBadChannelLength(length);
373  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
374  return result;
375  }
tuple result
Definition: mps_fire.py:95
static void throwBadChannelLength(const uint16_t length)

Member Data Documentation

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadLength_
private

Definition at line 112 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 111 of file SiStripFEDBuffer.h.

Referenced by hasData().

uint16_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 107 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 109 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 106 of file SiStripFEDBuffer.h.

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

uint16_t sistrip::FEDZSChannelUnpacker::offsetIncrement_
private

Definition at line 108 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 110 of file SiStripFEDBuffer.h.

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