12 const std::ios_base::fmtflags originalFormatFlags = os.flags();
13 os << std::hex << std::setfill(
'0') << std::setw(2);
14 os << uint16_t(value);
15 os.flags(originalFormatFlags);
18 void printHexWord(
const uint8_t* pointer,
const size_t lengthInBytes, std::ostream& os)
20 size_t i = lengthInBytes-1;
23 if (i != 0) os <<
" ";
27 void printHex(
const void* pointer,
const size_t lengthInBytes, std::ostream& os)
29 const uint8_t* bytePointer =
reinterpret_cast<const uint8_t*
>(pointer);
31 if (lengthInBytes <= 8) {
37 os <<
"word\tbyte\t \t\tbyte" << std::endl;;
38 const size_t words = lengthInBytes/8;
39 const size_t extraBytes = lengthInBytes - 8*words;
41 for (
size_t w = 0;
w < words;
w++) {
42 const size_t startByte =
w*8;
43 os <<
w <<
'\t' << startByte+8 <<
'\t';
45 os <<
"\t\t" << startByte << std::endl;
49 const size_t startByte = words*8;
50 os << words <<
'\t' << startByte+8 <<
'\t';
53 while (p-- > extraBytes) {
57 os <<
"\t\t" << startByte << std::endl;
66 uint16_t crc = 0xFFFF;
67 for (
size_t i = 0;
i < lengthInBytes-8;
i++) {
70 for (
size_t i=lengthInBytes-8;
i<lengthInBytes;
i++) {
73 if (
i==lengthInBytes-4 ||
i==lengthInBytes-3)
124 os <<
"Unrecognized";
149 os <<
"(L) Unrecognized";
168 os <<
"Processed raw";
171 os <<
"Zero suppressed";
174 os <<
"Zero suppressed (fake)";
177 os <<
"Zero suppressed lite";
186 os <<
"Zero suppressed lite CM Override";
189 os <<
"Zero suppressed lite (8 bit, top-stripped)";
192 os <<
"Zero suppressed lite CM Override (8 bit, top-stripped)";
195 os <<
"Zero suppressed lite (8 bit, bottom-stripped)";
198 os <<
"Zero suppressed lite CM Override (8 bit, bottom-stripped)";
201 os <<
"Zero suppressed lite (8 bit, top/bottom-stripped)";
204 os <<
"Zero suppressed lite CM Override (8 bit, top/bottom-stripped)";
213 os <<
"Unrecognized";
226 os <<
"Physics trigger";
229 os <<
"Calibration trigger";
232 os <<
"Test trigger";
235 os <<
"Technical trigger";
238 os <<
"Simulated event";
241 os <<
"Traced event";
250 os <<
"Unrecognized";
263 os <<
"Disconected 0";
266 os <<
"Warning overflow";
284 os <<
"Disconected 1";
287 os <<
"Unrecognized";
306 os <<
"Partial Full";
312 os <<
"Unrecognized";
335 if ( (bufferFormatString ==
"OLD_VME") ||
336 (bufferFormatString ==
"BUFFER_FORMAT_OLD_VME") ||
337 (bufferFormatString ==
"Old VME") ) {
340 if ( (bufferFormatString ==
"OLD_SLINK") ||
341 (bufferFormatString ==
"BUFFER_FORMAT_OLD_SLINK") ||
342 (bufferFormatString ==
"Old S-Link") ) {
345 if ( (bufferFormatString ==
"NEW") ||
346 (bufferFormatString ==
"BUFFER_FORMAT_NEW") ||
347 (bufferFormatString ==
"New") ) {
356 if ( (headerTypeString ==
"FULL_DEBUG") ||
357 (headerTypeString ==
"HEADER_TYPE_FULL_DEBUG") ||
358 (headerTypeString ==
"Full debug") ) {
361 if ( (headerTypeString ==
"APV_ERROR") ||
362 (headerTypeString ==
"HEADER_TYPE_APV_ERROR") ||
363 (headerTypeString ==
"APV error") ) {
366 if ( (headerTypeString ==
"None") ||
367 (headerTypeString ==
"none") ) {
376 if ( (readoutModeString ==
"READOUT_MODE_SCOPE") ||
377 (readoutModeString ==
"SCOPE") ||
378 (readoutModeString ==
"SCOPE_MODE") ||
379 (readoutModeString ==
"Scope mode") ) {
382 if ( (readoutModeString ==
"READOUT_MODE_VIRGIN_RAW") ||
383 (readoutModeString ==
"VIRGIN_RAW") ||
384 (readoutModeString ==
"Virgin raw") ) {
387 if ( (readoutModeString ==
"READOUT_MODE_PROC_RAW") ||
388 (readoutModeString ==
"PROC_RAW") ||
389 (readoutModeString ==
"PROCESSED_RAW") ||
390 (readoutModeString ==
"Processed raw") ) {
393 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED") ||
394 (readoutModeString ==
"ZERO_SUPPRESSED") ||
395 (readoutModeString ==
"Zero suppressed") ) {
398 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_LITE") ||
399 (readoutModeString ==
"ZERO_SUPPRESSED_LITE") ||
400 (readoutModeString ==
"Zero suppressed lite") ) {
403 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_CMOVERRIDE") ||
404 (readoutModeString ==
"ZERO_SUPPRESSED_CMOVERRIDE") ||
405 (readoutModeString ==
"ZERO_SUPPRESSED_CMO") ||
406 (readoutModeString ==
"Zero suppressed CM Override") ) {
409 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_LITE_CMOVERRIDE") ||
410 (readoutModeString ==
"ZERO_SUPPRESSED_LITE_CMO") ||
411 (readoutModeString ==
"ZERO_SUPPRESSED_LITE_CMOVERRIDE") ||
412 (readoutModeString ==
"Zero suppressed lite CM Override") ) {
415 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT") ||
416 (readoutModeString ==
"ZERO_SUPPRESSED_LITE8_TOPBOT") ||
417 (readoutModeString ==
"Zero suppressed lite8 TobBot") ){
420 if ( (readoutModeString ==
"READOUT_MODE_PREMIX_RAW") ||
421 (readoutModeString ==
"PREMIX_RAW") ||
422 (readoutModeString ==
"PreMix Raw") ) {
425 if ( (readoutModeString ==
"READOUT_MODE_SPY") ||
426 (readoutModeString ==
"SPY") ||
427 (readoutModeString ==
"Spy channel") ) {
436 if ( (daqEventTypeString ==
"PHYSICS") ||
437 (daqEventTypeString ==
"DAQ_EVENT_TYPE_PHYSICS") ||
438 (daqEventTypeString ==
"Physics trigger") ) {
441 if ( (daqEventTypeString ==
"CALIBRATION") ||
442 (daqEventTypeString ==
"DAQ_EVENT_TYPE_CALIBRATION") ||
443 (daqEventTypeString ==
"Calibration trigger") ) {
446 if ( (daqEventTypeString ==
"TEST") ||
447 (daqEventTypeString ==
"DAQ_EVENT_TYPE_TEST") ||
448 (daqEventTypeString ==
"Test trigger") ) {
451 if ( (daqEventTypeString ==
"TECHNICAL") ||
452 (daqEventTypeString ==
"DAQ_EVENT_TYPE_TECHNICAL") ||
453 (daqEventTypeString ==
"Technical trigger") ) {
456 if ( (daqEventTypeString ==
"SIMULATED") ||
457 (daqEventTypeString ==
"DAQ_EVENT_TYPE_SIMULATED") ||
458 (daqEventTypeString ==
"Simulated trigger") ) {
461 if ( (daqEventTypeString ==
"TRACED") ||
462 (daqEventTypeString ==
"DAQ_EVENT_TYPE_TRACED") ||
463 (daqEventTypeString ==
"Traced event") ) {
466 if ( (daqEventTypeString ==
"ERROR") ||
467 (daqEventTypeString ==
"DAQ_EVENT_TYPE_ERROR") ||
468 (daqEventTypeString ==
"Error") ) {
513 const uint16_t
mask = (0x0001 <<
num);
515 else data_ &= (~mask);
527 std::ostringstream ss;
528 ss <<
"Invalid buffer state: ";
547 std::ostringstream ss;
548 ss <<
"Invalid buffer state: ";
563 if (internalFreezeFlag()) os <<
"INTERNAL_FREEZE ";
564 if (slinkDownFlag()) os <<
"SLINK_DOWN ";
566 if (backpressureFlag()) os <<
"BACKPRESSURE ";
567 if (ttcReadyFlag()) os <<
"TTC_READY ";
570 printFlagsForBuffer(frameAddressFIFOState(),
"FRAME_ADDRESS",os);
571 printFlagsForBuffer(totalLengthFIFOState(),
"TOTAL_LENGTH",os);
572 printFlagsForBuffer(trackerHeaderFIFOState(),
"TRACKER_HEADER",os);
574 printFlagsForBuffer(feEventLengthFIFOState(),
"FE_LENGTH",os);
575 printFlagsForBuffer(feFPGABufferState(),
"FE",os);
604 std::ostringstream ss;
605 ss <<
"Invalid buffer state: ";
616 const uint32_t
mask = (0x00000001 <<
num);
618 else data_ &= (~mask);
628 const bool backpressure,
const bool slinkFull,
629 const bool slinkDown,
const bool internalFreeze,
630 const bool trackerHeaderMonitorDataReady,
const bool ttcReady)
654 const bool validFormatByteWhenNotWordSwapped = ( (headerPointer[BUFFERFORMAT] ==
BUFFER_FORMAT_CODE_NEW) ||
659 if (validFormatByteWhenNotWordSwapped || (!validFormatByteWhenNotWordSwapped && !validFormatByteWhenWordSwapped) ) {
660 memcpy(specialHeader_,headerPointer,8);
661 wordSwapped_ =
false;
663 memcpy(specialHeader_,headerPointer+4,4);
664 memcpy(specialHeader_+4,headerPointer,4);
690 const uint8_t eventTypeNibble = trackerEventTypeNibble();
691 const uint8_t
mode = (eventTypeNibble & 0xF);
709 const uint8_t eventTypeNibble = trackerEventTypeNibble();
716 const uint8_t
mode = (eventTypeNibble & 0xF);
744 wordSwapped_ = !wordSwapped_;
747 setBufferFormatByte(newBufferFormat);
753 switch (newBufferFormat) {
762 std::ostringstream ss;
763 ss <<
"Invalid buffer format: ";
775 setHeaderTypeNibble(headerType);
778 std::ostringstream ss;
779 ss <<
"Invalid header type: ";
787 switch(readoutMode) {
790 setReadoutModeBits(readoutMode);
804 setReadoutModeBits(readoutMode);
808 setReadoutModeBits(readoutMode);
811 std::ostringstream ss;
812 ss <<
"Invalid readout mode: ";
821 const uint8_t
mask = 0x1 << internalFEUnitNum;
822 const uint8_t
result = ( (apvAddressErrorRegister() & (~mask)) | (error?mask:0x00) );
823 setAPVEAddressErrorRegister(result);
829 const uint8_t
mask = 0x1 << internalFEUnitNum;
830 const uint8_t
result = ( (feEnableRegister() & (~mask)) | (enabled?mask:0x00) );
831 setFEEnableRegister(result);
837 const uint8_t
mask = 0x1 << internalFEUnitNum;
838 const uint8_t
result = ( (feOverflowRegister() & (~mask)) | (overflow?mask:0x00) );
839 setFEEnableRegister(result);
845 const uint8_t address,
const uint8_t addressErrorRegister,
846 const uint8_t feEnableRegister,
const uint8_t feOverflowRegister,
849 memset(specialHeader_,0x00,8);
853 setBufferFormatByte(bufferFormat);
854 setReadoutMode(readoutMode);
855 setHeaderType(headerType);
856 setAPVEAddress(address);
857 setAPVEAddressErrorRegister(addressErrorRegister);
858 setFEEnableRegister(feEnableRegister);
859 setFEOverflowRegister(feOverflowRegister);
860 setFEDStatusRegister(fedStatusRegister);
868 switch(eventTypeNibble()) {
884 header_[7] = ((header_[7] & 0xF0) | evtType);
890 header_[4] = (l1ID & 0x000000FF);
891 header_[5] = ( (l1ID & 0x0000FF00) >> 8);
892 header_[6] = ( (l1ID & 0x00FF0000) >> 16);
898 header_[3] = ( (bxID & 0x0FF0) >> 4);
899 header_[2] = ( (header_[2] & 0x0F) | ( (bxID & 0x000F) << 4) );
905 header_[2] = ( (header_[2] & 0xF0) | ( (sourceID & 0x0F00) >> 8) );
906 header_[1] = (sourceID & 0x00FF);
913 memset(header_,0x0,8);
917 setEventType(evtType);
920 setSourceID(sourceID);
928 switch(ttsNibble()) {
943 const bool slinkTransmissionError,
const bool badFEDID,
const bool slinkCRCError,
944 const uint8_t eventStatusNibble)
947 memset(trailer_,0x0,8);
951 setEventLengthIn64BitWords(eventLengthIn64BitWords);
952 setEventStatusNibble(eventStatusNibble);
955 setSLinkTransmissionErrorBit(slinkTransmissionError);
956 setBadSourceIDBit(badFEDID);
957 setSLinkCRCErrorBit(slinkCRCError);
962 trailer_[4] = (eventLengthIn64BitWords & 0x000000FF);
963 trailer_[5] = ( (eventLengthIn64BitWords & 0x0000FF00) >> 8);
964 trailer_[6] = ( (eventLengthIn64BitWords & 0x00FF0000) >> 16);
970 trailer_[2] = (crc & 0x00FF);
971 trailer_[3] = ( (crc >> 8) & 0x00FF );
977 if (bitSet) trailer_[1] |= 0x80;
978 else trailer_[1] &= (~0x80);
984 if (bitSet) trailer_[1] |= 0x40;
985 else trailer_[1] &= (~0x40);
991 if (bitSet) trailer_[0] |= 0x04;
992 else trailer_[0] &= (~0x40);
998 trailer_[1] = ( (trailer_[1] & 0xF0) | (eventStatusNibble & 0x0F) );
1004 trailer_[0] = ( (trailer_[0] & 0x0F) | (ttsBits & 0xF0) );
1017 return APV_ERROR_HEADER_SIZE_IN_BYTES;
1022 printHex(header_,APV_ERROR_HEADER_SIZE_IN_BYTES,os);
1035 return (header_[bitNumber/8] & (0x01<<(bitNumber%8)) );
1040 return (checkStatusBits(internalFEDChannelNum,0) && checkStatusBits(internalFEDChannelNum,1));
1050 memset(header_,0x00,APV_ERROR_HEADER_SIZE_IN_BYTES);
1052 setAPVStatusBit(iCh,0,apvsGood[iCh*2]);
1053 setAPVStatusBit(iCh,1,apvsGood[iCh*2+1]);
1061 const uint8_t byteNumber = bitNumber/8;
1062 const uint8_t bitInByte = bitNumber%8;
1063 const uint8_t
mask = (0x01 << bitInByte);
1064 header_[byteNumber] = ( (header_[byteNumber] & (~mask)) | (apvGood?mask:0x00) );
1072 setAPVStatusBit(internalFEDChannelNum,0,
false);
1073 setAPVStatusBit(internalFEDChannelNum,1,
false);
1077 setAPVStatusBit(internalFEDChannelNum,0,
true);
1079 setAPVStatusBit(internalFEDChannelNum,0,
false);
1082 setAPVStatusBit(internalFEDChannelNum,1,
true);
1084 setAPVStatusBit(internalFEDChannelNum,1,
false);
1123 return FULL_DEBUG_HEADER_SIZE_IN_BYTES;
1128 printHex(header_,FULL_DEBUG_HEADER_SIZE_IN_BYTES,os);
1138 return ( !unlockedFromBit(internalFEDChannelNum) &&
1139 !outOfSyncFromBit(internalFEDChannelNum) &&
1140 !apvError(internalFEDChannelNum,apvNum) &&
1141 !apvAddressError(internalFEDChannelNum,apvNum) );
1159 const uint8_t startByteInFEWord = (
FEDCH_PER_FEUNIT-1 - feUnitChanNum) * 6 / 8;
1164 return FEDChannelStatus( ((pFEWord[startByteInFEWord] & 0xC0) >> 6) | ((pFEWord[startByteInFEWord+1] & 0x0F) << 2) );
1166 return FEDChannelStatus( ((pFEWord[startByteInFEWord] & 0xF0) >> 4) | ((pFEWord[startByteInFEWord+1] & 0x03) << 4) );
1202 const uint32_t daqRegister,
const uint32_t daqRegister2)
1204 memset(header_,0x00,FULL_DEBUG_HEADER_SIZE_IN_BYTES);
1205 setBEStatusRegister(beStatusRegister);
1206 setDAQRegister(daqRegister);
1207 setDAQRegister2(daqRegister2);
1209 setFEUnitLength(iFE,feUnitLengths[iFE]);
1210 setFEUnitMajorityAddress(iFE,feMajorityAddresses[iFE]);
1213 setChannelStatus(iCh,channelStatus[iCh]);
1229 feWord(internalFEUnitNum)[9] = address;
1234 set32BitWordAt(feWord(0)+10,beStatusRegister);
1239 set32BitWordAt(feWord(7)+10,daqRegister);
1244 set32BitWordAt(feWord(6)+10,daqRegister2);
1250 set32BitWordAt(feWord(internalFEUnitNum)+10,reservedRegister);
1255 feWord(internalFEUnitNum)[15] = ( (length & 0xFF00) >> 8);
1256 feWord(internalFEUnitNum)[14] = (length & 0x00FF);
1262 uint8_t& byte = *(feWord(internalFEDChannelNum /
FEDCH_PER_FEUNIT)+(bitInFeWord/8));
1263 const uint8_t
mask = (0x1 << bitInFeWord%8);
1264 byte = ( (byte & (~mask)) | (value?mask:0x0) );
1276 originalBuffer_(fedBuffer),
1277 bufferSize_(fedBufferSize)
1279 init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1286 init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1290 void FEDBufferBase::init(
const uint8_t* fedBuffer,
const size_t fedBufferSize,
const bool allowUnrecognizedFormat)
1293 static const size_t MIN_BUFFER_SIZE = 8+8+8;
1297 std::ostringstream ss;
1298 ss <<
"Buffer is too small. " 1299 <<
"Min size is " << MIN_BUFFER_SIZE <<
". " 1310 std::ostringstream ss;
1311 ss <<
"Buffer format not recognized. " 1318 const uint32_t* originalU32 =
reinterpret_cast<const uint32_t*
>(
originalBuffer_);
1320 uint32_t* newU32 =
reinterpret_cast<uint32_t*
>(newBuffer);
1323 for (
size_t i = 0;
i < sizeU32;
i+=2) {
1324 newU32[
i] = originalU32[
i+1];
1325 newU32[
i+1] = originalU32[
i];
1330 memcpy(newU32,originalU32,8);
1332 memcpy(newU32+sizeU32-2,originalU32+sizeU32-2,8);
1334 for (
size_t i = 2;
i < sizeU32-2;
i+=2) {
1335 newU32[
i] = originalU32[
i+1];
1336 newU32[
i+1] = originalU32[
i];
1359 os <<
"buffer format: " <<
bufferFormat() << std::endl;
1360 os <<
"Buffer size: " <<
bufferSize() <<
" bytes" << std::endl;
1362 os <<
"Source ID: " <<
daqSourceID() << std::endl;
1363 os <<
"Header type: " <<
headerType() << std::endl;
1364 os <<
"Readout mode: " <<
readoutMode() << std::endl;
1365 os <<
"DAQ event type: " <<
daqEventType() << std::endl;
1366 os <<
"TTS state: " <<
daqTTSState() << std::endl;
1367 os <<
"L1 ID: " <<
daqLvl1ID() << std::endl;
1368 os <<
"BX ID: " <<
daqBXID() << std::endl;
1370 os <<
"APVe Address: " << uint16_t(
apveAddress()) << std::endl;
1371 os <<
"Enabled FE units: " << uint16_t(
nFEUnitsEnabled()) << std::endl;
1412 summary <<
"Check buffer type valid: " << (
checkBufferFormat() ?
"passed" :
"FAILED" ) << std::endl;
1413 summary <<
"Check header format valid: " << (
checkHeaderType() ?
"passed" :
"FAILED" ) << std::endl;
1414 summary <<
"Check readout mode valid: " << (
checkReadoutMode() ?
"passed" :
"FAILED" ) << std::endl;
1416 summary <<
"Check FE unit majority addresses: " << (
checkMajorityAddresses() ?
"passed" :
"FAILED" ) << std::endl;
1418 summary <<
"FEs with majority address error: ";
1419 unsigned int badFEs = 0;
1423 summary << uint16_t(iFE) <<
" ";
1427 summary << std::endl;
1428 summary <<
"Number of FE Units with bad addresses: " << badFEs << std::endl;
1430 summary <<
"Check for FE unit buffer overflows: " << (
checkNoFEOverflows() ?
"passed" :
"FAILED" ) << std::endl;
1432 summary <<
"FEs which overflowed: ";
1433 unsigned int badFEs = 0;
1436 summary << uint16_t(iFE) <<
" ";
1440 summary << std::endl;
1441 summary <<
"Number of FE Units which overflowed: " << badFEs << std::endl;
1443 summary <<
"Check for S-Link CRC errors: " << (
checkNoSlinkCRCError() ?
"passed" :
"FAILED" ) << std::endl;
1445 summary <<
"Check CRC: " << (
checkCRC() ?
"passed" :
"FAILED" ) << std::endl;
1446 summary <<
"Check source ID is FED ID: " << (
checkSourceIDs() ?
"passed" :
"FAILED" ) << std::endl;
1447 summary <<
"Check for unexpected source ID at FRL: " << (
checkNoUnexpectedSourceID() ?
"passed" :
"FAILED" ) << std::endl;
1449 summary <<
"Check length from trailer: " << (
checkLengthFromTrailer() ?
"passed" :
"FAILED" ) << std::endl;
1450 return summary.str();
1459 std::ostringstream ss;
1460 ss <<
"Request for CM median from channel with non-ZS packet code. " 1461 <<
"Packet code is " << uint16_t(
packetCode()) <<
"." 1466 std::ostringstream ss;
1467 ss <<
"Channel APV index out of range when requesting CM median for APV. " 1468 <<
"Channel APV index is " << uint16_t(apvIndex) <<
"." 1474 result |= data_[(offset_+3+2*apvIndex)^7];
1475 result |= ( ((data_[(offset_+4+2*apvIndex)^7]) << 8) & 0x300 );
bool checkNoUnexpectedSourceID() const
FEDBackendStatusRegister & setFEFPGABufferState(const FEDBufferState state)
FEDBackendStatusRegister & setQDRMemoryState(const FEDBufferState state)
FEDBackendStatusRegister & setL1ABXFIFOState(const FEDBufferState state)
bool checkNoExtraHeadersOrTrailers() const
virtual bool doChecks() const
bool feDataMissingFlag(const uint8_t internalFEUnitNum) const
bool qdrMemoryPartialFullFlag() const
void printHexValue(const uint8_t value, std::ostream &os)
bool checkSourceIDs() const
void printFlags(std::ostream &os) const
void setBit(const uint8_t num, const bool bitSet)
static const uint16_t FED_ID_MIN
uint8_t nFEUnitsEnabled() const
bool checkReadoutMode() const
bool getBit(const uint8_t num) const
void setQDRMemoryEmptyFlag(const bool bitSet)
virtual std::string checkSummary() const
uint8_t apveAddress() const
FEDBackendStatusRegister & setFrameAddressFIFOState(const FEDBufferState state)
uint32_t daqEventLengthInBytes() const
FEDBackendStatusRegister & setTrackerHeaderFIFOState(const FEDBufferState state)
bool l1aBxFIFOPartialFullFlag() const
bool checkHeaderType() const
bool doDAQHeaderAndTrailerChecks() const
FEDDAQTrailer & setSLinkCRCErrorBit(const bool bitSet)
FEDDAQTrailer & setTTSBits(const FEDTTSBits ttsBits)
FEDReadoutMode readoutMode() const
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
bool checkNoFEOverflows() const
FEDDAQTrailer & setSLinkTransmissionErrorBit(const bool bitSet)
FEDHeaderType fedHeaderTypeFromString(const std::string &headerTypeString)
void printFlags(std::ostream &os) const
uint16_t calculateFEDBufferCRC(const uint8_t *buffer, const size_t lengthInBytes)
std::ostream & operator<<(std::ostream &os, const FEDBufferFormat &value)
FEDBufferFormat fedBufferFormatFromString(const std::string &bufferFormatString)
void setBit(const uint8_t num, const bool bitSet)
FEDDAQEventType daqEventType() const
const uint8_t * orderedBuffer_
FEDTTSBits daqTTSState() const
bool checkNoSlinkCRCError() const
bool checkNoSLinkTransmissionError() const
FEDReadoutMode fedReadoutModeFromString(const std::string &readoutModeString)
FEDBackendStatusRegister(const uint32_t backendStatusRegister)
uint16_t cmMedian(const uint8_t apvIndex) const
FEDDAQTrailer daqTrailer_
bool slinkFullFlag() const
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED
FEDBackendStatusRegister & setTotalLengthFIFOState(const FEDBufferState state)
FEDDAQTrailer & setEventLengthIn64BitWords(const uint32_t eventLengthIn64BitWords)
bool qdrMemoryEmptyFlag() const
FEDDAQTrailer & setEventStatusNibble(const uint8_t eventStatusNibble)
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
FEDBackendStatusRegister & setTTCReadyFlag(const bool bitSet)
FEDDAQTrailer & setCRC(const uint16_t crc)
FEDStatusRegister & setL1ABXFIFOBufferState(const FEDBufferState state)
static const uint16_t FEUNITS_PER_FED
FEDBufferState qdrMemoryState() const
void setQDRMemoryFullFlag(const bool bitSet)
bool feEnabled(const uint8_t internalFEUnitNum) const
void setL1ABXFIFOFullFlag(const bool bitSet)
static const uint8_t BUFFER_FORMAT_CODE_NEW
FEDBufferBase(const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat=false)
bool qdrMemoryFullFlag() const
FEDHeaderType headerType() const
const uint8_t * originalBuffer_
void printFlagsForBuffer(const FEDBufferState bufferState, const std::string name, std::ostream &os) const
uint8_t packetCode(bool legacy=false, const uint8_t internalFEDChannelNum=0) const
void setL1ABXFIFOPartialFullFlag(const bool bitSet)
FEDBufferState l1aBxFIFOState() const
FEDTTSBits ttsBits() const
FEDDAQEventType fedDAQEventTypeFromString(const std::string &daqEventTypeString)
std::vector< FEDChannel > channels_
FEDBufferState getBufferState(const uint8_t bufferPosition) const
FEDDAQTrailer & setBadSourceIDBit(const bool bitSet)
bool l1aBxFIFOFullFlag() const
bool l1aBxFIFOEmptyFlag() const
void printHex(const void *pointer, const size_t length, std::ostream &os)
bool checkBufferFormat() const
static const uint16_t FEDCH_PER_FEUNIT
bool trackerHeaderMonitorDataReadyFlag() const
FEDBackendStatusRegister & setTrackerHeaderMonitorDataReadyFlag(const bool bitSet)
size_t bufferSize() const
unsigned short compute_crc_8bit(unsigned short crc, unsigned char data)
FEDBackendStatusRegister & setSLinkFullFlag(const bool bitSet)
uint32_t daqLvl1ID() const
void setBufferSate(const uint8_t bufferPosition, const FEDBufferState state)
void init(const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat)
TrackerSpecialHeader specialHeader_
virtual void print(std::ostream &os) const
bool doTrackerSpecialHeaderChecks() const
static const uint16_t FEDCH_PER_FED
bool checkLengthFromTrailer() const
virtual bool channelGood(const uint8_t internalFEDChannelNum) const
FEDBackendStatusRegister & setFEEventLengthFIFOState(const FEDBufferState state)
void printHexWord(const uint8_t *pointer, const size_t lengthInBytes, std::ostream &os)
static const uint16_t FED_ID_MAX
static const uint8_t BUFFER_FORMAT_CODE_OLD
uint16_t daqSourceID() const
FEDStatusRegister & setQDRMemoryBufferState(const FEDBufferState state)
FEDBackendStatusRegister & setInternalFreezeFlag(const bool bitSet)
void setL1ABXFIFOEmptyFlag(const bool bitSet)
FEDBackendStatusRegister & setBackpressureFlag(const bool bitSet)
bool checkMajorityAddresses() const
bool feOverflow(const uint8_t internalFEUnitNum) const
FEDStatusRegister fedStatusRegister() const
void setQDRMemoryPartialFullFlag(const bool bitSet)
FEDBackendStatusRegister & setSLinkDownFlag(const bool bitSet)
FEDBufferFormat bufferFormat() const