CMS 3D CMS Logo

sistrip::TrackerSpecialHeader Class Reference

#include <EventFilter/SiStripRawToDigi/interface/SiStripFEDBufferComponents.h>

List of all members.

Public Member Functions

uint8_t apvAddressErrorRegister () const
uint8_t apveAddress () const
FEDBufferFormat bufferFormat () const
uint8_t bufferFormatByte () const
FEDDataType dataType () const
FEDStatusRegister fedStatusRegister () const
uint16_t fedStatusRegisterWord () const
bool feEnabled (uint8_t internalFEUnitNum) const
uint8_t feEnableRegister () const
bool feOverflow (uint8_t internalFEUnitNum) const
uint8_t feOverflowRegister () const
const uint8_t * getPointer () const
FEDHeaderType headerType () const
uint8_t headerTypeNibble () const
bool majorityAddressErrorForFEUnit (uint8_t internalFEUnitNum) const
void print (std::ostream &os) const
FEDReadoutMode readoutMode () const
uint8_t trackerEventTypeNibble () const
 TrackerSpecialHeader (const uint8_t *headerPointer)
 TrackerSpecialHeader ()

Private Types

enum  byteIndicies {
  FEDSTATUS = 0, FEOVERFLOW = 2, FEENABLE = 3, ADDRESSERROR = 4,
  APVEADDRESS = 5, BUFFERTYPE = 6, BUFFERFORMAT = 7
}

Private Attributes

uint8_t specialHeader_ [8]
bool wordSwapped_


Detailed Description

Definition at line 162 of file SiStripFEDBufferComponents.h.


Member Enumeration Documentation

enum sistrip::TrackerSpecialHeader::byteIndicies [private]

Enumerator:
FEDSTATUS 
FEOVERFLOW 
FEENABLE 
ADDRESSERROR 
APVEADDRESS 
BUFFERTYPE 
BUFFERFORMAT 

Definition at line 187 of file SiStripFEDBufferComponents.h.


Constructor & Destructor Documentation

sistrip::TrackerSpecialHeader::TrackerSpecialHeader (  )  [inline]

Definition at line 360 of file SiStripFEDBufferComponents.h.

00361     : wordSwapped_(false)
00362     {
00363     }

sistrip::TrackerSpecialHeader::TrackerSpecialHeader ( const uint8_t *  headerPointer  ) 

Definition at line 266 of file SiStripFEDBufferComponents.cc.

References sistrip::BUFFER_FORMAT_CODE_NEW, sistrip::BUFFER_FORMAT_CODE_OLD, BUFFERFORMAT, specialHeader_, and wordSwapped_.

00267   {
00268     //the buffer format byte is one of the valid values if we assume the buffer is not swapped
00269     const bool validFormatByteWhenNotWordSwapped = ( (headerPointer[BUFFERFORMAT] == BUFFER_FORMAT_CODE_NEW) ||
00270                                                      (headerPointer[BUFFERFORMAT] == BUFFER_FORMAT_CODE_OLD) );
00271     //the buffer format byte is the old value if we assume the buffer is swapped
00272     const bool validFormatByteWhenWordSwapped = (headerPointer[BUFFERFORMAT^4] == BUFFER_FORMAT_CODE_OLD);
00273     //if the buffer format byte is valid if the buffer is not swapped or it is never valid
00274     if (validFormatByteWhenNotWordSwapped || (!validFormatByteWhenNotWordSwapped && !validFormatByteWhenWordSwapped) ) {
00275       memcpy(specialHeader_,headerPointer,8);
00276       wordSwapped_ = false;
00277     } else {
00278       memcpy(specialHeader_,headerPointer+4,4);
00279       memcpy(specialHeader_+4,headerPointer,4);
00280       wordSwapped_ = true;
00281     }
00282   }


Member Function Documentation

uint8_t sistrip::TrackerSpecialHeader::apvAddressErrorRegister (  )  const [inline]

Definition at line 177 of file SiStripFEDBufferComponents.h.

References ADDRESSERROR, and specialHeader_.

Referenced by majorityAddressErrorForFEUnit().

00177 { return specialHeader_[ADDRESSERROR]; }

uint8_t sistrip::TrackerSpecialHeader::apveAddress (  )  const [inline]

Definition at line 176 of file SiStripFEDBufferComponents.h.

References APVEADDRESS, and specialHeader_.

Referenced by sistrip::FEDBufferBase::apveAddress().

00176 { return specialHeader_[APVEADDRESS]; }

FEDBufferFormat sistrip::TrackerSpecialHeader::bufferFormat (  )  const

