CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
sistrip::FEDSpyBuffer Class Reference

#include <SiStripFEDSpyBuffer.h>

Inheritance diagram for sistrip::FEDSpyBuffer:
sistrip::FEDBufferBase

Public Member Functions

bool channelGood (const uint8_t internalFEDannelNum) const override
 
bool delayChipGood (const uint8_t delayChip) const
 
uint32_t delayChipL1ID (const uint8_t delayChip) const
 
uint32_t delayChipTotalEventCount (const uint8_t delayChip) const
 
 FEDSpyBuffer (const FEDRawData &fedBuffer)
 
uint32_t globalRunNumber () const
 
void print (std::ostream &os) const override
 
uint32_t spyHeaderL1ID () const
 
uint32_t spyHeaderTotalEventCount () const
 
 ~FEDSpyBuffer () override
 
- Public Member Functions inherited from sistrip::FEDBufferBase
uint8_t apveAddress () const
 
FEDBufferFormat bufferFormat () const
 
size_t bufferSize () const
 
uint16_t calcCRC () const
 
const FEDChannelchannel (const uint8_t internalFEDChannelNum) const
 
const FEDChannelchannel (const uint8_t internalFEUnitNum, const uint8_t internalChannelNum) const
 
bool channelGood (const uint8_t internalFEUnitNum, const uint8_t internalChannelNum) const
 
bool checkAPVEAddressValid () const
 
bool checkBufferFormat () const
 
bool checkCRC () const
 
bool checkHeaderType () const
 
bool checkLengthFromTrailer () const
 
bool checkMajorityAddresses () const
 
bool checkNoExtraHeadersOrTrailers () const
 
bool checkNoFEOverflows () const
 
bool checkNoSlinkCRCError () const
 
bool checkNoSLinkTransmissionError () const
 
bool checkNoUnexpectedSourceID () const
 
bool checkReadoutMode () const
 
bool checkSourceIDs () const
 
virtual std::string checkSummary () const
 
uint16_t daqBXID () const
 
uint16_t daqCRC () const
 
uint32_t daqEventLengthIn64bitWords () const
 
uint32_t daqEventLengthInBytes () const
 
FEDDAQEventType daqEventType () const
 
FEDDAQHeader daqHeader () const
 
uint32_t daqLvl1ID () const
 
uint16_t daqSourceID () const
 
FEDDAQTrailer daqTrailer () const
 
FEDTTSBits daqTTSState () const
 
bool doChecks () const
 
bool doDAQHeaderAndTrailerChecks () const
 
bool doTrackerSpecialHeaderChecks () const
 
void dump (std::ostream &os) const
 
void dumpOriginalBuffer (std::ostream &os) const
 
 FEDBufferBase (const FEDRawData &fedBuffer)
 
FEDStatusRegister fedStatusRegister () const
 
bool feEnabled (const uint8_t internalFEUnitNum) const
 
bool feOverflow (const uint8_t internalFEUnitNum) const
 
FEDHeaderType headerType () const
 
FEDLegacyReadoutMode legacyReadoutMode () const
 
bool majorityAddressErrorForFEUnit (const uint8_t internalFEUnitNum) const
 
uint8_t nFEUnitsEnabled () const
 
uint8_t packetCode (bool legacy=false, const uint8_t internalFEDChannelNum=0) const
 
FEDReadoutMode readoutMode () const
 
uint16_t sourceID () const
 
TrackerSpecialHeader trackerSpecialHeader () const
 
virtual ~FEDBufferBase ()
 

Private Member Functions

void findChannels ()
 

Private Attributes

uint16_t payloadLength_
 
const uint8_t * payloadPointer_
 
uint8_t versionId_
 

Static Private Attributes

static const uint8_t channelPositionsInData_ [FEDCH_PER_DELAY_CHIP] = {0, 3, 2, 1}
 

Additional Inherited Members

- Protected Member Functions inherited from sistrip::FEDBufferBase
 FEDBufferBase (const FEDRawData &fedBuffer, const bool fillChannelVector)
 
const uint8_t * getPointerToByteAfterEndOfPayload () const
 
