Skip to content

Commit

Permalink
[EMCAL-767] Added the TRU gridlines to the TRU Mask Position MO
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
sweyh99 authored Aug 6, 2024
1 parent 70bbf36 commit 2fc7cd7
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 11 deletions.
1 change: 1 addition & 0 deletions Modules/EMCAL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion Modules/EMCAL/include/EMCAL/CalibMonitoringTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<o2::emcal::CalibDB> mCalibDB; ///< EMCAL calibration DB handler
std::unique_ptr<o2::emcal::MappingHandler> mMapper; ///< EMCAL mapper
o2::emcal::BadChannelMap* mBadChannelMap; ///< EMCAL channel map
Expand Down
161 changes: 161 additions & 0 deletions Modules/EMCAL/include/EMCAL/DrawGridlines.h
Original file line number Diff line number Diff line change
@@ -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<double>(iside) - 0.5, -0.5, static_cast<double>(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<double>(iphi) - 0.5, 47.5, static_cast<double>(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<double>(iphi) - 0.5, 47.5, static_cast<double>(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<double>(etaoffset) - 0.5, 63.5, static_cast<double>(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<double>(sideoffset) - 0.5, static_cast<double>(iphi) - 0.5, static_cast<double>(sideoffset + 16) - 0.5, static_cast<double>(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<double>(iphi) - 0.5, 47.5, static_cast<int>(iphi) - 0.5);
smline->SetLineWidth(6);

histo->GetListOfFunctions()->Add(smline);
}
for (auto ieta = 0; ieta <= 48; ieta += 24) {
auto smline = new TLine(static_cast<double>(ieta) - 0.5, 99.5, static_cast<double>(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<int>(truoffset) - 0.5, -0.5, static_cast<int>(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<double>(sideoffset + 8) - 0.5, 63.5, static_cast<double>(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<double>(iphi) - 0.5, 47.5, static_cast<double>(iphi) - 0.5);
histo->GetListOfFunctions()->Add(fastorLine);
}
for (int ieta = 1; ieta < 48; ieta++) {
auto fastorLine = new TLine(static_cast<double>(ieta) - 0.5, -0.5, static_cast<double>(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<double>(etaoffset - 0.5), 63.5, static_cast<double>(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<double>(sideoffset - 0.5), static_cast<double>(phioffset - 0.5), static_cast<double>(sideoffset + 16) - 0.5, static_cast<double>(phioffset) - 0.5);
histo->GetListOfFunctions()->Add(fastorline);
}
}
for (auto ieta = 1; ieta < 48; ieta++) {
auto etaline = new TLine(static_cast<double>(ieta) - 0.5, 99.5, static_cast<double>(ieta) - 0.5, 103.5);
histo->GetListOfFunctions()->Add(etaline);
}
for (auto iphi = 101; iphi <= 103; iphi++) {
auto philine = new TLine(-0.5, static_cast<double>(iphi) - 0.5, 47.5, static_cast<int>(iphi) - 0.5);
histo->GetListOfFunctions()->Add(philine);
}
};
};

} // namespace o2::quality_control_modules::emcal

#endif // QUALITYCONTROL_DRAWGRIDLINES_H
1 change: 1 addition & 0 deletions Modules/EMCAL/include/EMCAL/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 16 additions & 10 deletions Modules/EMCAL/src/CalibMonitoringTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/property_tree/ptree.hpp>

using namespace o2::quality_control::postprocessing;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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

0 comments on commit 2fc7cd7

Please sign in to comment.