31 if ( what < 0 || what >3 )
return 0;
77 if ( strcmp(what,
"HITS")==0)
89 else if ( strcmp(what,
"FLAG")==0)
100 else if ( strcmp(what,
"EVTNR")==0)
111 else if ( strcmp(what,
"DETID")==0)
122 else if ( strcmp(what,
"ADC")==0)
134 else if ( strcmp(what,
"FEMID")==0)
146 else if ( strcmp(what,
"CHIPID")==0)
158 else if ( strcmp(what,
"CHANNEL")==0)
171 else if ( strcmp(what,
"MODADDR")==0)
183 else if ( strcmp(what,
"BCLCK")==0)
194 else if ( strcmp(what,
"PARITY")==0)
205 else if ( strcmp(what,
"FEMERROR")==0)
216 else if ( strcmp(what,
"CHECKPARITY")==0)
225 else if ( strcmp(what,
"ERRORCODE")==0)
252 int payloadlength = dlength -5;
265 p =
new int [ 4*512];
274 memset (p, 0, 4*512*
sizeof(
int));
280 if ( (k[payloadlength-1] & 0x80000000) == 0)
282 std::cout << __FILE__ <<
" " << __LINE__ <<
" Error in trailer word " << std::hex << k[payloadlength-1] << std::dec <<
" ";
288 if ( (k[0] & 0xFFF) != 0)
290 std::cout << __FILE__ <<
" " << __LINE__ <<
" Error: 1st word is not a FEM ID " << std::hex << k[0] << std::dec <<
" ";
297 int number_of_datawords = 0;
298 int adc, channelnumber, chipid;
301 for ( i = 0; i < payloadlength -2; i++)
304 if ( (k[i] & 0xFFF) == 0)
309 last_femid = ((k[
i] >> 12) & 0xf) -1;
316 if ( f & 1 ) last_femid = 0;
317 if ( f & 2 ) last_femid = 1;
318 if ( f & 4 ) last_femid = 2;
319 if ( f & 8 ) last_femid = 3;
321 number_of_datawords = 0;
339 else if ( number_of_datawords >= 512)
345 else if ( array_pos >= 4*512)
355 chipid = (k[
i]>>3) & 0x3f;
356 channelnumber = (k[
i]>>9) & 0x7f;
363 number_of_datawords++;
399 for (; i< dlength-1; i++)
401 p = p ^ (k[
i] & 0xffff);
406 if( p ==
iValue(0,
"PARITY") )
438 p[0] = k[0] & 0xffff;
439 p[1] = k[1] & 0xffff;
440 p[2] = k[2] & 0xffff;
441 p[3] = k[3] & 0xffff;
442 p[4] = k[4] & 0xffff;
443 p[5] = k[dlength-1] & 0xffff;
444 p[6] = k[dlength-2] & 0xffff;
459 os <<
" Number of hits " <<
iValue(0,
"HITS") << std::endl;
460 os <<
" Event number: " <<
iValue(0,
"EVTNR") << std::endl;
461 os <<
" Det id " <<
iValue(0,
"DETID") << std::endl;
462 if (
iValue(0,
"ERRORCODE"))
464 os <<
" Error Code ********* " <<
iValue(0,
"ERRORCODE");
465 switch (
iValue(0,
"ERRORCODE") )
468 os <<
" (no FEM ID found)";
472 os <<
" (Max hit count per FEM ID reached)";
476 os <<
" (Max hit count per packet reached)";
486 os <<
" Error Code " <<
iValue(0,
"ERRORCODE") << std::endl;
488 os <<
" module address " <<
iValue(0,
"MODADDR") << std::endl;
489 os <<
" Flag word 0x" << std::hex <<
iValue(0,
"FLAG") <<std::dec << std::endl;
490 os <<
" beam clock counter " <<
iValue(0,
"BCLCK") << std::endl;
491 os <<
" FEM Error word " <<
iValue(0,
"FEMERROR") << std::endl;
492 os <<
" Parity " << std::hex <<
iValue(0,
"PARITY") << std::dec <<std::endl;
495 if (
iValue(0,
"CHECKPARITY") ==1 )
497 os <<
"Yes" <<std::endl;
506 if (
iValue(0,
"HITS") ) os <<
" hit # | FemId Chip Chan ADC" << std::endl;
508 for ( hit = 0; hit <
iValue(0,
"HITS"); hit++)
510 os << std::setw(6) << hit <<
" |"
511 << std::setw(5) <<
iValue(hit, 0)
512 << std::setw(7) <<
iValue(hit, 1)
513 << std::setw(7) <<
iValue(hit, 2)
514 << std::setw(7) <<
iValue(hit, 3)
520 std::cout << std::endl;