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_LITE8") ||
399 (readoutModeString ==
"ZERO_SUPPRESSED_LITE8") ||
400 (readoutModeString ==
"Zero suppressed lite8") ){
403 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT") ||
404 (readoutModeString ==
"ZERO_SUPPRESSED_LITE8_TOPBOT") ||
405 (readoutModeString ==
"Zero suppressed lite8 TopBot") ){
408 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT") ||
409 (readoutModeString ==
"ZERO_SUPPRESSED_LITE8_BOTBOT") ||
410 (readoutModeString ==
"Zero suppressed lite8 BotBot") ){
413 if ( (readoutModeString ==
"READOUT_MODE_ZERO_SUPPRESSED_LITE10") ||
414 (readoutModeString ==
"ZERO_SUPPRESSED_LITE10") ||
415 (readoutModeString ==
"Zero suppressed lite10") ) {
418 if ( (readoutModeString ==
"READOUT_MODE_PREMIX_RAW") ||
419 (readoutModeString ==
"PREMIX_RAW") ||
420 (readoutModeString ==
"PreMix Raw") ) {
423 if ( (readoutModeString ==
"READOUT_MODE_SPY") ||
424 (readoutModeString ==
"SPY") ||
425 (readoutModeString ==
"Spy channel") ) {
434 if ( packetCode ==
"ZERO_SUPPRESSED" || packetCode ==
"Zero suppressed" ) {
436 }
else if ( packetCode ==
"ZERO_SUPPRESSED10" || packetCode ==
"Zero suppressed 10" ) {
438 }
else if ( packetCode ==
"ZERO_SUPPRESSED8_BOTBOT" || packetCode ==
"Zero suppressed 8 BOTBOT" ) {
440 }
else if ( packetCode ==
"ZERO_SUPPRESSED8_TOPBOT" || packetCode ==
"Zero suppressed 8 TOPBOT" ) {
443 throw cms::Exception(
"FEDBuffer") <<
"'" << packetCode <<
"' cannot be converted into a valid packet code for FEDReadoutMode ZERO_SUPPRESSED";
447 if ( packetCode ==
"VIRGIN_RAW" || packetCode ==
"Virgin raw" ) {
449 }
else if ( packetCode ==
"VIRGIN_RAW10" || packetCode ==
"Virgin raw 10" ) {
451 }
else if ( packetCode ==
"VIRGIN_RAW8_BOTBOT" || packetCode ==
"Virgin raw 8 BOTBOT" ) {
453 }
else if ( packetCode ==
"VIRGIN_RAW8_TOPBOT" || packetCode ==
"Virgin raw 8 TOPBOT" ) {
456 throw cms::Exception(
"FEDBuffer") <<
"'" << packetCode <<
"' cannot be converted into a valid packet code for FEDReadoutMode VIRGIN_RAW";
459 if ( packetCode ==
"PROC_RAW" || packetCode ==
"Processed raw" ) {
461 }
else if ( packetCode ==
"PROC_RAW10" || packetCode ==
"Processed raw 10" ) {
463 }
else if ( packetCode ==
"PROC_RAW8_BOTBOT" || packetCode ==
"Processed raw 8 BOTBOT" ) {
465 }
else if ( packetCode ==
"PROC_RAW8_TOPBOT" || packetCode ==
"Processed raw 8 TOPBOT" ) {
468 throw cms::Exception(
"FEDBuffer") <<
"'" << packetCode <<
"' cannot be converted into a valid packet code for FEDReadoutMode PROC_RAW";
471 if ( packetCode ==
"SCOPE" || packetCode ==
"Scope" 472 || packetCode.empty() ) {
475 throw cms::Exception(
"FEDBuffer") <<
"'" << packetCode <<
"' cannot be converted into a valid packet code for FEDReadoutMode SCOPE";
478 if ( !packetCode.empty() ) {
479 throw cms::Exception(
"FEDBuffer") <<
"Packet codes are only needed for zero-suppressed (non-lite), virgin raw, processed raw and spy data. FEDReadoutMode=" << mode <<
" and packetCode='" << packetCode <<
"'";
487 if ( (daqEventTypeString ==
"PHYSICS") ||
488 (daqEventTypeString ==
"DAQ_EVENT_TYPE_PHYSICS") ||
489 (daqEventTypeString ==
"Physics trigger") ) {
492 if ( (daqEventTypeString ==
"CALIBRATION") ||
493 (daqEventTypeString ==
"DAQ_EVENT_TYPE_CALIBRATION") ||
494 (daqEventTypeString ==
"Calibration trigger") ) {
497 if ( (daqEventTypeString ==
"TEST") ||
498 (daqEventTypeString ==
"DAQ_EVENT_TYPE_TEST") ||
499 (daqEventTypeString ==
"Test trigger") ) {
502 if ( (daqEventTypeString ==
"TECHNICAL") ||
503 (daqEventTypeString ==
"DAQ_EVENT_TYPE_TECHNICAL") ||
504 (daqEventTypeString ==
"Technical trigger") ) {
507 if ( (daqEventTypeString ==
"SIMULATED") ||
508 (daqEventTypeString ==
"DAQ_EVENT_TYPE_SIMULATED") ||
509 (daqEventTypeString ==
"Simulated trigger") ) {
512 if ( (daqEventTypeString ==
"TRACED") ||
513 (daqEventTypeString ==
"DAQ_EVENT_TYPE_TRACED") ||
514 (daqEventTypeString ==
"Traced event") ) {
517 if ( (daqEventTypeString ==
"ERROR") ||
518 (daqEventTypeString ==
"DAQ_EVENT_TYPE_ERROR") ||
519 (daqEventTypeString ==
"Error") ) {
564 const uint16_t
mask = (0x0001 <<
num);
566 else data_ &= (~mask);
578 std::ostringstream ss;
579 ss <<
"Invalid buffer state: ";
598 std::ostringstream ss;
599 ss <<
"Invalid buffer state: ";
614 if (internalFreezeFlag()) os <<
"INTERNAL_FREEZE ";
615 if (slinkDownFlag()) os <<
"SLINK_DOWN ";
617 if (backpressureFlag()) os <<
"BACKPRESSURE ";
618 if (ttcReadyFlag()) os <<
"TTC_READY ";
621 printFlagsForBuffer(frameAddressFIFOState(),
"FRAME_ADDRESS",os);
622 printFlagsForBuffer(totalLengthFIFOState(),
"TOTAL_LENGTH",os);
623 printFlagsForBuffer(trackerHeaderFIFOState(),
"TRACKER_HEADER",os);
625 printFlagsForBuffer(feEventLengthFIFOState(),
"FE_LENGTH",os);
626 printFlagsForBuffer(feFPGABufferState(),
"FE",os);
655 std::ostringstream ss;
656 ss <<
"Invalid buffer state: ";
667 const uint32_t
mask = (0x00000001 <<
num);
669 else data_ &= (~mask);
679 const bool backpressure,
const bool slinkFull,
680 const bool slinkDown,
const bool internalFreeze,
681 const bool trackerHeaderMonitorDataReady,
const bool ttcReady)
705 const bool validFormatByteWhenNotWordSwapped = ( (headerPointer[BUFFERFORMAT] ==
BUFFER_FORMAT_CODE_NEW) ||
710 if (validFormatByteWhenNotWordSwapped || (!validFormatByteWhenNotWordSwapped && !validFormatByteWhenWordSwapped) ) {
711 memcpy(specialHeader_,headerPointer,8);
712 wordSwapped_ =
false;
714 memcpy(specialHeader_,headerPointer+4,4);
715 memcpy(specialHeader_+4,headerPointer,4);
741 const uint8_t eventTypeNibble = trackerEventTypeNibble();
742 const uint8_t
mode = (eventTypeNibble & 0xF);
760 const uint8_t eventTypeNibble = trackerEventTypeNibble();
767 const uint8_t
mode = (eventTypeNibble & 0xF);
795 wordSwapped_ = !wordSwapped_;
798 setBufferFormatByte(newBufferFormat);
804 switch (newBufferFormat) {
813 std::ostringstream ss;
814 ss <<
"Invalid buffer format: ";
826 setHeaderTypeNibble(headerType);
829 std::ostringstream ss;
830 ss <<
"Invalid header type: ";
838 switch(readoutMode) {
841 setReadoutModeBits(readoutMode);
855 setReadoutModeBits(readoutMode);
859 setReadoutModeBits(readoutMode);
862 std::ostringstream ss;
863 ss <<
"Invalid readout mode: ";
872 const uint8_t
mask = 0x1 << internalFEUnitNum;
873 const uint8_t
result = ( (apvAddressErrorRegister() & (~mask)) | (error?mask:0x00) );
874 setAPVEAddressErrorRegister(result);
880 const uint8_t
mask = 0x1 << internalFEUnitNum;
881 const uint8_t
result = ( (feEnableRegister() & (~mask)) | (enabled?mask:0x00) );
882 setFEEnableRegister(result);
888 const uint8_t
mask = 0x1 << internalFEUnitNum;
889 const uint8_t
result = ( (feOverflowRegister() & (~mask)) | (overflow?mask:0x00) );
890 setFEEnableRegister(result);
896 const uint8_t address,
const uint8_t addressErrorRegister,
897 const uint8_t feEnableRegister,
const uint8_t feOverflowRegister,
900 memset(specialHeader_,0x00,8);
904 setBufferFormatByte(bufferFormat);
905 setReadoutMode(readoutMode);
906 setHeaderType(headerType);
907 setAPVEAddress(address);
908 setAPVEAddressErrorRegister(addressErrorRegister);
909 setFEEnableRegister(feEnableRegister);
910 setFEOverflowRegister(feOverflowRegister);
911 setFEDStatusRegister(fedStatusRegister);
919 switch(eventTypeNibble()) {
935 header_[7] = ((header_[7] & 0xF0) | evtType);
941 header_[4] = (l1ID & 0x000000FF);
942 header_[5] = ( (l1ID & 0x0000FF00) >> 8);
943 header_[6] = ( (l1ID & 0x00FF0000) >> 16);
949 header_[3] = ( (bxID & 0x0FF0) >> 4);
950 header_[2] = ( (header_[2] & 0x0F) | ( (bxID & 0x000F) << 4) );
956 header_[2] = ( (header_[2] & 0xF0) | ( (sourceID & 0x0F00) >> 8) );
957 header_[1] = (sourceID & 0x00FF);
964 memset(header_,0x0,8);
968 setEventType(evtType);
971 setSourceID(sourceID);
979 switch(ttsNibble()) {
994 const bool slinkTransmissionError,
const bool badFEDID,
const bool slinkCRCError,
995 const uint8_t eventStatusNibble)
998 memset(trailer_,0x0,8);
1002 setEventLengthIn64BitWords(eventLengthIn64BitWords);
1003 setEventStatusNibble(eventStatusNibble);
1004 setTTSBits(ttsBits);
1006 setSLinkTransmissionErrorBit(slinkTransmissionError);
1007 setBadSourceIDBit(badFEDID);
1008 setSLinkCRCErrorBit(slinkCRCError);
1013 trailer_[4] = (eventLengthIn64BitWords & 0x000000FF);
1014 trailer_[5] = ( (eventLengthIn64BitWords & 0x0000FF00) >> 8);
1015 trailer_[6] = ( (eventLengthIn64BitWords & 0x00FF0000) >> 16);
1021 trailer_[2] = (crc & 0x00FF);
1022 trailer_[3] = ( (crc >> 8) & 0x00FF );
1028 if (bitSet) trailer_[1] |= 0x80;
1029 else trailer_[1] &= (~0x80);
1035 if (bitSet) trailer_[1] |= 0x40;
1036 else trailer_[1] &= (~0x40);
1042 if (bitSet) trailer_[0] |= 0x04;
1043 else trailer_[0] &= (~0x40);
1049 trailer_[1] = ( (trailer_[1] & 0xF0) | (eventStatusNibble & 0x0F) );
1055 trailer_[0] = ( (trailer_[0] & 0x0F) | (ttsBits & 0xF0) );
1068 return APV_ERROR_HEADER_SIZE_IN_BYTES;
1073 printHex(header_,APV_ERROR_HEADER_SIZE_IN_BYTES,os);
1086 return (header_[bitNumber/8] & (0x01<<(bitNumber%8)) );
1091 return (checkStatusBits(internalFEDChannelNum,0) && checkStatusBits(internalFEDChannelNum,1));
1101 memset(header_,0x00,APV_ERROR_HEADER_SIZE_IN_BYTES);
1103 setAPVStatusBit(iCh,0,apvsGood[iCh*2]);
1104 setAPVStatusBit(iCh,1,apvsGood[iCh*2+1]);
1112 const uint8_t byteNumber = bitNumber/8;
1113 const uint8_t bitInByte = bitNumber%8;
1114 const uint8_t
mask = (0x01 << bitInByte);
1115 header_[byteNumber] = ( (header_[byteNumber] & (~mask)) | (apvGood?mask:0x00) );
1123 setAPVStatusBit(internalFEDChannelNum,0,
false);
1124 setAPVStatusBit(internalFEDChannelNum,1,
false);
1128 setAPVStatusBit(internalFEDChannelNum,0,
true);
1130 setAPVStatusBit(internalFEDChannelNum,0,
false);
1133 setAPVStatusBit(internalFEDChannelNum,1,
true);
1135 setAPVStatusBit(internalFEDChannelNum,1,
false);
1174 return FULL_DEBUG_HEADER_SIZE_IN_BYTES;
1179 printHex(header_,FULL_DEBUG_HEADER_SIZE_IN_BYTES,os);
1189 return ( !unlockedFromBit(internalFEDChannelNum) &&
1190 !outOfSyncFromBit(internalFEDChannelNum) &&
1191 !apvError(internalFEDChannelNum,apvNum) &&
1192 !apvAddressError(internalFEDChannelNum,apvNum) );
1210 const uint8_t startByteInFEWord = (
FEDCH_PER_FEUNIT-1 - feUnitChanNum) * 6 / 8;
1215 return FEDChannelStatus( ((pFEWord[startByteInFEWord] & 0xC0) >> 6) | ((pFEWord[startByteInFEWord+1] & 0x0F) << 2) );
1217 return FEDChannelStatus( ((pFEWord[startByteInFEWord] & 0xF0) >> 4) | ((pFEWord[startByteInFEWord+1] & 0x03) << 4) );
1253 const uint32_t daqRegister,
const uint32_t daqRegister2)
1255 memset(header_,0x00,FULL_DEBUG_HEADER_SIZE_IN_BYTES);
1256 setBEStatusRegister(beStatusRegister);
1257 setDAQRegister(daqRegister);
1258 setDAQRegister2(daqRegister2);
1260 setFEUnitLength(iFE,feUnitLengths[iFE]);
1261 setFEUnitMajorityAddress(iFE,feMajorityAddresses[iFE]);
1264 setChannelStatus(iCh,channelStatus[iCh]);
1280 feWord(internalFEUnitNum)[9] = address;
1285 set32BitWordAt(feWord(0)+10,beStatusRegister);
1290 set32BitWordAt(feWord(7)+10,daqRegister);
1295 set32BitWordAt(feWord(6)+10,daqRegister2);
1301 set32BitWordAt(feWord(internalFEUnitNum)+10,reservedRegister);
1306 feWord(internalFEUnitNum)[15] = ( (length & 0xFF00) >> 8);
1307 feWord(internalFEUnitNum)[14] = (length & 0x00FF);
1313 uint8_t& byte = *(feWord(internalFEDChannelNum /
FEDCH_PER_FEUNIT)+(bitInFeWord/8));
1314 const uint8_t
mask = (0x1 << bitInFeWord%8);
1315 byte = ( (byte & (~mask)) | (value?mask:0x0) );
1327 originalBuffer_(fedBuffer),
1328 bufferSize_(fedBufferSize)
1330 init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1337 init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1341 void FEDBufferBase::init(
const uint8_t* fedBuffer,
const size_t fedBufferSize,
const bool allowUnrecognizedFormat)
1344 static const size_t MIN_BUFFER_SIZE = 8+8+8;
1348 std::ostringstream ss;
1349 ss <<
"Buffer is too small. " 1350 <<
"Min size is " << MIN_BUFFER_SIZE <<
". " 1361 std::ostringstream ss;
1362 ss <<
"Buffer format not recognized. " 1369 const uint32_t* originalU32 =
reinterpret_cast<const uint32_t*
>(
originalBuffer_);
1371 uint32_t* newU32 =
reinterpret_cast<uint32_t*
>(newBuffer);
1374 for (
size_t i = 0;
i < sizeU32;
i+=2) {
1375 newU32[
i] = originalU32[
i+1];
1376 newU32[
i+1] = originalU32[
i];
1381 memcpy(newU32,originalU32,8);
1383 memcpy(newU32+sizeU32-2,originalU32+sizeU32-2,8);
1385 for (
size_t i = 2;
i < sizeU32-2;
i+=2) {
1386 newU32[
i] = originalU32[
i+1];
1387 newU32[
i+1] = originalU32[
i];
1410 os <<
"buffer format: " <<
bufferFormat() << std::endl;
1411 os <<
"Buffer size: " <<
bufferSize() <<
" bytes" << std::endl;
1413 os <<
"Source ID: " <<
daqSourceID() << std::endl;
1414 os <<
"Header type: " <<
headerType() << std::endl;
1415 os <<
"Readout mode: " <<
readoutMode() << std::endl;
1416 os <<
"DAQ event type: " <<
daqEventType() << std::endl;
1417 os <<
"TTS state: " <<
daqTTSState() << std::endl;
1418 os <<
"L1 ID: " <<
daqLvl1ID() << std::endl;
1419 os <<
"BX ID: " <<
daqBXID() << std::endl;
1421 os <<
"APVe Address: " << uint16_t(
apveAddress()) << std::endl;
1422 os <<
"Enabled FE units: " << uint16_t(
nFEUnitsEnabled()) << std::endl;
1463 summary <<
"Check buffer type valid: " << (
checkBufferFormat() ?
"passed" :
"FAILED" ) << std::endl;
1464 summary <<
"Check header format valid: " << (
checkHeaderType() ?
"passed" :
"FAILED" ) << std::endl;
1465 summary <<
"Check readout mode valid: " << (
checkReadoutMode() ?
"passed" :
"FAILED" ) << std::endl;
1467 summary <<
"Check FE unit majority addresses: " << (
checkMajorityAddresses() ?
"passed" :
"FAILED" ) << std::endl;
1469 summary <<
"FEs with majority address error: ";
1470 unsigned int badFEs = 0;
1474 summary << uint16_t(iFE) <<
" ";
1478 summary << std::endl;
1479 summary <<
"Number of FE Units with bad addresses: " << badFEs << std::endl;
1481 summary <<
"Check for FE unit buffer overflows: " << (
checkNoFEOverflows() ?
"passed" :
"FAILED" ) << std::endl;
1483 summary <<
"FEs which overflowed: ";
1484 unsigned int badFEs = 0;
1487 summary << uint16_t(iFE) <<
" ";
1491 summary << std::endl;
1492 summary <<
"Number of FE Units which overflowed: " << badFEs << std::endl;
1494 summary <<
"Check for S-Link CRC errors: " << (
checkNoSlinkCRCError() ?
"passed" :
"FAILED" ) << std::endl;
1496 summary <<
"Check CRC: " << (
checkCRC() ?
"passed" :
"FAILED" ) << std::endl;
1497 summary <<
"Check source ID is FED ID: " << (
checkSourceIDs() ?
"passed" :
"FAILED" ) << std::endl;
1498 summary <<
"Check for unexpected source ID at FRL: " << (
checkNoUnexpectedSourceID() ?
"passed" :
"FAILED" ) << std::endl;
1500 summary <<
"Check length from trailer: " << (
checkLengthFromTrailer() ?
"passed" :
"FAILED" ) << std::endl;
1501 return summary.str();
1510 std::ostringstream ss;
1511 ss <<
"Request for CM median from channel with non-ZS packet code. " 1512 <<
"Packet code is " << uint16_t(
packetCode()) <<
"." 1517 std::ostringstream ss;
1518 ss <<
"Channel APV index out of range when requesting CM median for APV. " 1519 <<
"Channel APV index is " << uint16_t(apvIndex) <<
"." 1525 result |= data_[(offset_+3+2*apvIndex)^7];
1526 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
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED8_BOTBOT
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
static const uint8_t PACKET_CODE_SCOPE
FEDBackendStatusRegister & setTrackerHeaderFIFOState(const FEDBufferState state)
bool l1aBxFIFOPartialFullFlag() const
static const uint8_t PACKET_CODE_PROC_RAW10
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)
uint8_t packetCodeFromString(const std::string &packetCodeString, FEDReadoutMode mode)
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)
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED8_TOPBOT
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED10
FEDBackendStatusRegister(const uint32_t backendStatusRegister)
uint16_t cmMedian(const uint8_t apvIndex) const
FEDDAQTrailer daqTrailer_
static const uint8_t PACKET_CODE_VIRGIN_RAW10
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
static const uint8_t PACKET_CODE_VIRGIN_RAW8_TOPBOT
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
static const uint8_t PACKET_CODE_PROC_RAW
static const uint8_t PACKET_CODE_VIRGIN_RAW8_BOTBOT
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)
static const uint8_t PACKET_CODE_PROC_RAW8_BOTBOT
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)
static const uint8_t PACKET_CODE_PROC_RAW8_TOPBOT
void setL1ABXFIFOEmptyFlag(const bool bitSet)
FEDBackendStatusRegister & setBackpressureFlag(const bool bitSet)
bool checkMajorityAddresses() const
static const uint8_t PACKET_CODE_VIRGIN_RAW
bool feOverflow(const uint8_t internalFEUnitNum) const
FEDStatusRegister fedStatusRegister() const
void setQDRMemoryPartialFullFlag(const bool bitSet)
FEDBackendStatusRegister & setSLinkDownFlag(const bool bitSet)
FEDBufferFormat bufferFormat() const