16 #include "Identifier/Identifier.h"
17 #include "eformat/Issue.h"
18 #include "eformat/SourceIdentifier.h"
20 using eformat::helper::SourceIdentifier;
27 const IInterface*
p) :
29 m_tgcRODReadOut(nullptr)
54 return StatusCode::SUCCESS;
61 delete m_tgcRODReadOut; m_tgcRODReadOut=
nullptr;
76 return StatusCode::SUCCESS;
79 uint32_t source_id = robFrag.rod_source_id();
80 SourceIdentifier sid(robFrag.rod_source_id());
85 int idHash = rdoIdHash(rdoId);
91 TgcRdo* rdo = getCollection(robFrag, rdoIdc);
94 ATH_MSG_WARNING(
"Pointer of RDO is NULL. Skip decoding of this ROD in this event..." );
95 return StatusCode::SUCCESS;
99 byteStream2Rdo(bs, *rdo, robFrag.rod_source_id());
100 if( !m_tgcRODReadOut->check(bs, *rdo, robFrag.rod_source_id())){
101 ATH_MSG_WARNING(
" Can't Check the contents of TgcRdo: Skip decoding of remaining hits of this event..." );
102 return StatusCode::SUCCESS;
105 if( !m_tgcRODReadOut->byteStream2Rdo(bs, *rdo, robFrag.rod_source_id())){
106 ATH_MSG_WARNING(
" Can't Convert the TGC BS to Rdo: Skip decoding of remaining hits of this event..." );
107 return StatusCode::SUCCESS;
114 <<
"already found into the container; do not convert" );
117 return StatusCode::SUCCESS;
124 TgcRdo* theColl =
nullptr;
126 uint32_t source_id = robFrag.rod_source_id();
127 SourceIdentifier sid(source_id);
131 int idHash = rdoIdHash(rdoId);
133 ATH_MSG_DEBUG(
" Created new Collection ID = " << sid.human() <<
" Hash = " << idHash );
136 theColl =
new TgcRdo(rdoId, idHash);
141 delete theColl; theColl =
nullptr;
144 theColl->
setL1Id(robFrag.rod_lvl1_id());
145 theColl->
setBcId(robFrag.rod_bc_id());
147 theColl->
setOnlineId(sid.subdetector_id(), sid.module_id());
149 uint32_t nstatus = robFrag.rod_nstatus();
151 robFrag.rod_status(
status);
157 if(m_showStatusWords) {
158 showStatusWords(source_id, rdoId, idHash, nstatus,
status);
178 ATH_MSG_DEBUG(
"Error: input TgcRdo id does not match bytestream id" );
185 {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 8}, {0, 9}
190 for(
int iCnt = 0; iCnt < 7; iCnt++)
201 for(
int iCnt = 0; iCnt < 7; iCnt++)
203 if(counters[iCnt].
count == 0)
205 switch(counters[iCnt].
id)
210 " " << counters[iCnt].
count <<
"words" );
211 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
221 " " << counters[iCnt].
count <<
"words" );
224 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
230 <<
" rdo.rodId():" <<rdo.
rodId()
231 <<
" roh.ldbId:" <<roh.
ldbId
232 <<
" roh.sbId:" <<roh.
sbId
233 <<
" rdo.l1Id():"<<rdo.
l1Id()
234 <<
" rdo.bcId():"<<rdo.
bcId() );
246 else slbId = (roh.
sbId-8)*2+1;
280 " " << counters[iCnt].
count <<
"words" );
283 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
341 " " << counters[iCnt].
count <<
"words" );
344 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
392 " " << counters[iCnt].
count <<
"words" );
394 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
405 static_cast<bool>(sl.
fwd),
418 ATH_MSG_VERBOSE(
"Error: Muon::TGC_RodDecoder::byteStream2Rdo Unsupported fragment type "
419 << counters[iCnt].
id);
430 static const unsigned int maxNStatus = 5;
431 static const std::string statusDataWord[maxNStatus] = {
432 "First status word specific|generic:",
433 "TGC ROD event status :",
434 "ROD VME fileter bits | SSW timeout:",
435 "Local status word | presence :",
439 static const unsigned int maxFirstStatus = 5;
440 static const std::string firstStatus[maxFirstStatus] = {
443 "Timeout occurred in at least one of the FE links. Fragment is incomplete.",
444 "Data may be incorrect, see TGC ROD event status word",
445 "An overflow in one of the ROD internal buffers has occurred. The fragment is incomplete."
448 static const unsigned int maxTgcRodEventStatus = 31;
449 static const std::string tgcRodEventStatus[maxTgcRodEventStatus] = {
450 "EC_RXsend : Error in request to send an event via RXlink",
451 "EC_FELdown : A Front End link has gone down - abandoned",
452 "EC_frame : Invalid FE link framing words",
453 "EC_Glnk : Front End link G-link error",
454 "EC_xor : Invalid XOR event checksum",
455 "EC_ovfl : Input FE event is too long or FE FIFO overflow",
456 "EC_timeout : Timeout expired for at least one FE link",
457 "EC_xormezz : Bad XOR checksum from mezz board",
458 "EC_wc0 : Event has WC=0 or WX>max WC",
459 "EC_L1ID : L1ID mismatch (TTC EVID FIFO vs local).",
460 "EC_nohdr : First word is not header",
461 "EC_rectype : Unrecognized record type",
462 "EC_null : Unexpected nulls in FE input",
463 "EC_order : Word is out of order",
464 "EC_LDB : Invalid or unexpected Star Switch ID",
465 "EC_RXovfl : RXfifo has overflowed",
466 "EC_SSWerr : SSW reports T1C, NRC, T2C, or GlinkNoLock error",
467 "EC_sbid : SBid does not match SBinfo table",
468 "EC_SBtype : SBtype does not match SBinfo table",
469 "EC_duprx : RX ID is duplicated in the event",
470 "EC_ec4 : Unexpected SB L1 Event ID(lo 4)",
471 "EC_bc : Unexpected SB BCID",
472 "EC_celladr : Invalid cell address",
473 "EC_hitovfl : Too many hits in event",
474 "EC_trgbit : Unexpected trigger bits",
475 "EC_badEoE : Bad End-of-event marker received, not 0xFCA",
476 "EC_endWCnot0 : WC not 0 after End-of-event marker",
477 "EC_noEoE : No End-of-event marker received",
478 "EC_SLGlink : Sector Logic reports G-Link error",
479 "EC_SLbc : Sector Logic BCID[2:0] does not match its SB BCID",
480 "EC_unxrxid : Data from disabled SSW RX ID"
483 static const unsigned int maxSSWs = 12;
485 static const unsigned int maxPresence = 10;
486 static const std::string presence[maxPresence] = {
489 "hits in readout fmt",
490 "tracklets in readout fmt",
491 "hits in chamber fmt",
492 "tracklets in chamber fmt",
499 static const unsigned int maxLocalStatus = 16;
500 static const std::string localStatus[maxLocalStatus] = {
501 "hit BCs are merged",
502 "tracklet BCs are merged",
504 "tracklets are sorted",
515 "ROI in this fragment",
516 "no L1AID, BCID check wrt ROD"
520 <<
"source_id=0x" << source_id <<
", "
521 <<
"rdoId=0x" << rdoId << (rdoId<16 ?
" , " :
", ")
522 <<
"idHash=0x" << idHash << (idHash<16 ?
" , " :
", ")
523 << (idHash<12 ?
"A" :
"C") << (idHash%12+1<10 ?
"0" :
"") << std::dec << idHash%12+1
525 ATH_MSG_INFO(
"***** Based on http://cern.ch/atlas-tgc/doc/ROBformat.pdf ****************************");
532 for(
unsigned int j=0; j<maxFirstStatus; j++) {
534 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << firstStatus[j]);
539 for(
unsigned int j=0; j<maxTgcRodEventStatus; j++) {
541 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << tgcRodEventStatus[j]);
546 for(
unsigned int j=0; j<maxSSWs; j++) {
548 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " <<
"time-out for SSW" << j);
551 for(
unsigned int j=0+16; j<=maxSSWs+16; j++) {
553 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " <<
"data from SSW" << j-16 <<
" gave filter \"accept\"");
558 for(
unsigned int j=0; j<maxPresence; j++) {
559 if(j==0 || j==6 || j==7)
continue;
561 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << presence[j]);
566 for(
unsigned int j=0+16; j<maxLocalStatus+16; j++) {
567 if((j>=4+16 && j<=13+16))
continue;
569 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << localStatus[j-16]);
575 ATH_MSG_INFO(
"**************************************************************************************");