Definition at line 284 of file SiStripFEDBufferComponents.cc.

References sistrip::BUFFER_FORMAT_CODE_NEW, sistrip::BUFFER_FORMAT_CODE_OLD, sistrip::BUFFER_FORMAT_INVALID, sistrip::BUFFER_FORMAT_NEW, sistrip::BUFFER_FORMAT_OLD_SLINK, sistrip::BUFFER_FORMAT_OLD_VME, bufferFormatByte(), and wordSwapped_.

Referenced by sistrip::FEDBufferBase::bufferFormat(), and sistrip::FEDBufferBase::FEDBufferBase().

00285   {
00286     if (bufferFormatByte() == BUFFER_FORMAT_CODE_NEW) return BUFFER_FORMAT_NEW;
00287     else if (bufferFormatByte() == BUFFER_FORMAT_CODE_OLD) {
00288       if (wordSwapped_) return BUFFER_FORMAT_OLD_VME;
00289       else return BUFFER_FORMAT_OLD_SLINK;
00290     }
00291     else return BUFFER_FORMAT_INVALID;
00292   }

uint8_t sistrip::TrackerSpecialHeader::bufferFormatByte (  )  const [inline]

Definition at line 169 of file SiStripFEDBufferComponents.h.

References BUFFERFORMAT, and specialHeader_.

Referenced by bufferFormat().

00169 { return specialHeader_[BUFFERFORMAT]; }

FEDDataType sistrip::TrackerSpecialHeader::dataType (  )  const

Definition at line 322 of file SiStripFEDBufferComponents.cc.

References sistrip::DATA_TYPE_REAL, sistrip::READOUT_MODE_SCOPE, and trackerEventTypeNibble().

Referenced by sistrip::FEDBufferBase::dataType().

00323   {
00324     uint8_t eventTypeNibble = trackerEventTypeNibble();
00325     //if it is scope mode then it is always real
00326     if (eventTypeNibble == READOUT_MODE_SCOPE) return DATA_TYPE_REAL;
00327     //in other modes it is the lowest order bit of event type nibble
00328     else return FEDDataType(eventTypeNibble & 0x1);
00329   }

FEDStatusRegister sistrip::TrackerSpecialHeader::fedStatusRegister (  )  const [inline]

Definition at line 184 of file SiStripFEDBufferComponents.h.

References fedStatusRegisterWord().

Referenced by sistrip::FEDBufferBase::fedStatusRegister().

00184 { return FEDStatusRegister(fedStatusRegisterWord()); }

uint16_t sistrip::TrackerSpecialHeader::fedStatusRegisterWord (  )  const [inline]

Definition at line 380 of file SiStripFEDBufferComponents.h.

References FEDSTATUS, and specialHeader_.

Referenced by fedStatusRegister().

00381     {
00382       //get 16 bits
00383       uint16_t statusRegister = ( (specialHeader_[(FEDSTATUS+1)]<<8) | specialHeader_[FEDSTATUS]);
00384       return statusRegister;
00385     }

bool sistrip::TrackerSpecialHeader::feEnabled ( uint8_t  internalFEUnitNum  )  const [inline]

Definition at line 370 of file SiStripFEDBufferComponents.h.

References feEnableRegister().

Referenced by sistrip::FEDBufferBase::feEnabled().

00371     {
00372       return ( (0x1<<internalFEUnitNum) & feEnableRegister() );
00373     }

uint8_t sistrip::TrackerSpecialHeader::feEnableRegister (  )  const [inline]

Definition at line 179 of file SiStripFEDBufferComponents.h.

References FEENABLE, and specialHeader_.

Referenced by feEnabled().

00179 { return specialHeader_[FEENABLE]; }

bool sistrip::TrackerSpecialHeader::feOverflow ( uint8_t  internalFEUnitNum  )  const [inline]

Definition at line 375 of file SiStripFEDBufferComponents.h.

References feOverflowRegister().

Referenced by sistrip::FEDBufferBase::feOverflow().

00376     {
00377       return ( (0x1<<internalFEUnitNum) & feOverflowRegister() );
00378     }

uint8_t sistrip::TrackerSpecialHeader::feOverflowRegister (  )  const [inline]

Definition at line 181 of file SiStripFEDBufferComponents.h.

References FEOVERFLOW, and specialHeader_.

Referenced by sistrip::FEDBufferBase::checkNoFEOverflows(), and feOverflow().

00181 { return specialHeader_[FEOVERFLOW]; }

const uint8_t* sistrip::TrackerSpecialHeader::getPointer (  )  const [inline]

