CMS 3D CMS Logo

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 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)
 
 FEDDAQTrailer (const uint8_t *trailer)
 
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

◆ FEDDAQTrailer() [1/3]

Phase2Tracker::FEDDAQTrailer::FEDDAQTrailer ( )
inline

Definition at line 32 of file Phase2TrackerFEDDAQTrailer.h.

32 {}

◆ FEDDAQTrailer() [2/3]

Phase2Tracker::FEDDAQTrailer::FEDDAQTrailer ( const uint8_t *  trailer)
inlineexplicit

Definition at line 86 of file Phase2TrackerFEDDAQTrailer.h.

86 { memcpy(trailer_, trailer, 8); }

References trailer_.

◆ FEDDAQTrailer() [3/3]

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.

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  }

References crc(), eventLengthIn64BitWords(), eventStatusNibble(), setBadSourceIDBit(), setCRC(), setEventLengthIn64BitWords(), setEventStatusNibble(), setSLinkCRCErrorBit(), setSLinkTransmissionErrorBit(), setTTSBits(), slinkCRCError(), slinkTransmissionError(), trailer_, and ttsBits().

Member Function Documentation

◆ badSourceID()

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

Definition at line 46 of file Phase2TrackerFEDDAQTrailer.h.

46 { return fBit(); }

References fBit().

◆ cBit()

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

Definition at line 98 of file Phase2TrackerFEDDAQTrailer.h.

98 { return (trailer_[1] & 0x80); }

References trailer_.

Referenced by slinkTransmissionError().

◆ crc()

uint16_t Phase2Tracker::FEDDAQTrailer::crc ( void  ) const
inline

Definition at line 96 of file Phase2TrackerFEDDAQTrailer.h.

96 { return (trailer_[2] | (trailer_[3] << 8)); }

References trailer_.

Referenced by Phase2Tracker::Phase2TrackerFEDBuffer::daqCRC(), FEDDAQTrailer(), and setCRC().

◆ data()

const uint8_t * Phase2Tracker::FEDDAQTrailer::data ( ) const
inline

Definition at line 112 of file Phase2TrackerFEDDAQTrailer.h.

112 { return trailer_; }

References trailer_.

◆ eoeNibble()

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

Definition at line 88 of file Phase2TrackerFEDDAQTrailer.h.

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

References trailer_.

◆ eventLengthIn64BitWords()

uint32_t Phase2Tracker::FEDDAQTrailer::eventLengthIn64BitWords ( ) const
inline

Definition at line 90 of file Phase2TrackerFEDDAQTrailer.h.

90  {
91  return (trailer_[4] | (trailer_[5] << 8) | (trailer_[6] << 16));
92  }

References trailer_.

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

◆ eventLengthInBytes()

uint32_t Phase2Tracker::FEDDAQTrailer::eventLengthInBytes ( ) const
inline

◆ eventStatusNibble()

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

Definition at line 102 of file Phase2TrackerFEDDAQTrailer.h.

102 { return (trailer_[1] & 0x0F); }

References trailer_.

Referenced by FEDDAQTrailer(), and setEventStatusNibble().

◆ fBit()

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

Definition at line 100 of file Phase2TrackerFEDDAQTrailer.h.

100 { return (trailer_[1] & 0x40); }

References trailer_.

Referenced by badSourceID().

◆ lastTrailer()

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

Definition at line 52 of file Phase2TrackerFEDDAQTrailer.h.

52 { return !tBit(); }

References tBit().

◆ print()

void Phase2Tracker::FEDDAQTrailer::print ( std::ostream &  os) const
inline

Definition at line 110 of file Phase2TrackerFEDDAQTrailer.h.

110 { printHex(trailer_, 8, os); }

References Phase2Tracker::printHex(), and trailer_.

◆ rBit()

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

Definition at line 108 of file Phase2TrackerFEDDAQTrailer.h.

108 { return (trailer_[0] & 0x04); }

References trailer_.

Referenced by slinkCRCError().

◆ setBadSourceIDBit()

void Phase2Tracker::FEDDAQTrailer::setBadSourceIDBit ( const bool  bitSet)

Definition at line 97 of file Phase2TrackerFEDDAQTrailer.cc.

97  {
98  if (bitSet)
99  trailer_[1] |= 0x40;
100  else
101  trailer_[1] &= (~0x40);
102  }

