|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +/// |
| 13 | +/// \file TrendingTaskITSError.h |
| 14 | +/// \author Mariia Selina on the structure from Piotr Konopka |
| 15 | +/// |
| 16 | + |
| 17 | +#ifndef QUALITYCONTROL_TRENDINGTASKITSError_H |
| 18 | +#define QUALITYCONTROL_TRENDINGTASKITSError_H |
| 19 | + |
| 20 | +#include "ITS/TrendingTaskConfigITS.h" |
| 21 | +#include "QualityControl/PostProcessingInterface.h" |
| 22 | +#include "QualityControl/Reductor.h" |
| 23 | +#include "ITSMFTReconstruction/DecodingStat.h" |
| 24 | + |
| 25 | +#include <TAxis.h> |
| 26 | +#include <TColor.h> |
| 27 | +#include <TGraph.h> |
| 28 | +#include <TMultiGraph.h> |
| 29 | +#include <TLegend.h> |
| 30 | +#include <TCanvas.h> |
| 31 | +#include <TTree.h> |
| 32 | +#include <memory> |
| 33 | +#include <string> |
| 34 | +#include <vector> |
| 35 | +#include <unordered_map> |
| 36 | + |
| 37 | +namespace o2::quality_control::repository |
| 38 | +{ |
| 39 | +class DatabaseInterface; |
| 40 | +} |
| 41 | + |
| 42 | +namespace o2::quality_control::postprocessing |
| 43 | +{ |
| 44 | + |
| 45 | +/// \brief A post-processing task which trends values, stores them in a TTree |
| 46 | +/// and produces plots. |
| 47 | +/// |
| 48 | +/// A post-processing task which trends objects inside QC database (QCDB). It |
| 49 | +/// extracts some values of one or multiple |
| 50 | +/// objects using the Reductor classes, then stores them inside a TTree. One can |
| 51 | +/// generate plots out the TTree - the |
| 52 | +/// class exposes the TTree::Draw interface to the user. The TTree and plots are |
| 53 | +/// stored in the QCDB. The class is |
| 54 | +/// configured with configuration files, see Framework/postprocessing.json as an |
| 55 | +/// example. |
| 56 | +/// |
| 57 | + |
| 58 | +class TrendingTaskITSError : public PostProcessingInterface |
| 59 | +{ |
| 60 | + public: |
| 61 | + TrendingTaskITSError() = default; |
| 62 | + ~TrendingTaskITSError() override = default; |
| 63 | + |
| 64 | + void configure(const boost::property_tree::ptree& config) override; |
| 65 | + void initialize(Trigger, framework::ServiceRegistryRef) override; |
| 66 | + void update(Trigger, framework::ServiceRegistryRef) override; |
| 67 | + void finalize(Trigger, framework::ServiceRegistryRef) override; |
| 68 | + |
| 69 | + private: |
| 70 | + // other functions; mainly style of plots |
| 71 | + void SetLegendStyle(TLegend* legend, const std::string& name, bool isRun); |
| 72 | + void SetCanvasSettings(TCanvas* canvas); |
| 73 | + void SetGraphStyle(TGraph* graph, const std::string& name, const std::string& title, int col, int mkr); |
| 74 | + void SetGraphName(TMultiGraph* graph, const std::string& name, const std::string& title); |
| 75 | + void SetGraphAxes(TMultiGraph* graph, const std::string& xtitle, |
| 76 | + const std::string& ytitle, bool isTime); |
| 77 | + void SetHistoAxes(TH1* hist, const std::vector<std::string>& runlist, |
| 78 | + const double& Ymin, const double& Ymax); |
| 79 | + |
| 80 | + struct MetaData { |
| 81 | + Int_t runNumber = 0; |
| 82 | + }; |
| 83 | + |
| 84 | + void trendValues(const Trigger& t, repository::DatabaseInterface& qcdb); |
| 85 | + void storePlots(repository::DatabaseInterface& qcdb); |
| 86 | + void storeTrend(repository::DatabaseInterface& qcdb); |
| 87 | + |
| 88 | + TrendingTaskConfigITS mConfig; |
| 89 | + MetaData mMetaData; |
| 90 | + UInt_t mTime; |
| 91 | + Int_t nEntries = 0; |
| 92 | + |
| 93 | + std::vector<std::string> runlist; |
| 94 | + std::unique_ptr<TTree> mTrend; |
| 95 | + std::unordered_map<std::string, std::unique_ptr<Reductor>> mReductors; |
| 96 | + |
| 97 | + const int colors[30] = { 1, 46, kAzure + 3, 807, 797, 827, 417, 841, 868, 867, 860, 602, 921, 874, 600, 820, 400, 840, 920, 616, 632, 432, 880, 416, 29, 900, kMagenta - 9, kOrange + 4, kGreen - 5, kPink - 9 }; |
| 98 | + const int markers[30] = { 8, 20, 21, 22, 23, 25, 26, 27, 29, 30, 32, 33, 34, 39, 41, 43, 45, 47, 48, 49, 105, 107, 112, 114, 116, 117, 118, 119, 120, 121 }; |
| 99 | + |
| 100 | + // const std::string trend_titles[o2::itsmft::GBTLinkDecodingStat::NErrorsDefined] = { "NoRDHAtStart", "PageNotStopped", "StopPageNotEmpty", "PageCounterDiscontinuity", "RDHvsGBTHPageCnt", "MissingGBTTrigger", "MissingGBTHeader", "MissingGBTTrailer", "NonZeroPageAfterStop", "DataForStoppedLane", "NoDataForActiveLane", "IBChipLaneMismatch", "CableDataHeadWrong", "InvalidActiveLanes", "PacketCounterJump", "PacketDoneMissing", "MissingDiagnosticWord", "GBTWordNotRecognized", "WrongeCableID", "WrongAlignmentWord", "MissingROF", "OldROF" }; |
| 101 | +}; |
| 102 | +} // namespace o2::quality_control::postprocessing |
| 103 | +#endif // QUALITYCONTROL_TRENDINGTASKITSError_H |
0 commit comments