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.

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  }

References findChannels(), payloadPointer_, and versionId_.

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

◆ delayChipGood()

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

Definition at line 107 of file SiStripFEDSpyBuffer.cc.

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  }

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

Referenced by channelGood().

◆ delayChipL1ID()

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

Definition at line 82 of file SiStripFEDSpyBuffer.cc.

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  }

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

Referenced by delayChipGood(), and spyHeaderL1ID().

◆ delayChipTotalEventCount()

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

Definition at line 92 of file SiStripFEDSpyBuffer.cc.

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  }

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

Referenced by delayChipGood(), and spyHeaderTotalEventCount().

◆ findChannels()

void sistrip::FEDSpyBuffer::findChannels ( )
private

Definition at line 23 of file SiStripFEDSpyBuffer.cc.

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  }

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().

◆ globalRunNumber()

uint32_t sistrip::FEDSpyBuffer::globalRunNumber ( ) const

Definition at line 43 of file SiStripFEDSpyBuffer.cc.

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  }

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

◆ print()

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

Reimplemented from sistrip::FEDBufferBase.

Definition at line 102 of file SiStripFEDSpyBuffer.cc.

102  {
104  //TODO
105  }

References sistrip::FEDBufferBase::print().

◆ spyHeaderL1ID()

uint32_t sistrip::FEDSpyBuffer::spyHeaderL1ID ( ) const

Definition at line 56 of file SiStripFEDSpyBuffer.cc.

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  }

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

Referenced by delayChipGood().

◆ spyHeaderTotalEventCount()

uint32_t sistrip::FEDSpyBuffer::spyHeaderTotalEventCount ( ) const

Definition at line 69 of file SiStripFEDSpyBuffer.cc.

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  }

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

Referenced by delayChipGood().

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
mps_fire.i
i
Definition: mps_fire.py:428
sistrip::FEDSpyBuffer::payloadLength_
uint16_t payloadLength_
Definition: SiStripFEDSpyBuffer.h:72
sistrip::FEDBufferBase::dump
void dump(std::ostream &os) const
Definition: SiStripFEDBufferComponents.h:1395
sistrip::FEDSpyBuffer::findChannels
void findChannels()
Definition: SiStripFEDSpyBuffer.cc:23
sistrip::FEDSpyBuffer::delayChipTotalEventCount
uint32_t delayChipTotalEventCount(const uint8_t delayChip) const
Definition: SiStripFEDSpyBuffer.cc:92
sistrip::FEDBufferBase::getPointerToByteAfterEndOfPayload
const uint8_t * getPointerToByteAfterEndOfPayload() const
Definition: SiStripFEDBufferComponents.h:1552
sistrip::FEDBufferBase::FEDBufferBase
FEDBufferBase(const FEDRawData &fedBuffer)
Definition: SiStripFEDBufferComponents.cc:1248
sistrip::FEDBufferBase::getPointerToDataAfterTrackerSpecialHeader
const uint8_t * getPointerToDataAfterTrackerSpecialHeader() const
Definition: SiStripFEDBufferComponents.h:1550
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
sistrip::FEDSpyBuffer::delayChipL1ID
uint32_t delayChipL1ID(const uint8_t delayChip) const
Definition: SiStripFEDSpyBuffer.cc:82
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
sistrip::internalFEDChannelNum
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
Definition: SiStripFEDBufferComponents.h:785
sistrip::FEDSpyBuffer::delayChipGood
bool delayChipGood(const uint8_t delayChip) const
Definition: SiStripFEDSpyBuffer.cc:107
sistrip::SPY_SAMPLES_PER_CHANNEL
static const uint16_t SPY_SAMPLES_PER_CHANNEL
Definition: SiStripFEDSpyBuffer.h:23
sistrip::FEDCH_PER_DELAY_CHIP
static const uint16_t FEDCH_PER_DELAY_CHIP
Definition: SiStripFEDSpyBuffer.h:15
sistrip::SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
Definition: SiStripFEDSpyBuffer.h:18
sistrip::FEDSpyBuffer::spyHeaderTotalEventCount
uint32_t spyHeaderTotalEventCount() const
Definition: SiStripFEDSpyBuffer.cc:69
sistrip::FEDBufferBase::channels_
std::vector< FEDChannel > channels_
Definition: SiStripFEDBufferComponents.h:730
sistrip::DELAY_CHIPS_PER_FED
static const uint16_t DELAY_CHIPS_PER_FED
Definition: SiStripFEDSpyBuffer.h:16
sistrip::FEDBufferBase::print
virtual void print(std::ostream &os) const
Definition: SiStripFEDBufferComponents.cc:1310
sistrip::FEDBufferBase::bufferSize
size_t bufferSize() const
Definition: SiStripFEDBufferComponents.h:1405
sistrip::FEDSpyBuffer::payloadPointer_
const uint8_t * payloadPointer_
Definition: SiStripFEDSpyBuffer.h:71
sistrip::FEDSpyBuffer::channelPositionsInData_
static const uint8_t channelPositionsInData_[FEDCH_PER_DELAY_CHIP]
Definition: SiStripFEDSpyBuffer.h:66
sistrip::SPY_DELAYCHIP_DATA_OFFSET_IN_BITS
static const uint16_t SPY_DELAYCHIP_DATA_OFFSET_IN_BITS
Definition: SiStripFEDSpyBuffer.h:20
Exception
Definition: hltDiff.cc:245
mps_fire.result
result
Definition: mps_fire.py:311
sistrip::FEDSpyBuffer::versionId_
uint8_t versionId_
Definition: SiStripFEDSpyBuffer.h:73
sistrip::FEDSpyBuffer::spyHeaderL1ID
uint32_t spyHeaderL1ID() const
Definition: SiStripFEDSpyBuffer.cc:56