|
| 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