Skip to content

Commit 222ebeb

Browse files
authored
[EMCAL-1148] Monitoring task for FEC data rates (#2387)
Trends of data rate per FEC vs time sorted per SM - 1 Canvas per SM (20 canvases) - 4 branch per SM - 10 FECs per branch FEC indices of LEDMON and TRU FECs are disabled for all SMs as the occupancy histogram has no data for those FECs. In small SMs inactive FEC indices are disabled as well. For all disabled FEC indices the mapping is static and will not change in time.
1 parent 6e96d18 commit 222ebeb

4 files changed

Lines changed: 231 additions & 5 deletions

File tree

Modules/EMCAL/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
add_library(O2QcEMCAL)
44

5-
6-
target_sources(O2QcEMCAL PRIVATE src/TriggerTask.cxx src/PedestalTask.cxx src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/OccupancyToFECReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx src/CalibCheck.cxx src/NumPatchesPerFastORCheck.cxx src/PedestalChannelCheck.cxx src/PayloadPerEventDDLCheck.cxx src/RawErrorCheckAll.cxx src/CellTimeCalibCheck.cxx src/CellAmpCheck.cxx src/TrendGraphCheck.cxx)
7-
5+
target_sources(O2QcEMCAL PRIVATE src/FECRateVisualization.cxx src/TriggerTask.cxx src/PedestalTask.cxx src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/OccupancyToFECReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx src/CalibCheck.cxx src/NumPatchesPerFastORCheck.cxx src/PedestalChannelCheck.cxx src/PayloadPerEventDDLCheck.cxx src/RawErrorCheckAll.cxx src/CellTimeCalibCheck.cxx src/CellAmpCheck.cxx src/TrendGraphCheck.cxx)
86

97
target_include_directories(
108
O2QcEMCAL
@@ -45,9 +43,9 @@ add_root_dictionary(O2QcEMCAL
4543
include/EMCAL/CellAmpCheck.h
4644
include/EMCAL/TrendGraphCheck.h
4745
include/EMCAL/DrawGridlines.h
46+
include/EMCAL/FECRateVisualization.h
4847
LINKDEF include/EMCAL/LinkDef.h)
4948

50-
5149
install(TARGETS O2QcEMCAL
5250
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
5351
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
///
13+
/// \file FECRateVisualization.h
14+
/// \author Markus Fasel
15+
///
16+
17+
#ifndef QUALITYCONTROL_SKELETONPOSTPROCESSING_H
18+
#define QUALITYCONTROL_SKELETONPOSTPROCESSING_H
19+
20+
#include "QualityControl/PostProcessingInterface.h"
21+
#include <array>
22+
#include <memory>
23+
#include <TCanvas.h>
24+
25+
namespace o2::quality_control_modules::emcal
26+
{
27+
28+
/// \brief Example Quality Control Postprocessing Task
29+
/// \author My Name
30+
class FECRateVisualization final : public quality_control::postprocessing::PostProcessingInterface
31+
{
32+
public:
33+
/// \brief Constructor
34+
FECRateVisualization() = default;
35+
/// \brief Destructor
36+
~FECRateVisualization() override;
37+
38+
/// \brief Configuration a post-processing task.
39+
/// Configuration of a post-processing task. The task may create variables that shall live throughout its lifetime.
40+
/// \param config boost property with the full QC configuration file
41+
void configure(const boost::property_tree::ptree& config) override;
42+
/// \brief Initialization of a post-processing task.
43+
/// Initialization of a post-processing task. User receives a Trigger which caused the initialization and a service
44+
/// registry with singleton interfaces.
45+
/// \param trigger Trigger which caused the initialization, for example Trigger::SOR
46+
/// \param services Interface containing optional interfaces, for example DatabaseInterface
47+
void initialize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
48+
/// \brief Update of a post-processing task.
49+
/// Update of a post-processing task. User receives a Trigger which caused the update and a service
50+
/// registry with singleton interfaces.
51+
/// \param trigger Trigger which caused the initialization, for example Trigger::Period
52+
/// \param services Interface containing optional interfaces, for example DatabaseInterface
53+
void update(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
54+
/// \brief Finalization of a post-processing task.
55+
/// Finalization of a post-processing task. User receives a Trigger which caused the finalization and a service
56+
/// registry with singleton interfaces.
57+
/// \param trigger Trigger which caused the initialization, for example Trigger::EOR
58+
/// \param services Interface containing optional interfaces, for example DatabaseInterface
59+
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
60+
61+
private:
62+
std::array<std::unique_ptr<TCanvas>, 20> mSupermoduleCanvas; /// Canvas with FEC Rates per supermodule
63+
double mMaxRate = 2000.;
64+
};
65+
66+
} // namespace o2::quality_control_modules::emcal
67+
68+
#endif // QUALITYCONTROL_SKELETONPOSTPROCESSING_H

Modules/EMCAL/include/EMCAL/LinkDef.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@
3939
#pragma link C++ class o2::quality_control_modules::emcal::RawErrorCheckAll + ;
4040
#pragma link C++ class o2::quality_control_modules::emcal::DrawGridlines + ;
4141

42-
#endif
42+
#pragma link C++ class o2::quality_control_modules::emcal::FECRateVisualization+;
43+
44+
#endif
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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+
#include "EMCAL/FECRateVisualization.h"
12+
#include "QualityControl/DatabaseInterface.h"
13+
#include "QualityControl/QcInfoLogger.h"
14+
15+
#include <TCanvas.h>
16+
#include <TGraph.h>
17+
#include <TH1.h>
18+
#include <TLegend.h>
19+
#include <TTree.h>
20+
21+
#include <boost/property_tree/ptree.hpp>
22+
23+
using namespace o2::quality_control::postprocessing;
24+
using namespace o2::quality_control::core;
25+
26+
namespace o2::quality_control_modules::emcal
27+
{
28+
29+
FECRateVisualization::~FECRateVisualization()
30+
{
31+
}
32+
33+
void FECRateVisualization::configure(const boost::property_tree::ptree& config)
34+
{
35+
auto taskConfig = config.get_child_optional("qc.postprocessing." + getID() + ".configuration");
36+
if (taskConfig) {
37+
auto cfgMaxRate = taskConfig.get().get_child_optional("MaxRate");
38+
if (cfgMaxRate) {
39+
mMaxRate = cfgMaxRate->get_value<double>();
40+
ILOG(Info, Support) << "Found max FEC rate: " << mMaxRate << ENDM;
41+
}
42+
}
43+
}
44+
45+
void FECRateVisualization::initialize(Trigger, framework::ServiceRegistryRef)
46+
{
47+
for (int ism = 0; ism < 20; ism++) {
48+
mSupermoduleCanvas[ism] = std::make_unique<TCanvas>(Form("FECRatesSM%d", ism), Form("FEC rates for supermodule %d", ism), 800, 600);
49+
getObjectsManager()->startPublishing(mSupermoduleCanvas[ism].get(), PublicationPolicy::Forever);
50+
}
51+
}
52+
53+
void FECRateVisualization::update(Trigger t, framework::ServiceRegistryRef services)
54+
{
55+
std::cout << "Using max rate: " << mMaxRate << std::endl;
56+
std::array<Color_t, 10> colors = { { kRed, kGreen, kBlue, kOrange, kTeal, kMagenta, kCyan, kViolet, kGray, kBlack } };
57+
std::array<Style_t, 10> markers = { { 20, 21, 22, 24, 25, 26, 27, 28, 29, 30 } };
58+
59+
const std::array<int, 12> fecs_small_A = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13 } },
60+
fecs_small_C = { { 27, 28, 29, 31, 32, 33, 34, 39, 36, 37, 38, 39 } };
61+
const std::array<int, 24> fecs_DCAL = { { 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 16, 17, 18, 19, 21, 22, 27, 28, 29, 31, 32, 33, 34, 35 } };
62+
enum SMType {
63+
FULL,
64+
SMALL_A,
65+
SMALL_C,
66+
DCAL
67+
};
68+
const std::array<SMType, 20> smtypes{ { FULL, FULL, FULL, FULL, FULL, FULL, FULL, FULL, FULL, FULL, SMALL_A, SMALL_C, DCAL, DCAL, DCAL, DCAL, DCAL, DCAL, SMALL_C, SMALL_A } };
69+
70+
auto& qcdb = services.get<quality_control::repository::DatabaseInterface>();
71+
auto mo = qcdb.retrieveMO("EMC/MO/CellTrendingDetailEMCAL", "CellTrendingDetailEMCAL", t.timestamp, t.activity);
72+
TTree* datatree = static_cast<TTree*>(mo->getObject());
73+
if (!datatree) {
74+
ILOG(Error, Support) << "Tree not found" << ENDM;
75+
return;
76+
}
77+
78+
for (int smID = 0; smID < 20; smID++) {
79+
int minfec = smID * 40;
80+
mSupermoduleCanvas[smID]->Clear();
81+
mSupermoduleCanvas[smID]->Divide(2, 2);
82+
int currentpad = 0;
83+
TLegend* leg = nullptr;
84+
bool isFirst = true;
85+
for (int ifec = 0; ifec < 40; ifec++) {
86+
if (ifec % 10 == 0) {
87+
currentpad++;
88+
mSupermoduleCanvas[smID]->cd(currentpad);
89+
90+
leg = new TLegend(0.15, 0.75, 0.89, 0.89);
91+
leg->SetBorderSize(0);
92+
leg->SetFillStyle(0);
93+
leg->SetTextFont(42);
94+
leg->SetNColumns(5);
95+
isFirst = true;
96+
}
97+
bool found = true;
98+
switch (smtypes[smID]) {
99+
case SMType::FULL:
100+
// exclude LEDMON (0) and TRU FECs (10, 20, 30) as they leave no data in the occupancy plot
101+
found = (ifec != 0) && (ifec != 10) && (ifec != 20) && (ifec != 30);
102+
break;
103+
case SMType::SMALL_A:
104+
found = std::find(fecs_small_A.begin(), fecs_small_A.end(), ifec) != fecs_small_A.end();
105+
break;
106+
case SMType::SMALL_C:
107+
found = std::find(fecs_small_C.begin(), fecs_small_C.end(), ifec) != fecs_small_C.end();
108+
break;
109+
case SMType::DCAL:
110+
found = std::find(fecs_DCAL.begin(), fecs_DCAL.end(), ifec) != fecs_DCAL.end();
111+
break;
112+
default:
113+
break;
114+
};
115+
if (!found) {
116+
continue;
117+
}
118+
int globalfec = ifec + minfec;
119+
const char* drawoptions = (isFirst) ? "pl" : "plsame";
120+
datatree->Draw(Form("cellOccupancyEMCwThr_PHYS.fecCounts[%d]:time", globalfec), "", drawoptions);
121+
// gPad->GetListOfPrimitives()->ls();
122+
auto targetgraph = static_cast<TGraph*>(gPad->GetPrimitive("Graph"));
123+
targetgraph->SetName(Form("fectrend%d", ifec));
124+
targetgraph->SetMarkerColor(colors[ifec % 10]);
125+
targetgraph->SetLineColor(colors[ifec % 10]);
126+
targetgraph->SetMarkerStyle(markers[ifec % 10]);
127+
leg->AddEntry(targetgraph, Form("FEC %d", ifec), "lep");
128+
129+
if (isFirst) {
130+
auto frame = static_cast<TH1*>(gPad->GetPrimitive("htemp"));
131+
frame->SetName(Form("frame_SM%d_branch_%d", smID, ifec / 10));
132+
frame->GetXaxis()->SetTimeDisplay(1);
133+
frame->GetXaxis()->SetNdivisions(503);
134+
frame->GetXaxis()->SetTimeFormat("%Y-%m-%d %H:%M");
135+
frame->GetXaxis()->SetTimeOffset(0, "gmt");
136+
frame->GetYaxis()->SetLimits(0., mMaxRate);
137+
frame->SetYTitle("FEC counts / minute");
138+
frame->SetTitle(Form("Branch %d", ifec / 10));
139+
leg->Draw();
140+
isFirst = false;
141+
}
142+
143+
gPad->Update();
144+
}
145+
146+
mSupermoduleCanvas[smID]->cd();
147+
mSupermoduleCanvas[smID]->Update();
148+
}
149+
}
150+
151+
void FECRateVisualization::finalize(Trigger, framework::ServiceRegistryRef)
152+
{
153+
for (auto& canvas : mSupermoduleCanvas) {
154+
getObjectsManager()->stopPublishing(canvas.get());
155+
}
156+
}
157+
158+
} // namespace o2::quality_control_modules::emcal

0 commit comments

Comments
 (0)