-
Notifications
You must be signed in to change notification settings - Fork 164
[QC-798] Add a check to ensure entries increase every cycle #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Barthelemy
merged 5 commits into
AliceO2Group:master
from
Barthelemy:add-check-nb-entries
Jun 2, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,51 @@ | ||
| // 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 IncreasingEntries.h | ||
| /// \author My Name | ||
| /// | ||
|
|
||
| #ifndef QC_MODULE_COMMON_COMMONINCREASINGENTRIES_H | ||
| #define QC_MODULE_COMMON_COMMONINCREASINGENTRIES_H | ||
|
|
||
| #include "QualityControl/CheckInterface.h" | ||
| #include <TPaveText.h> | ||
|
|
||
| namespace o2::quality_control_modules::common | ||
| { | ||
|
|
||
| /// \brief Example QC Check | ||
| /// \author My Name | ||
| class IncreasingEntries : public o2::quality_control::checker::CheckInterface | ||
| { | ||
| public: | ||
| /// Default constructor | ||
| IncreasingEntries() = default; | ||
| /// Destructor | ||
| ~IncreasingEntries() override = default; | ||
|
|
||
| // Override interface | ||
| 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; | ||
| std::shared_ptr<TPaveText> mPaveText; | ||
|
|
||
| ClassDefOverride(IncreasingEntries, 2); | ||
| }; | ||
|
|
||
| } // namespace o2::quality_control_modules::common | ||
|
|
||
| #endif // QC_MODULE_COMMON_COMMONINCREASINGENTRIES_H |
This file contains hidden or 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 hidden or 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,75 @@ | ||
| // 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 IncreasingEntries.cxx | ||
| /// \author My Name | ||
| /// | ||
|
|
||
| #include "Common/IncreasingEntries.h" | ||
| #include "QualityControl/MonitorObject.h" | ||
| #include "QualityControl/Quality.h" | ||
| #include "QualityControl/QcInfoLogger.h" | ||
| // ROOT | ||
| #include <TH1.h> | ||
| #include <TList.h> | ||
|
|
||
| #include <DataFormatsQualityControl/FlagReasons.h> | ||
|
|
||
| using namespace std; | ||
| using namespace o2::quality_control; | ||
|
|
||
| namespace o2::quality_control_modules::common | ||
| { | ||
|
|
||
| void IncreasingEntries::configure() | ||
| { | ||
| mPaveText = make_shared<TPaveText>(1, 0.125, 0.6, 0, "NDC"); | ||
| mPaveText->AddText("Number of Entries has not changed"); | ||
| mPaveText->AddText("in the past cycle"); | ||
| mPaveText->SetFillColor(kRed); | ||
| mPaveText->SetMargin(0); | ||
| } | ||
|
|
||
| Quality IncreasingEntries::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) | ||
| { | ||
| Quality result = Quality::Good; | ||
|
|
||
| for (auto& [moName, mo] : *moMap) { | ||
|
|
||
| TH1* histo = dynamic_cast<TH1*>(mo->getObject()); | ||
| if (histo == nullptr) { | ||
| continue; | ||
| } | ||
|
|
||
| double previousNumberEntries = mLastEntries.count(moName) > 0 ? mLastEntries.at(moName) : 0; | ||
| double currentNumberEntries = histo->GetEntries(); | ||
|
|
||
| if (previousNumberEntries == currentNumberEntries) { | ||
| result = Quality::Bad; | ||
| result.addReason(FlagReasonFactory::Unknown(), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "Number of entries stopped increasing."); | ||
| histo->GetListOfFunctions()->Add(mPaveText->Clone()); | ||
| } | ||
|
|
||
| mLastEntries[moName] = currentNumberEntries; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| std::string IncreasingEntries::getAcceptedType() { return "TH1"; } | ||
|
|
||
| void IncreasingEntries::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) | ||
| { | ||
| // as we want to add the text on the faulty histo we cannot do it here. | ||
| } | ||
|
|
||
| } // namespace o2::quality_control_modules::common | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be filled on the next occasion