Skip to content

Commit 7a9c615

Browse files
author
jokonig
committed
[EMCAL-1039]: Add checker for number of physics triggers
- Number of triggers per TF is a good indication to check if detector is (partially) busy - New checker checks if last entry in trending histogram is below a settable fraction times the maximum observed number of triggers per TF - Data quality good or bad is now indicated in the TCanvas
1 parent 891a040 commit 7a9c615

File tree

4 files changed

+179
-1
lines changed

4 files changed

+179
-1
lines changed

Modules/EMCAL/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
add_library(O2QcEMCAL)
44

5-
target_sources(O2QcEMCAL PRIVATE src/FECRateVisualization.cxx src/TriggerTask.cxx src/PedestalTask.cxx src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/OccupancyToFECReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx src/CalibCheck.cxx src/NumPatchesPerFastORCheck.cxx src/PedestalChannelCheck.cxx src/PayloadPerEventDDLCheck.cxx src/RawErrorCheckAll.cxx src/CellTimeCalibCheck.cxx src/CellAmpCheck.cxx src/TrendGraphCheck.cxx)
5+
target_sources(O2QcEMCAL PRIVATE src/FECRateVisualization.cxx src/TriggerTask.cxx src/PedestalTask.cxx src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/OccupancyToFECReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx src/CalibCheck.cxx src/NumPatchesPerFastORCheck.cxx src/PedestalChannelCheck.cxx src/PayloadPerEventDDLCheck.cxx src/RawErrorCheckAll.cxx src/CellTimeCalibCheck.cxx src/CellAmpCheck.cxx src/TrendGraphCheck.cxx src/NumPhysTriggCheck.cxx)
66