Definition at line 168 of file SiStripFEDBufferComponents.h.

References specialHeader_.

00168 { return specialHeader_; }

FEDHeaderType sistrip::TrackerSpecialHeader::headerType (  )  const

Definition at line 294 of file SiStripFEDBufferComponents.cc.

References sistrip::HEADER_TYPE_APV_ERROR, sistrip::HEADER_TYPE_FULL_DEBUG, sistrip::HEADER_TYPE_INVALID, and headerTypeNibble().

Referenced by sistrip::FEDBufferBase::headerType().

00295   {
00296     if ( (headerTypeNibble() == HEADER_TYPE_FULL_DEBUG) || 
00297          (headerTypeNibble() == HEADER_TYPE_APV_ERROR) )
00298       return FEDHeaderType(headerTypeNibble());
00299     else return HEADER_TYPE_INVALID;
00300   }

uint8_t sistrip::TrackerSpecialHeader::headerTypeNibble (  )  const [inline]

Definition at line 171 of file SiStripFEDBufferComponents.h.

References BUFFERTYPE, and specialHeader_.

Referenced by sistrip::FEDBuffer::FEDBuffer(), and headerType().

00171 { return ( (specialHeader_[BUFFERTYPE] & 0xF0) >> 4 ); }

bool sistrip::TrackerSpecialHeader::majorityAddressErrorForFEUnit ( uint8_t  internalFEUnitNum  )  const [inline]

Definition at line 365 of file SiStripFEDBufferComponents.h.

References apvAddressErrorRegister().

Referenced by sistrip::FEDBufferBase::majorityAddressErrorForFEUnit().

00366     {
00367       return ( (0x1<<internalFEUnitNum) & apvAddressErrorRegister() );
00368     }

void sistrip::TrackerSpecialHeader::print ( std::ostream &  os  )  const [inline]

Definition at line 185 of file SiStripFEDBufferComponents.h.

References sistrip::printHex(), and specialHeader_.

Referenced by sistrip::operator<<().

00185 { printHex(specialHeader_,8,os); }

FEDReadoutMode sistrip::TrackerSpecialHeader::readoutMode (  )  const

Definition at line 302 of file SiStripFEDBufferComponents.cc.

References mode, sistrip::READOUT_MODE_INVALID, sistrip::READOUT_MODE_PROC_RAW, sistrip::READOUT_MODE_SCOPE, sistrip::READOUT_MODE_VIRGIN_RAW, sistrip::READOUT_MODE_ZERO_SUPPRESSED, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE, and trackerEventTypeNibble().

Referenced by sistrip::FEDBufferBase::readoutMode().

00303   {
00304     const uint8_t eventTypeNibble = trackerEventTypeNibble();
00305     //if it is scope mode then return as is (it cannot be fake data)
00306     if (eventTypeNibble == READOUT_MODE_SCOPE) return FEDReadoutMode(eventTypeNibble);
00307     //if not then ignore the last bit which indicates if it is real or fake
00308     else {
00309       const uint8_t mode = (eventTypeNibble & 0xE);
00310       switch(mode) {
00311       case READOUT_MODE_VIRGIN_RAW:
00312       case READOUT_MODE_PROC_RAW:
00313       case READOUT_MODE_ZERO_SUPPRESSED:
00314       case READOUT_MODE_ZERO_SUPPRESSED_LITE:
00315         return FEDReadoutMode(mode);
00316       default:
00317         return READOUT_MODE_INVALID;
00318       }
00319     }   
00320   }

uint8_t sistrip::TrackerSpecialHeader::trackerEventTypeNibble (  )  const [inline]

Definition at line 173 of file SiStripFEDBufferComponents.h.

References BUFFERTYPE, and specialHeader_.

Referenced by dataType(), and readoutMode().

00173 { return (specialHeader_[BUFFERTYPE] & 0x0F); }


Member Data Documentation

uint8_t sistrip::TrackerSpecialHeader::specialHeader_[8] [private]

Definition at line 189 of file SiStripFEDBufferComponents.h.

Referenced by apvAddressErrorRegister(), apveAddress(), bufferFormatByte(), fedStatusRegisterWord(), feEnableRegister(), feOverflowRegister(), getPointer(), headerTypeNibble(), print(), trackerEventTypeNibble(), and TrackerSpecialHeader().

bool sistrip::TrackerSpecialHeader::wordSwapped_ [private]

Definition at line 191 of file SiStripFEDBufferComponents.h.

Referenced by bufferFormat(), and TrackerSpecialHeader().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:52:35 2009 for CMSSW by  doxygen 1.5.4