12 #include "Identifier/Identifier.h"
13 #include "eformat/Issue.h"
14 #include "eformat/SourceIdentifier.h"
16 using eformat::helper::SourceIdentifier;
23 const IInterface*
p) :
25 m_tgcRODReadOut(nullptr)
47 return StatusCode::SUCCESS;
54 delete m_tgcRODReadOut; m_tgcRODReadOut=
nullptr;
69 return StatusCode::SUCCESS;
72 uint32_t source_id = robFrag.rod_source_id();
73 SourceIdentifier sid(robFrag.rod_source_id());
78 int idHash = rdoIdHash(rdoId);
84 TgcRdo* rdo = getCollection(robFrag, rdoIdc);
87 ATH_MSG_WARNING(
"Pointer of RDO is NULL. Skip decoding of this ROD in this event..." );
88 return StatusCode::SUCCESS;
92 byteStream2Rdo(bs, *rdo, robFrag.rod_source_id());
93 if( !m_tgcRODReadOut->check(bs, *rdo, robFrag.rod_source_id())){
94 ATH_MSG_WARNING(
" Can't Check the contents of TgcRdo: Skip decoding of remaining hits of this event..." );
95 return StatusCode::SUCCESS;
98 if( !m_tgcRODReadOut->byteStream2Rdo(bs, *rdo, robFrag.rod_source_id())){
99 ATH_MSG_WARNING(
" Can't Convert the TGC BS to Rdo: Skip decoding of remaining hits of this event..." );
100 return StatusCode::SUCCESS;
107 <<
"already found into the container; do not convert" );
110 return StatusCode::SUCCESS;
117 TgcRdo* theColl =
nullptr;
119 uint32_t source_id = robFrag.rod_source_id();
120 SourceIdentifier sid(source_id);
124 int idHash = rdoIdHash(rdoId);
126 ATH_MSG_DEBUG(
" Created new Collection ID = " << sid.human() <<
" Hash = " << idHash );
129 theColl =
new TgcRdo(rdoId, idHash);
134 delete theColl; theColl =
nullptr;
137 theColl->
setL1Id(robFrag.rod_lvl1_id());
138 theColl->
setBcId(robFrag.rod_bc_id());
140 theColl->
setOnlineId(sid.subdetector_id(), sid.module_id());
142 uint32_t nstatus = robFrag.rod_nstatus();
144 robFrag.rod_status(
status);
150 if(m_showStatusWords) {
151 showStatusWords(source_id, rdoId, idHash, nstatus,
status);
171 ATH_MSG_DEBUG(
"Error: input TgcRdo id does not match bytestream id" );
178 {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 8}, {0, 9}
183 for(
int iCnt = 0; iCnt < 7; iCnt++)
194 for(
int iCnt = 0; iCnt < 7; iCnt++)
196 if(counters[iCnt].
count == 0)
198 switch(counters[iCnt].
id)
203 " " << counters[iCnt].
count <<
"words" );
204 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
214 " " << counters[iCnt].
count <<
"words" );
217 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
223 <<
" rdo.rodId():" <<rdo.
rodId()
224 <<
" roh.ldbId:" <<roh.
ldbId
225 <<
" roh.sbId:" <<roh.
sbId
226 <<
" rdo.l1Id():"<<rdo.
l1Id()
227 <<
" rdo.bcId():"<<rdo.
bcId() );
239 else slbId = (roh.
sbId-8)*2+1;
273 " " << counters[iCnt].
count <<
"words" );
276 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
334 " " << counters[iCnt].
count <<
"words" );
337 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
385 " " << counters[iCnt].
count <<
"words" );
387 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
398 static_cast<bool>(sl.
fwd),
411 ATH_MSG_VERBOSE(
"Error: Muon::TGC_RodDecoder::byteStream2Rdo Unsupported fragment type "
412 << counters[iCnt].
id);
423 static const unsigned int maxNStatus = 5;
424 static const std::string statusDataWord[maxNStatus] = {
425 "First status word specific|generic:",
426 "TGC ROD event status :",
427 "ROD VME fileter bits | SSW timeout:",
428 "Local status word | presence :",
432 static const unsigned int maxFirstStatus = 5;
433 static const std::string firstStatus[maxFirstStatus] = {
436 "Timeout occurred in at least one of the FE links. Fragment is incomplete.",
437 "Data may be incorrect, see TGC ROD event status word",
438 "An overflow in one of the ROD internal buffers has occurred. The fragment is incomplete."
441 static const unsigned int maxTgcRodEventStatus = 31;
442 static const std::string tgcRodEventStatus[maxTgcRodEventStatus] = {
443 "EC_RXsend : Error in request to send an event via RXlink",
444 "EC_FELdown : A Front End link has gone down - abandoned",
445 "EC_frame : Invalid FE link framing words",
446 "EC_Glnk : Front End link G-link error",
447 "EC_xor : Invalid XOR event checksum",
448 "EC_ovfl : Input FE event is too long or FE FIFO overflow",
449 "EC_timeout : Timeout expired for at least one FE link",
450 "EC_xormezz : Bad XOR checksum from mezz board",
451 "EC_wc0 : Event has WC=0 or WX>max WC",
452 "EC_L1ID : L1ID mismatch (TTC EVID FIFO vs local).",
453 "EC_nohdr : First word is not header",
454 "EC_rectype : Unrecognized record type",
455 "EC_null : Unexpected nulls in FE input",
456 "EC_order : Word is out of order",
457 "EC_LDB : Invalid or unexpected Star Switch ID",
458 "EC_RXovfl : RXfifo has overflowed",
459 "EC_SSWerr : SSW reports T1C, NRC, T2C, or GlinkNoLock error",
460 "EC_sbid : SBid does not match SBinfo table",
461 "EC_SBtype : SBtype does not match SBinfo table",
462 "EC_duprx : RX ID is duplicated in the event",
463 "EC_ec4 : Unexpected SB L1 Event ID(lo 4)",
464 "EC_bc : Unexpected SB BCID",
465 "EC_celladr : Invalid cell address",
466 "EC_hitovfl : Too many hits in event",
467 "EC_trgbit : Unexpected trigger bits",
468 "EC_badEoE : Bad End-of-event marker received, not 0xFCA",
469 "EC_endWCnot0 : WC not 0 after End-of-event marker",
470 "EC_noEoE : No End-of-event marker received",
471 "EC_SLGlink : Sector Logic reports G-Link error",
472 "EC_SLbc : Sector Logic BCID[2:0] does not match its SB BCID",
473 "EC_unxrxid : Data from disabled SSW RX ID"
476 static const unsigned int maxSSWs = 12;
478 static const unsigned int maxPresence = 10;
479 static const std::string presence[maxPresence] = {
482 "hits in readout fmt",
483 "tracklets in readout fmt",
484 "hits in chamber fmt",
485 "tracklets in chamber fmt",
492 static const unsigned int maxLocalStatus = 16;
493 static const std::string localStatus[maxLocalStatus] = {
494 "hit BCs are merged",
495 "tracklet BCs are merged",
497 "tracklets are sorted",
508 "ROI in this fragment",
509 "no L1AID, BCID check wrt ROD"
513 <<
"source_id=0x" << source_id <<
", "
514 <<
"rdoId=0x" << rdoId << (rdoId<16 ?
" , " :
", ")
515 <<
"idHash=0x" << idHash << (idHash<16 ?
" , " :
", ")
516 << (idHash<12 ?
"A" :
"C") << (idHash%12+1<10 ?
"0" :
"") << std::dec << idHash%12+1
518 ATH_MSG_INFO(
"***** Based on http://cern.ch/atlas-tgc/doc/ROBformat.pdf ****************************");
525 for(
unsigned int j=0; j<maxFirstStatus; j++) {
527 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << firstStatus[j]);
532 for(
unsigned int j=0; j<maxTgcRodEventStatus; j++) {
534 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << tgcRodEventStatus[j]);
539 for(
unsigned int j=0; j<maxSSWs; j++) {
541 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " <<
"time-out for SSW" << j);
544 for(
unsigned int j=0+16; j<=maxSSWs+16; j++) {
546 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " <<
"data from SSW" << j-16 <<
" gave filter \"accept\"");
551 for(
unsigned int j=0; j<maxPresence; j++) {
552 if(j==0 || j==6 || j==7)
continue;
554 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << presence[j]);
559 for(
unsigned int j=0+16; j<maxLocalStatus+16; j++) {
560 if((j>=4+16 && j<=13+16))
continue;
562 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << localStatus[j-16]);
568 ATH_MSG_INFO(
"**************************************************************************************");