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::FEDBSChannelUnpacker Class Reference

#include <SiStripFEDBuffer.h>

Public Member Functions

uint16_t adc () const
 
 FEDBSChannelUnpacker ()
 
bool hasData () const
 
FEDBSChannelUnpackeroperator++ ()
 
FEDBSChannelUnpackeroperator++ (int)
 
uint8_t sampleNumber () const
 

Static Public Member Functions

static FEDBSChannelUnpacker virginRawModeUnpacker (const FEDChannel &channel, uint16_t num_bits)
 
static FEDBSChannelUnpacker zeroSuppressedLiteModeUnpacker (const FEDChannel &channel, uint16_t num_bits)
 
static FEDBSChannelUnpacker zeroSuppressedModeUnpacker (const FEDChannel &channel, uint16_t num_bits)
 

Private Member Functions

 FEDBSChannelUnpacker (const uint8_t *payload, const uint16_t channelPayloadOffset, const int16_t channelPayloadLength, const uint16_t offsetIncrement, bool useZS)
 
void readNewClusterInfo ()
 

Static Private Member Functions

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

Private Attributes

uint16_t bitOffsetIncrement_
 
uint16_t channelPayloadLength_
 
uint16_t channelPayloadOffset_
 
uint16_t currentBitOffset_
 
uint16_t currentLocalBitOffset_
 
uint8_t currentStrip_
 
uint16_t currentWordOffset_
 
const uint8_t * data_
 
uint16_t oldWordOffset_
 
bool useZS_
 
uint8_t valuesLeftInCluster_
 

Detailed Description

Definition at line 137 of file SiStripFEDBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDBSChannelUnpacker::FEDBSChannelUnpacker ( )
inline

Definition at line 207 of file SiStripFEDBuffer.h.

208  : data_(NULL),
212  currentStrip_(0),
214  useZS_(false), valuesLeftInCluster_(0)
215  { }
#define NULL
Definition: scimark2.h:8
sistrip::FEDBSChannelUnpacker::FEDBSChannelUnpacker ( const uint8_t *  payload,
const uint16_t  channelPayloadOffset,
const int16_t  channelPayloadLength,
const uint16_t  offsetIncrement,
bool  useZS 
)
inlineprivate

Definition at line 217 of file SiStripFEDBuffer.h.

References bitOffsetIncrement_, and throwBadWordLength().

218  : data_(payload),
219  oldWordOffset_(0), currentWordOffset_(channelPayloadOffset),
221  bitOffsetIncrement_(offsetIncrement),
222  channelPayloadOffset_(channelPayloadOffset),
223  channelPayloadLength_(channelPayloadLength),
224  useZS_(useZS), valuesLeftInCluster_(0)
225  {
226  if (bitOffsetIncrement_>16) throwBadWordLength(bitOffsetIncrement_); // more than 2 words... still to be implemented
227  }
static void throwBadWordLength(const uint16_t word_length)

Member Function Documentation

uint16_t sistrip::FEDBSChannelUnpacker::adc ( ) const
inline

Definition at line 259 of file SiStripFEDBuffer.h.

References bitOffsetIncrement_, currentLocalBitOffset_, currentWordOffset_, data_, and oldWordOffset_.

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

260  {
261  uint16_t bits_missing = (bitOffsetIncrement_-8)+currentLocalBitOffset_;
262  uint16_t adc = (data_[currentWordOffset_^7]<<bits_missing);
264  adc += ( (data_[(currentWordOffset_+1)^7]>>(8-bits_missing)) );
265  }
266  return (adc&((1<<bitOffsetIncrement_)-1));
267  }
bool sistrip::FEDBSChannelUnpacker::hasData ( ) const
inline
FEDBSChannelUnpacker & sistrip::FEDBSChannelUnpacker::operator++ ( void  )
inline

Definition at line 274 of file SiStripFEDBuffer.h.

References bitOffsetIncrement_, currentBitOffset_, currentLocalBitOffset_, currentStrip_, currentWordOffset_, hasData(), oldWordOffset_, readNewClusterInfo(), throwUnorderedData(), useZS_, and valuesLeftInCluster_.

275  {
279  while (currentLocalBitOffset_>=8) {
282  }
283  if (useZS_) {
285  else {
286  if (hasData()) {
287  const uint8_t oldStrip = currentStrip_;
289  if ( !(currentStrip_ > oldStrip) ) throwUnorderedData(oldStrip,currentStrip_);
290  }
291  }
292  } else { currentStrip_++; }
293  return (*this);
294  }
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
FEDBSChannelUnpacker & sistrip::FEDBSChannelUnpacker::operator++ ( int  )
inline

Definition at line 296 of file SiStripFEDBuffer.h.

297  {
298  ++(*this); return *this;
299  }
void sistrip::FEDBSChannelUnpacker::readNewClusterInfo ( )
inlineprivate
uint8_t sistrip::FEDBSChannelUnpacker::sampleNumber ( ) const
inline

Definition at line 254 of file SiStripFEDBuffer.h.

References currentStrip_.

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

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

Definition at line 424 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

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

