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 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

◆ 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.

References trailer_.

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

◆ 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.

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

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

◆ badSourceID()

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

Definition at line 46 of file Phase2TrackerFEDDAQTrailer.h.

References fBit().

46 { return fBit(); }

◆ cBit()

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

Definition at line 98 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by slinkTransmissionError().

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

◆ crc()

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

Definition at line 96 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

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

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

◆ data()

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

Definition at line 112 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

◆ eoeNibble()

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

Definition at line 88 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

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

◆ eventLengthIn64BitWords()

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

◆ eventLengthInBytes()

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

◆ eventStatusNibble()

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

Definition at line 102 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by FEDDAQTrailer(), and setEventStatusNibble().

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

◆ fBit()

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

Definition at line 100 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by badSourceID().

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

◆ lastTrailer()

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

Definition at line 52 of file Phase2TrackerFEDDAQTrailer.h.

References tBit().

52 { return !tBit(); }

◆ print()

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

Definition at line 110 of file Phase2TrackerFEDDAQTrailer.h.

References l1tGTMenu_BTagSeeds_cff::os, Phase2Tracker::printHex(), and trailer_.

110 { printHex(trailer_, 8, os); }
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:59

◆ rBit()

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

Definition at line 108 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by slinkCRCError().

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

◆ setBadSourceIDBit()

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  }

◆ setCRC()

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

Definition at line 85 of file Phase2TrackerFEDDAQTrailer.cc.

References crc(), and trailer_.

Referenced by FEDDAQTrailer().

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

◆ setEventLengthIn64BitWords()

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

Definition at line 79 of file Phase2TrackerFEDDAQTrailer.cc.

References eventLengthIn64BitWords(), and trailer_.

Referenced by FEDDAQTrailer().

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

◆ setEventStatusNibble()

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

Definition at line 111 of file Phase2TrackerFEDDAQTrailer.cc.

References eventStatusNibble(), and trailer_.

Referenced by FEDDAQTrailer().

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

◆ setSLinkCRCErrorBit()

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  }

◆ setSLinkTransmissionErrorBit()

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  }

◆ setTTSBits()

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

Definition at line 115 of file Phase2TrackerFEDDAQTrailer.cc.

References trailer_, and ttsBits().

Referenced by FEDDAQTrailer().

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

◆ slinkCRCError()

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

Definition at line 56 of file Phase2TrackerFEDDAQTrailer.h.

References rBit().

Referenced by FEDDAQTrailer().

56 { return rBit(); }

◆ slinkTransmissionError()

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

Definition at line 43 of file Phase2TrackerFEDDAQTrailer.h.

References cBit().

Referenced by FEDDAQTrailer().

43 { return cBit(); }

◆ tBit()

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

Definition at line 106 of file Phase2TrackerFEDDAQTrailer.h.

References trailer_.

Referenced by lastTrailer().

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

◆ ttsBits()

FEDTTSBits Phase2Tracker::FEDDAQTrailer::ttsBits ( ) const

◆ ttsNibble()

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

◆ trailer_

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