Skip to content

Commit ffdbaa3

Browse files
committed
[EMCAL-527] Adding RawCheck
Implemented Checks: - checker for ErrorType histogram
1 parent e7bce0a commit ffdbaa3

3 files changed

Lines changed: 136 additions & 1 deletion

File tree

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(QcEMCAL)
44

5-
target_sources(QcEMCAL PRIVATE src/RawTask.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx)
5+
target_sources(QcEMCAL PRIVATE src/RawTask.cxx src/RawCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx)
66

77
target_include_directories(
88
QcEMCAL
@@ -16,6 +16,7 @@ add_root_dictionary(QcEMCAL
1616
HEADERS include/EMCAL/DigitsQcTask.h
1717
include/EMCAL/DigitCheck.h
1818
include/EMCAL/RawTask.h
19+
include/EMCAL/RawCheck.h
1920
LINKDEF include/EMCAL/LinkDef.h
2021
BASENAME QcEMCAL)
2122

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
///
12+
/// \file RawCheck.h
13+
/// \author Cristina Terrevoli
14+
///
15+
16+
#ifndef QC_MODULE_EMCAL_EMCALRAWCHECK_H
17+
#define QC_MODULE_EMCAL_EMCALRAWCHECK_H
18+
19+
#include "QualityControl/CheckInterface.h"
20+
21+
class TH1F;
22+
23+
using namespace o2::quality_control::core;
24+
25+
namespace o2::quality_control_modules::emcal
26+
{
27+
28+
/// \brief Example Quality Control DPL Task
29+
/// It is final because there is no reason to derive from it. Just remove it if needed.
30+
/// \author Barthelemy von Haller
31+
class RawCheck /*final*/ : public o2::quality_control::checker::CheckInterface // todo add back the "final" when doxygen is fixed
32+
{
33+
public:
34+
/// Default constructor
35+
RawCheck() = default;
36+
/// Destructor
37+
~RawCheck() override = default;
38+
39+
// Override interface
40+
void configure(std::string name) override;
41+
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
42+
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
43+
std::string getAcceptedType() override;
44+
45+
ClassDefOverride(RawCheck, 1);
46+
};
47+
48+
} // namespace o2::quality_control_modules::emcal
49+
50+
#endif // QC_MODULE_EMCAL_EMCALRAWCHECK_H

Modules/EMCAL/src/RawCheck.cxx

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
///
12+
/// \file RawCheck.cxx
13+
/// \author Cristina Terrevoli
14+
///
15+
16+
#include <TCanvas.h>
17+
#include <TH1.h>
18+
#include <TH2.h>
19+
#include <TPaveText.h>
20+
#include <TList.h>
21+
22+
#include "QualityControl/QcInfoLogger.h"
23+
#include "QualityControl/MonitorObject.h"
24+
#include "QualityControl/Quality.h"
25+
#include <fairlogger/Logger.h>
26+
#include "EMCAL/RawCheck.h"
27+
28+
using namespace std;
29+
30+
namespace o2::quality_control_modules::emcal
31+
{
32+
33+
void RawCheck::configure(std::string) {}
34+
35+
Quality RawCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
36+
{
37+
auto mo = moMap->begin()->second;
38+
Quality result = Quality::Good;
39+
40+
if (mo->getName() == "ErrorTypePerSM") {
41+
auto* h = dynamic_cast<TH2*>(mo->getObject());
42+
if (h->GetEntries() != 0) {
43+
result = Quality::Bad;
44+
} // checker for the error type per SM
45+
}
46+
std::cout << " result " << result << std::endl;
47+
48+
return result;
49+
}
50+
51+
std::string RawCheck::getAcceptedType() { return "TH1"; }
52+
53+
void RawCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
54+
{
55+
if (mo->getName().find("Error") != std::string::npos) {
56+
auto* h = dynamic_cast<TH1*>(mo->getObject());
57+
TPaveText* msg = new TPaveText(0.5, 0.5, 0.9, 0.75, "NDC");
58+
h->GetListOfFunctions()->Add(msg);
59+
msg->SetName(Form("%s_msg", mo->GetName()));
60+
61+
if (checkResult == Quality::Good) {
62+
//check the error type, loop on X entries to find the SM and on Y to find the Error Number
63+
//
64+
msg->Clear();
65+
msg->AddText("No Error: OK!!!");
66+
msg->SetFillColor(kGreen);
67+
//
68+
h->SetFillColor(kGreen);
69+
} else if (checkResult == Quality::Bad) {
70+
LOG(INFO) << "Quality::Bad, setting to red";
71+
msg->Clear();
72+
msg->AddText("Presence of Error Code"); //Type of the Error, in SM XX
73+
msg->AddText("If NOT a technical run,");
74+
msg->AddText("call EMCAL on-call.");
75+
h->SetFillColor(kRed);
76+
} else if (checkResult == Quality::Medium) {
77+
LOG(INFO) << "Quality::medium, setting to orange";
78+
h->SetFillColor(kOrange);
79+
}
80+
h->SetLineColor(kBlack);
81+
}
82+
}
83+
84+
} // namespace o2::quality_control_modules::emcal

0 commit comments

Comments
 (0)