const uint8_t * getPointerToDataAfterTrackerSpecialHeader () const
 
- Protected Attributes inherited from sistrip::FEDBufferBase
std::vector< FEDChannelchannels_
 

Detailed Description

Definition at line 33 of file SiStripFEDSpyBuffer.h.

Constructor & Destructor Documentation

◆ FEDSpyBuffer()

sistrip::FEDSpyBuffer::FEDSpyBuffer ( const FEDRawData fedBuffer)
explicit

constructor from a FEDRawData buffer

The sistrip::preconstructCheckFEDSpyBuffer() method should be used to check the validity of fedBuffer before constructing a sistrip::FEDBuffer.

See also
sistrip::preconstructCheckFEDSpyBuffer()

Definition at line 8 of file SiStripFEDSpyBuffer.cc.

References findChannels(), payloadPointer_, and versionId_.

9  : FEDBufferBase(fedBuffer),
13  //Check the buffer format version ID and take action for any exceptions
14  if (versionId_ == 0x00) {
16  }
17  //find the channel start positions
18  findChannels();
19  }
const uint8_t * getPointerToDataAfterTrackerSpecialHeader() const
const uint8_t * getPointerToByteAfterEndOfPayload() const
const uint8_t * payloadPointer_
FEDBufferBase(const FEDRawData &fedBuffer)

◆ ~FEDSpyBuffer()

sistrip::FEDSpyBuffer::~FEDSpyBuffer ( )
override

Definition at line 21 of file SiStripFEDSpyBuffer.cc.

21 {}

Member Function Documentation

◆ channelGood()

bool sistrip::FEDSpyBuffer::channelGood ( const uint8_t  internalFEDannelNum) const
overridevirtual

Reimplemented from sistrip::FEDBufferBase.

Definition at line 135 of file SiStripFEDSpyBuffer.cc.

References delayChipGood(), sistrip::FEDCH_PER_DELAY_CHIP, and sistrip::internalFEDChannelNum().

135  {
137  }
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
bool delayChipGood(const uint8_t delayChip) const
static const uint16_t FEDCH_PER_DELAY_CHIP

◆ delayChipGood()

bool sistrip::FEDSpyBuffer::delayChipGood ( const uint8_t  delayChip) const

Definition at line 107 of file SiStripFEDSpyBuffer.cc.

References delayChipL1ID(), delayChipTotalEventCount(), sistrip::FEDBufferBase::dump(), spyHeaderL1ID(), spyHeaderTotalEventCount(), contentValuesCheck::ss, and versionId_.

Referenced by channelGood().

107  {
108  if (versionId_ == 0x00) {
109  if (delayChip == 0)
110  return true;
111  }
112  uint32_t l1CountBefore = 0;
113  uint32_t totalEventCountBefore = 0;
114  if (delayChip == 0) {
115  l1CountBefore = spyHeaderL1ID();
116  totalEventCountBefore = spyHeaderTotalEventCount();
117  } else {
118  l1CountBefore = delayChipL1ID(delayChip - 1);
119  totalEventCountBefore = delayChipTotalEventCount(delayChip - 1);
120  }
121  const uint32_t l1CountAfter = delayChipL1ID(delayChip);
122  const uint32_t totalEventCountAfter = delayChipTotalEventCount(delayChip);
123  const bool eventMatches = ((l1CountBefore == l1CountAfter) && (totalEventCountBefore == totalEventCountAfter));
124  if (!eventMatches) {
125  std::ostringstream ss;
126  ss << "Delay chip data was overwritten on chip " << uint16_t(delayChip) << " L1A before: " << l1CountBefore
127  << " after: " << l1CountAfter << " Total event count before: " << totalEventCountBefore
128  << " after: " << totalEventCountAfter << std::endl;
129  dump(ss);
130  edm::LogInfo("FEDSpyBuffer") << ss.str();
131  }
132  return eventMatches;
133  }
uint32_t spyHeaderL1ID() const
uint32_t delayChipL1ID(const uint8_t delayChip) const
uint32_t delayChipTotalEventCount(const uint8_t delayChip) const
uint32_t spyHeaderTotalEventCount() const
void dump(std::ostream &os) const
Log< level::Info, false > LogInfo

