-
Notifications
You must be signed in to change notification settings - Fork 164
[EMCAL-1039]: Add checker for number of physics triggers #2587
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
Merged
Changes from 1 commit
Commits
Show all changes
2 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,61 @@ | ||
| // 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 NumPhysTriggCheck.h | ||
| /// \author Joshua Koenig | ||
| /// | ||
|
|
||
| #ifndef QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH | ||
| #define QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH | ||
|
|
||
| #include "QualityControl/CheckInterface.h" | ||
|
|
||
| namespace o2::quality_control_modules::emcal | ||
| { | ||
|
|
||
| /// \brief Check whether a plot is empty or not. | ||
| /// | ||
| /// \author Barthelemy von Haller | ||
| class NumPhysTriggCheck : public o2::quality_control::checker::CheckInterface | ||
| { | ||
| public: | ||
| /// \brief Default constructor | ||
| NumPhysTriggCheck() = default; | ||
| /// \brief Destructor | ||
| ~NumPhysTriggCheck() override = default; | ||
|
|
||
| /// \brief Configure checker setting thresholds from taskParameters where specified | ||
| void configure() override; | ||
|
|
||
| /// \brief Check whether the number of physics triggers for the current trigger falls below a certain threshold copared to the maximum in the time range | ||
| /// \param moMap List of histos to check | ||
| /// \return Quality of the selection | ||
| Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override; | ||
|
|
||
| /// \brief Beautify the monitoring objects | ||
| /// \param mo Monitoring object to beautify | ||
| /// \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: | ||
| double mFracToMaxGood = 0.5; ///< Thresholds for minimum fraction of physics triggers compared to maximum | ||
| }; | ||
|
|
||
| } // namespace o2::quality_control_modules::emcal | ||
|
|
||
| #endif // QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH |
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,115 @@ | ||
| // 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. | ||
| #include "EMCAL/NumPhysTriggCheck.h" | ||
| #include "QualityControl/MonitorObject.h" | ||
| #include "QualityControl/Quality.h" | ||
| #include "QualityControl/QcInfoLogger.h" | ||
| // ROOT | ||
| #include <TCanvas.h> | ||
| #include <TGraph.h> | ||
| #include <TPaveText.h> | ||
| #include <TLatex.h> | ||
| #include <TList.h> | ||
| #include <TLine.h> | ||
| #include <TRobustEstimator.h> | ||
| #include <ROOT/TSeq.hxx> | ||
| #include <iostream> | ||
| #include <vector> | ||
|
|
||
| using namespace std; | ||
|
|
||
| namespace o2::quality_control_modules::emcal | ||
| { | ||
|
|
||
| void NumPhysTriggCheck::configure() | ||
| { | ||
| // configure threshold-based checkers for bad quality | ||
| auto fracToMaxGood = mCustomParameters.find("FracToMaxGood"); | ||
| if (fracToMaxGood != mCustomParameters.end()) { | ||
| try { | ||
| mFracToMaxGood = std::stof(fracToMaxGood->second); | ||
| } catch (std::exception& e) { | ||
| ILOG(Error, Support) << fmt::format("Value {} not a float", fracToMaxGood->second.data()) << ENDM; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Quality NumPhysTriggCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) | ||
| { | ||
| auto mo = moMap->begin()->second; | ||
| Quality result = Quality::Good; | ||
|
|
||
| if (mo->getName().find("NPhysTriggersTFSlice") != std::string::npos) { | ||
| auto Can = dynamic_cast<TCanvas*>(mo->getObject()); | ||
| if (Can == nullptr) { | ||
| return Quality::Null; | ||
| } | ||
| TGraph* gr = nullptr; | ||
| TList* primitives = Can->GetListOfPrimitives(); | ||
| for (TObject* obj : *primitives) { | ||
| if (obj->InheritsFrom("TGraph")) { | ||
| gr = (TGraph*)obj; | ||
| break; | ||
| } | ||
| } | ||
| if (gr == nullptr) { | ||
| return Quality::Null; | ||
| } | ||
| if (gr->GetN() == 0) { | ||
| return Quality::Bad; | ||
| } | ||
| double maxVal = 0.; | ||
| for (int i = 0; i < gr->GetN(); ++i) { | ||
| if (gr->GetPointY(i) > maxVal) { | ||
| maxVal = gr->GetPointY(i); | ||
| } | ||
| } | ||
| double currentVal = gr->GetPointY(gr->GetN() - 1); | ||
| if (currentVal < mFracToMaxGood * maxVal) { | ||
| result = Quality::Bad; | ||
| } | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| std::string NumPhysTriggCheck::getAcceptedType() { return "TCanvas"; } | ||
|
|
||
| void NumPhysTriggCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) | ||
| { | ||
| if (mo->getName().find("NPhysTriggersTFSlice") != std::string::npos) { | ||
| auto Can = dynamic_cast<TCanvas*>(mo->getObject()); | ||
| if (Can == nullptr) { | ||
| return; | ||
| } | ||
|
|
||
| Can->cd(); | ||
| TPaveText* msg = new TPaveText(0.17, 0.2, 0.5, 0.3, "NDC"); | ||
| msg->SetName(Form("%s_msg", mo->GetName())); | ||
|
|
||
| if (checkResult == Quality::Good) { | ||
| // | ||
| msg->Clear(); | ||
| msg->AddText("Data quality: GOOD"); | ||
| msg->SetFillColor(kGreen); | ||
| msg->Draw("same"); | ||
| Can->Update(); | ||
| } else if (checkResult == Quality::Bad) { | ||
| ILOG(Debug, Devel) << "Quality::Bad"; | ||
| msg->Clear(); | ||
| msg->AddText("Data quality: BAD"); | ||
| msg->SetFillColor(kRed); | ||
| msg->Draw("same"); | ||
| Can->Update(); | ||
| } | ||
| } | ||
| } | ||
| } // namespace o2::quality_control_modules::emcal | ||
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.
Uh oh!
There was an error while loading. Please reload this page.