From 0216620a46a46430e1c5259beddae95d56443109 Mon Sep 17 00:00:00 2001 From: Sierra Weyhmiller Date: Tue, 16 Jul 2024 14:29:19 -0400 Subject: [PATCH] [EMCAL-767] changed the SM, TRU, and FastOR gridlines to a public helper class --- Modules/EMCAL/CMakeLists.txt | 1 + .../EMCAL/include/EMCAL/CalibMonitoringTask.h | 1 - Modules/EMCAL/include/EMCAL/DrawGridlines.h | 145 ++++++++++++++++++ Modules/EMCAL/include/EMCAL/LinkDef.h | 1 + Modules/EMCAL/src/CalibMonitoringTask.cxx | 90 +---------- 5 files changed, 152 insertions(+), 86 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 55f988a6b8..19bc9077b3 100644 --- a/Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h +++ b/Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h @@ -77,7 +77,6 @@ class CalibMonitoringTask final : public quality_control::postprocessing::PostPr int GetTRUIndexFromSTUIndex(Int_t id, Int_t detector); int GetChannelForMaskRun2(int mask, int bitnumber, bool onethirdsm); std::vector GetAbsFastORIndexFromMask(); - void DrawTRUGrid(); std::vector mCalibObjects; ///< list of vectors of parm objects to be processed TH1* mTimeCalibParamHisto = nullptr; ///< Monitor Time Calib Param diff --git a/Modules/EMCAL/include/EMCAL/DrawGridlines.h b/Modules/EMCAL/include/EMCAL/DrawGridlines.h new file mode 100644 index 0000000000..f52ee73e1a --- /dev/null +++ b/Modules/EMCAL/include/EMCAL/DrawGridlines.h @@ -0,0 +1,145 @@ +// 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" + +namespace o2::quality_control_modules::emcal +{ + +/// \file DrawGridlines.h +/// \brief Quality Control helper task for drawing the EMCAL gridlines +/// \author Sierra Cantway + +class DrawGridlines final : 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() + { + + // 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); + smline->Draw("same"); + } + 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); + smline->Draw("same"); + } + 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); + smline->Draw("same"); + } + + // 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); + smline->Draw("same"); + } + 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); + smline->Draw("same"); + } + } + 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); + smline->Draw("same"); + } + 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); + smline->Draw("same"); + } + }; + + /// \brief Draw the gridlines for the TRU limits + static void DrawTRUGrid() + { + + // 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); + truline->Draw("same"); + } + } + + // 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); + truseparator->Draw("same"); + } + }; + + /// \brief Draw the gridlines for the FastOR limits + static void DrawFastORGrid() + { + + // 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); + fastorLine->Draw("same"); + } + 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); + fastorLine->Draw("same"); + } + + // 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); + fastorline->Draw("same"); + } + 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); + fastorline->Draw("same"); + } + } + 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); + etaline->Draw("same"); + } + 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); + philine->Draw("same"); + } + }; +}; + +} // 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 793885d272..8611af0391 100644 --- a/Modules/EMCAL/src/CalibMonitoringTask.cxx +++ b/Modules/EMCAL/src/CalibMonitoringTask.cxx @@ -24,6 +24,7 @@ // QC includes #include "QualityControl/QcInfoLogger.h" #include "EMCAL/CalibMonitoringTask.h" +#include "EMCAL/DrawGridlines.h" // root includes #include "TCanvas.h" @@ -93,90 +94,6 @@ std::vector CalibMonitoringTask::GetAbsFastORIndexFromMask() return maskedfastors; } -void CalibMonitoringTask::DrawTRUGrid() -{ - // 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); - fastorLine->Draw("same"); - } - 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); - fastorLine->Draw("same"); - } - 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(2); - truline->Draw("same"); - } - } - 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(3); - smline->Draw("same"); - } - 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(3); - smline->Draw("same"); - } - 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(3); - smline->Draw("same"); - } - - // 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); - fastorline->Draw("same"); - } - 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); - fastorline->Draw("same"); - } - 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(3); - smline->Draw("same"); - } - 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(3); - smline->Draw("same"); - } - auto truseparator = new TLine(static_cast(sideoffset + 8) - 0.5, 63.5, static_cast(sideoffset + 8) - 0.5, 99.5); - truseparator->SetLineWidth(2); - truseparator->Draw("same"); - } - 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); - etaline->Draw("same"); - } - 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); - philine->Draw("same"); - } - 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(3); - smline->Draw("same"); - } - 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(3); - smline->Draw("same"); - } -} - void CalibMonitoringTask::configure(const boost::property_tree::ptree& config) { mCalibDB = std::make_unique(config.get("qc.config.conditionDB.url").data()); @@ -445,7 +362,10 @@ void CalibMonitoringTask::update(Trigger t, framework::ServiceRegistryRef) mTRUMaskPositionCanvas->Clear(); mTRUMaskPositionCanvas->cd(); mTRUMaskPositionHisto->Draw("colz"); - DrawTRUGrid(); + + o2::quality_control_modules::emcal::DrawGridlines::DrawFastORGrid(); + o2::quality_control_modules::emcal::DrawGridlines::DrawTRUGrid(); + o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(); } } }