CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool channelGood (const uint8_t internalFEDannelNum) const
 
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 uint8_t *fedBuffer, const size_t fedBufferSize)
 
uint32_t globalRunNumber () const
 
virtual void print (std::ostream &os) const
 
uint32_t spyHeaderL1ID () const
 
uint32_t spyHeaderTotalEventCount () const
 
virtual ~FEDSpyBuffer ()
 
- 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
 
FEDDataType dataType () const
 
virtual bool doChecks () const
 
bool doDAQHeaderAndTrailerChecks () const
 
bool doTrackerSpecialHeaderChecks () const
 
void dump (std::ostream &os) const
 
void dumpOriginalBuffer (std::ostream &os) const
 
 FEDBufferBase (const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat=false)
 
FEDStatusRegister fedStatusRegister () const
 
bool feEnabled (const uint8_t internalFEUnitNum) const
 
bool feOverflow (const uint8_t internalFEUnitNum) const
 
FEDHeaderType headerType () const
 
bool majorityAddressErrorForFEUnit (const uint8_t internalFEUnitNum) const
 
uint8_t nFEUnitsEnabled () 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 uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat, 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 32 of file SiStripFEDSpyBuffer.h.

Constructor & Destructor Documentation

sistrip::FEDSpyBuffer::FEDSpyBuffer ( const uint8_t *  fedBuffer,
const size_t  fedBufferSize 
)

Definition at line 8 of file SiStripFEDSpyBuffer.cc.

References Exception, findChannels(), payloadPointer_, sistrip::READOUT_MODE_SPY, sistrip::FEDBufferBase::readoutMode(), and versionId_.

9  : FEDBufferBase(fedBuffer,fedBufferSize,false),
13  {
14  //Check it is spy data
15  if (!(readoutMode() == READOUT_MODE_SPY))
16  throw cms::Exception("FEDSpyBuffer") << "Buffer is not from spy channel";
17  //Check the buffer format version ID and take action for any exceptions
18  if (versionId_ == 0x00) {
20  }
21  //find the channel start positions
22  findChannels();
23  }
const uint8_t * getPointerToByteAfterEndOfPayload() const
FEDReadoutMode readoutMode() const
const uint8_t * getPointerToDataAfterTrackerSpecialHeader() const
FEDBufferBase(const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat=false)
const uint8_t * payloadPointer_
sistrip::FEDSpyBuffer::~FEDSpyBuffer ( )
virtual

Definition at line 25 of file SiStripFEDSpyBuffer.cc.

26  {
27  }

Member Function Documentation

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

Reimplemented from sistrip::FEDBufferBase.

Definition at line 146 of file SiStripFEDSpyBuffer.cc.

References delayChipGood(), and sistrip::FEDCH_PER_DELAY_CHIP.

147  {
149  }
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
static const uint16_t FEDCH_PER_DELAY_CHIP
bool delayChipGood(const uint8_t delayChip) const
bool sistrip::FEDSpyBuffer::delayChipGood ( const uint8_t  delayChip) const

Definition at line 118 of file SiStripFEDSpyBuffer.cc.

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

Referenced by channelGood().

119  {
120  if (versionId_ == 0x00) {
121  if (delayChip == 0) return true;
122  }
123  uint32_t l1CountBefore = 0;
124  uint32_t totalEventCountBefore = 0;
125  if (delayChip == 0) {
126  l1CountBefore = spyHeaderL1ID();
127  totalEventCountBefore = spyHeaderTotalEventCount();
128  } else {
129  l1CountBefore = delayChipL1ID(delayChip-1);
130  totalEventCountBefore = delayChipTotalEventCount(delayChip-1);
131  }
132  const uint32_t l1CountAfter = delayChipL1ID(delayChip);
133  const uint32_t totalEventCountAfter = delayChipTotalEventCount(delayChip);
134  const bool eventMatches = ( (l1CountBefore == l1CountAfter) && (totalEventCountBefore == totalEventCountAfter) );
135  if (!eventMatches) {
136  std::ostringstream ss;
137  ss << "Delay chip data was overwritten on chip " << uint16_t(delayChip)
138  << " L1A before: " << l1CountBefore << " after: " << l1CountAfter
139  << " Total event count before: " << totalEventCountBefore << " after: " << totalEventCountAfter << std::endl;
140  dump(ss);
141  edm::LogInfo("FEDSpyBuffer") << ss.str();
142  }
143  return eventMatches;
144  }
void dump(std::ostream &os) const
uint32_t delayChipTotalEventCount(const uint8_t delayChip) const
uint32_t spyHeaderL1ID() const
uint32_t spyHeaderTotalEventCount() const
uint32_t delayChipL1ID(const uint8_t delayChip) const
uint32_t sistrip::FEDSpyBuffer::delayChipL1ID ( const uint8_t  delayChip) const

Definition at line 90 of file SiStripFEDSpyBuffer.cc.

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

Referenced by delayChipGood(), and spyHeaderL1ID().

91  {
92  const uint8_t* delayChipCounters = payloadPointer_ + ( (SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip+1) - 8);
93  uint32_t result = 0;
94  result |= delayChipCounters[4];
95  result |= (uint32_t(delayChipCounters[5]) << 8);
96  result |= (uint32_t(delayChipCounters[6]) << 16);
97  result |= (uint32_t(delayChipCounters[7]) << 24);
98  return result;
99  }
tuple result
Definition: query.py:137
static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
const uint8_t * payloadPointer_
uint32_t sistrip::FEDSpyBuffer::delayChipTotalEventCount ( const uint8_t  delayChip) const

Definition at line 101 of file SiStripFEDSpyBuffer.cc.

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