77
target_include_directories(
88
O2QcEMCAL
@@ -44,6 +44,7 @@ add_root_dictionary(O2QcEMCAL
4444
include/EMCAL/TrendGraphCheck.h
4545
include/EMCAL/DrawGridlines.h
4646
include/EMCAL/FECRateVisualization.h
47+
include/EMCAL/NumPhysTriggCheck.h
4748
LINKDEF include/EMCAL/LinkDef.h)
4849

4950
install(TARGETS O2QcEMCAL

Modules/EMCAL/include/EMCAL/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#pragma link C++ class o2::quality_control_modules::emcal::TriggerTask + ;
3030
#pragma link C++ class o2::quality_control_modules::emcal::NumPatchesPerFastORCheck + ;
3131
#pragma link C++ class o2::quality_control_modules::emcal::PedestalChannelCheck + ;
32+
#pragma link C++ class o2::quality_control_modules::emcal::NumPhysTriggCheck + ;
3233

3334
#pragma link C++ class o2::quality_control_modules::emcal::PayloadPerEventDDLCheck + ;
3435

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// \file NumPhysTriggCheck.h
14+
/// \author Joshua Koenig
15+
///
16+
17+
#ifndef QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH
18+
#define QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH
19+
20+
#include "QualityControl/CheckInterface.h"
21+
22+
namespace o2::quality_control_modules::emcal
23+
{
24+
25+
/// \brief Check whether a plot is empty or not.
26+
///
27+
/// \author Barthelemy von Haller
28+
class NumPhysTriggCheck : public o2::quality_control::checker::CheckInterface
29+
{
30+
public:
31+
/// \brief Default constructor
32+
NumPhysTriggCheck() = default;
33+
/// \brief Destructor
34+
~NumPhysTriggCheck() override = default;
35+
36+
/// \brief Configure checker setting thresholds from taskParameters where specified
37+
void configure() override;
38+
39+
/// \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
40+
/// \param moMap List of histos to check
41+
/// \return Quality of the selection
42+
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
43+
44+
/// \brief Beautify the monitoring objects
45+
/// \param mo Monitoring object to beautify
46+
/// \param checkResult Quality status of this checker
47+
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
48+
49+
/// \brief Accept only TH1 histograms as input
50+
/// \return Name of the accepted object: TH1
51+
std::string getAcceptedType() override;
52+
53+
ClassDefOverride(NumPhysTriggCheck, 1);
54+
55+
private:
56+
double mFracToMaxGood = 0.5; ///< Thresholds for minimum fraction of physics triggers compared to maximum
57+
};
58+
59+
} // namespace o2::quality_control_modules::emcal
60+
61+
#endif // QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
#include "EMCAL/NumPhysTriggCheck.h"
12+
#include "QualityControl/MonitorObject.h"
13+
#include "QualityControl/Quality.h"
14+
#include "QualityControl/QcInfoLogger.h"
15+
// ROOT
16+
#include <TCanvas.h>
17+
#include <TGraph.h>
18+
#include <TPaveText.h>
19+
#include <TLatex.h>
20+
#include <TList.h>
21+
#include <TLine.h>
22+
#include <TRobustEstimator.h>
23+
#include <ROOT/TSeq.hxx>
24+
#include <iostream>
25+
#include <vector>
26+
27+
using namespace std;
28+
29+
namespace o2::quality_control_modules::emcal
30+
{
31+
32+
void NumPhysTriggCheck::configure()
33+
{
34+
// configure threshold-based checkers for bad quality
35+
auto fracToMaxGood = mCustomParameters.find("FracToMaxGood");
36+
if (fracToMaxGood != mCustomParameters.end()) {
37+
try {
38+
mFracToMaxGood = std::stof(fracToMaxGood->second);
39+
} catch (std::exception& e) {
40+
ILOG(Error, Support) << fmt::format("Value {} not a float", fracToMaxGood->second.data()) << ENDM;
41+
}
42+
}
43+
}
44+
45+
Quality NumPhysTriggCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
46+
{
47+
auto mo = moMap->begin()->second;
48+
Quality result = Quality::Good;
49+
50+
if (mo->getName().find("NPhysTriggersTFSlice") != std::string::npos) {
51+
auto Can = dynamic_cast<TCanvas*>(mo->getObject());
52+
if (Can == nullptr) {
53+
return Quality::Null;
54+
}
55+
TGraph* gr = nullptr;
56+
TList* primitives = Can->GetListOfPrimitives();
57+
for (TObject* obj : *primitives) {
58+
if (obj->InheritsFrom("TGraph")) {
59+
gr = (TGraph*)obj;
60+
break;
61+
}
62+
}
63+
if (gr == nullptr) {
64+
return Quality::Null;
65+
}
66+
if (gr->GetN() == 0) {
67+
return Quality::Bad;
68+
}
69+
double maxVal = 0.;
70+
for (int i = 0; i < gr->GetN(); ++i) {
71+
if (gr->GetPointY(i) > maxVal) {
72+
maxVal = gr->GetPointY(i);
73+
}
74+
}
75+
double currentVal = gr->GetPointY(gr->GetN() - 1);
76+
if (currentVal < mFracToMaxGood * maxVal) {
77+
result = Quality::Bad;
78+
}
79+
}
80+
81+
return result;
82+
}
83+
84+
std::string NumPhysTriggCheck::getAcceptedType() { return "TCanvas"; }
85+
86+
void NumPhysTriggCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
87+
{
88+
if (mo->getName().find("NPhysTriggersTFSlice") != std::string::npos) {
89+
auto Can = dynamic_cast<TCanvas*>(mo->getObject());
90+
if (Can == nullptr) {
91+
return;
92+
}
93+
94+
Can->cd();
95+
TPaveText* msg = new TPaveText(0.17, 0.2, 0.5, 0.3, "NDC");
96+
msg->SetName(Form("%s_msg", mo->GetName()));
97+
98+
if (checkResult == Quality::Good) {
99+
//
100+
msg->Clear();
101+
msg->AddText("Data quality: GOOD");
102+
msg->SetFillColor(kGreen);
103+
msg->Draw("same");
104+
Can->Update();
105+
} else if (checkResult == Quality::Bad) {
106+
ILOG(Debug, Devel) << "Quality::Bad";
107+
msg->Clear();
108+
msg->AddText("Data quality: BAD");
109+
msg->SetFillColor(kRed);
110+
msg->Draw("same");
111+
Can->Update();
112+
}
113+
}
114+
}
115+
} // namespace o2::quality_control_modules::emcal

0 commit comments

Comments
 (0)