Skip to content

Commit f9497ae

Browse files
author
jokonig
committed
[EMCAL-519] Optimize QC Messages for oncall related histograms
- Add online supermodule indices to multiple histograms - Add grid lines with SM borders to mw histograms
1 parent 8655e47 commit f9497ae

File tree

11 files changed

+188
-9
lines changed

11 files changed

+188
-9
lines changed

Modules/EMCAL/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ add_root_dictionary(O2QcEMCAL
4545
include/EMCAL/DrawGridlines.h
4646
include/EMCAL/FECRateVisualization.h
4747
include/EMCAL/NumPhysTriggCheck.h
48+
include/EMCAL/NumPhysTriggCheck.h
49+
include/EMCAL/IndicesConverter.h
4850
LINKDEF include/EMCAL/LinkDef.h)
4951

5052
install(TARGETS O2QcEMCAL

Modules/EMCAL/include/EMCAL/DrawGridlines.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "TLine.h"
1616
#include "TH2D.h"
17+
#include "QualityControl/QcInfoLogger.h"
1718

1819
namespace o2::quality_control_modules::emcal
1920
{
@@ -36,6 +37,24 @@ class DrawGridlines : public quality_control::postprocessing::PostProcessingInte
3637
if (histo == nullptr) {
3738
return;
3839
}
40+
41+
// check if the gridlines are already drawn by looking for a line at the first SM boundary
42+
auto* funcs = histo->GetListOfFunctions();
43+
if (!funcs) {
44+
return;
45+
}
46+
47+
// Remove previously added grid lines
48+
TIter it(funcs);
49+
TObject* obj = nullptr;
50+
while ((obj = it())) {
51+
if (obj->InheritsFrom(TLine::Class())) {
52+
ILOG(Debug, Support) << "Removing existing grid line from histogram " << histo->GetName() << ENDM;
53+
funcs->Remove(obj);
54+
delete obj;
55+
}
56+
}
57+
3958
// EMCAL
4059
for (int iside = 0; iside <= 48; iside += 24) {
4160
auto smline = new TLine(static_cast<double>(iside) - 0.5, -0.5, static_cast<double>(iside) - 0.5, 63.5);
@@ -115,6 +134,63 @@ class DrawGridlines : public quality_control::postprocessing::PostProcessingInte
115134
}
116135
};
117136

137+
/// \brief Draw the gridlines in the standard cell geometry
138+
static void DrawSMGridInStdGeo(TH2* histo = nullptr)
139+
{
140+
if (histo == nullptr) {
141+
return;
142+
}
143+
// EMCAL
144+
for (int iside = 0; iside <= 96; iside += 48) {
145+
auto smline = new TLine(static_cast<double>(iside) - 0.5, -0.5, static_cast<double>(iside) - 0.5, 127.5);
146+
smline->SetLineWidth(6);
147+
148+
histo->GetListOfFunctions()->Add(smline);
149+
}
150+
for (int iphi = 0; iphi < 120; iphi += 24) {
151+
auto smline = new TLine(-0.5, static_cast<double>(iphi) - 0.5, 95.5, static_cast<double>(iphi) - 0.5);
152+
smline->SetLineWidth(6);
153+
154+
histo->GetListOfFunctions()->Add(smline);
155+
}
156+
for (auto iphi = 120; iphi <= 128; iphi += 8) {
157+
auto smline = new TLine(-0.5, static_cast<double>(iphi) - 0.5, 95.5, static_cast<double>(iphi) - 0.5);
158+
smline->SetLineWidth(6);
159+
160+
histo->GetListOfFunctions()->Add(smline);
161+
}
162+
163+
// DCAL
164+
for (int side = 0; side < 2; side++) {
165+
int sideoffset = (side == 0) ? 0 : 64;
166+
for (int isepeta = 0; isepeta < 2; isepeta++) {
167+
int etaoffset = sideoffset + isepeta * 32;
168+
auto smline = new TLine(static_cast<double>(etaoffset) - 0.5, 127.5, static_cast<double>(etaoffset) - 0.5, 199.5);
169+
smline->SetLineWidth(6);
170+
171+
histo->GetListOfFunctions()->Add(smline);
172+
}
173+
for (auto iphi = 152; iphi <= 176; iphi += 24) {
174+
auto smline = new TLine(static_cast<double>(sideoffset) - 0.5, static_cast<double>(iphi) - 0.5, static_cast<double>(sideoffset + 32) - 0.5, static_cast<double>(iphi) - 0.5);
175+
smline->SetLineWidth(6);
176+
177+
histo->GetListOfFunctions()->Add(smline);
178+
}
179+
}
180+
for (auto iphi = 200; iphi <= 208; iphi += 8) {
181+
auto smline = new TLine(-0.5, static_cast<double>(iphi) - 0.5, 95.5, static_cast<int>(iphi) - 0.5);
182+
smline->SetLineWidth(6);
183+
184+
histo->GetListOfFunctions()->Add(smline);
185+
}
186+
for (auto ieta = 0; ieta <= 96; ieta += 48) {
187+
auto smline = new TLine(static_cast<double>(ieta) - 0.5, 199.5, static_cast<double>(ieta) - 0.5, 207.5);
188+
smline->SetLineWidth(6);
189+
190+
histo->GetListOfFunctions()->Add(smline);
191+
}
192+
};
193+
118194
/// \brief Draw the gridlines for the FastOR limits
119195
static void DrawFastORGrid(TH2* histo = nullptr)
120196
{

Modules/EMCAL/include/EMCAL/FECRateVisualization.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <array>
2222
#include <memory>
2323
#include <TCanvas.h>
24+
#include <EMCAL/IndicesConverter.h>
2425

2526
namespace o2::quality_control_modules::emcal
2627
{
@@ -60,6 +61,7 @@ class FECRateVisualization final : public quality_control::postprocessing::PostP
6061

6162
private:
6263
std::array<std::unique_ptr<TCanvas>, 20> mSupermoduleCanvas; /// Canvas with FEC Rates per supermodule
64+
o2::emcal::IndicesConverter mIndicesConverter; ///< Converter for online-offline supermodule indices
6365
double mMaxRate = 2000.;
6466
};
6567

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef QUALITYCONTROL_INDICESCONVERTER_H
13+
#define QUALITYCONTROL_INDICESCONVERTER_H
14+
#include <map>
15+
#include <string>
16+
17+
namespace o2::emcal
18+
{
19+
class IndicesConverter
20+
{
21+
public:
22+
IndicesConverter()
23+
{
24+
Initialize();
25+
}
26+
~IndicesConverter() = default;
27+
28+
void Initialize()
29+
{
30+
// Initialize the map with online and offline supermodule indices
31+
for (int i = 0; i < 20; i++) {
32+
std::string SMSide = "A";
33+
if (i % 2 != 0) {
34+
SMSide = "C";
35+
}
36+
int SMRowIndex = (i / 2) + (i >= 12 ? 3 : 0); // Adjust row index for DCAL
37+
mOnlineToOfflineSMMap[i] = "SM" + SMSide + std::to_string(SMRowIndex);
38+
}
39+
}
40+
41+
int GetOfflineSMIndex(const std::string& onlineSMIndex) const
42+
{
43+
for (const auto& pair : mOnlineToOfflineSMMap) {
44+
if (pair.second == onlineSMIndex) {
45+
return pair.first;
46+
}
47+
}
48+
return -1; // Return -1 if no matching index is found
49+
}
50+
std::string GetOnlineSMIndex(const int offlineSMIndex) const
51+
{
52+
if (mOnlineToOfflineSMMap.find(offlineSMIndex) != mOnlineToOfflineSMMap.end()) {
53+
return mOnlineToOfflineSMMap.at(offlineSMIndex);
54+
} else {
55+
return "Invalid SM Index";
56+
}
57+
}
58+
59+
private:
60+
std::map<int, std::string> mOnlineToOfflineSMMap; ///< Map for conversion between online and offline supermodule indices
61+
};
62+
63+
} // namespace o2::emcal
64+
65+
#endif // QUALITYCONTROL_INDICESCONVERTER_H

Modules/EMCAL/include/EMCAL/LinkDef.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
#pragma link C++ class o2::quality_control_modules::emcal::RawErrorCheckAll + ;
4141
#pragma link C++ class o2::quality_control_modules::emcal::DrawGridlines + ;
4242

43-
#pragma link C++ class o2::quality_control_modules::emcal::FECRateVisualization+;
44-
45-
#endif
43+
#pragma link C++ class o2::quality_control_modules::emcal::FECRateVisualization+;
44+
45+
#endif

Modules/EMCAL/include/EMCAL/RawCheck.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define QC_MODULE_EMCAL_EMCALRAWCHECK_H
1414

1515
#include "QualityControl/CheckInterface.h"
16+
#include "EMCAL/IndicesConverter.h"
1617
#include <array>
1718
#include <tuple>
1819
#include <vector>
@@ -64,6 +65,11 @@ class RawCheck final : public o2::quality_control::checker::CheckInterface
6465
bool mILMessageNoisyFECCheck = false; ///< Switch for IL message for noisy FEC
6566
bool mILMessagePayloadSizeCheck = false; ///< Switch for IL message for large payload size
6667

68+
/************************************************
69+
* Conversion between online and offline indices *
70+
************************************************/
71+
o2::emcal::IndicesConverter mIndicesConverter; ///< Converter for online and offline supermodule indices
72+
6773
/************************************************
6874
* sigma cuts *
6975
************************************************/

Modules/EMCAL/include/EMCAL/SupermoduleProjectorTask.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// QC includes
2121
#include "QualityControl/QualityObject.h"
2222
#include "QualityControl/PostProcessingInterface.h"
23+
#include "EMCAL/IndicesConverter.h"
2324
#include <map>
2425
#include <memory>
2526
#include <vector>
@@ -98,6 +99,7 @@ class SupermoduleProjectorTask final : public quality_control::postprocessing::P
9899
std::vector<DataSource> mDataSources; ///< Data sources to be projected
99100
std::map<std::string, TCanvas*> mCanvasHandler; ///< Mapping between data source and output canvas
100101
std::map<std::string, PlotAttributes> mAttributeHandler; ///< Customizations for canvases (i.e. axis titles)
102+
o2::emcal::IndicesConverter mIndicesConverter; ///< Converter for online-offline supermodule indices
101103
};
102104

103105
} // namespace o2::quality_control_modules::emcal

