7#include "Identifier/Identifier.h"
11#include "eformat/Issue.h"
12#include "eformat/SourceIdentifier.h"
14using eformat::helper::SourceIdentifier;
26 return StatusCode::SUCCESS;
34 const EventContext& ctx)
const {
37 }
catch (eformat::Issue& ex) {
39 return StatusCode::SUCCESS;
43 uint32_t source_id = robFrag.rod_source_id();
44 SourceIdentifier sid(robFrag.rod_source_id());
50 int idHash = rdoIdHash(rdoId);
59 "Pointer of RDO is NULL. Skip decoding of this ROD in this "
61 return StatusCode::SUCCESS;
67 *cabling, msgStream())) {
69 " Can't Check the contents of TgcRdo: Skip decoding of "
70 "remaining hits of this event...");
71 return StatusCode::SUCCESS;
75 bs, *rdo, robFrag.rod_source_id(), *cabling, msgStream())) {
77 " Can't Convert the TGC BS to Rdo: Skip decoding of "
78 "remaining hits of this event...");
79 return StatusCode::SUCCESS;
85 <<
"already found into the container; do not convert");
88 return StatusCode::SUCCESS;
97 uint32_t source_id = robFrag.rod_source_id();
98 SourceIdentifier sid(source_id);
103 int idHash = rdoIdHash(rdoId);
106 <<
" Hash = " << idHash);
109 theColl =
new TgcRdo(rdoId, idHash);
117 theColl->
setL1Id(robFrag.rod_lvl1_id());
118 theColl->
setBcId(robFrag.rod_bc_id());
120 theColl->
setOnlineId(sid.subdetector_id(), sid.module_id());
122 uint32_t nstatus = robFrag.rod_nstatus();
123 const uint32_t* status;
124 robFrag.rod_status(status);
125 theColl->
setErrors(nstatus > 0 ? status[0] : 0);
128 theColl->
setOrbit(nstatus > 4 ? status[4] : 0);
141 uint32_t source_id)
const {
149 ATH_MSG_DEBUG(
"Error: input TgcRdo id does not match bytestream id");
156 {0, 5}, {0, 8}, {0, 9}};
160 for (
int iCnt = 0; iCnt < 7; iCnt++) {
162 if (counter.id == counters[iCnt].
id) {
163 counters[iCnt].
count = counter.count;
169 for (
int iCnt = 0; iCnt < 7; iCnt++) {
170 if (counters[iCnt].
count == 0) {
173 switch (counters[iCnt].
id) {
177 << counters[iCnt].
count <<
"words");
178 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
189 << counters[iCnt].
count <<
"words");
192 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
201 <<
" roh.sbId:" << roh.
sbId
202 <<
" rdo.l1Id():" << rdo.
l1Id()
203 <<
" rdo.bcId():" << rdo.
bcId());
205 uint16_t slbId = roh.
sbId;
220 slbId = roh.
sbId * 2;
222 slbId = (roh.
sbId - 8) * 2 + 1;
251 << counters[iCnt].
count <<
"words");
254 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
298 << counters[iCnt].
count <<
"words");
301 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
307 if (hptinner.
sector & 4) {
311 0, hptinner.
sector, 0, 0, 0, 0, 0, 0,
330 << counters[iCnt].
count <<
"words");
332 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
349 "Error: Muon::TGC_RodDecoder::byteStream2Rdo Unsupported "
351 << counters[iCnt].
id);
361 const uint32_t source_id,
const uint16_t rdoId,
const int idHash,
362 const uint32_t nstatus,
const uint32_t* status)
const {
363 static const unsigned int maxNStatus = 5;
364 static const std::string statusDataWord[maxNStatus] = {
365 "First status word specific|generic:",
366 "TGC ROD event status :",
367 "ROD VME fileter bits | SSW timeout:",
368 "Local status word | presence :",
372 static const unsigned int maxFirstStatus = 5;
373 static const std::string firstStatus[maxFirstStatus] = {
376 "Timeout occurred in at least one of the FE links. Fragment is "
378 "Data may be incorrect, see TGC ROD event status word",
379 "An overflow in one of the ROD internal buffers has occurred. The "
380 "fragment is incomplete."
383 static const unsigned int maxTgcRodEventStatus = 31;
384 static const std::string tgcRodEventStatus[maxTgcRodEventStatus] = {
385 "EC_RXsend : Error in request to send an event via RXlink",
386 "EC_FELdown : A Front End link has gone down - abandoned",
387 "EC_frame : Invalid FE link framing words",
388 "EC_Glnk : Front End link G-link error",
389 "EC_xor : Invalid XOR event checksum",
390 "EC_ovfl : Input FE event is too long or FE FIFO overflow",
391 "EC_timeout : Timeout expired for at least one FE link",
392 "EC_xormezz : Bad XOR checksum from mezz board",
393 "EC_wc0 : Event has WC=0 or WX>max WC",
394 "EC_L1ID : L1ID mismatch (TTC EVID FIFO vs local).",
395 "EC_nohdr : First word is not header",
396 "EC_rectype : Unrecognized record type",
397 "EC_null : Unexpected nulls in FE input",
398 "EC_order : Word is out of order",
399 "EC_LDB : Invalid or unexpected Star Switch ID",
400 "EC_RXovfl : RXfifo has overflowed",
401 "EC_SSWerr : SSW reports T1C, NRC, T2C, or GlinkNoLock error",
402 "EC_sbid : SBid does not match SBinfo table",
403 "EC_SBtype : SBtype does not match SBinfo table",
404 "EC_duprx : RX ID is duplicated in the event",
405 "EC_ec4 : Unexpected SB L1 Event ID(lo 4)",
406 "EC_bc : Unexpected SB BCID",
407 "EC_celladr : Invalid cell address",
408 "EC_hitovfl : Too many hits in event",
409 "EC_trgbit : Unexpected trigger bits",
410 "EC_badEoE : Bad End-of-event marker received, not 0xFCA",
411 "EC_endWCnot0 : WC not 0 after End-of-event marker",
412 "EC_noEoE : No End-of-event marker received",
413 "EC_SLGlink : Sector Logic reports G-Link error",
414 "EC_SLbc : Sector Logic BCID[2:0] does not match its SB BCID",
415 "EC_unxrxid : Data from disabled SSW RX ID"
418 static const unsigned int maxSSWs = 12;
420 static const unsigned int maxPresence = 10;
421 static const std::string presence[maxPresence] = {
424 "hits in readout fmt",
425 "tracklets in readout fmt",
426 "hits in chamber fmt",
427 "tracklets in chamber fmt",
434 static const unsigned int maxLocalStatus = 16;
435 static const std::string localStatus[maxLocalStatus] = {
436 "hit BCs are merged",
437 "tracklet BCs are merged",
439 "tracklets are sorted",
450 "ROI in this fragment",
451 "no L1AID, BCID check wrt ROD"
455 <<
"source_id=0x" << source_id <<
", "
456 <<
"rdoId=0x" << rdoId << (rdoId < 16 ?
" , " :
", ")
457 <<
"idHash=0x" << idHash << (idHash < 16 ?
" , " :
", ")
458 << (idHash < 12 ?
"A" :
"C")
459 << (idHash % 12 + 1 < 10 ?
"0" :
"") << std::dec
460 << idHash % 12 + 1 <<
" ******");
462 "***** Based on http://cern.ch/atlas-tgc/doc/ROBformat.pdf "
463 "****************************");
465 for (uint32_t i = 0; i < nstatus && i < maxNStatus; i++) {
466 ATH_MSG_INFO(statusDataWord[i] <<
" status[" << i <<
"]=0x" << std::hex
472 for (
unsigned int j = 0; j < maxFirstStatus; j++) {
473 if ((status[i] >> j) & 0x1) {
480 for (
unsigned int j = 0; j < maxTgcRodEventStatus; j++) {
481 if ((status[i] >> j) & 0x1) {
483 << tgcRodEventStatus[j]);
488 for (
unsigned int j = 0; j < maxSSWs; j++) {
489 if ((status[i] >> j) & 0x1) {
491 <<
"time-out for SSW" << j);
494 for (
unsigned int j = 0 + 16; j <= maxSSWs + 16; j++) {
495 if ((status[i] >> j) & 0x1) {
497 <<
"data from SSW" << j - 16
498 <<
" gave filter \"accept\"");
503 for (
unsigned int j = 0; j < maxPresence; j++) {
504 if (j == 0 || j == 6 || j == 7) {
507 if ((status[i] >> j) & 0x1) {
514 for (
unsigned int j = 0 + 16; j < maxLocalStatus + 16; j++) {
515 if ((j >= 4 + 16 && j <= 13 + 16)) {
518 if ((status[i] >> j) & 0x1) {
520 << localStatus[j - 16]);
527 "**********************************************************************"
#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,...
std::unique_ptr< TgcRODReadOut > m_tgcRODReadOut
RawData format converter.
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.
Gaudi::Property< 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 StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, TgcRdoContainer &rdoIdc, const EventContext &ctx) const override
Convert ROBFragment to RDO.
virtual ~TGC_RodDecoderRawdata()
Default destructor.
Gaudi::Property< bool > m_showStatusWords
Flag for showStatusWords.
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_cablingKey
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...
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
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
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.