|
| 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 ITSClusterCheck.cxx |
| 13 | +/// \author Artem Isakov |
| 14 | +/// \author LiAng Zhang |
| 15 | +/// \author Jian Liu |
| 16 | +/// |
| 17 | + |
| 18 | +#include "ITS/ITSClusterCheck.h" |
| 19 | +#include "QualityControl/MonitorObject.h" |
| 20 | +#include "QualityControl/Quality.h" |
| 21 | + |
| 22 | +#include <fairlogger/Logger.h> |
| 23 | +#include <TList.h> |
| 24 | +#include <TH2.h> |
| 25 | +#include <TText.h> |
| 26 | + |
| 27 | +namespace o2::quality_control_modules::its |
| 28 | +{ |
| 29 | + |
| 30 | +void ITSClusterCheck::configure(std::string) {} |
| 31 | + |
| 32 | +Quality ITSClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) |
| 33 | +{ |
| 34 | + auto mo = moMap->begin()->second; |
| 35 | + Quality result = Quality::Null; |
| 36 | + std::map<std::string, std::shared_ptr<MonitorObject>>::iterator iter; |
| 37 | + for (iter = moMap->begin(); iter != moMap->end(); iter++) { |
| 38 | + if (iter->second->getName() == "Layer0/AverageClusterSize") { |
| 39 | + auto* h = dynamic_cast<TH2D*>(iter->second->getObject()); |
| 40 | + if (h->GetMaximum() > 30) { |
| 41 | + result = Quality::Bad; |
| 42 | + } else { |
| 43 | + result = Quality::Good; |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + return result; |
| 48 | +} |
| 49 | + |
| 50 | +std::string ITSClusterCheck::getAcceptedType() { return "TH2D"; } |
| 51 | + |
| 52 | +void ITSClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) |
| 53 | +{ |
| 54 | + auto* h = dynamic_cast<TH2D*>(mo->getObject()); |
| 55 | + TText* tInfo; |
| 56 | + |
| 57 | + if (checkResult == Quality::Good) { |
| 58 | + tInfo = new TText(0.1, 0.8, "Quality::GOOD"); |
| 59 | + tInfo->SetTextColor(kGreen); |
| 60 | + } else if (checkResult == Quality::Bad) { |
| 61 | + tInfo = new TText(0.1, 0.8, "Quality::GOOD"); |
| 62 | + tInfo->SetTextColor(kRed); |
| 63 | + } |
| 64 | + tInfo->SetTextSize(17); |
| 65 | + tInfo->SetNDC(); |
| 66 | + h->GetListOfFunctions()->Add(tInfo); |
| 67 | +} |
| 68 | + |
| 69 | +} // namespace o2::quality_control_modules::its |
0 commit comments