Project
Loading...
Searching...
No Matches
RUDecodeData.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
18
19#include "Framework/Logger.h"
24
25namespace o2
26{
27namespace itsmft
28{
29
33{
34 for (int i = ruInfo->nCables; i--;) {
35 if (cableLinkPtr[i] && !cableLinkPtr[i]->rofJumpWasSeen) {
36 cableData[i].clear();
37 }
38 }
39 nChipsFired = 0;
42}
43
48{
49 chipData->setTrigger(lnk->trigger);
50 chipData->setInteractionRecord(lnk->ir);
51}
52
55void RUDecodeData::fillChipStatistics(int icab, const ChipPixelData* chipData)
56{
57 cableLinkPtr[icab]->chipStat.nHits += chipData->getData().size();
58 uint32_t action = 0;
59 if (chipData->getErrorFlags()) {
60 action = cableLinkPtr[icab]->chipStat.addErrors(*chipData, verbosity);
61 auto compid = ChipError::composeID(cableLinkPtr[icab]->feeID, chipData->getChipID());
62 auto& chErr = chipErrorsTF[compid];
63 chErr.first++;
64 chErr.second |= chipData->getErrorFlags();
65
66 if (chipData->isErrorSet(ChipStat::RepeatingPixel)) {
67 auto& errMsg = errMsgVecTF.emplace_back();
68 errMsg.id = chipData->getChipID();
69 errMsg.errType = ChipStat::RepeatingPixel;
70 errMsg.errInfo0 = chipData->getErrorInfo() & 0xffff; // row
71 errMsg.errInfo1 = (chipData->getErrorInfo() >> 16) & 0xffff; // row
72 }
73 }
74 if (action & ChipStat::ErrActDump) {
75 linkHBFToDump[(uint64_t(cableLinkPtr[icab]->subSpec) << 32) + cableLinkPtr[icab]->hbfEntry] = cableLinkPtr[icab]->irHBF.orbit;
76 }
77}
78
82{
83 const auto* cdat = cableData[icab].data();
84 size_t cdats = cableData[icab].getUnusedSize(), cdi = 0;
85 const auto lll = cableLinkPtr[icab];
86 LOGP(info, "RU#{} Cab{} Nbytes: {} IR: {} | {}", ruSWID, icab, cdats, lll->ir.asString(), lll->describe());
87 std::string dmp = "";
88 while (cdi < cdats) {
89 dmp += fmt::format(" {:#04x}", cdat[cdi++]);
90 if (cdi && (cdi % 9) == 0) {
91 LOGP(info, "wrd#{}: {}", cdi / 9 - 1, dmp);
92 dmp = "";
93 }
94 }
95 if (!dmp.empty()) {
96 LOGP(info, "wrd#{}: {}", cdi / 9 - 1, dmp);
97 }
98}
99
103{
104 auto* link = cableLinkPtr[icab];
105 if (link->ir == ir) {
106 link->rofJumpWasSeen = false;
107 return true;
108 }
109 if (link->statusInTF == GBTLink::CollectedDataStatus::None || link->statusInTF == GBTLink::CollectedDataStatus::StoppedOnEndOfData) { // link was not seen in this TF or data was over
110 return true;
111 }
112 // apparently there was desynchronization
113 if (link->ir > ir) {
114 link->rofJumpWasSeen = true;
115#ifdef _RAW_READER_ERROR_CHECKS_
116 link->statistics.errorCounts[GBTLinkDecodingStat::ErrMissingROF]++;
117 linkHBFToDump[(uint64_t(link->subSpec) << 32) + link->hbfEntry] = link->irHBF.orbit;
118 if (link->needToPrintError(link->statistics.errorCounts[GBTLinkDecodingStat::ErrMissingROF])) {
119 LOGP(info, "{} (cable {}) has IR={} > current majority IR={} -> {}", link->describe(),
120 cableHWID[icab], link->ir.asString(), ir.asString(), link->statistics.ErrNames[GBTLinkDecodingStat::ErrMissingROF]);
121 }
122#endif
123 } else { // link IR is behind the majority IR? In principle, this should never happen
124#ifdef _RAW_READER_ERROR_CHECKS_
125 link->statistics.errorCounts[GBTLinkDecodingStat::ErrOldROF]++;
126 linkHBFToDump[(uint64_t(link->subSpec) << 32) + link->hbfEntry] = link->irHBF.orbit;
127 if (link->needToPrintError(link->statistics.errorCounts[GBTLinkDecodingStat::ErrOldROF]) && !ROFRampUpStage) {
128 LOGP(error, "{} (cable {}) has IR={} for current majority IR={} -> {}", link->describe(),
129 cableHWID[icab], link->ir.asString(), ir.asString(), link->statistics.ErrNames[GBTLinkDecodingStat::ErrOldROF]);
130 }
131#endif
132 // clean data of cables of this link
133 for (int i = 0; i < ruInfo->nCables; i++) {
134 if (cableLinkPtr[i] == link) {
135 cableData[i].clear();
136 }
137 }
138 link->rofJumpWasSeen = false;
139 }
140 return false;
141}
142
143} // namespace itsmft
144} // namespace o2
Alpide Chip and GBT link decoding statistics.
int32_t i
Declaration of the Readout Unite decoder class.
void setInteractionRecord(const o2::InteractionRecord &r)
Definition PixelData.h:114
auto getErrorInfo() const
Definition PixelData.h:132
bool isErrorSet(ChipStat::DecErrors i) const
Definition PixelData.h:129
void setTrigger(uint32_t t)
Definition PixelData.h:123
auto getErrorFlags() const
Definition PixelData.h:131
uint16_t getChipID() const
Definition PixelData.h:108
const std::vector< PixelData > & getData() const
Definition PixelData.h:115
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string asString() const
static uint32_t composeID(uint16_t feeID, int16_t chipID)
std::unordered_map< uint64_t, uint32_t > linkHBFToDump
void dumpcabledata(int icab)
std::unordered_map< uint32_t, std::pair< uint32_t, uint32_t > > chipErrorsTF
void setROFInfo(ChipPixelData *chipData, const GBTLink *lnk)
std::array< PayLoadCont, MaxCablesPerRU > cableData
std::array< uint8_t, MaxCablesPerRU > cableHWID
std::array< GBTLink *, MaxCablesPerRU > cableLinkPtr
std::vector< ErrorMessage > errMsgVecTF
bool checkLinkInSync(int icab, const o2::InteractionRecord ir)
void fillChipStatistics(int icab, const ChipPixelData *chipData)
uint8_t nCables
Definition RUInfo.h:36
o2::InteractionRecord ir(0, 0)