CMS 3D CMS Logo

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

#include <Phase2TrackerFEDDAQTrailer.h>

Public Member Functions

bool badSourceID () const
 
bool cBit () const
 
uint16_t crc () const
 
const uint8_t * data () const
 
uint8_t eoeNibble () const
 
uint32_t eventLengthIn64BitWords () const
 
uint32_t eventLengthInBytes () const
 
uint8_t eventStatusNibble () const
 
bool fBit () const
 
 FEDDAQTrailer ()
 
 FEDDAQTrailer (const uint8_t *trailer)
 
 FEDDAQTrailer (const uint32_t eventLengthIn64BitWords, const uint16_t crc=0, const FEDTTSBits ttsBits=TTS_READY, const bool slinkTransmissionError=false, const bool badFEDID=false, const bool slinkCRCError=false, const uint8_t eventStatusNibble=0)
 
bool lastTrailer () const
 
void print (std::ostream &os) const
 
bool rBit () const
 
void setBadSourceIDBit (const bool bitSet)
 
void setCRC (const uint16_t crc)
 
void setEventLengthIn64BitWords (const uint32_t eventLengthIn64BitWords)
 
void setEventStatusNibble (const uint8_t eventStatusNibble)
 
void setSLinkCRCErrorBit (const bool bitSet)
 
void setSLinkTransmissionErrorBit (const bool bitSet)
 
void setTTSBits (const FEDTTSBits ttsBits)
 
bool slinkCRCError () const
 
bool slinkTransmissionError () const
 
bool tBit () const
 
FEDTTSBits ttsBits () const
 
uint8_t ttsNibble () const
 

Private Attributes

uint8_t trailer_ [8]
 

Detailed Description

Definition at line 30 of file Phase2TrackerFEDDAQTrailer.h.

Constructor & Destructor Documentation

Phase2Tracker::FEDDAQTrailer::FEDDAQTrailer ( )
inline

Definition at line 32 of file Phase2TrackerFEDDAQTrailer.h.

32 {}
Phase2Tracker::FEDDAQTrailer::FEDDAQTrailer ( const uint8_t *  trailer)
inlineexplicit

Definition at line 86 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

86 { memcpy(trailer_, trailer, 8); }
Phase2Tracker::FEDDAQTrailer::FEDDAQTrailer ( const uint32_t  eventLengthIn64BitWords,
const uint16_t  crc = 0,
const FEDTTSBits  ttsBits = TTS_READY,
const bool  slinkTransmissionError = false,
const bool  badFEDID = false,
const bool  slinkCRCError = false,
const uint8_t  eventStatusNibble = 0 
)

Definition at line 58 of file Phase2TrackerFEDDAQTrailer.cc.

References setBadSourceIDBit(), setCRC(), setEventLengthIn64BitWords(), setEventStatusNibble(), setSLinkCRCErrorBit(), setSLinkTransmissionErrorBit(), setTTSBits(), and trailer_.

64  {
65  //clear everything (T,x,$ all set to 0)
66  memset(trailer_, 0x0, 8);
67  //set the EoE nibble to indicate this is the last fragment
68  trailer_[7] = 0xA0;
69  //set variable fields vith values supplied
73  setCRC(crc);
75  setBadSourceIDBit(badFEDID);
77  }
void setSLinkCRCErrorBit(const bool bitSet)
void setSLinkTransmissionErrorBit(const bool bitSet)
void setEventStatusNibble(const uint8_t eventStatusNibble)
void setTTSBits(const FEDTTSBits ttsBits)
void setEventLengthIn64BitWords(const uint32_t eventLengthIn64BitWords)
void setBadSourceIDBit(const bool bitSet)

Member Function Documentation

bool Phase2Tracker::FEDDAQTrailer::badSourceID ( ) const
inline

Definition at line 46 of file Phase2TrackerFEDDAQTrailer.h.

References fBit().

46 { return fBit(); }
bool Phase2Tracker::FEDDAQTrailer::cBit ( ) const
inline

Definition at line 98 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by slinkTransmissionError().

98 { return (trailer_[1] & 0x80); }
uint16_t Phase2Tracker::FEDDAQTrailer::crc ( void  ) const
inline

Definition at line 96 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by Phase2Tracker::Phase2TrackerFEDBuffer::daqCRC().

96 { return (trailer_[2] | (trailer_[3] << 8)); }
const uint8_t * Phase2Tracker::FEDDAQTrailer::data ( ) const
inline

Definition at line 112 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

uint8_t Phase2Tracker::FEDDAQTrailer::eoeNibble ( ) const
inline

Definition at line 88 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

88 { return ((trailer_[7] & 0xF0) >> 4); }
uint32_t Phase2Tracker::FEDDAQTrailer::eventLengthIn64BitWords ( ) const
inline

