-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a generic reference data comparator
The code introduces some tools that allow to compare the plots produced by given task(s) with that of a reference run: - `ReferenceComparatorTask` draws histograms with their reference superimposed, as well as the ratio between histograms and reference - `ReferenceComparatorCheck` compares the histograms with their corresponding reference, and assesses their compatibility. The comparison is performed by a dynamically loadable module that provides the actual comparison algorithm - `ReferenceComparatorPlot` is an utility class to draw the current and reference histograms, and their ratio - `ObjectComparator*` are dynamically loadable modules than implement different histogram comparison methods Three examples are provided: - `ObjectComparatorDeviation` evaluates the average relative difference between the histogram bins - `ObjectComparatorChi2` compares the histograms using a chi2-based test - `ObjectComparatorKolmogorov` compares the histograms using a Kolmogorov test
- Loading branch information
1 parent
aa8c25e
commit 1cca51e
Showing
19 changed files
with
1,920 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"qc": { | ||
"config": { | ||
"database": { | ||
"implementation": "CCDB", | ||
"host": "ccdb-test.cern.ch:8080", | ||
"username": "not_applicable", | ||
"password": "not_applicable", | ||
"name": "not_applicable" | ||
}, | ||
"Activity": { | ||
}, | ||
"monitoring": { | ||
"url": "infologger:///debug?qc" | ||
}, | ||
"consul": { | ||
"url": "" | ||
}, | ||
"conditionDB": { | ||
"url": "ccdb-test.cern.ch:8080" | ||
} | ||
}, | ||
"postprocessing": { | ||
"ExampleRefComp": { | ||
"active": "true", | ||
"className": "o2::quality_control_modules::common::ReferenceComparatorTask", | ||
"moduleName": "QualityControl", | ||
"detectorName": "MCH", | ||
"extendedTaskParameters": { | ||
"default": { | ||
"default": { | ||
"notOlderThan" : "300", | ||
"referenceRun" : "551875" | ||
} | ||
}, | ||
"PHYSICS": { | ||
"PROTON-PROTON": { | ||
"referenceRun" : "551890" | ||
} | ||
} | ||
}, | ||
"dataGroups": [ | ||
{ | ||
"name": "Tracks", | ||
"inputPath": "MCH/MO/Tracks/WithCuts", | ||
"referencePath": "MCH/MO/Tracks", | ||
"outputPath": "Tracks/WithCuts", | ||
"normalizeReference": "true", | ||
"drawRatioOnly": "false", | ||
"drawOption1D": "E", | ||
"drawOption2D": "COL", | ||
"inputObjects": [ | ||
"TrackEta", | ||
"TrackEtaPhi" | ||
] | ||
} | ||
], | ||
"initTrigger": [ | ||
"userorcontrol" | ||
], | ||
"updateTrigger": [ | ||
"60 seconds" | ||
], | ||
"stopTrigger": [ | ||
"userorcontrol" | ||
] | ||
} | ||
}, | ||
"checks": { | ||
"ExampleRefCheck": { | ||
"active": "true", | ||
"className": "o2::quality_control_modules::common::ReferenceComparatorCheck", | ||
"moduleName": "QualityControl", | ||
"detectorName": "MCH", | ||
"policy": "OnAny", | ||
"extendedCheckParameters": { | ||
"default": { | ||
"default": { | ||
"moduleName" : "QualityControl", | ||
"comparatorName" : "o2::quality_control_modules::common::ObjectComparatorChi2", | ||
"threshold" : "0.5" | ||
} | ||
} | ||
}, | ||
"dataSource": [ | ||
{ | ||
"type": "PostProcessing", | ||
"name": "ExampleRefComp", | ||
"MOs" : [ | ||
"Tracks/WithCuts/TrackEta", | ||
"Tracks/WithCuts/TrackEtaPhi" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file ObjectComparatorChi2.h | ||
/// \author Andrea Ferrero | ||
/// \brief A class for comparing two histogram objects based on a chi2 test | ||
/// | ||
|
||
#ifndef QUALITYCONTROL_ObjectComparatorChi2_H | ||
#define QUALITYCONTROL_ObjectComparatorChi2_H | ||
|
||
#include "Common/ObjectComparatorInterface.h" | ||
|
||
namespace o2::quality_control_modules::common | ||
{ | ||
|
||
/// \brief A class for comparing two histogram objects based on a chi2 test | ||
class ObjectComparatorChi2 : public ObjectComparatorInterface | ||
{ | ||
public: | ||
/// \brief Constructor | ||
ObjectComparatorChi2() = default; | ||
/// \brief Destructor | ||
virtual ~ObjectComparatorChi2() = default; | ||
|
||
/// \brief objects comparison function | ||
/// \return the quality resulting from the object comparison | ||
o2::quality_control::core::Quality compare(TObject* obj, TObject* objRef, std::string& message) override; | ||
}; | ||
|
||
} // namespace o2::quality_control_modules::common | ||
|
||
#endif // QUALITYCONTROL_ObjectComparatorChi2_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file ObjectComparatorDeviation.h | ||
/// \author Andrea Ferrero | ||
/// \brief A class for comparing two histogram objects based on the average of the relative deviation between the bins | ||
/// | ||
|
||
#ifndef QUALITYCONTROL_ObjectComparatorDeviation_H | ||
#define QUALITYCONTROL_ObjectComparatorDeviation_H | ||
|
||
#include "Common/ObjectComparatorInterface.h" | ||
|
||
namespace o2::quality_control_modules::common | ||
{ | ||
|
||
/// \brief A class for comparing two histogram objects based on the average of the relative deviation between the bins | ||
class ObjectComparatorDeviation : public ObjectComparatorInterface | ||
{ | ||
public: | ||
/// \brief Constructor | ||
ObjectComparatorDeviation() = default; | ||
/// \brief Destructor | ||
virtual ~ObjectComparatorDeviation() = default; | ||
|
||
/// \brief objects comparison function | ||
/// \return the quality resulting from the object comparison | ||
o2::quality_control::core::Quality compare(TObject* obj, TObject* objRef, std::string& message) override; | ||
}; | ||
|
||
} // namespace o2::quality_control_modules::common | ||
|
||
#endif // QUALITYCONTROL_ObjectComparatorDeviation_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file ObjectComparatorInterface.h | ||
/// \author Andrea Ferrero | ||
/// \brief An interface for comparing two TObject | ||
/// | ||
|
||
#ifndef QUALITYCONTROL_ObjectComparatorInterface_H | ||
#define QUALITYCONTROL_ObjectComparatorInterface_H | ||
|
||
#include "QualityControl/Quality.h" | ||
#include "QualityControl/CustomParameters.h" | ||
#include "QualityControl/Activity.h" | ||
class TObject; | ||
|
||
namespace o2::quality_control_modules::common | ||
{ | ||
|
||
/// \brief An interface for comparing two TObject | ||
class ObjectComparatorInterface | ||
{ | ||
public: | ||
/// \brief Constructor | ||
ObjectComparatorInterface() = default; | ||
/// \brief Destructor | ||
virtual ~ObjectComparatorInterface() = default; | ||
|
||
/// \brief comparator configuration via CustomParameters | ||
// virtual void configure(const o2::quality_control::core::CustomParameters& customParameters, const o2::quality_control::core::Activity activity = {}){}; | ||
|
||
/// setter/getter methods for the threshold to define the goodness of the comparison | ||
void setThreshold(double threshold) { mThreshold = threshold; } | ||
double getThreshold() { return mThreshold; } | ||
|
||
/// \brief objects comparison function | ||
/// \return the quality resulting from the object comparison | ||
virtual o2::quality_control::core::Quality compare(TObject* obj, TObject* objRef, std::string& message) = 0; | ||
|
||
private: | ||
/// the threshold to define the goodness of the comparison | ||
double mThreshold{ 0 }; | ||
}; | ||
|
||
} // namespace o2::quality_control_modules::common | ||
|
||
#endif // QUALITYCONTROL_ObjectComparatorInterface_H |
42 changes: 42 additions & 0 deletions
42
Modules/Common/include/Common/ObjectComparatorKolmogorov.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file ObjectComparatorKolmogorov.h | ||
/// \author Andrea Ferrero | ||
/// \brief A class for comparing two histogram objects based on a Kolmogorov test | ||
/// | ||
|
||
#ifndef QUALITYCONTROL_ObjectComparatorKolmogorov_H | ||
#define QUALITYCONTROL_ObjectComparatorKolmogorov_H | ||
|
||
#include "Common/ObjectComparatorInterface.h" | ||
|
||
namespace o2::quality_control_modules::common | ||
{ | ||
|
||
/// \brief A class for comparing two histogram objects based on a Kolmogorov test | ||
class ObjectComparatorKolmogorov : public ObjectComparatorInterface | ||
{ | ||
public: | ||
/// \brief Constructor | ||
ObjectComparatorKolmogorov() = default; | ||
/// \brief Destructor | ||
virtual ~ObjectComparatorKolmogorov() = default; | ||
|
||
/// \brief objects comparison function | ||
/// \return the quality resulting from the object comparison | ||
o2::quality_control::core::Quality compare(TObject* obj, TObject* objRef, std::string& message) override; | ||
}; | ||
|
||
} // namespace o2::quality_control_modules::common | ||
|
||
#endif // QUALITYCONTROL_ObjectComparatorKolmogorov_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file ReferenceComparatorCheck.h | ||
/// \author Andrea Ferrero | ||
/// \brief A generic QC check that compares a given set of histograms with their corresponding references | ||
/// | ||
|
||
#ifndef QUALITYCONTROL_ReferenceComparatorCheck_H | ||
#define QUALITYCONTROL_ReferenceComparatorCheck_H | ||
|
||
#include "QualityControl/CheckInterface.h" | ||
#include "Common/ObjectComparatorInterface.h" | ||
|
||
#include <sstream> | ||
|
||
class TPaveText; | ||
|
||
namespace o2::quality_control_modules::common | ||
{ | ||
|
||
/// \brief A generic QC check that compares a given set of histograms with their corresponding references | ||
/// \author Andrea Ferrero | ||
class ReferenceComparatorCheck : public o2::quality_control::checker::CheckInterface | ||
{ | ||
public: | ||
/// Default constructor | ||
ReferenceComparatorCheck() = default; | ||
/// Destructor | ||
~ReferenceComparatorCheck() override = default; | ||
|
||
// Override interface | ||
void configure() override; | ||
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; | ||
|
||
private: | ||
std::unique_ptr<ObjectComparatorInterface> mComparator; | ||
std::map<std::string, Quality> mQualityFlags; | ||
std::map<std::string, std::shared_ptr<TPaveText>> mQualityLabels; | ||
}; | ||
|
||
} // namespace o2::quality_control_modules::common | ||
|
||
#endif // QC_MODULE_SKELETON_ReferenceComparatorCheck_H |
Oops, something went wrong.