diff --git a/Modules/EMCAL/CMakeLists.txt b/Modules/EMCAL/CMakeLists.txt index bbf1119c13485..45e86864aad2e 100644 --- a/Modules/EMCAL/CMakeLists.txt +++ b/Modules/EMCAL/CMakeLists.txt @@ -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 @@ -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) diff --git a/Modules/EMCAL/include/EMCAL/LinkDef.h b/Modules/EMCAL/include/EMCAL/LinkDef.h index a3e44a5a6e803..0da29f16c3524 100644 --- a/Modules/EMCAL/include/EMCAL/LinkDef.h +++ b/Modules/EMCAL/include/EMCAL/LinkDef.h @@ -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 diff --git a/Modules/EMCAL/include/EMCAL/RawCheck.h b/Modules/EMCAL/include/EMCAL/RawCheck.h new file mode 100644 index 0000000000000..cd950cb085939 --- /dev/null +++ b/Modules/EMCAL/include/EMCAL/RawCheck.h @@ -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>* moMap) override; + void beautify(std::shared_ptr 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 diff --git a/Modules/EMCAL/src/RawCheck.cxx b/Modules/EMCAL/src/RawCheck.cxx new file mode 100644 index 0000000000000..ada1e5a5f0ce2 --- /dev/null +++ b/Modules/EMCAL/src/RawCheck.cxx @@ -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 +#include +#include +#include +#include + +#include "QualityControl/QcInfoLogger.h" +#include "QualityControl/MonitorObject.h" +#include "QualityControl/Quality.h" +#include +#include "EMCAL/RawCheck.h" + +using namespace std; + +namespace o2::quality_control_modules::emcal +{ + +void RawCheck::configure(std::string) {} + +Quality RawCheck::check(std::map>* moMap) +{ + auto mo = moMap->begin()->second; + Quality result = Quality::Good; + + if (mo->getName() == "ErrorTypePerSM") { + auto* h = dynamic_cast(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 mo, Quality checkResult) +{ + if (mo->getName().find("Error") != std::string::npos) { + auto* h = dynamic_cast(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