Referenced by delayChipGood(), and spyHeaderTotalEventCount().

102  {
103  const uint8_t* delayChipCounters = payloadPointer_ + ( (SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip+1) - 8);
104  uint32_t result = 0;
105  result |= delayChipCounters[0];
106  result |= (uint32_t(delayChipCounters[1]) << 8);
107  result |= (uint32_t(delayChipCounters[2]) << 16);
108  result |= (uint32_t(delayChipCounters[3]) << 24);
109  return result;
110  }
tuple result
Definition: query.py:137
static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES
const uint8_t * payloadPointer_
void sistrip::FEDSpyBuffer::findChannels ( )
private

Definition at line 29 of file SiStripFEDSpyBuffer.cc.

References sistrip::FEDBufferBase::bufferSize(), channelPositionsInData_, sistrip::FEDBufferBase::channels_, sistrip::DELAY_CHIPS_PER_FED, Exception, sistrip::FEDCH_PER_DELAY_CHIP, 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().

30  {
31  size_t delayChipStartByteIndex = 0;
32  //Loop over delay chips checking their data fits into buffer and setting up channel objects with correct offset
33  for (uint8_t iDelayChip = 0; iDelayChip < DELAY_CHIPS_PER_FED; ++iDelayChip) {
34  if (delayChipStartByteIndex+SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES > payloadLength_) {
35  throw cms::Exception("FEDSpyBuffer") << "Delay chip " << uint16_t(iDelayChip) << " does not fit into buffer. "
36  << "Buffer size is " << bufferSize() << " delay chip data starts at " << delayChipStartByteIndex+8+8+8+8 << ". ";
37  }
38  for (uint8_t i = 0; i < FEDCH_PER_DELAY_CHIP; i++) {
39  const uint8_t chanelIndexInDataOrder = channelPositionsInData_[i];
40  const uint8_t fedCh = iDelayChip*FEDCH_PER_DELAY_CHIP + i;
41  const size_t channelOffsetInBits = SPY_DELAYCHIP_DATA_OFFSET_IN_BITS + 10*chanelIndexInDataOrder;
42  channels_[fedCh] = FEDChannel(payloadPointer_+delayChipStartByteIndex,channelOffsetInBits,SPY_SAMPLES_PER_CHANNEL);
43  }
44  delayChipStartByteIndex += SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES;
45  }
46  }
int i
Definition: DBlmapReader.cc:9
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
uint32_t sistrip::FEDSpyBuffer::globalRunNumber ( ) const

Definition at line 48 of file SiStripFEDSpyBuffer.cc.

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

49  {
50  if (versionId_ < 0x02) {
51  return 0;
52  }
53  const uint8_t * runNumberPointer = getPointerToDataAfterTrackerSpecialHeader()+4;
54  uint32_t result = 0;
55  result |= runNumberPointer[0];
56  result |= (uint32_t(runNumberPointer[1]) << 8);
57  result |= (uint32_t(runNumberPointer[2]) << 16);
58  result |= (uint32_t(runNumberPointer[3]) << 24);
59  return result;
60  }
const uint8_t * getPointerToDataAfterTrackerSpecialHeader() const
tuple result
Definition: query.py:137
void sistrip::FEDSpyBuffer::print ( std::ostream &  os) const
virtual

Reimplemented from sistrip::FEDBufferBase.

Definition at line 112 of file SiStripFEDSpyBuffer.cc.

References sistrip::FEDBufferBase::print().

113  {
115  //TODO
116  }
virtual void print(std::ostream &os) const
uint32_t sistrip::FEDSpyBuffer::spyHeaderL1ID ( ) const

Definition at line 62 of file SiStripFEDSpyBuffer.cc.

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

Referenced by delayChipGood().

63  {
64  if (versionId_ == 0x00) {
65  return delayChipL1ID(0);
66  }
67  uint32_t result = 0;
68  const uint8_t* spyCounters = payloadPointer_-8;
69  result |= spyCounters[4];
70  result |= (uint32_t(spyCounters[5]) << 8);
71  result |= (uint32_t(spyCounters[6]) << 16);
72  result |= (uint32_t(spyCounters[7]) << 24);
73  return result;
74  }
tuple result
Definition: query.py:137
const uint8_t * payloadPointer_
uint32_t delayChipL1ID(const uint8_t delayChip) const
uint32_t sistrip::FEDSpyBuffer::spyHeaderTotalEventCount ( ) const

Definition at line 76 of file SiStripFEDSpyBuffer.cc.

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

Referenced by delayChipGood().

77  {
78  if (versionId_ == 0x00) {
79  return delayChipTotalEventCount(0);
80  }
81  uint32_t result = 0;
82  const uint8_t* spyCounters = payloadPointer_-8;
83  result |= spyCounters[0];
84  result |= (uint32_t(spyCounters[1]) << 8);
85  result |= (uint32_t(spyCounters[2]) << 16);
86  result |= (uint32_t(spyCounters[3]) << 24);
87  return result;
88  }
tuple result
Definition: query.py:137
uint32_t delayChipTotalEventCount(const uint8_t delayChip) const
const uint8_t * payloadPointer_

Member Data Documentation

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

Definition at line 57 of file SiStripFEDSpyBuffer.h.

Referenced by findChannels().

uint16_t sistrip::FEDSpyBuffer::payloadLength_
private

Definition at line 63 of file SiStripFEDSpyBuffer.h.

Referenced by findChannels().

const uint8_t* sistrip::FEDSpyBuffer::payloadPointer_
private
uint8_t sistrip::FEDSpyBuffer::versionId_
private