Modules/EMCAL/src/CellTask.cxx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,13 @@ void CellTask::CellHistograms::startPublishing(o2::quality_control::core::Object
10671067
}
10681068
};
10691069

1070+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancy);
1071+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyThr);
1072+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyThrBelow);
1073+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyGood);
1074+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyBad);
1075+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mIntegratedOccupancy);
1076+
10701077
publishOptional(mCellTime);
10711078
publishOptional(mCellTimeCalib);
10721079
publishOptional(mCellAmplitude);
@@ -1091,8 +1098,6 @@ void CellTask::CellHistograms::startPublishing(o2::quality_control::core::Object
10911098
publishOptional(mCellAmplitudeCalib_EMCAL);
10921099
publishOptional(mCellAmplitudeCalib_DCAL);
10931100
publishOptional(mCellOccupancy);
1094-
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyThr);
1095-
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyThrBelow);
10961101
publishOptional(mCellOccupancyThr);
10971102
publishOptional(mCellOccupancyThrBelow);
10981103
publishOptional(mCellOccupancyGood);
@@ -1169,6 +1174,14 @@ void CellTask::CellHistograms::reset()
11691174
for (auto histos : mCellTimeBC) {
11701175
resetOptional(histos);
11711176
}
1177+
1178+
// Draw Grid Lines
1179+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancy);
1180+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyThr);
1181+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyThrBelow);
1182+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyGood);
1183+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mCellOccupancyBad);
1184+
o2::quality_control_modules::emcal::DrawGridlines::DrawSMGridInTriggerGeo(mIntegratedOccupancy);
11721185
}
11731186

