Skip to content
11 changes: 0 additions & 11 deletions Framework/include/QualityControl/CheckInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ class CheckInterface : public core::UserCodeInterface
/// then this should be reset here.
virtual void reset(); // not fully abstract because we don't want to change all the existing subclasses

/// \brief Returns the name of the class that can be treated by this check.
///
/// The name of the class returned by this method will be checked against the MonitorObject's encapsulated
/// object's class. If it is the same or a parent then the check will be applied. Therefore, this method
/// must return the highest class in the hierarchy that this check can use.
/// If the class does not override it, we return "TObject".
virtual std::string getAcceptedType();

bool isObjectCheckable(const std::shared_ptr<core::MonitorObject> mo);
bool isObjectCheckable(const core::MonitorObject* mo);

virtual void startOfActivity(const core::Activity& activity); // not fully abstract because we don't want to change all the existing subclasses
virtual void endOfActivity(const core::Activity& activity); // not fully abstract because we don't want to change all the existing subclasses

Expand Down
7 changes: 6 additions & 1 deletion Framework/include/QualityControl/MonitorObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ class MonitorObject : public TObject
/// \brief Get metadata value of given key, returns std::nullopt if none exists;
std::optional<std::string> getMetadata(const std::string& key);

/// \brief Check if the encapsulated object inherits from the given class name
/// \param className Name of the class to check inheritance from
/// \return true if the encapsulated object inherits from the given class, false otherwise
bool encapsulatedInheritsFrom(std::string_view className) const;

void Draw(Option_t* option) override;
TObject* DrawClone(Option_t* option) const override;

Expand Down Expand Up @@ -149,7 +154,7 @@ class MonitorObject : public TObject
void releaseObject();
void cloneAndSetObject(const MonitorObject&);

ClassDefOverride(MonitorObject, 14);
ClassDefOverride(MonitorObject, 15);
};

} // namespace o2::quality_control::core
Expand Down
16 changes: 0 additions & 16 deletions Framework/src/CheckInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,12 @@
#include "QualityControl/ReferenceUtils.h"
#include "QualityControl/MonitorObject.h"

#include <TClass.h>

using namespace std;
using namespace o2::quality_control::core;

namespace o2::quality_control::checker
{

std::string CheckInterface::getAcceptedType() { return "TObject"; }

bool CheckInterface::isObjectCheckable(const std::shared_ptr<MonitorObject> mo)
{
return isObjectCheckable(mo.get());
}

bool CheckInterface::isObjectCheckable(const MonitorObject* mo)
{
TObject* encapsulated = mo->getObject();

return encapsulated->IsA()->InheritsFrom(getAcceptedType().c_str());
}

void CheckInterface::configure()
{
// noop, override it if you want.
Expand Down
9 changes: 9 additions & 0 deletions Framework/src/MonitorObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "QualityControl/MonitorObject.h"
#include <TObject.h>
#include <TClass.h>
#include "QualityControl/RepoPathUtils.h"
#include "QualityControl/QcInfoLogger.h"

Expand Down Expand Up @@ -162,6 +163,14 @@ std::optional<std::string> MonitorObject::getMetadata(const std::string& key)
return std::nullopt;
}

bool MonitorObject::encapsulatedInheritsFrom(std::string_view className) const
{
if (!mObject) {
return false;
}
return mObject->IsA()->InheritsFrom(className.data());
}

std::string MonitorObject::getPath() const
{
return RepoPathUtils::getMoPath(this);
Expand Down
7 changes: 0 additions & 7 deletions Framework/test/testCheckInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ class TestCheck : public checker::CheckInterface
str->String().Append(" is beautiful now");
}

std::string getAcceptedType() override
{
return "TObjString";
}

string mValidString;
};

Expand All @@ -90,6 +85,4 @@ TEST_CASE("test_invoke_all_interface_methods")

testCheck.beautify(mo);
CHECK(reinterpret_cast<TObjString*>(mo->getObject())->String() == "A string is beautiful now");

CHECK(testCheck.getAcceptedType() == "TObjString");
}
2 changes: 0 additions & 2 deletions Modules/Benchmark/include/Benchmark/AlwaysGoodCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class AlwaysGoodCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

ClassDefOverride(AlwaysGoodCheck, 2);
};

Expand Down
2 changes: 0 additions & 2 deletions Modules/Benchmark/src/AlwaysGoodCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ Quality AlwaysGoodCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
return Quality::Good;
}

std::string AlwaysGoodCheck::getAcceptedType() { return ""; }

void AlwaysGoodCheck::beautify(std::shared_ptr<MonitorObject>, Quality)
{
}
Expand Down
1 change: 0 additions & 1 deletion Modules/CPV/include/CPV/PedestalCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class PedestalCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
Expand Down
1 change: 0 additions & 1 deletion Modules/CPV/include/CPV/PhysicsCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class PhysicsCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override { return "TH1"; }

