From 2fc7cd7c577a1b50dc233de2ff9714db782c4e17 Mon Sep 17 00:00:00 2001 From: sweyh99 <51177851+sweyh99@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:28:15 -0400 Subject: [PATCH] [EMCAL-767] Added the TRU gridlines to the TRU Mask Position MO - Added the TRU gridlines to the TRU Mask Position monitor object - changed the SM, TRU, and FastOR gridlines to a public helper class - Changed the TRUMaskPosition monitoring object to a histogram --- Modules/EMCAL/CMakeLists.txt | 1 + .../EMCAL/include/EMCAL/CalibMonitoringTask.h | 2 +- Modules/EMCAL/include/EMCAL/DrawGridlines.h | 161 ++++++++++++++++++ Modules/EMCAL/include/EMCAL/LinkDef.h | 1 + Modules/EMCAL/src/CalibMonitoringTask.cxx | 26 +-- 5 files changed, 180 insertions(+), 11 deletions(-) create mode 100644 Modules/EMCAL/include/EMCAL/DrawGridlines.h diff --git a/Modules/EMCAL/CMakeLists.txt b/Modules/EMCAL/CMakeLists.txt index 55623eb54b..bebe9aa9a2 100644 --- a/Modules/EMCAL/CMakeLists.txt +++ b/Modules/EMCAL/CMakeLists.txt @@ -44,6 +44,7 @@ add_root_dictionary(O2QcEMCAL include/EMCAL/CellTimeCalibCheck.h include/EMCAL/CellAmpCheck.h include/EMCAL/TrendGraphCheck.h + include/EMCAL/DrawGridlines.h LINKDEF include/EMCAL/LinkDef.h) diff --git a/Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h b/Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h index 07deb955ea..856c92a4ca 100644 --- a/Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h +++ b/Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h @@ -94,7 +94,7 @@ class CalibMonitoringTask final : public quality_control::postprocessing::PostPr TH1* mTRUThresholds = nullptr; ///< The L0 threshold vs TRU ID PHYS TH1* mL0Algorithm = nullptr; ///< The L0 algorithm vs TRU ID TH1* mRollbackSTU = nullptr; ///< The Rollback buffer vs TRU ID - TH1* mTRUMaskPosition = nullptr; ///< The FastOR Mask Position in Eta, Phi + TH2* mTRUMaskPositionHisto = nullptr; ///< The FastOR Mask Position in Eta, Phi Histogram std::unique_ptr mCalibDB; ///< EMCAL calibration DB handler std::unique_ptr mMapper; ///< EMCAL mapper o2::emcal::BadChannelMap* mBadChannelMap; ///< EMCAL channel map diff --git a/Modules/EMCAL/include/EMCAL/DrawGridlines.h b/Modules/EMCAL/include/EMCAL/DrawGridlines.h new file mode 100644 index 0000000000..c22d68d10e --- /dev/null +++ b/Modules/EMCAL/include/EMCAL/DrawGridlines.h @@ -0,0 +1,161 @@ +// 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. + +#ifndef QUALITYCONTROL_DRAWGRIDLINES_H +#define QUALITYCONTROL_DRAWGRIDLINES_H + +#include "TLine.h" +#include "TH2D.h" + +namespace o2::quality_control_modules::emcal +{ + +/// \file DrawGridlines.h +/// \brief Quality Control helper task for drawing the EMCAL gridlines +/// \author Sierra Cantway + +class DrawGridlines : public quality_control::postprocessing::PostProcessingInterface +{ + public: + /// \brief Constructor + DrawGridlines() = default; + /// \brief Destructor + ~DrawGridlines() = default; + + /// \brief Draw the gridlines for the Supermodule limits in the Trigger Geometry + static void DrawSMGridInTriggerGeo(TH2* histo = nullptr) + { + if (histo == nullptr) { + return; + } + // EMCAL + for (int iside = 0; iside <= 48; iside += 24) { + auto smline = new TLine(static_cast(iside) - 0.5, -0.5, static_cast(iside) - 0.5, 63.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + for (int iphi = 0; iphi < 60; iphi += 12) { + auto smline = new TLine(-0.5, static_cast(iphi) - 0.5, 47.5, static_cast(iphi) - 0.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + for (auto iphi = 60; iphi <= 64; iphi += 4) { + auto smline = new TLine(-0.5, static_cast(iphi) - 0.5, 47.5, static_cast(iphi) - 0.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + + // DCAL + for (int side = 0; side < 2; side++) { + int sideoffset = (side == 0) ? 0 : 32; + for (int isepeta = 0; isepeta < 2; isepeta++) { + int etaoffset = sideoffset + isepeta * 16; + auto smline = new TLine(static_cast(etaoffset) - 0.5, 63.5, static_cast(etaoffset) - 0.5, 99.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + for (auto iphi = 76; iphi <= 88; iphi += 12) { + auto smline = new TLine(static_cast(sideoffset) - 0.5, static_cast(iphi) - 0.5, static_cast(sideoffset + 16) - 0.5, static_cast(iphi) - 0.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + } + for (auto iphi = 100; iphi <= 104; iphi += 4) { + auto smline = new TLine(-0.5, static_cast(iphi) - 0.5, 47.5, static_cast(iphi) - 0.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + for (auto ieta = 0; ieta <= 48; ieta += 24) { + auto smline = new TLine(static_cast(ieta) - 0.5, 99.5, static_cast(ieta) - 0.5, 103.5); + smline->SetLineWidth(6); + + histo->GetListOfFunctions()->Add(smline); + } + }; + + /// \brief Draw the gridlines for the TRU limits + static void DrawTRUGrid(TH2* histo = nullptr) + { + if (histo == nullptr) { + return; + } + // EMCAL + for (int side = 0; side < 2; side++) { + int sideoffset = 24 * side; + for (int itru = 0; itru < 2; itru++) { + int truoffset = sideoffset + (itru + 1) * 8; + auto truline = new TLine(static_cast(truoffset) - 0.5, -0.5, static_cast(truoffset) - 0.5, 59.5); + truline->SetLineWidth(3); + + histo->GetListOfFunctions()->Add(truline); + } + } + + // DCAL + for (int side = 0; side < 2; side++) { + int sideoffset = (side == 0) ? 0 : 32; + auto truseparator = new TLine(static_cast(sideoffset + 8) - 0.5, 63.5, static_cast(sideoffset + 8) - 0.5, 99.5); + truseparator->SetLineWidth(3); + + histo->GetListOfFunctions()->Add(truseparator); + } + }; + + /// \brief Draw the gridlines for the FastOR limits + static void DrawFastORGrid(TH2* histo = nullptr) + { + if (histo == nullptr) { + return; + } + // EMCAL + for (int iphi = 1; iphi < 64; iphi++) { + auto fastorLine = new TLine(-0.5, static_cast(iphi) - 0.5, 47.5, static_cast(iphi) - 0.5); + histo->GetListOfFunctions()->Add(fastorLine); + } + for (int ieta = 1; ieta < 48; ieta++) { + auto fastorLine = new TLine(static_cast(ieta) - 0.5, -0.5, static_cast(ieta) - 0.5, 63.5); + histo->GetListOfFunctions()->Add(fastorLine); + } + + // DCAL + for (int side = 0; side < 2; side++) { + int sideoffset = (side == 0) ? 0 : 32; + for (int ieta = 0; ieta <= 16; ieta++) { + int etaoffset = sideoffset + ieta; + auto fastorline = new TLine(static_cast(etaoffset - 0.5), 63.5, static_cast(etaoffset) - 0.5, 99.5); + histo->GetListOfFunctions()->Add(fastorline); + } + for (int iphi = 0; iphi <= 36; iphi++) { + int phioffset = iphi + 64; + auto fastorline = new TLine(static_cast(sideoffset - 0.5), static_cast(phioffset - 0.5), static_cast(sideoffset + 16) - 0.5, static_cast(phioffset) - 0.5); + histo->GetListOfFunctions()->Add(fastorline); + } + } + for (auto ieta = 1; ieta < 48; ieta++) { + auto etaline = new TLine(static_cast(ieta) - 0.5, 99.5, static_cast(ieta) - 0.5, 103.5); + histo->GetListOfFunctions()->Add(etaline); + } + for (auto iphi = 101; iphi <= 103; iphi++) { + auto philine = new TLine(-0.5, static_cast(iphi) - 0.5, 47.5, static_cast(iphi) - 0.5); + histo->GetListOfFunctions()->Add(philine); + } + }; +}; + +} // namespace o2::quality_control_modules::emcal + +#endif // QUALITYCONTROL_DRAWGRIDLINES_H diff --git a/Modules/EMCAL/include/EMCAL/LinkDef.h b/Modules/EMCAL/include/EMCAL/LinkDef.h index d3912abbb4..1dd6ab8743 100644 --- a/Modules/EMCAL/include/EMCAL/LinkDef.h +++ b/Modules/EMCAL/include/EMCAL/LinkDef.h @@ -37,5 +37,6 @@ #pragma link C++ class o2::quality_control_modules::emcal::TrendGraphCheck + ; #pragma link C++ class o2::quality_control_modules::emcal::RawErrorCheckAll + ; +#pragma link C++ class o2::quality_control_modules::emcal::DrawGridlines + ; #endif diff --git a/Modules/EMCAL/src/CalibMonitoringTask.cxx b/Modules/EMCAL/src/CalibMonitoringTask.cxx index 28367d5a7f..8d0e412ba6 100644 --- a/Modules/EMCAL/src/CalibMonitoringTask.cxx +++ b/Modules/EMCAL/src/CalibMonitoringTask.cxx @@ -24,12 +24,14 @@ // QC includes #include "QualityControl/QcInfoLogger.h" #include "EMCAL/CalibMonitoringTask.h" +#include "EMCAL/DrawGridlines.h" // root includes #include "TCanvas.h" #include "TPaveText.h" #include "TH1D.h" #include "TH2D.h" +#include "TLine.h" #include using namespace o2::quality_control::postprocessing; @@ -246,13 +248,13 @@ void CalibMonitoringTask::initialize(Trigger, framework::ServiceRegistryRef) } getObjectsManager()->startPublishing(mRollbackSTU); - if (!mTRUMaskPosition) { - mTRUMaskPosition = new TH2D("TRUMaskPosition", "TRU Mask Position", 48., -0.5, 47.5, 104, -0.5, 103.5); - mTRUMaskPosition->GetXaxis()->SetTitle("FastOR Abs Eta"); - mTRUMaskPosition->GetYaxis()->SetTitle("FastOR Abs Phi"); - mTRUMaskPosition->SetStats(false); + if (!mTRUMaskPositionHisto) { + mTRUMaskPositionHisto = new TH2D("TRUMaskPositionHisto", "TRU Mask Position Histogram", 48., -0.5, 47.5, 104, -0.5, 103.5); + mTRUMaskPositionHisto->GetXaxis()->SetTitle("FastOR Abs Eta"); + mTRUMaskPositionHisto->GetYaxis()->SetTitle("FastOR Abs Phi"); + mTRUMaskPositionHisto->SetStats(false); } - getObjectsManager()->startPublishing(mTRUMaskPosition); + getObjectsManager()->startPublishing(mTRUMaskPositionHisto); } } o2::emcal::Geometry::GetInstanceFromRunNumber(300000); @@ -348,8 +350,12 @@ void CalibMonitoringTask::update(Trigger t, framework::ServiceRegistryRef) for (auto fastORID : fastORs) { auto [eta, phi] = mTriggerMapping->getPositionInEMCALFromAbsFastORIndex(fastORID); - mTRUMaskPosition->SetBinContent(eta + 1, phi + 1, 1.); + mTRUMaskPositionHisto->SetBinContent(eta + 1, phi + 1, 1.); } + + o2::quality_control_modules::emcal::DrawGridlines::DrawFastORGrid(mTRUMaskPositionHisto); + o2::quality_control_modules::emcal::DrawGridlines::DrawTRUGrid(mTRUMaskPositionHisto); + o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mTRUMaskPositionHisto); } } } @@ -377,7 +383,7 @@ void CalibMonitoringTask::finalize(Trigger t, framework::ServiceRegistryRef) getObjectsManager()->stopPublishing(mTRUThresholds); getObjectsManager()->stopPublishing(mL0Algorithm); getObjectsManager()->stopPublishing(mRollbackSTU); - getObjectsManager()->stopPublishing(mTRUMaskPosition); + getObjectsManager()->stopPublishing(mTRUMaskPositionHisto); } } } @@ -428,8 +434,8 @@ void CalibMonitoringTask::reset() if (mRollbackSTU) { mRollbackSTU->Reset(); } - if (mTRUMaskPosition) { - mTRUMaskPosition->Reset(); + if (mTRUMaskPositionHisto) { + mTRUMaskPositionHisto->Reset(); } } } // namespace o2::quality_control_modules::emcal