CMS 3D CMS Logo

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 88 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

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

Definition at line 359 of file SiStripFEDBuffer.h.

References channelPayloadLength_, and readNewClusterInfo().

360  : data_(payload),
361  currentOffset_(channelPayloadOffset),
362  offsetIncrement_(offsetIncrement),
363  currentStrip_(0),
365  channelPayloadOffset_(channelPayloadOffset),
366  channelPayloadLength_(channelPayloadLength)
367  {
369  }

Member Function Documentation

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

Definition at line 401 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

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

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

Definition at line 406 of file SiStripFEDBuffer.h.

References currentOffset_, and data_.

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

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

Definition at line 416 of file SiStripFEDBuffer.h.

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

417  {
418  if (valuesLeftInCluster_) {
419  currentStrip_++;
422  } else {
424  if (hasData()) {
425  const uint8_t oldStrip = currentStrip_;
427  if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
428  }
429  }
430  return (*this);
431  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDZSChannelUnpacker & sistrip::FEDZSChannelUnpacker::operator++ ( int  )
inline

Definition at line 433 of file SiStripFEDBuffer.h.

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

Definition at line 387 of file SiStripFEDBuffer.h.

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

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

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

Definition at line 396 of file SiStripFEDBuffer.h.

References currentStrip_.

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

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

Definition at line 452 of file SiStripFEDBuffer.cc.

References Exception.

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.

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.

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 379 of file SiStripFEDBuffer.h.

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

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and SiStripClusterizerFromRaw::run().

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

Definition at line 371 of file SiStripFEDBuffer.h.

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

Referenced by sistrip::RawToDigiUnpacker::createDigis(), and SiStripClusterizerFromRaw::run().

372  {
373  uint16_t length = channel.length();
374  if (length & 0xF000) throwBadChannelLength(length);
375  FEDZSChannelUnpacker result(channel.data(),channel.offset()+7,length-7);
376  return result;
377  }
static void throwBadChannelLength(const uint16_t length)

Member Data Documentation

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadLength_
private

Definition at line 114 of file SiStripFEDBuffer.h.

Referenced by FEDZSChannelUnpacker(), and hasData().

uint16_t sistrip::FEDZSChannelUnpacker::channelPayloadOffset_
private

Definition at line 113 of file SiStripFEDBuffer.h.

Referenced by hasData().

uint16_t sistrip::FEDZSChannelUnpacker::currentOffset_
private

Definition at line 109 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDZSChannelUnpacker::currentStrip_
private

Definition at line 111 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDZSChannelUnpacker::data_
private

Definition at line 108 of file SiStripFEDBuffer.h.

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

uint16_t sistrip::FEDZSChannelUnpacker::offsetIncrement_
private

Definition at line 110 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint8_t sistrip::FEDZSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 112 of file SiStripFEDBuffer.h.

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