private:
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
Expand Down
3 changes: 0 additions & 3 deletions Modules/CPV/src/PedestalCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ Quality PedestalCheck::check(std::map<std::string, std::shared_ptr<MonitorObject
return result;
}

// std::string PedestalCheck::getAcceptedType() { return "TObject"; }
std::string PedestalCheck::getAcceptedType() { return "TH1"; }

void PedestalCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
return; // do noting for the time being. Maybe in the future we will do something sofisticated
Expand Down
1 change: 0 additions & 1 deletion Modules/CTP/include/CTP/RawDataReaderCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;
void startOfActivity(const Activity& activity) override;
const double_t nofOrbitsPerTF = o2::base::GRPGeomHelper::instance().getNHBFPerTF();
const double_t TimeTF = nofOrbitsPerTF * o2::constants::lhc::LHCOrbitMUS / 1e6; // in seconds
Expand Down
2 changes: 0 additions & 2 deletions Modules/CTP/src/RawDataReaderCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ float RawDataReaderCheck::setTextPosition(float iPos, std::shared_ptr<TLatex> ms
return MessagePos;
}

std::string RawDataReaderCheck::getAcceptedType() { return "TH1"; }

void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
std::shared_ptr<TLatex> msg;
Expand Down
1 change: 0 additions & 1 deletion Modules/Common/include/Common/CcdbInspectorCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class CcdbInspectorCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;
void reset() override;
void startOfActivity(const Activity& activity) override;
void endOfActivity(const Activity& activity) override;
Expand Down
1 change: 0 additions & 1 deletion Modules/Common/include/Common/EverIncreasingGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class EverIncreasingGraph : public o2::quality_control::checker::CheckInterface

Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) override;
std::string getAcceptedType() override;

private:
ClassDefOverride(EverIncreasingGraph, 2);
Expand Down
1 change: 0 additions & 1 deletion Modules/Common/include/Common/IncreasingEntries.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class IncreasingEntries : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
std::map<std::string, double> mLastEntries; // moName -> number of entries
Expand Down
1 change: 0 additions & 1 deletion Modules/Common/include/Common/MeanIsAbove.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class MeanIsAbove : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) override;
std::string getAcceptedType() override;

private:
float mThreshold = 0.0f;
Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/include/Common/NonEmpty.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class NonEmpty : public o2::quality_control::checker::CheckInterface

Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) override;
std::string getAcceptedType() override;

ClassDefOverride(NonEmpty, 2);
};

Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/include/Common/ReferenceComparatorCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class ReferenceComparatorCheck : public o2::quality_control::checker::CheckInter
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void reset() override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

void startOfActivity(const Activity& activity) override;
void endOfActivity(const Activity& activity) override;

Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/include/Common/TrendCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class TrendCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

void startOfActivity(const Activity& activity) override;
void endOfActivity(const Activity& activity) override;

Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/src/CcdbInspectorCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ Quality CcdbInspectorCheck::check(std::map<std::string, std::shared_ptr<MonitorO
return result;
}

std::string CcdbInspectorCheck::getAcceptedType() { return "TH2"; }

void CcdbInspectorCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
}
Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/src/EverIncreasingGraph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ Quality EverIncreasingGraph::check(std::map<std::string, std::shared_ptr<Monitor
return result;
}

std::string EverIncreasingGraph::getAcceptedType() { return "TGraph"; }

void EverIncreasingGraph::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
ILOG(Info, Support) << "EverIncreasingGraph::Beautify" << ENDM;
Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/src/IncreasingEntries.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ Quality IncreasingEntries::check(std::map<std::string, std::shared_ptr<MonitorOb
return result;
}

std::string IncreasingEntries::getAcceptedType() { return "TH1"; }

void IncreasingEntries::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
// only add the pavetext on the faulty plots
Expand Down
4 changes: 1 addition & 3 deletions Modules/Common/src/MeanIsAbove.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ void MeanIsAbove::configure()
mThreshold = stof(mCustomParameters.at("meanThreshold"));
}

std::string MeanIsAbove::getAcceptedType() { return "TH1"; }