425  {
426  std::ostringstream ss;
427  ss << "Channel length is invalid. "
428  << "Channel length is " << uint16_t(length) << "."
429  << std::endl;
430  throw cms::Exception("FEDBuffer") << ss.str();
431  }
void sistrip::FEDBSChannelUnpacker::throwBadWordLength ( const uint16_t  word_length)
staticprivate

Definition at line 433 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by FEDBSChannelUnpacker(), and virginRawModeUnpacker().

434  {
435  std::ostringstream ss;
436  ss << "Word length is invalid. "
437  << "Word length is " << word_length << "."
438  << std::endl;
439  throw cms::Exception("FEDBuffer") << ss.str();
440  }
void sistrip::FEDBSChannelUnpacker::throwUnorderedData ( const uint8_t  currentStrip,
const uint8_t  firstStripOfNewCluster 
)
staticprivate

Definition at line 442 of file SiStripFEDBuffer.cc.

References Exception, and contentValuesCheck::ss.

Referenced by operator++().

443  {
444  std::ostringstream ss;
445  ss << "First strip of new cluster is not greater than last strip of previous cluster. "
446  << "Last strip of previous cluster is " << uint16_t(currentStrip) << ". "
447  << "First strip of new cluster is " << uint16_t(firstStripOfNewCluster) << "."
448  << std::endl;
449  throw cms::Exception("FEDBuffer") << ss.str();
450  }
FEDBSChannelUnpacker sistrip::FEDBSChannelUnpacker::virginRawModeUnpacker ( const FEDChannel channel,
uint16_t  num_bits 
)
inlinestatic

Definition at line 229 of file SiStripFEDBuffer.h.

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

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

230  {
231  uint16_t length = channel.length();
232  if (length & 0xF000) throwBadChannelLength(length);
233  if (num_bits<=0 or num_bits>16) throwBadWordLength(num_bits);
234  FEDBSChannelUnpacker result(channel.data(), channel.offset()+3, length-3, num_bits, false);
235  return result;
236  }
static void throwBadWordLength(const uint16_t word_length)
static void throwBadChannelLength(const uint16_t length)
tuple result
Definition: query.py:137
FEDBSChannelUnpacker sistrip::FEDBSChannelUnpacker::zeroSuppressedLiteModeUnpacker ( const FEDChannel channel,
uint16_t  num_bits 
)
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  uint16_t length = channel.length();
249  if (length & 0xF000) throwBadChannelLength(length);
250  FEDBSChannelUnpacker result(channel.data(), channel.offset()+2, length-2, num_bits, true);
251  return result;
252  }
static void throwBadChannelLength(const uint16_t length)
tuple result
Definition: query.py:137
FEDBSChannelUnpacker sistrip::FEDBSChannelUnpacker::zeroSuppressedModeUnpacker ( const FEDChannel channel,
uint16_t  num_bits 
)
inlinestatic

Definition at line 238 of file SiStripFEDBuffer.h.

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

239  {
240  uint16_t length = channel.length();
241  if (length & 0xF000) throwBadChannelLength(length);
242  FEDBSChannelUnpacker result(channel.data(), channel.offset()+7, length-7, num_bits, true);
243  return result;
244  }
static void throwBadChannelLength(const uint16_t length)
tuple result
Definition: query.py:137

Member Data Documentation

uint16_t sistrip::FEDBSChannelUnpacker::bitOffsetIncrement_
private

Definition at line 161 of file SiStripFEDBuffer.h.

Referenced by adc(), FEDBSChannelUnpacker(), and operator++().

uint16_t sistrip::FEDBSChannelUnpacker::channelPayloadLength_
private

Definition at line 164 of file SiStripFEDBuffer.h.

Referenced by hasData().

uint16_t sistrip::FEDBSChannelUnpacker::channelPayloadOffset_
private

Definition at line 163 of file SiStripFEDBuffer.h.

Referenced by hasData().

uint16_t sistrip::FEDBSChannelUnpacker::currentBitOffset_
private

Definition at line 159 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint16_t sistrip::FEDBSChannelUnpacker::currentLocalBitOffset_
private

Definition at line 160 of file SiStripFEDBuffer.h.

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

uint8_t sistrip::FEDBSChannelUnpacker::currentStrip_
private

Definition at line 162 of file SiStripFEDBuffer.h.

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

uint16_t sistrip::FEDBSChannelUnpacker::currentWordOffset_
private

Definition at line 158 of file SiStripFEDBuffer.h.

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

const uint8_t* sistrip::FEDBSChannelUnpacker::data_
private

Definition at line 156 of file SiStripFEDBuffer.h.

Referenced by adc(), and readNewClusterInfo().

uint16_t sistrip::FEDBSChannelUnpacker::oldWordOffset_
private

Definition at line 157 of file SiStripFEDBuffer.h.

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

bool sistrip::FEDBSChannelUnpacker::useZS_
private

Definition at line 165 of file SiStripFEDBuffer.h.

Referenced by operator++().

uint8_t sistrip::FEDBSChannelUnpacker::valuesLeftInCluster_
private

Definition at line 166 of file SiStripFEDBuffer.h.

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