References trailer_.

Referenced by FEDDAQTrailer().

◆ setCRC()

void Phase2Tracker::FEDDAQTrailer::setCRC ( const uint16_t  crc)

Definition at line 85 of file Phase2TrackerFEDDAQTrailer.cc.

85  {
86  trailer_[2] = (crc & 0x00FF);
87  trailer_[3] = ((crc >> 8) & 0x00FF);
88  }

References crc(), and trailer_.

Referenced by FEDDAQTrailer().

◆ setEventLengthIn64BitWords()

void Phase2Tracker::FEDDAQTrailer::setEventLengthIn64BitWords ( const uint32_t  eventLengthIn64BitWords)

Definition at line 79 of file Phase2TrackerFEDDAQTrailer.cc.

79  {
80  trailer_[4] = (eventLengthIn64BitWords & 0x000000FF);
81  trailer_[5] = ((eventLengthIn64BitWords & 0x0000FF00) >> 8);
82  trailer_[6] = ((eventLengthIn64BitWords & 0x00FF0000) >> 16);
83  }

References eventLengthIn64BitWords(), and trailer_.

Referenced by FEDDAQTrailer().

◆ setEventStatusNibble()

void Phase2Tracker::FEDDAQTrailer::setEventStatusNibble ( const uint8_t  eventStatusNibble)

Definition at line 111 of file Phase2TrackerFEDDAQTrailer.cc.

111  {
112  trailer_[1] = ((trailer_[1] & 0xF0) | (eventStatusNibble & 0x0F));
113  }

References eventStatusNibble(), and trailer_.

Referenced by FEDDAQTrailer().

◆ setSLinkCRCErrorBit()

void Phase2Tracker::FEDDAQTrailer::setSLinkCRCErrorBit ( const bool  bitSet)

Definition at line 104 of file Phase2TrackerFEDDAQTrailer.cc.

104  {
105  if (bitSet)
106  trailer_[0] |= 0x04;
107  else
108  trailer_[0] &= (~0x40);
109  }

References trailer_.

Referenced by FEDDAQTrailer().

◆ setSLinkTransmissionErrorBit()

void Phase2Tracker::FEDDAQTrailer::setSLinkTransmissionErrorBit ( const bool  bitSet)

Definition at line 90 of file Phase2TrackerFEDDAQTrailer.cc.

90  {
91  if (bitSet)
92  trailer_[1] |= 0x80;
93  else
94  trailer_[1] &= (~0x80);
95  }

References trailer_.

Referenced by FEDDAQTrailer().

◆ setTTSBits()

void Phase2Tracker::FEDDAQTrailer::setTTSBits ( const FEDTTSBits  ttsBits)

Definition at line 115 of file Phase2TrackerFEDDAQTrailer.cc.

115 { trailer_[0] = ((trailer_[0] & 0x0F) | (ttsBits & 0xF0)); }

References trailer_, and ttsBits().

Referenced by FEDDAQTrailer().

◆ slinkCRCError()

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

Definition at line 56 of file Phase2TrackerFEDDAQTrailer.h.

56 { return rBit(); }

References rBit().

Referenced by FEDDAQTrailer().

◆ slinkTransmissionError()

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

Definition at line 43 of file Phase2TrackerFEDDAQTrailer.h.

43 { return cBit(); }

References cBit().

Referenced by FEDDAQTrailer().

◆ tBit()

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

Definition at line 106 of file Phase2TrackerFEDDAQTrailer.h.

106 { return (trailer_[0] & 0x08); }

References trailer_.

Referenced by lastTrailer().

◆ ttsBits()

FEDTTSBits Phase2Tracker::FEDDAQTrailer::ttsBits ( ) const

◆ ttsNibble()

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

Definition at line 104 of file Phase2TrackerFEDDAQTrailer.h.

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

References trailer_.

Referenced by ttsBits().

Member Data Documentation

◆ trailer_

