|
| 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 RawQcCheck.cxx |
| 13 | +/// \author Bogdan Vulpescu / Xavier Lopez |
| 14 | +/// |
| 15 | + |
| 16 | +#include "MID/RawQcCheck.h" |
| 17 | +#include "QualityControl/MonitorObject.h" |
| 18 | +#include "QualityControl/Quality.h" |
| 19 | +#include "QualityControl/QcInfoLogger.h" |
| 20 | +// ROOT |
| 21 | +#include <TH1.h> |
| 22 | + |
| 23 | +using namespace std; |
| 24 | + |
| 25 | +namespace o2::quality_control_modules::mid |
| 26 | +{ |
| 27 | + |
| 28 | +void RawQcCheck::configure(std::string) {} |
| 29 | + |
| 30 | +Quality RawQcCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) |
| 31 | +{ |
| 32 | + Quality result = Quality::Null; |
| 33 | + int nDigMT11, nDigMT12, nDigMT21, nDigMT22; |
| 34 | + |
| 35 | + for (auto& [moName, mo] : *moMap) { |
| 36 | + |
| 37 | + (void)moName; |
| 38 | + if (mo->getName() == "mDetElemID") { |
| 39 | + auto* h = dynamic_cast<TH1F*>(mo->getObject()); |
| 40 | + |
| 41 | + result = Quality::Good; |
| 42 | + |
| 43 | + nDigMT11 = nDigMT12 = nDigMT21 = nDigMT22 = 0; |
| 44 | + // count digits in stations |
| 45 | + for (int i = 1; i <= h->GetNbinsX(); i++) { |
| 46 | + if (i >= 1 && i <= 18) { |
| 47 | + nDigMT11 += h->GetBinContent(i); |
| 48 | + } else if (i >= 19 && i <= 36) { |
| 49 | + nDigMT12 += h->GetBinContent(i); |
| 50 | + } else if (i >= 37 && i <= 54) { |
| 51 | + nDigMT21 += h->GetBinContent(i); |
| 52 | + } |
| 53 | + if (i >= 55 && i <= 72) { |
| 54 | + nDigMT22 += h->GetBinContent(i); |
| 55 | + } |
| 56 | + } |
| 57 | + // set check quality |
| 58 | + if (nDigMT11 == 0) { |
| 59 | + result = Quality::Medium; |
| 60 | + if (nDigMT12 == 0) { |
| 61 | + result = Quality::Bad; |
| 62 | + } |
| 63 | + } |
| 64 | + if (nDigMT22 == 0) { |
| 65 | + result = Quality::Medium; |
| 66 | + if (nDigMT21 == 0) { |
| 67 | + result = Quality::Bad; |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + } // end check mDetElemID |
| 72 | + } |
| 73 | + return result; |
| 74 | +} |
| 75 | + |
| 76 | +std::string RawQcCheck::getAcceptedType() { return "TH1"; } |
| 77 | + |
| 78 | +void RawQcCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) |
| 79 | +{ |
| 80 | + if (mo->getName() == "mDetElemID") { |
| 81 | + auto* h = dynamic_cast<TH1F*>(mo->getObject()); |
| 82 | + |
| 83 | + if (checkResult == Quality::Good) { |
| 84 | + h->SetFillColor(kGreen); |
| 85 | + } else if (checkResult == Quality::Bad) { |
| 86 | + ILOG(Info) << "Quality::Bad, setting to red"; |
| 87 | + h->SetFillColor(kRed); |
| 88 | + } else if (checkResult == Quality::Medium) { |
| 89 | + ILOG(Info) << "Quality::medium, setting to orange"; |
| 90 | + h->SetFillColor(kOrange); |
| 91 | + } |
| 92 | + h->SetLineColor(kBlack); |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +} // namespace o2::quality_control_modules::mid |
0 commit comments