Quality MeanIsAbove::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
{
auto mo = moMap->begin()->second;
Expand All @@ -59,7 +57,7 @@ void MeanIsAbove::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResul
// A line is drawn at the level of the threshold.
// Its colour depends on the quality.

if (!this->isObjectCheckable(mo)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change in behaviour. There are similar uses removed in TOF code. I think we should not break the existing behaviour that users might rely on.

Extract a helper which performs a similar check, but is called encapsulatedInheritFrom(std::string_view) and is a public member of MonitorObject. Find all the former uses of isObjectCheckable and use the new helper there instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added encapsulatedInheritFrom(std::string_view) method to MonitorObject class and restored the type checking behavior in MeanIsAbove.cxx and all affected TOF check classes. This preserves the existing behavior that users might rely on. Fixed in 8997573.

if (!mo->encapsulatedInheritsFrom("TH1")) {
ILOG(Error, Support) << "object not checkable" << ENDM;
return;
}
Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/src/NonEmpty.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ ClassImp(o2::quality_control_modules::common::NonEmpty)
return result;
}

std::string NonEmpty::getAcceptedType() { return "TH1"; }

void NonEmpty::beautify(std::shared_ptr<MonitorObject> /*mo*/, Quality /*checkResult*/)
{
// NOOP
Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/src/ReferenceComparatorCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ void ReferenceComparatorCheck::reset()
mQualityFlags.clear();
}

std::string ReferenceComparatorCheck::getAcceptedType() { return "TH1"; }

// return the ROOT color index associated to a give quality level
static int getQualityColor(const Quality& q)
{
Expand Down
2 changes: 0 additions & 2 deletions Modules/Common/src/TrendCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ Quality TrendCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>*
return result;
}

std::string TrendCheck::getAcceptedType() { return "TObject"; }

static void drawThresholds(TGraph* graph, const std::vector<std::pair<double, std::pair<double, double>>>& thresholds, int lineColor, int lineStyle)
{
if (thresholds.empty()) {
Expand Down
1 change: 0 additions & 1 deletion Modules/Common/test/testMeanIsAbove.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ BOOST_AUTO_TEST_CASE(test_types)
std::map<std::string, std::shared_ptr<MonitorObject>> moMap = { { "test", mo } };

MeanIsAbove check;
BOOST_TEST(!check.isObjectCheckable(mo));

Quality quality = check.check(&moMap);
BOOST_CHECK_EQUAL(quality, Quality::Null);
Expand Down
7 changes: 0 additions & 7 deletions Modules/Common/test/testNonEmpty.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ BOOST_AUTO_TEST_CASE(checkable)
MonitorObject monitorObject(&histo, "task", "testClass", "TST");
monitorObject.setIsOwner(false);
NonEmpty myCheck;

BOOST_CHECK_EQUAL(myCheck.getAcceptedType(), "TH1");
BOOST_CHECK_EQUAL(myCheck.isObjectCheckable(&monitorObject), true);

TObject obj;
monitorObject.setObject(&obj);
BOOST_CHECK_EQUAL(myCheck.isObjectCheckable(&monitorObject), false);
}

BOOST_AUTO_TEST_CASE(beautify)
Expand Down
1 change: 0 additions & 1 deletion Modules/EMCAL/include/EMCAL/CalibCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class CalibCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
/************************************************
Expand Down
1 change: 0 additions & 1 deletion Modules/EMCAL/include/EMCAL/CellAmpCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CellAmpCheck : public o2::quality_control::checker::CheckInterface
check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo,
Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
// /************************************************
Expand Down
2 changes: 0 additions & 2 deletions Modules/EMCAL/include/EMCAL/CellCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class CellCheck : public o2::quality_control::checker::CheckInterface
// Override interface
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

ClassDefOverride(CellCheck, 1);
};

Expand Down
1 change: 0 additions & 1 deletion Modules/EMCAL/include/EMCAL/CellTimeCalibCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class CellTimeCalibCheck : public o2::quality_control::checker::CheckInterface
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
/************************************************
Expand Down
2 changes: 0 additions & 2 deletions Modules/EMCAL/include/EMCAL/DigitCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class DigitCheck : public o2::quality_control::checker::CheckInterface
// Override interface
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

ClassDefOverride(DigitCheck, 2);
};

Expand Down
2 changes: 0 additions & 2 deletions Modules/EMCAL/include/EMCAL/NumPatchesPerFastORCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class NumPatchesPerFastORCheck : public o2::quality_control::checker::CheckInter
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

struct FastORNoiseInfo {
int mCounts;
int mTRUIndex;
Expand Down
4 changes: 0 additions & 4 deletions Modules/EMCAL/include/EMCAL/NumPhysTriggCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ class NumPhysTriggCheck : public o2::quality_control::checker::CheckInterface
/// \param checkResult Quality status of this checker
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;

/// \brief Accept only TH1 histograms as input
/// \return Name of the accepted object: TH1
std::string getAcceptedType() override;

ClassDefOverride(NumPhysTriggCheck, 1);

private:
Expand Down
1 change: 0 additions & 1 deletion Modules/EMCAL/include/EMCAL/PayloadPerEventDDLCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class PayloadPerEventDDLCheck : public o2::quality_control::checker::CheckInterf
void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
// /************************************************
Expand Down
Loading