8 #define coutfl std::cout << __FILE__<< " " << __LINE__ << " "
9 #define cerrfl std::cerr << __FILE__<< " " << __LINE__ << " "
72 for (
int i = 0;
i < 32;
i++)
74 for (
int j = 0;
j < 4*64;
j++)
93 if ( (k[0] >> 28) != 0x8)
return 1;
94 if ( (k[1] >> 28) != 0x9)
return 1;
95 if ( (k[2] >> 28) != 0x9)
return 1;
96 if ( (k[3] >> 28) != 0x9)
return 1;
97 if ( (k[4] >> 28) != 0x9)
return 1;
108 for (
int fem_index = 5; fem_index <
dlength ; )
111 if ( k[fem_index] == 0xa000ffff)
115 unsigned int i =
decode_FEM ( &k[fem_index], fem_nr, dlength - fem_index);
142 int index_channel = NFEM*64;
143 int index_sample = 0;
144 int index_parity = 0;
150 if ( k[0] != 0xa000ffff)
return 0;
160 int corrected_index_channel;
169 for ( index = 4; index < len;)
171 int word_classifier = k[
index] >> 28;
173 if ( (k[index] >> 28) == 0xe)
175 corrected_index_channel = index_channel^1;
179 pre_post[1][corrected_index_channel] = ((k[
index]>>14) & 0x3fff);
186 else if ( word_classifier == 0x1)
191 NFEM = (k[
index] >> 6) & 0x7;
192 CHNL = k[
index] & 0x3f;
194 if (NFEM != fem_nr || NFEM >=
NR_FEMS)
196 coutfl <<
"NFEM and fem_nr differ - " << NFEM <<
" " << fem_nr <<
" " << hex << k[
index] << dec << endl;
201 index_channel = NFEM*64+CHNL;
202 corrected_index_channel = index_channel^1;
206 if ( (k[index+1] >> 28) == 0x3)
211 if ( (k[index] >> 28) == 0x3)
215 adc[index_sample++][corrected_index_channel] = k[
index] & 0x3fff;
216 adc[index_sample++][corrected_index_channel] = (k[
index] >> 14) & 0x3fff;
221 else if ( (k[index] >> 28) == 0xe)
224 pre_post[1][corrected_index_channel] = ((k[
index]>>14) & 0x3fff);
231 coutfl <<
"wrong tag! " << hex << (k[index] >> 28) << dec <<
" at index " << index << endl;
241 else if ( word_classifier == 0xb)
243 if ( index_parity == 0)
255 if ( index >= len)
break;
270 return adc[sample][ch];
279 if ( strcmp(what,
"CLOCK") == 0 )
284 if ( strcmp(what,
"EVTNR") == 0 )
289 if ( strcmp(what,
"SAMPLES") == 0 )
294 if ( strcmp(what,
"NRMODULES") == 0 )
300 if ( strcmp(what,
"CHANNELS") == 0 )
305 if ( strcmp(what,
"DETID") == 0 )
310 if ( strcmp(what,
"MODULEADDRESS") == 0 )
316 if ( strcmp(what,
"FEMSLOT") == 0 )
322 if ( strcmp(what,
"FEMEVTNR") == 0 )
328 if ( strcmp(what,
"FEMCLOCK") == 0 )
334 if ( strcmp(what,
"CHECKSUMMSB") == 0 )
340 if ( strcmp(what,
"CHECKSUMLSB") == 0 )
346 if ( strcmp(what,
"CALCCHECKSUMMSB") == 0 )
352 if ( strcmp(what,
"CALCCHECKSUMLSB") == 0 )
360 if ( strcmp(what,
"EVENCHECKSUMOK") == 0 )
365 if ( strcmp(what,
"ODDCHECKSUMOK") == 0 )
370 if ( strcmp(what,
"CHECKSUMOK") == 0 )
375 if ( strcmp(what,
"PRE") == 0 )
381 if ( strcmp(what,
"POST") == 0 )
387 if ( strcmp(what,
"SUPPRESSED") == 0 )
405 os <<
" *** Corrupt packet " << std::endl;
409 os <<
"Evt Nr: " <<
iValue(0,
"EVTNR") << std::endl;
410 os <<
"Clock: " <<
iValue(0,
"CLOCK") << std::endl;
411 os <<
"Nr Modules: " <<
iValue(0,
"NRMODULES") << std::endl;
412 os <<
"Channels: " <<
iValue(0,
"CHANNELS") << std::endl;
413 os <<
"Samples: " <<
iValue(0,
"SAMPLES") << std::endl;
414 os <<
"Det. ID: " << hex <<
"0x" <<
iValue(0,
"DETID") << dec << std::endl;
415 os <<
"Mod. Addr: " << hex <<
"0x" <<
iValue(0,
"MODULEADDRESS") << dec << std::endl;
418 for (
int i = 0;
i <
iValue(0,
"NRMODULES");
i++) os << setw(8) <<
iValue(
i,
"FEMSLOT");
421 os <<
"FEM Evt nr: ";
422 for (
int i = 0;
i <
iValue(0,
"NRMODULES");
i++) os << setw(8) <<
iValue(
i,
"FEMEVTNR");
426 for (
int i = 0;
i <
iValue(0,
"NRMODULES");
i++) os << setw(8) <<
iValue(
i,
"FEMCLOCK");
429 char oldFill=os.fill(
'0');
431 os <<
"FEM Checksum LSB: ";
432 for (
int i = 0;
i <
iValue(0,
"NRMODULES");
i++)
434 os <<
"0x" << hex << setw(4) <<
iValue(
i,
"CHECKSUMLSB") <<
" " << dec;
445 os <<
"FEM Checksum MSB: ";
446 for (
int i = 0;
i <
iValue(0,
"NRMODULES");
i++)
448 os <<
"0x" << hex << setw(4) <<
iValue(
i,
"CHECKSUMMSB") <<
" "<< dec;
466 os << setw(4) <<
c <<
" |-";
470 os << setw(4) <<
c <<
" | ";
476 os << setw(6) <<
iValue(
c,
"PRE");
477 os << setw(6) <<
iValue(
c,
"POST") <<
" | " ;
479 if ( !
iValue(
c,
"SUPPRESSED") )