32 sERROR[10] =
"ALCT CRC Error ";
34 sERROR[10] =
"ALCT CRC Error ( disabled ) ";
40 sERROR[15] =
"TMB CRC Error ";
42 sERROR[15] =
"TMB CRC Error ( disabled ) ";
48 sERROR[18] =
"CFEB CRC Error ";
50 sERROR[18] =
"CFEB CRC Error ( disabled ) ";
56 sERROR[25] =
"DCC Trailer Missing ";
57 sERROR[26] =
"DCC Header Missing ";
59 sERROR[25] =
"DCC Trailer Missing (disabled) ";
60 sERROR[26] =
"DCC Header Missing (disabled) ";
73 sDMBExpectedPayload(nPAYLOADS),
74 sDMBEventStaus(nSTATUSES),
81 sERROR[0] =
" Any errors ";
82 sERROR[1] =
" DDU Trailer Missing ";
83 sERROR[2] =
" DDU Header Missing ";
84 sERROR[3] =
" DDU CRC Error (not yet implemented) ";
85 sERROR[4] =
" DDU Word Count Error ";
86 sERROR[5] =
" DMB Trailer Missing ";
87 sERROR[6] =
" DMB Header Missing ";
88 sERROR[7] =
" ALCT Trailer Missing ";
89 sERROR[8] =
" ALCT Header Missing ";
90 sERROR[9] =
" ALCT Word Count Error ";
91 sERROR[10] =
"ALCT CRC Error ";
92 sERROR[11] =
"ALCT Trailer Bit Error ";
101 sERROR[12] =
"TMB Trailer Missing ";
102 sERROR[13] =
"TMB Header Missing ";
103 sERROR[14] =
"TMB Word Count Error ";
104 sERROR[15] =
"TMB CRC Error ";
105 sERROR[16] =
"CFEB Word Count Per Sample Error ";
106 sERROR[17] =
"CFEB Sample Count Error ";
107 sERROR[18] =
"CFEB CRC Error ";
108 sERROR[19] =
"DDU Event Size Limit Error ";
110 sERROR[21] =
"ALCT DAV Error ";
111 sERROR[22] =
"TMB DAV Error ";
112 sERROR[23] =
"CFEB DAV Error ";
113 sERROR[24] =
"DMB Active Error ";
114 sERROR[25] =
"DCC Trailer Missing ";
115 sERROR[26] =
"DCC Header Missing ";
116 sERROR[27] =
"DMB DAV vs. DMB Active mismatch Error ";
117 sERROR[28] =
"Extra words between DDU Header and first DMB header";
121 sWARNING[0] =
" Extra words between DDU Trailer and DDU Header ";
122 sWARNING[1] =
" DDU Header Incomplete ";
173 sERROR_[0] =
" Any errors: 00";
174 sERROR_[1] =
" DDU Trailer Missing: 01";
175 sERROR_[2] =
" DDU Header Missing: 02";
176 sERROR_[3] =
" DDU CRC Error (not yet implemented): 03";
177 sERROR_[4] =
" DDU Word Count Error: 04";
178 sERROR_[5] =
" DMB Trailer Missing: 05";
179 sERROR_[6] =
" DMB Header Missing: 06";
180 sERROR_[7] =
" ALCT Trailer Missing: 07";
181 sERROR_[8] =
" ALCT Header Missing: 08";
182 sERROR_[9] =
" ALCT Word Count Error: 09";
183 sERROR_[10] =
"ALCT CRC Error: 10";
184 sERROR_[11] =
"ALCT Trailer Bit Error: 11";
185 sERROR_[12] =
"TMB Trailer Missing: 12";
186 sERROR_[13] =
"TMB Header Missing: 13";
187 sERROR_[14] =
"TMB Word Count Error: 14";
188 sERROR_[15] =
"TMB CRC Error: 15";
189 sERROR_[16] =
"CFEB Word Count Per Sample Error: 16";
190 sERROR_[17] =
"CFEB Sample Count Error: 17";
191 sERROR_[18] =
"CFEB CRC Error: 18";
192 sERROR_[19] =
"DDU Event Size Limit Error: 19";
194 sERROR_[21] =
"ALCT DAV Error: 21";
195 sERROR_[22] =
"TMB DAV Error: 22";
196 sERROR_[23] =
"CFEB DAV Error: 23";
197 sERROR_[24] =
"DMB Active Error: 24";
198 sERROR_[25] =
"DCC Trailer Missing: 25";
199 sERROR_[26] =
"DCC Header Missing: 26";
200 sERROR_[27] =
"DMB DAV vs. DMB Active mismatch Error: 27";
201 sERROR_[28] =
"Extra words between DDU Header and first DMB header: 28";
204 sWARNING_[0] =
" Extra words between DDU Trailer and DDU Header: 00";
205 sWARNING_[1] =
" DDU Header Incomplete: 02";
260 bzero(
tmpbuf,
sizeof(uint16_t) * 16);
271 bool fTMB_MiniScope_Start =
false;
272 bool fTMB_RPC_Start =
false;
273 bool fTMB_BlockedCFEBs_Start =
false;
275 bool fTMB_MiniScope =
false;
276 bool fTMB_RPC =
false;
277 bool fTMB_BlockedCFEBs =
false;
310 for (
int g = 0;
g < 4;
g++) {
311 if (
buf0[
g] == 0x1000) {
313 }
else if (
buf0[
g] != 0x3000)
342 if ((((
buf0[3] & 0xF000) == 0x5000 && (
buf0[0] & 0x00FF) == 0x005F) ||
343 ((
buf0[3] & 0xF000) == 0x5000 && (
buf0[0] & 0x000F) == 0x0008)) &&
346 (
buf1[3] & 0xF000) == 0xD000) {
354 CERR <<
"\n\nDCC Header Occurrence ";
355 CERR <<
" ERROR 25 " <<
sERROR[25] << endl;
365 bzero(
tmpbuf,
sizeof(uint16_t) * 16);
378 ((
buf0[0] & 0xF000) == 0xC000 || (
buf0[1] & 0xF000) == 0xC000 || (
buf0[2] & 0xF000) == 0xC000 ||
379 (
buf0[3] & 0xF000) == 0xC000) &&
389 CERR <<
" ERROR 20 " <<
sERROR[20] << endl;
394 if (
buf0[1] == 0x8000 &&
buf0[2] == 0x0001 &&
buf0[3] == 0x8000) {
409 CERR <<
" ERROR 1 " <<
sERROR[1] << endl;
426 CERR <<
" ERROR 5 " <<
sERROR[5] << endl;
456 bzero(
tmpbuf,
sizeof(uint16_t) * 16);
520 for (
int bit = 0; bit < 15; bit++)
528 if ((
buf_1[3] & 0xF000) != 0x5000) {
533 CERR <<
" WARNING 1 " <<
sWARNING[1] <<
". What must have been Header 1: 0x" << std::hex <<
buf_1[0] <<
" 0x"
541 COUT <<
"\n----------------------------------------------------------" << endl;
543 <<
" L1A = " << (((
buf_1[2] & 0xFFFF) + ((
buf_1[3] & 0x00FF) << 16))) << endl;
548 if ((
buf0[0] & 0xF000) == 0xA000 && (
buf0[1] & 0xF000) == 0xA000 && (
buf0[2] & 0xF000) == 0xA000 &&
549 (
buf0[3] & 0xF000) == 0xA000) {
603 fTMB_MiniScope_Start =
false;
604 fTMB_RPC_Start =
false;
605 fTMB_BlockedCFEBs_Start =
false;
607 fTMB_MiniScope =
false;
609 fTMB_BlockedCFEBs =
false;
622 COUT <<
"Crate=" << setw(3) << setfill(
'0') << ((
buf0[1] >> 4) & 0x00FF) <<
" DMB=" << setw(2) << setfill(
'0')
623 << (
buf0[1] & 0x000F) <<
" ";
626 COUT << setw(1) << ((
buf0[0] & 0x0200) >> 9) <<
" " << ((
buf0[0] & 0x0800) >> 11)
629 COUT << setw(1) << ((
buf0[0] & 0x0010) >> 4) << ((
buf0[0] & 0x0008) >> 3) << ((
buf0[0] & 0x0004) >> 2)
630 << ((
buf0[0] & 0x0002) >> 1) << (
buf0[0] & 0x0001);
641 if (
buf0[0] & 0x0001)
643 if (
buf0[0] & 0x0002)
645 if (
buf0[0] & 0x0004)
647 if (
buf0[0] & 0x0008)
649 if (
buf0[0] & 0x0010)
651 if (
buf0[0] & 0x0020)
653 if (
buf0[0] & 0x0040)
672 if (
buf0[0] & 0x0001)
674 if (
buf0[0] & 0x0002)
676 if (
buf0[0] & 0x0004)
678 if (
buf0[0] & 0x0008)
680 if (
buf0[0] & 0x0010)
693 if ((
buf0[0] == 0xDB0A && (
buf0[1] & 0xF000) == 0xD000 && (
buf0[2] & 0xF000) == 0xD000 &&
694 (
buf0[3] & 0xF000) == 0xD000) &&
695 ((
buf_1[0] & 0xF000) == 0xA000 && (
buf_1[1] & 0xF000) == 0xA000 && (
buf_1[2] & 0xF000) == 0xA000 &&
696 (
buf_1[3] & 0xF000) == 0xA000)) {
708 int nWGs_per_layer = ((
buf1[2] & 0x0007) + 1) * 16;
710 nWG_round_up =
int(nWGs_per_layer / 12) + (nWGs_per_layer % 3 ? 1 : 0);
712 bool config_present =
buf1[0] & 0x4000;
714 bool lct_overflow =
buf1[0] & 0x2000;
716 bool raw_overflow =
buf1[0] & 0x1000;
718 int lct_tbins = (
buf1[3] & 0x01E0) >> 5;
720 int raw_tbins = (
buf1[3] & 0x001F);
726 for (
int g = 0;
g < 4;
g++) {
727 if (
buf1[
g] == 0x1000)
740 int config_size = (config_present ? 3 + 5 : 0);
742 int colreg_size = (config_present ? nWGs_per_layer / 4 : 0);
744 int hot_ch_size = (config_present ?
nWG_round_up * 6 : 0);
746 int alct_0_1_size = (!lct_overflow ? 2 * lct_tbins : 0);
748 int raw_hit_dump_size = (!raw_overflow ?
nWG_round_up * 6 * raw_tbins : 0);
754 ALCT_WordsExpected += config_size + colreg_size + hot_ch_size + alct_0_1_size + raw_hit_dump_size;
766 if (((
buf0[0] & 0xF800) == 0x6000 && (
buf0[1] & 0x8F80) == 0x0080 && (
buf0[2] & 0x8000) == 0x0000 &&
767 (
buf0[3] & 0xc000) == 0x0000) &&
768 ((
buf_1[0] & 0xF000) == 0xA000 && (
buf_1[1] & 0xF000) == 0xA000 && (
buf_1[2] & 0xF000) == 0xA000 &&
769 (
buf_1[3] & 0xF000) == 0xA000)) {
776 if ((
buf0[3] & 0x0003) == 0) {
780 if ((
buf0[1] & 0x0003) == 1)
783 (((
buf0[3] & 0x0001)) + ((
buf0[3] & 0x0002) >> 1) + ((
buf0[3] & 0x0004) >> 2) +
784 ((
buf0[3] & 0x0008) >> 3) + ((
buf0[3] & 0x0010) >> 4) + ((
buf0[3] & 0x0020) >> 5) +
785 ((
buf0[3] & 0x0040) >> 6)) *
798 if ((
buf0[0] & 0xFFFF) == 0xDB0C) {
816 if ((
buf1[1] & 0x3000) == 0x3000) {
819 if ((
buf1[1] & 0x3000) == 0x0000) {
828 if ((
buf0[0] & 0xFFFF) == 0x6B0C && (((
buf_1[0] & 0xF000) == 0xA000 && (
buf_1[1] & 0xF000) == 0xA000 &&
829 (
buf_1[2] & 0xF000) == 0xA000 && (
buf_1[3] & 0xF000) == 0xA000) ||
830 ((
buf_1[0] & 0x0800) == 0x0000 && (
buf_1[1] & 0xF800) == 0xD000 &&
831 (
buf_1[2] & 0xFFFF) == 0xDE0D && (
buf_1[3] & 0xF000) == 0xD000)
842 if ((
buf0[1] & 0x3000) == 0x3000) {
845 if ((
buf0[1] & 0x3000) == 0x0000) {
849 if ((
buf0[1] & 0x3000) == 0x1000) {
874 (
buf0[0] == 0xDE0D && (
buf0[1] & 0xF800) == 0xD000 && (
buf0[2] & 0xF800) == 0xD000 &&
877 ((
buf0[0] & 0x0800) == 0x0000 && (
buf0[1] & 0xF800) == 0xD000 && (
buf0[2] & 0xFFFF) == 0xDE0D &&
944 for (uint16_t
j = 0,
w = 0;
j < 4; ++
j) {
947 for (uint32_t
i = 15,
t = 0, ncrc = 0;
i < 16;
i--) {
982 fTMB_RPC_Start =
true;
987 fTMB_MiniScope_Start =
true;
992 fTMB_BlockedCFEBs_Start =
true;
1002 fTMB_MiniScope =
true;
1007 fTMB_BlockedCFEBs =
true;
1019 ((
buf0[0] & 0xF000) == 0xD000 && (
buf0[1] & 0xF000) == 0xD000 && (
buf0[2] & 0xFFFF) == 0xDE0F &&
1022 (
buf0[0] == 0xDE0F && (
buf0[1] & 0xF000) == 0xD000 && (
buf0[2] & 0xF000) == 0xD000 &&
1080 else if (
pos == 3) {
1093 if (fTMB_BlockedCFEBs)
1103 for (uint16_t
j = 0,
w = 0;
j < 4; ++
j) {
1106 for (uint32_t
i = 15,
t = 0, ncrc = 0;
i < 16;
i--) {
1108 ncrc = (
TMB_CRC << 1) & 0x3ffffc;
1118 if (((
buf0[1] & 0xF000) == 0x7000) && ((
buf0[2] & 0xF000) == 0x7000) &&
1119 ((
buf0[1] != 0x7FFF) || (
buf0[2] != 0x7FFF)) &&
1120 (((
buf0[3] & 0xFFFF) == 0x7FFF) ||
1170 if ((
buf0[0] & 0xF000) == 0xB000 && (
buf0[1] & 0xF000) == 0xB000 && (
buf0[2] & 0xF000) == 0xB000 &&
1171 (
buf0[3] & 0xF000) == 0xB000) {
1204 if ((
buf0[0] & 0xF000) == 0xF000 && (
buf0[1] & 0xF000) == 0xF000 && (
buf0[2] & 0xF000) == 0xF000 &&
1205 (
buf0[3] & 0xF000) == 0xF000) {
1214 if (
buf0[0] & 0x0400)
1216 if (
buf0[0] & 0x0800)
1233 if ((
buf1[0] & 0xF000) != 0xE000 || (
buf1[1] & 0xF000) != 0xE000 || (
buf1[2] & 0xF000) != 0xE000 ||
1234 (
buf1[3] & 0xF000) != 0xE000) {
1257 if ((
buf0[0] & 0xF000) == 0xE000 && (
buf0[1] & 0xF000) == 0xE000 && (
buf0[2] & 0xF000) == 0xE000 &&
1258 (
buf0[3] & 0xF000) == 0xE000) {
1334 COUT <<
" DMB=" << (
buf0[1] & 0x000F);
1380 if (
buf0[0] == 0x8000 &&
buf0[1] == 0x8000 &&
buf0[2] == 0xFFFF &&
buf0[3] == 0x8000) {
1403 COUT <<
" Ex-Err: DMB (Header, Trailer) " << std::endl;
1454 COUT <<
"----------------------------------------------------------" << endl;
1466 CERR <<
" ERROR " <<
err <<
" " <<
sERROR[
err] << endl;
1472 for (
int wrn = 1; wrn <
nWARNINGS; ++wrn) {
1475 COUT <<
" WARNING " << wrn <<
" " <<
sWARNING[wrn] << endl;
1492 bzero(
tmpbuf,
sizeof(uint16_t) * 16);
1501 if ((
buf1[3] & 0xFF00) == 0xEF00 &&
1502 (((
buf2[3] & 0xFF00) == 0xAF00) || ((
buf2[3] & 0xFF00) == 0xA000 && (
buf2[0] & 0x0003) == 0x0))) {
1526 bzero(
tmpbuf,
sizeof(uint16_t) * 16);
1540 memcpy((
void*)
tmpbuf, (
void*)(
buffer - 16),
sizeof(
short) * 16);
1567 for (
int wrn = 0; wrn <
nWARNINGS; ++wrn)
1702 for (
int wrn = 0; wrn <
nWARNINGS; ++wrn)
1709 for (
int i = 0;
i < length;
i++) {
1710 if ((
buffer[
i] & mask) == sig) {