◆ delayChipL1ID()

uint32_t sistrip::FEDSpyBuffer::delayChipL1ID ( const uint8_t  delayChip) const

Definition at line 82 of file SiStripFEDSpyBuffer.cc.

References payloadPointer_, mps_fire::result, and sistrip::SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES.

Referenced by delayChipGood(), and spyHeaderL1ID().

82  {
83  const uint8_t* delayChipCounters = payloadPointer_ + ((SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip + 1) - 8);
84  uint32_t result = 0;
85  result |= delayChipCounters[4];
86  result |= (uint32_t(delayChipCounters[5]) << 8);
87  result |= (uint32_t(delayChipCounters[6]) << 16);
88  result |= (uint32_t(delayChipCounters[7]) << 24);
89  return result;
90  }
static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
const uint8_t * payloadPointer_

◆ delayChipTotalEventCount()

uint32_t sistrip::FEDSpyBuffer::delayChipTotalEventCount ( const uint8_t  delayChip) const

Definition at line 92 of file SiStripFEDSpyBuffer.cc.

References payloadPointer_, mps_fire::result, and sistrip::SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES.

Referenced by delayChipGood(), and spyHeaderTotalEventCount().

92  {
93  const uint8_t* delayChipCounters = payloadPointer_ + ((SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip + 1) - 8);
94  uint32_t result = 0;
95  result |= delayChipCounters[0];
96  result |= (uint32_t(delayChipCounters[1]) << 8);
97  result |= (uint32_t(delayChipCounters[2]) << 16);
98  result |= (uint32_t(delayChipCounters[3]) << 24);
99  return result;
100  }
static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
const uint8_t * payloadPointer_

◆ findChannels()

void sistrip::FEDSpyBuffer::findChannels ( )
private

Definition at line 23 of file SiStripFEDSpyBuffer.cc.

References sistrip::FEDBufferBase::bufferSize(), channelPositionsInData_, sistrip::FEDBufferBase::channels_, sistrip::DELAY_CHIPS_PER_FED, Exception, sistrip::FEDCH_PER_DELAY_CHIP, mps_fire::i, payloadLength_, payloadPointer_, sistrip::SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES, sistrip::SPY_DELAYCHIP_DATA_OFFSET_IN_BITS, and sistrip::SPY_SAMPLES_PER_CHANNEL.

Referenced by FEDSpyBuffer().

23  {
24  size_t delayChipStartByteIndex = 0;
25  //Loop over delay chips checking their data fits into buffer and setting up channel objects with correct offset
26  for (uint8_t iDelayChip = 0; iDelayChip < DELAY_CHIPS_PER_FED; ++iDelayChip) {
27  if (delayChipStartByteIndex + SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES > payloadLength_) {
28  throw cms::Exception("FEDSpyBuffer") << "Delay chip " << uint16_t(iDelayChip) << " does not fit into buffer. "
29  << "Buffer size is " << bufferSize() << " delay chip data starts at "
30  << delayChipStartByteIndex + 8 + 8 + 8 + 8 << ". ";
31  }
32  for (uint8_t i = 0; i < FEDCH_PER_DELAY_CHIP; i++) {
33  const uint8_t chanelIndexInDataOrder = channelPositionsInData_[i];
34  const uint8_t fedCh = iDelayChip * FEDCH_PER_DELAY_CHIP + i;
35  const size_t channelOffsetInBits = SPY_DELAYCHIP_DATA_OFFSET_IN_BITS + 10 * chanelIndexInDataOrder;
36  channels_[fedCh] =
37  FEDChannel(payloadPointer_ + delayChipStartByteIndex, channelOffsetInBits, SPY_SAMPLES_PER_CHANNEL);
38  }
39  delayChipStartByteIndex += SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES;
40  }
41  }
static const uint16_t SPY_SAMPLES_PER_CHANNEL
static const uint16_t DELAY_CHIPS_PER_FED
std::vector< FEDChannel > channels_
static const uint16_t FEDCH_PER_DELAY_CHIP
static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
const uint8_t * payloadPointer_
static const uint8_t channelPositionsInData_[FEDCH_PER_DELAY_CHIP]
static const uint16_t SPY_DELAYCHIP_DATA_OFFSET_IN_BITS

