Skip to content

Commit

Permalink
TRD: Grab CCDB Chamber Status for plots (#2075)
Browse files Browse the repository at this point in the history
* TRD: change type of mChamberStatus to array*

* TRD: create separate function to plot chamber status

* TRD: functions clean up

* TRD: apply chamber status changes to digits task

* TRD: clean up

* TRD: create TRDHelpers class

* TRD: color options for drawing chamber status

* TRD: change tracklets task histogram to shared pointers

* TRD: set TRDHelpers class as pure static

* TRD: merge drawing functions into one

* TRD: change definitions for better readibility

* better definitions for readibility

* TRD: add grid helper function to receive shared pointers

* TRD: new variable for chamber status

* TRD: Empty, trigger CI
  • Loading branch information
leo-barreto authored Jan 22, 2024
1 parent c012aa5 commit 5fb93ae
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 375 deletions.
3 changes: 2 additions & 1 deletion Modules/TRD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
add_library(O2QcTRD)

target_sources(O2QcTRD PRIVATE src/TrackletCountCheck.cxx src/PulsePositionCheck.cxx src/TrackingTask.cxx src/PulseHeightTrackMatch.cxx src/TrackletsCheck.cxx src/TrackletsTask.cxx src/PulseHeightCheck.cxx src/RawData.cxx src/DigitsTask.cxx
src/TRDTrending.cxx src/TrendingTaskConfigTRD.cxx src/PulseHeightPostProcessing.cxx)
src/TRDTrending.cxx src/TrendingTaskConfigTRD.cxx src/PulseHeightPostProcessing.cxx src/TRDHelpers.cxx)

target_include_directories(
O2QcTRD
Expand All @@ -26,6 +26,7 @@ add_root_dictionary(O2QcTRD
include/TRD/PulseHeightTrackMatch.h
include/TRD/TrackletsCheck.h
include/TRD/TrackletsTask.h
include/TRD/TRDHelpers.h
include/TRD/PulseHeightCheck.h
include/TRD/RawData.h
include/TRD/PulseHeightPostProcessing.h
Expand Down
5 changes: 1 addition & 4 deletions Modules/TRD/include/TRD/DigitsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ class DigitsTask final : public TaskInterface
void endOfActivity(const Activity& activity) override;
void reset() override;
void buildHistograms();
void drawTrdLayersGrid(TH2F* hist);
void drawLinesOnPulseHeight(TH1F* h);
void fillLinesOnHistsPerLayer(int iLayer);
void drawHashOnLayers(int layer, int hcid, int col, int rowstart, int rowend);
void buildChamberIgnoreBP();

private:
Expand Down Expand Up @@ -87,7 +84,7 @@ class DigitsTask final : public TaskInterface

// CCDB objects
const o2::trd::NoiseStatusMCM* mNoiseMap = nullptr;
const o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr;
const std::array<int, o2::trd::constants::MAXCHAMBER>* mChamberStatus = nullptr;
};

} // namespace o2::quality_control_modules::trd
Expand Down
1 change: 1 addition & 0 deletions Modules/TRD/include/TRD/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma link C++ class o2::quality_control_modules::trd::RawData + ;
#pragma link C++ class o2::quality_control_modules::trd::PulseHeightCheck + ;
#pragma link C++ class o2::quality_control_modules::trd::TrackletsTask + ;
#pragma link C++ class o2::quality_control_modules::trd::TRDHelpers + ;
#pragma link C++ class o2::quality_control_modules::trd::TrackletsCheck + ;
#pragma link C++ class o2::quality_control::postprocessing::TRDTrending + ;
#pragma link C++ class o2::quality_control::postprocessing::PulseHeightPostProcessing + ;
Expand Down
49 changes: 49 additions & 0 deletions Modules/TRD/include/TRD/TRDHelpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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 TRDHelpers.h
///

#ifndef QC_MODULE_TRD_TRDHELPER_H
#define QC_MODULE_TRD_TRDHELPER_H

