Skip to content

Commit

Permalink
Merge b60b6c4 into sapling-pr-archive-ktf
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf authored Jan 3, 2025
2 parents 10ff1e0 + b60b6c4 commit d605e63
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ struct GBTLinkDecodingStat {
ClassDefNV(GBTLinkDecodingStat, 3);
};

struct ErrorMessage {
uint16_t id = -1;
uint16_t errType = 0;
uint16_t errInfo0 = 0;
uint16_t errInfo1 = 0;
ClassDefNV(ErrorMessage, 1)
};

} // namespace itsmft
} // namespace o2
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ struct RUDecodeData {
bool ROFRampUpStage = false; // flag that the data come from the ROF rate ramp-up stage
GBTCalibData calibData{}; // calibration info from GBT calibration word
std::unordered_map<uint32_t, std::pair<uint32_t, uint32_t>> chipErrorsTF{}; // vector of chip decoding errors seen in the given TF
std::vector<ErrorMessage> errMsgVecTF; // Specific errors info collected for sending for the whole TF

const RUInfo* ruInfo = nullptr;

RUDecodeData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class RawPixelDecoder final : public PixelReader
template <class CalibContainer>
void fillCalibData(CalibContainer& calib);

template <class LinkErrors, class DecErrors>
void collectDecodingErrors(LinkErrors& linkErrors, DecErrors& decErrors);
template <class LinkErrors, class DecErrors, class ErrMsgs>
void collectDecodingErrors(LinkErrors& linkErrors, DecErrors& decErrors, ErrMsgs& errInfos);

const RUDecodeData* getRUDecode(int ruSW) const { return mRUEntry[ruSW] < 0 ? nullptr : &mRUDecodeVec[mRUEntry[ruSW]]; }
const GBTLink* getGBTLink(int i) const { return i < 0 ? nullptr : &mGBTLinks[i]; }
Expand Down Expand Up @@ -267,20 +267,33 @@ void RawPixelDecoder<Mapping>::fillCalibData(CalibContainer& calib)

///______________________________________________________________________
template <class Mapping>
template <class LinkErrors, class DecErrors>
void RawPixelDecoder<Mapping>::collectDecodingErrors(LinkErrors& linkErrors, DecErrors& decErrors)
template <class LinkErrors, class DecErrors, class ErrMsgs>
void RawPixelDecoder<Mapping>::collectDecodingErrors(LinkErrors& linkErrors, DecErrors& decErrors, ErrMsgs& errInfos)
{
for (auto& lnk : mGBTLinks) {
if (lnk.gbtErrStatUpadated) {
linkErrors.push_back(lnk.statistics);
lnk.gbtErrStatUpadated = false;
}
}
size_t nerr = 0, nerrMsg = 0;
for (auto& ru : mRUDecodeVec) {
for (const auto& err : ru.chipErrorsTF) {
decErrors.emplace_back(ChipError{err.first, err.second.first, err.second.second}); // id, nerrors, errorFlags
nerr += ru.chipErrorsTF.size();
nerrMsg += ru.errMsgVecTF.size();
}
if (nerr || nerrMsg) {
decErrors.reserve(nerr);
errInfos.reserve(nerrMsg);
for (auto& ru : mRUDecodeVec) {
for (const auto& err : ru.chipErrorsTF) {
decErrors.emplace_back(ChipError{err.first, err.second.first, err.second.second}); // id, nerrors, errorFlags
}
for (auto& err : ru.errMsgVecTF) {
errInfos.push_back(err);
}
ru.chipErrorsTF.clear();
ru.errMsgVecTF.clear();
}
ru.chipErrorsTF.clear();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::itsmft::ClustererParam < o2::detectors::DetID::ITS>> + ;
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::itsmft::ClustererParam < o2::detectors::DetID::MFT>> + ;

#pragma link C++ class o2::itsmft::ErrorMessage + ;
#pragma link C++ class std::vector < o2::itsmft::ErrorMessage> + ;

#endif
8 changes: 8 additions & 0 deletions Detectors/ITSMFT/common/reconstruction/src/RUDecodeData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ void RUDecodeData::fillChipStatistics(int icab, const ChipPixelData* chipData)
auto& chErr = chipErrorsTF[compid];
chErr.first++;
chErr.second |= chipData->getErrorFlags();

if (chipData->isErrorSet(ChipStat::RepeatingPixel)) {
auto& errMsg = errMsgVecTF.emplace_back();
errMsg.id = chipData->getChipID();
errMsg.errType = ChipStat::RepeatingPixel;
errMsg.errInfo0 = chipData->getErrorInfo() & 0xffff; // row
errMsg.errInfo1 = (chipData->getErrorInfo() >> 16) & 0xffff; // row
}
}
if (action & ChipStat::ErrActDump) {
linkHBFToDump[(uint64_t(cableLinkPtr[icab]->subSpec) << 32) + cableLinkPtr[icab]->hbfEntry] = cableLinkPtr[icab]->irHBF.orbit;
Expand Down
4 changes: 3 additions & 1 deletion Detectors/ITSMFT/common/workflow/src/STFDecoderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
}
auto& linkErrors = pc.outputs().make<std::vector<GBTLinkDecodingStat>>(Output{orig, "LinkErrors", 0});
auto& decErrors = pc.outputs().make<std::vector<ChipError>>(Output{orig, "ChipErrors", 0});
mDecoder->collectDecodingErrors(linkErrors, decErrors);
auto& errMessages = pc.outputs().make<std::vector<ErrorMessage>>(Output{orig, "ErrorInfo", 0});
mDecoder->collectDecodingErrors(linkErrors, decErrors, errMessages);

pc.outputs().snapshot(Output{orig, "PHYSTRIG", 0}, mDecoder->getExternalTriggers());

Expand Down Expand Up @@ -398,6 +399,7 @@ DataProcessorSpec getSTFDecoderSpec(const STFDecoderInp& inp)

outputs.emplace_back(inp.origin, "LinkErrors", 0, Lifetime::Timeframe);
outputs.emplace_back(inp.origin, "ChipErrors", 0, Lifetime::Timeframe);
outputs.emplace_back(inp.origin, "ErrorInfo", 0, Lifetime::Timeframe);
outputs.emplace_back(inp.origin, "CHIPSSTATUS", 0, Lifetime::Timeframe);

if (inp.askSTFDist) {
Expand Down
9 changes: 4 additions & 5 deletions Framework/Core/include/Framework/ServiceRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,33 +267,32 @@ struct ServiceRegistry {

/// @deprecated old API to be substituted with the ServiceHandle one
template <class I, class C, enum ServiceKind K = ServiceKind::Serial>
requires std::is_base_of_v<I, C>
void registerService(C* service, Salt salt = ServiceRegistry::globalDeviceSalt())
{
// This only works for concrete implementations of the type T.
// We need type elision as we do not want to know all the services in
// advance
static_assert(std::is_base_of<I, C>::value == true,
"Registered service is not derived from declared interface");
constexpr ServiceTypeHash typeHash{TypeIdHelpers::uniqueId<I>()};
ServiceRegistry::registerService(typeHash, reinterpret_cast<void*>(service), K, salt, typeid(C).name());
}

/// @deprecated old API to be substituted with the ServiceHandle one
template <class I, class C, enum ServiceKind K = ServiceKind::Serial>
requires std::is_base_of_v<I, C>
void registerService(C const* service, Salt salt = ServiceRegistry::globalDeviceSalt())
{
// This only works for concrete implementations of the type T.
// We need type elision as we do not want to know all the services in
// advance
static_assert(std::is_base_of<I, C>::value == true,
"Registered service is not derived from declared interface");
constexpr ServiceTypeHash typeHash{TypeIdHelpers::uniqueId<I const>()};
this->registerService(typeHash, reinterpret_cast<void*>(const_cast<C*>(service)), K, salt, typeid(C).name());
}

/// Check if service of type T is currently active.
template <typename T>
std::enable_if_t<std::is_const_v<T> == false, bool> active(Salt salt) const
requires(std::is_const_v<T> == false)
bool active(Salt salt) const
{
constexpr ServiceTypeHash typeHash{TypeIdHelpers::uniqueId<T>()};
if (this->getPos(typeHash, GLOBAL_CONTEXT_SALT) != -1) {
Expand Down
3 changes: 2 additions & 1 deletion Framework/Core/include/Framework/ServiceRegistryRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class ServiceRegistryRef

/// Check if service of type T is currently active.
template <typename T>
std::enable_if_t<std::is_const_v<T> == false, bool> active() const
requires(std::is_const_v<T> == false)
[[nodiscard]] bool active() const
{
return mRegistry.active<T>(mSalt);
}
Expand Down

0 comments on commit d605e63

Please sign in to comment.