Skip to content

Commit

Permalink
New trending plot of GTB Links decoding errors (#1918)
Browse files Browse the repository at this point in the history
* Creating new trending  graph with GTBLinks decoding errors

* Clang correction

* 22 to const int correction

* some corrections from Artem

* testing line removed

* more changes from Artem

---------

Co-authored-by: JianLIUhep <jian.liu@cern.ch>
  • Loading branch information
selindra and JianLIUhep authored Aug 15, 2023
1 parent 9da6c0d commit 1486e32
Show file tree
Hide file tree
Showing 7 changed files with 745 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Modules/ITS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

# ---- Library ----
# ---- Library ----

add_library(O2QcITS
src/ITSRawTask.cxx
Expand All @@ -9,6 +8,7 @@ add_library(O2QcITS
src/TrendingTaskITSCluster.cxx
src/TrendingTaskITSTracks.cxx
src/TrendingTaskConfigITS.cxx
src/TrendingTaskITSError.cxx
src/TH2XlineReductor.cxx
src/ReductorBinContent.cxx
src/ITSFhrTask.cxx
Expand Down Expand Up @@ -63,6 +63,7 @@ add_root_dictionary(O2QcITS
include/ITS/TrendingTaskITSFEE.h
include/ITS/TrendingTaskITSCluster.h
include/ITS/TrendingTaskITSTracks.h
include/ITS/TrendingTaskITSError.h
include/ITS/TH2XlineReductor.h
include/ITS/ReductorBinContent.h
include/ITS/ITSFhrTask.h
Expand Down
1 change: 1 addition & 0 deletions Modules/ITS/include/ITS/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
#pragma link C++ class o2::quality_control_modules::its::ITSThresholdCalibrationCheck + ;
#pragma link C++ class o2::quality_control_modules::its::ITSDecodingErrorTask + ;
#pragma link C++ class o2::quality_control_modules::its::ITSDecodingErrorCheck + ;
#pragma link C++ class o2::quality_control::postprocessing::TrendingTaskITSError + ;
#endif
15 changes: 11 additions & 4 deletions Modules/ITS/include/ITS/ReductorBinContent.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ class ReductorBinContent : public quality_control::postprocessing::Reductor
const char* getBranchLeafList() override;
void update(TObject* obj) override;

void setParams(Int_t Flags, Int_t Triggers)
{
nFlags = Flags;
nTriggers = Triggers;
}

private:
static constexpr int nFlags = 3;
static constexpr int nTriggers = 13;
int nFlags = 3;
int nTriggers = 13;

struct mystat {
Double_t binContent[nFlags]; // Bin content in a specified slice
Double_t integral[nTriggers]; // Integral over all Fee ID
// std::vector<Double_t> binContent; // Bin content in a specified slice
Double_t binContent[100];
Double_t integral[100]; // Integral over all Fee I
};

mystat mStats;
Expand Down
103 changes: 103 additions & 0 deletions Modules/ITS/include/ITS/TrendingTaskITSError.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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 TrendingTaskITSError.h
/// \author Mariia Selina on the structure from Piotr Konopka
///

#ifndef QUALITYCONTROL_TRENDINGTASKITSError_H
#define QUALITYCONTROL_TRENDINGTASKITSError_H

#include "ITS/TrendingTaskConfigITS.h"
#include "QualityControl/PostProcessingInterface.h"
#include "QualityControl/Reductor.h"
#include "ITSMFTReconstruction/DecodingStat.h"

#include <TAxis.h>
#include <TColor.h>
#include <TGraph.h>
#include <TMultiGraph.h>
#include <TLegend.h>
#include <TCanvas.h>
#include <TTree.h>
#include <memory>
#include <string>
#include <vector>
#include <unordered_map>

namespace o2::quality_control::repository
{
class DatabaseInterface;
}

namespace o2::quality_control::postprocessing
{

/// \brief A post-processing task which trends values, stores them in a TTree
/// and produces plots.
///
/// A post-processing task which trends objects inside QC database (QCDB). It
/// extracts some values of one or multiple
/// objects using the Reductor classes, then stores them inside a TTree. One can
/// generate plots out the TTree - the
/// class exposes the TTree::Draw interface to the user. The TTree and plots are
/// stored in the QCDB. The class is
/// configured with configuration files, see Framework/postprocessing.json as an
/// example.
///

class TrendingTaskITSError : public PostProcessingInterface
{
public:
TrendingTaskITSError() = default;
~TrendingTaskITSError() override = default;

void configure(const boost::property_tree::ptree& config) override;
void initialize(Trigger, framework::ServiceRegistryRef) override;
void update(Trigger, framework::ServiceRegistryRef) override;
void finalize(Trigger, framework::ServiceRegistryRef) override;

private:
// other functions; mainly style of plots
void SetLegendStyle(TLegend* legend, const std::string& name, bool isRun);
void SetCanvasSettings(TCanvas* canvas);
void SetGraphStyle(TGraph* graph, const std::string& name, const std::string& title, int col, int mkr);
void SetGraphName(TMultiGraph* graph, const std::string& name, const std::string& title);
void SetGraphAxes(TMultiGraph* graph, const std::string& xtitle,
const std::string& ytitle, bool isTime);
void SetHistoAxes(TH1* hist, const std::vector<std::string>& runlist,
const double& Ymin, const double& Ymax);

struct MetaData {
Int_t runNumber = 0;
};

void trendValues(const Trigger& t, repository::DatabaseInterface& qcdb);
void storePlots(repository::DatabaseInterface& qcdb);
void storeTrend(repository::DatabaseInterface& qcdb);

TrendingTaskConfigITS mConfig;
MetaData mMetaData;
UInt_t mTime;
Int_t nEntries = 0;

std::vector<std::string> runlist;
std::unique_ptr<TTree> mTrend;
std::unordered_map<std::string, std::unique_ptr<Reductor>> mReductors;

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

// 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" };
};
} // namespace o2::quality_control::postprocessing
#endif // QUALITYCONTROL_TRENDINGTASKITSError_H
Loading

0 comments on commit 1486e32

Please sign in to comment.