#include "QualityControl/TaskInterface.h"
#include "TRDQC/StatusHelper.h"

class TH2F;

using namespace o2::quality_control::core;

namespace o2::quality_control_modules::trd
{

class TRDHelpers
{
public:
TRDHelpers() = default;
~TRDHelpers() = default;

static void addChamberGridToHistogram(std::shared_ptr<TH2F> histogram, int unitsPerSection);
static void drawChamberStatusOnHistograms(const std::array<int, o2::trd::constants::MAXCHAMBER>* ptrChamber, std::shared_ptr<TH2F> chamberMap, std::array<std::shared_ptr<TH2F>, o2::trd::constants::NLAYER> ptrLayersArray, int unitsPerSection);
static void drawHalfChamberMask(int halfChamberStatus, std::pair<float, float> xCoords, std::pair<float, float> yCoords, std::shared_ptr<TH2F> histogram);
static bool isHalfChamberMasked(int halfChamberId, const std::array<int, o2::trd::constants::MAXCHAMBER>* ptrChamber);

private:
// Chamber status values definitions, used for masking
static const int mConfiguredChamberStatus = 3;
static const int mEmptyChamberStatus = 0;
static const int mErrorChamberStatus = 99;
};

} // namespace o2::quality_control_modules::trd

#endif
29 changes: 12 additions & 17 deletions Modules/TRD/include/TRD/TrackletsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,26 @@ class TrackletsTask final : public TaskInterface
void endOfActivity(const Activity& activity) override;
void reset() override;
void buildHistograms();
void drawLinesMCM(TH2F* histo);
void drawTrdLayersGrid(TH2F* hist);
void buildTrackletLayers();
void drawHashedOnHistsPerLayer(int layer); //, int hcid, int rowstart, int rowend);
void drawHashOnLayers(int layer, int hcid, int rowstart, int rowend);

private:
// settings
bool mRemoveNoise{ false };
// histograms
std::array<TH1F*, 3> mTrackletQ;
TH1F* mTrackletSlope = nullptr;
TH1F* mTrackletHCID = nullptr;
TH1F* mTrackletPosition = nullptr;
TH1F* mTrackletsPerEvent = nullptr;
TH1F* mTrackletsPerEventPP = nullptr;
TH1F* mTrackletsPerEventPbPb = nullptr;
TH2F* mTrackletsPerHC2D = nullptr;
TH1F* mTrackletsPerTimeFrame = nullptr;
TH1F* mTriggersPerTimeFrame = nullptr;
std::array<TH2F*, 6> mLayers;
std::array<std::shared_ptr<TH1F>, 3> mTrackletQ;
std::shared_ptr<TH1F> mTrackletSlope = nullptr;
std::shared_ptr<TH1F> mTrackletHCID = nullptr;
std::shared_ptr<TH1F> mTrackletPosition = nullptr;
std::shared_ptr<TH1F> mTrackletsPerEvent = nullptr;
std::shared_ptr<TH1F> mTrackletsPerEventPP = nullptr;
std::shared_ptr<TH1F> mTrackletsPerEventPbPb = nullptr;
std::shared_ptr<TH2F> mTrackletsPerHC2D = nullptr;
std::shared_ptr<TH1F> mTrackletsPerTimeFrame = nullptr;
std::shared_ptr<TH1F> mTriggersPerTimeFrame = nullptr;
std::array<std::shared_ptr<TH2F>, o2::trd::constants::NLAYER> mLayers;

// data to pull from CCDB
const o2::trd::NoiseStatusMCM* mNoiseMap = nullptr;
const o2::trd::HalfChamberStatusQC* mChamberStatus = nullptr;
const std::array<int, o2::trd::constants::MAXCHAMBER>* mChamberStatus = nullptr;
};

} // namespace o2::quality_control_modules::trd
Expand Down
Loading

0 comments on commit 5fb93ae

Please sign in to comment.