uint8_t Phase2Tracker::FEDDAQTrailer::trailer_[8]
private
Phase2Tracker::FEDDAQTrailer::setEventLengthIn64BitWords
void setEventLengthIn64BitWords(const uint32_t eventLengthIn64BitWords)
Definition: Phase2TrackerFEDDAQTrailer.cc:79
Phase2Tracker::TTS_BUSY
Definition: Phase2TrackerFEDDAQTrailer.h:19
Phase2Tracker::TTS_READY
Definition: Phase2TrackerFEDDAQTrailer.h:20
Phase2Tracker::FEDDAQTrailer::slinkTransmissionError
bool slinkTransmissionError() const
Definition: Phase2TrackerFEDDAQTrailer.h:43
Phase2Tracker::FEDDAQTrailer::ttsBits
FEDTTSBits ttsBits() const
Definition: Phase2TrackerFEDDAQTrailer.cc:43
Phase2Tracker::FEDDAQTrailer::eventStatusNibble
uint8_t eventStatusNibble() const
Definition: Phase2TrackerFEDDAQTrailer.h:102
Phase2Tracker::FEDDAQTrailer::setBadSourceIDBit
void setBadSourceIDBit(const bool bitSet)
Definition: Phase2TrackerFEDDAQTrailer.cc:97
Phase2Tracker::FEDDAQTrailer::eventLengthIn64BitWords
uint32_t eventLengthIn64BitWords() const
Definition: Phase2TrackerFEDDAQTrailer.h:90
Phase2Tracker::TTS_WARN_OVERFLOW
Definition: Phase2TrackerFEDDAQTrailer.h:17
Phase2Tracker::FEDDAQTrailer::rBit
bool rBit() const
Definition: Phase2TrackerFEDDAQTrailer.h:108
Phase2Tracker::FEDDAQTrailer::setSLinkCRCErrorBit
void setSLinkCRCErrorBit(const bool bitSet)
Definition: Phase2TrackerFEDDAQTrailer.cc:104
Phase2Tracker::FEDDAQTrailer::crc
uint16_t crc() const
Definition: Phase2TrackerFEDDAQTrailer.h:96
Phase2Tracker::FEDDAQTrailer::trailer_
uint8_t trailer_[8]
Definition: Phase2TrackerFEDDAQTrailer.h:78
Phase2Tracker::TTS_INVALID
Definition: Phase2TrackerFEDDAQTrailer.h:23
Phase2Tracker::TTS_OUT_OF_SYNC
Definition: Phase2TrackerFEDDAQTrailer.h:18
Phase2Tracker::FEDDAQTrailer::setCRC
void setCRC(const uint16_t crc)
Definition: Phase2TrackerFEDDAQTrailer.cc:85
Phase2Tracker::FEDDAQTrailer::tBit
bool tBit() const
Definition: Phase2TrackerFEDDAQTrailer.h:106
Phase2Tracker::FEDDAQTrailer::fBit
bool fBit() const
Definition: Phase2TrackerFEDDAQTrailer.h:100
Phase2Tracker::FEDDAQTrailer::ttsNibble
uint8_t ttsNibble() const
Definition: Phase2TrackerFEDDAQTrailer.h:104
Phase2Tracker::FEDDAQTrailer::setEventStatusNibble
void setEventStatusNibble(const uint8_t eventStatusNibble)
Definition: Phase2TrackerFEDDAQTrailer.cc:111
Phase2Tracker::TTS_ERROR
Definition: Phase2TrackerFEDDAQTrailer.h:21
Phase2Tracker::TTS_DISCONNECTED0
Definition: Phase2TrackerFEDDAQTrailer.h:16
Phase2Tracker::TTS_DISCONNECTED1
Definition: Phase2TrackerFEDDAQTrailer.h:22
Phase2Tracker::FEDTTSBits
FEDTTSBits
Definition: Phase2TrackerFEDDAQTrailer.h:15
Phase2Tracker::printHex
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:58
Phase2Tracker::FEDDAQTrailer::setTTSBits
void setTTSBits(const FEDTTSBits ttsBits)
Definition: Phase2TrackerFEDDAQTrailer.cc:115
Phase2Tracker::FEDDAQTrailer::setSLinkTransmissionErrorBit
void setSLinkTransmissionErrorBit(const bool bitSet)
Definition: Phase2TrackerFEDDAQTrailer.cc:90
Phase2Tracker::FEDDAQTrailer::cBit
bool cBit() const
Definition: Phase2TrackerFEDDAQTrailer.h:98
Phase2Tracker::FEDDAQTrailer::slinkCRCError
bool slinkCRCError() const
Definition: Phase2TrackerFEDDAQTrailer.h:56