11741187
void CellTask::CellHistograms::clean()

Modules/EMCAL/src/FECRateVisualization.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <TH1.h>
1818
#include <TLegend.h>
1919
#include <TTree.h>
20+
#include <TLatex.h>
2021

2122
#include <boost/property_tree/ptree.hpp>
2223

@@ -44,6 +45,7 @@ void FECRateVisualization::configure(const boost::property_tree::ptree& config)
4445

4546
void FECRateVisualization::initialize(Trigger, framework::ServiceRegistryRef)
4647
{
48+
mIndicesConverter.Initialize();
4749
for (int ism = 0; ism < 20; ism++) {
4850
mSupermoduleCanvas[ism] = std::make_unique<TCanvas>(Form("FECRatesSM%d", ism), Form("FEC rates for supermodule %d", ism), 800, 600);
4951
getObjectsManager()->startPublishing(mSupermoduleCanvas[ism].get(), PublicationPolicy::Forever);
@@ -79,6 +81,7 @@ void FECRateVisualization::update(Trigger t, framework::ServiceRegistryRef servi
7981
int minfec = smID * 40;
8082
mSupermoduleCanvas[smID]->Clear();
8183
mSupermoduleCanvas[smID]->Divide(2, 2);
84+
mSupermoduleCanvas[smID]->SetTopMargin(0.1);
8285
int currentpad = 0;
8386
TLegend* leg = nullptr;
8487
bool isFirst = true;
@@ -144,6 +147,11 @@ void FECRateVisualization::update(Trigger t, framework::ServiceRegistryRef servi
144147
}
145148

146149
mSupermoduleCanvas[smID]->cd();
150+
TLatex* msg = new TLatex(0.35, 0.96, Form("Supermodule %d (%s)", smID, mIndicesConverter.GetOnlineSMIndex(smID).data()));
151+
msg->SetNDC();
152+
msg->SetTextSize(0.05);
153+
msg->SetTextFont(62);
154+
msg->Draw();
147155
mSupermoduleCanvas[smID]->Update();
148156
}
149157
}

Modules/EMCAL/src/RawCheck.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ void RawCheck::configure()
5757
loadConfigValueDouble("BunchMinAmpFractionSignalSM", mBunchMinCheckFractionSignalSM);
5858
loadConfigValueInt("BunchMinAmpMinEntriesFEC", mBunchMinCheckMinEntriesFEC);
5959
loadConfigValueDouble("BunchMinAmpFractionSignalFEC", mBunchMinCheckFractionSignalFEC);
60+
61+
mIndicesConverter.Initialize();
6062
}
6163