◆ globalRunNumber()

uint32_t sistrip::FEDSpyBuffer::globalRunNumber ( ) const

Definition at line 43 of file SiStripFEDSpyBuffer.cc.

References sistrip::FEDBufferBase::getPointerToDataAfterTrackerSpecialHeader(), mps_fire::result, and versionId_.

43  {
44  if (versionId_ < 0x02) {
45  return 0;
46  }
47  const uint8_t* runNumberPointer = getPointerToDataAfterTrackerSpecialHeader() + 4;
48  uint32_t result = 0;
49  result |= runNumberPointer[0];
50  result |= (uint32_t(runNumberPointer[1]) << 8);
51  result |= (uint32_t(runNumberPointer[2]) << 16);
52  result |= (uint32_t(runNumberPointer[3]) << 24);
53  return result;
54  }
const uint8_t * getPointerToDataAfterTrackerSpecialHeader() const

◆ print()

void sistrip::FEDSpyBuffer::print ( std::ostream &  os) const
overridevirtual

Reimplemented from sistrip::FEDBufferBase.

Definition at line 102 of file SiStripFEDSpyBuffer.cc.

References l1tGTMenu_BTagSeeds_cff::os, and sistrip::FEDBufferBase::print().

102  {
104  //TODO
105  }
virtual void print(std::ostream &os) const

◆ spyHeaderL1ID()

uint32_t sistrip::FEDSpyBuffer::spyHeaderL1ID ( ) const

Definition at line 56 of file SiStripFEDSpyBuffer.cc.

References delayChipL1ID(), payloadPointer_, mps_fire::result, and versionId_.

Referenced by delayChipGood().

56  {
57  if (versionId_ == 0x00) {
58  return delayChipL1ID(0);
59  }
60  uint32_t result = 0;
61  const uint8_t* spyCounters = payloadPointer_ - 8;
62  result |= spyCounters[4];
63  result |= (uint32_t(spyCounters[5]) << 8);
64  result |= (uint32_t(spyCounters[6]) << 16);
65  result |= (uint32_t(spyCounters[7]) << 24);
66  return result;
67  }
uint32_t delayChipL1ID(const uint8_t delayChip) const
const uint8_t * payloadPointer_

◆ spyHeaderTotalEventCount()

uint32_t sistrip::FEDSpyBuffer::spyHeaderTotalEventCount ( ) const

Definition at line 69 of file SiStripFEDSpyBuffer.cc.

References delayChipTotalEventCount(), payloadPointer_, mps_fire::result, and versionId_.

Referenced by delayChipGood().

69  {
70  if (versionId_ == 0x00) {
71  return delayChipTotalEventCount(0);
72  }
73  uint32_t result = 0;
74  const uint8_t* spyCounters = payloadPointer_ - 8;
75  result |= spyCounters[0];
76  result |= (uint32_t(spyCounters[1]) << 8);
77  result |= (uint32_t(spyCounters[2]) << 16);
78  result |= (uint32_t(spyCounters[3]) << 24);
79  return result;
80  }
uint32_t delayChipTotalEventCount(const uint8_t delayChip) const
const uint8_t * payloadPointer_

Member Data Documentation

◆ channelPositionsInData_

const uint8_t sistrip::FEDSpyBuffer::channelPositionsInData_ = {0, 3, 2, 1}
staticprivate

Definition at line 66 of file SiStripFEDSpyBuffer.h.

Referenced by findChannels().

◆ payloadLength_

uint16_t sistrip::FEDSpyBuffer::payloadLength_
private

Definition at line 72 of file SiStripFEDSpyBuffer.h.

Referenced by findChannels().

◆ payloadPointer_

const uint8_t* sistrip::FEDSpyBuffer::payloadPointer_
private

◆ versionId_

uint8_t sistrip::FEDSpyBuffer::versionId_
private