Definition at line 90 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by Phase2Tracker::Phase2TrackerFEDBuffer::daqEventLengthIn64bitWords(), and eventLengthInBytes().

90  {
91  return (trailer_[4] | (trailer_[5] << 8) | (trailer_[6] << 16));
92  }
uint32_t Phase2Tracker::FEDDAQTrailer::eventLengthInBytes ( ) const
inline
uint8_t Phase2Tracker::FEDDAQTrailer::eventStatusNibble ( ) const
inline

Definition at line 102 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

102 { return (trailer_[1] & 0x0F); }
bool Phase2Tracker::FEDDAQTrailer::fBit ( ) const
inline

Definition at line 100 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by badSourceID().

100 { return (trailer_[1] & 0x40); }
bool Phase2Tracker::FEDDAQTrailer::lastTrailer ( ) const
inline

Definition at line 52 of file Phase2TrackerFEDDAQTrailer.h.

References tBit().

52 { return !tBit(); }
void Phase2Tracker::FEDDAQTrailer::print ( std::ostream &  os) const
inline

Definition at line 110 of file Phase2TrackerFEDDAQTrailer.h.

References Phase2Tracker::printHex(), and trailer_.

110 { printHex(trailer_, 8, os); }
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:58
bool Phase2Tracker::FEDDAQTrailer::rBit ( ) const
inline

Definition at line 108 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by slinkCRCError().

108 { return (trailer_[0] & 0x04); }
void Phase2Tracker::FEDDAQTrailer::setBadSourceIDBit ( const bool  bitSet)

Definition at line 97 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

97  {
98  if (bitSet)
99  trailer_[1] |= 0x40;
100  else
101  trailer_[1] &= (~0x40);
102  }
void Phase2Tracker::FEDDAQTrailer::setCRC ( const uint16_t  crc)

Definition at line 85 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

85  {
86  trailer_[2] = (crc & 0x00FF);
87  trailer_[3] = ((crc >> 8) & 0x00FF);
88  }
void Phase2Tracker::FEDDAQTrailer::setEventLengthIn64BitWords ( const uint32_t  eventLengthIn64BitWords)

Definition at line 79 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

79  {
80  trailer_[4] = (eventLengthIn64BitWords & 0x000000FF);
81  trailer_[5] = ((eventLengthIn64BitWords & 0x0000FF00) >> 8);
82  trailer_[6] = ((eventLengthIn64BitWords & 0x00FF0000) >> 16);
83  }
void Phase2Tracker::FEDDAQTrailer::setEventStatusNibble ( const uint8_t  eventStatusNibble)

Definition at line 111 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

111  {
112  trailer_[1] = ((trailer_[1] & 0xF0) | (eventStatusNibble & 0x0F));
113  }
void Phase2Tracker::FEDDAQTrailer::setSLinkCRCErrorBit ( const bool  bitSet)

Definition at line 104 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

104  {
105  if (bitSet)
106  trailer_[0] |= 0x04;
107  else
108  trailer_[0] &= (~0x40);
109  }
void Phase2Tracker::FEDDAQTrailer::setSLinkTransmissionErrorBit ( const bool  bitSet)

Definition at line 90 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

90  {
91  if (bitSet)
92  trailer_[1] |= 0x80;
93  else
94  trailer_[1] &= (~0x80);
95  }
void Phase2Tracker::FEDDAQTrailer::setTTSBits ( const FEDTTSBits  ttsBits)

Definition at line 115 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_.

Referenced by FEDDAQTrailer().

115 { trailer_[0] = ((trailer_[0] & 0x0F) | (ttsBits & 0xF0)); }
bool Phase2Tracker::FEDDAQTrailer::slinkCRCError ( ) const
inline

Definition at line 56 of file Phase2TrackerFEDDAQTrailer.h.

References rBit().

56 { return rBit(); }
bool Phase2Tracker::FEDDAQTrailer::slinkTransmissionError ( ) const
inline

Definition at line 43 of file Phase2TrackerFEDDAQTrailer.h.

References cBit().

43 { return cBit(); }
bool Phase2Tracker::FEDDAQTrailer::tBit ( ) const
inline

Definition at line 106 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by lastTrailer().

106 { return (trailer_[0] & 0x08); }
FEDTTSBits Phase2Tracker::FEDDAQTrailer::ttsBits ( ) const
uint8_t Phase2Tracker::FEDDAQTrailer::ttsNibble ( ) const
inline

Definition at line 104 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by ttsBits().

104 { return ((trailer_[0] & 0xF0) >> 4); }

Member Data Documentation

uint8_t Phase2Tracker::FEDDAQTrailer::trailer_[8]
private