Skip to content

Commit

Permalink
[EMCAL-527] Adding RawCheck (AliceO2Group#320)
Browse files Browse the repository at this point in the history
* [EMCAL-527] Adding RawCheck

Implemented Checks:
- checker for ErrorType histogram

* Remove extra empty line.

* trigger build

Co-authored-by: Giulio Eulisse <[email protected]>
Co-authored-by: Barthélémy von Haller <[email protected]>
  • Loading branch information
3 people authored Mar 4, 2020
1 parent f7125f2 commit 263e5c1
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Modules/EMCAL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ---- Library ----
# ---- Library ----

add_library(QcEMCAL)

target_sources(QcEMCAL PRIVATE src/RawTask.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx)
target_sources(QcEMCAL PRIVATE src/RawTask.cxx src/RawCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx)

target_include_directories(
QcEMCAL
Expand All @@ -16,6 +16,7 @@ add_root_dictionary(QcEMCAL
HEADERS include/EMCAL/DigitsQcTask.h
include/EMCAL/DigitCheck.h
include/EMCAL/RawTask.h
include/EMCAL/RawCheck.h
LINKDEF include/EMCAL/LinkDef.h
BASENAME QcEMCAL)

Expand Down
4 changes: 3 additions & 1 deletion Modules/EMCAL/include/EMCAL/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma link C++ class o2::quality_control_modules::emcal::DigitCheck + ;

#pragma link C++ class o2::quality_control_modules::emcal::RawTask+;
#pragma link C++ class o2::quality_control_modules::emcal::RawTask + ;

#pragma link C++ class o2::quality_control_modules::emcal::RawCheck + ;

#endif
50 changes: 50 additions & 0 deletions Modules/EMCAL/include/EMCAL/RawCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 RawCheck.h
/// \author Cristina Terrevoli
///

#ifndef QC_MODULE_EMCAL_EMCALRAWCHECK_H
#define QC_MODULE_EMCAL_EMCALRAWCHECK_H

#include "QualityControl/CheckInterface.h"

class TH1F;

using namespace o2::quality_control::core;

namespace o2::quality_control_modules::emcal
{

/// \brief Example Quality Control DPL Task
/// It is final because there is no reason to derive from it. Just remove it if needed.
/// \author Barthelemy von Haller
class RawCheck /*final*/ : public o2::quality_control::checker::CheckInterface // todo add back the "final" when doxygen is fixed
{
public:
/// Default constructor
RawCheck() = default;
/// Destructor
~RawCheck() override = default;

// Override interface
void configure(std::string name) 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;

ClassDefOverride(RawCheck, 1);
};

} // namespace o2::quality_control_modules::emcal

#endif // QC_MODULE_EMCAL_EMCALRAWCHECK_H
84 changes: 84 additions & 0 deletions Modules/EMCAL/src/RawCheck.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 RawCheck.cxx
/// \author Cristina Terrevoli
///

#include <TCanvas.h>
#include <TH1.h>
#include <TH2.h>
#include <TPaveText.h>
#include <TList.h>

#include "QualityControl/QcInfoLogger.h"
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include <fairlogger/Logger.h>
#include "EMCAL/RawCheck.h"

using namespace std;

namespace o2::quality_control_modules::emcal
{

void RawCheck::configure(std::string) {}

Quality RawCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
{
auto mo = moMap->begin()->second;
Quality result = Quality::Good;

if (mo->getName() == "ErrorTypePerSM") {
auto* h = dynamic_cast<TH2*>(mo->getObject());
if (h->GetEntries() != 0) {
result = Quality::Bad;
} // checker for the error type per SM
}
std::cout << " result " << result << std::endl;

return result;
}

std::string RawCheck::getAcceptedType() { return "TH1"; }

void RawCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
if (mo->getName().find("Error") != std::string::npos) {
auto* h = dynamic_cast<TH1*>(mo->getObject());
TPaveText* msg = new TPaveText(0.5, 0.5, 0.9, 0.75, "NDC");
h->GetListOfFunctions()->Add(msg);
msg->SetName(Form("%s_msg", mo->GetName()));

if (checkResult == Quality::Good) {
//check the error type, loop on X entries to find the SM and on Y to find the Error Number
//
msg->Clear();
msg->AddText("No Error: OK!!!");
msg->SetFillColor(kGreen);
//
h->SetFillColor(kGreen);
} else if (checkResult == Quality::Bad) {
LOG(INFO) << "Quality::Bad, setting to red";
msg->Clear();
msg->AddText("Presence of Error Code"); //Type of the Error, in SM XX
msg->AddText("If NOT a technical run,");
msg->AddText("call EMCAL on-call.");
h->SetFillColor(kRed);
} else if (checkResult == Quality::Medium) {
LOG(INFO) << "Quality::medium, setting to orange";
h->SetFillColor(kOrange);
}
h->SetLineColor(kBlack);
}
}

} // namespace o2::quality_control_modules::emcal

0 comments on commit 263e5c1

Please sign in to comment.