12#include "Identifier/Identifier.h"
13#include "eformat/Issue.h"
14#include "eformat/SourceIdentifier.h"
16using eformat::helper::SourceIdentifier;
23 const IInterface* p) :
47 return StatusCode::SUCCESS;
56 StatusCode
sc = AthAlgTool::finalize();
67 }
catch (eformat::Issue &ex) {
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);
87 ATH_MSG_WARNING(
"Pointer of RDO is NULL. Skip decoding of this ROD in this event..." );
88 return StatusCode::SUCCESS;
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();
143 const uint32_t* status;
144 robFrag.rod_status(status);
145 theColl->
setErrors(nstatus > 0 ? status[0] : 0);
148 theColl->
setOrbit(nstatus > 4 ? status[4] : 0);
161 uint32_t source_id)
const
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++)
186 if(counter.id == counters[iCnt].
id)
188 counters[iCnt].
count = counter.count;
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() );
229 uint16_t slbId = roh.
sbId;
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);
422 const uint32_t nstatus,
const uint32_t* status)
const {
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 ****************************");
520 for(uint32_t i=0; i<nstatus && i<maxNStatus; i++) {
521 ATH_MSG_INFO(statusDataWord[i] <<
" status[" << i <<
"]=0x" << std::hex << status[i]);
525 for(
unsigned int j=0; j<maxFirstStatus; j++) {
526 if((status[i] >> j) & 0x1) {
527 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << firstStatus[j]);
532 for(
unsigned int j=0; j<maxTgcRodEventStatus; j++) {
533 if((status[i] >> j) & 0x1) {
534 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << tgcRodEventStatus[j]);
539 for(
unsigned int j=0; j<maxSSWs; j++) {
540 if((status[i] >> j) & 0x1) {
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++) {
545 if((status[i] >> j) & 0x1) {
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;
553 if((status[i] >> j) & 0x1) {
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;
561 if((status[i] >> j) & 0x1) {
562 ATH_MSG_INFO(std::dec << std::setw(3) << j <<
" : " << localStatus[j-16]);
568 ATH_MSG_INFO(
"**************************************************************************************");
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current TgcRawData
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old TgcRdo
void fromBS32(uint32_t data, T &s)
unsigned bcTag(unsigned bcBitMap)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
TGC_RodDecoderRawdata(const std::string &t, const std::string &n, const IInterface *p)
Default constructor.
virtual StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, TgcRdoContainer &rdoIdc) const override
Convert ROBFragment to RDO.
ServiceHandle< MuonTGC_CablingSvc > m_cablingSvc
void showStatusWords(const uint32_t source_id, const uint16_t rdoId, const int idHash, const uint32_t nstatus, const uint32_t *status) const
Show status words.
virtual StatusCode initialize() override
Standard AlgTool method.
bool m_showStatusWords
Flag for showStatusWords.
virtual StatusCode finalize() override
Standard AlgTool method.
bool m_checkRawData
Switch for checking rawdata format with readout format.
TgcRdo * getCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, TgcRdoContainer &rdoIdc) const
Retrieve header of ROBFragment.
virtual ~TGC_RodDecoderRawdata()
Default destructor.
TgcRODReadOut * m_tgcRODReadOut
RawData format converter.
void byteStream2Rdo(OFFLINE_FRAGMENTS_NAMESPACE::PointerType bs, TgcRdo &rdo, uint32_t source_id) const
Convert data contents of ROBFragment to RDO The same byteStream2Rdo method in TGC_RodDecoderReadout i...
bool m_readSlbHeaderId
Switch for reading IDs in SLB Header or ROD Header.
TGC ROD decoder for conversion from ROB fragment to TgcRDO.
An unit object of TGC ROD output.
void setLocalStatus(uint32_t data)
void setTriggerType(uint16_t v)
void setRodStatus(uint32_t data)
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
void setOrbit(uint32_t orbit)
void setErrors(uint16_t data)
uint16_t subDetectorId() const
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
uint16_t identify() const
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
const DataType * PointerType
eformat::ROBFragment< PointerType > ROBFragment
The struct for fragment count in ByteStream.
The struct for Inner trigger bits in ByteStream.
The struct for HiPt in ByteStream.
The struct for hit in ByteStream.
The struct for tracklet in ByteStream.
The struct for triplet strip in ByteStream.
The struct for SL in ByteStream.
The struct for source ID in ByteStream.