6264
Quality RawCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
@@ -90,7 +92,7 @@ Quality RawCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* m
9092
result = Quality::Bad;
9193
std::stringstream messagebuilder;
9294
for (auto imod : badModules) {
93-
messagebuilder << "Pedestals peak detected in SM " << imod << std::endl;
95+
messagebuilder << "Pedestals peak detected in SM " << imod << " " << mIndicesConverter.GetOnlineSMIndex(imod) << std::endl;
9496
}
9597
message = messagebuilder.str();
9698
} else {
@@ -110,10 +112,10 @@ Quality RawCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* m
110112
std::stringstream messagebuilder;
111113
for (int ism = 0; ism < fecsPerSM.size(); ism++) {
112114
if (badsms.test(ism)) {
113-
messagebuilder << "Pedestals not set full SM " << ism << std::endl;
115+
messagebuilder << "Pedestals not set full SM " << ism << " " << mIndicesConverter.GetOnlineSMIndex(ism) << std::endl;
114116
} else {
115117
for (auto& fec : fecsPerSM[ism]) {
116-
messagebuilder << "Pedestals not set SM " << ism << " FEC " << fec << std::endl;
118+
messagebuilder << "Pedestals not set SM " << ism << " " << mIndicesConverter.GetOnlineSMIndex(ism) << " FEC " << fec << std::endl;
117119
}
118120
}
119121
}

0 commit comments

Comments
 (0)