Skip to content

Commit 4aebbdd

Browse files
authored
[MFT] comparison plot of cluster radial positions in all MFT layers (#2645)
* remove redundant Draw() calls in beautifier * change axis title to properly reflect normalisation * define new MO * canvas updating * proper initialisation of THStack * change legend entries
1 parent 5743bbd commit 4aebbdd

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

Modules/MFT/include/MFT/QcMFTClusterTask.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
/// \author Katarina Krizkova Gajdosova
1717
/// \author Diana Maria Krupova
1818
/// \author David Grund
19+
/// \author Jakub Juracka
1920
///
2021

2122
#ifndef QC_MFT_CLUSTER_TASK_H
2223
#define QC_MFT_CLUSTER_TASK_H
2324

2425
#include <TH1F.h>
2526
#include <TH2F.h>
27+
#include <TCanvas.h>
28+
#include <TString.h>
29+
#include <THStack.h>
2630
#include <DataFormatsITSMFT/TopologyDictionary.h>
2731
#include "ReconstructionDataFormats/BaseCluster.h"
2832
#include "MFTBase/GeometryTGeo.h"
@@ -79,6 +83,8 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi
7983
std::unique_ptr<TH1FRatio> mClusterZ = nullptr;
8084
std::vector<std::unique_ptr<TH2FRatio>> mClusterXYinLayer;
8185
std::vector<std::unique_ptr<TH1FRatio>> mClusterRinLayer;
86+
std::unique_ptr<TCanvas> mClusterRinAllLayers = nullptr;
87+
std::unique_ptr<THStack> mClusterRinAllLayersStack = nullptr;
8288

8389
std::unique_ptr<TH1FRatio> mClustersROFSize = nullptr;
8490
std::unique_ptr<TH1FRatio> mClustersBC = nullptr;
@@ -87,6 +93,8 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi
8793

8894
int mOnlineQC;
8995

96+
const TString mColors[10] = { "#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#8C564B", "#E377C2", "#9467BD", "#BCBD22", "#7F7F7F", "#17BECF" };
97+
9098
// needed to construct the name and path of some histograms
9199
int mHalf[936] = { 0 };
92100
int mDisk[936] = { 0 };
@@ -100,6 +108,7 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi
100108

101109
// internal functions
102110
void getChipMapData();
111+
void updateCanvas();
103112

104113
// cluster size in pixels
105114
int mClusterSize = { 0 };

Modules/MFT/src/QcMFTClusterCheck.cxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ void QcMFTClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality chec
278278
tl->SetTextFont(142);
279279
tl->SetTextSize(0.08);
280280
hMap->GetListOfFunctions()->Add(tl);
281-
tl->Draw();
282281
}
283282
}
284283

@@ -299,7 +298,6 @@ void QcMFTClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality chec
299298
b->SetFillStyle(4055);
300299
b->SetFillColor(15);
301300
h->GetListOfFunctions()->Add(b);
302-
b->Draw();
303301
}
304302
}
305303
}
@@ -319,31 +317,25 @@ void QcMFTClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality chec
319317
msg1->Clear();
320318
msg1->AddText("Quality Good");
321319
msg1->SetFillColor(kGreen);
322-
msg1->Draw();
323320
msg2->Clear();
324321
msg2->AddText("No action needed");
325322
msg2->SetFillColor(kGreen);
326-
msg2->Draw();
327323
} else if (checkResult == Quality::Medium) {
328324
LOG(info) << "Quality::Medium";
329325
msg1->Clear();
330326
msg1->AddText("Quality medium");
331327
msg1->SetFillColor(kOrange);
332-
msg1->Draw();
333328
msg2->Clear();
334329
msg2->AddText("Write a logbook entry tagging MFT");
335330
msg2->SetFillColor(kOrange);
336-
msg2->Draw();
337331
} else if (checkResult == Quality::Bad) {
338332
LOG(info) << "Quality::Bad";
339333
msg1->Clear();
340334
msg1->AddText("Quality bad");
341335
msg1->SetFillColor(kRed);
342-
msg1->Draw();
343336
msg2->Clear();
344337
msg2->AddText("Call the on-call!");
345338
msg2->SetFillColor(kRed);
346-
msg2->Draw();
347339
}
348340
}
349341
}

Modules/MFT/src/QcMFTClusterTask.cxx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <TH2.h>
2929
#include <TString.h>
3030
#include <TAxis.h>
31+
#include <THStack.h>
32+
#include <TColor.h>
3133
// O2
3234
#include <DataFormatsITSMFT/CompCluster.h>
3335
#include <Framework/InputRecord.h>
@@ -249,11 +251,20 @@ void QcMFTClusterTask::initialize(o2::framework::InitContext& /*ctx*/)
249251

250252
auto clusterR = std::make_unique<TH1FRatio>(
251253
Form("ClusterRinLayer/mClusterRinLayer%d", nMFTLayer),
252-
Form("Cluster Radial Position in Layer %d; r (cm); # entries", nMFTLayer), 400, 0, 20, true);
254+
Form("Cluster Radial Position in Layer %d; r (cm); # entries per orbit", nMFTLayer), 400, 0, 20, true);
253255
mClusterRinLayer.push_back(std::move(clusterR));
254256
getObjectsManager()->startPublishing(mClusterRinLayer[nMFTLayer].get());
255257
getObjectsManager()->setDisplayHint(mClusterRinLayer[nMFTLayer].get(), "hist");
256258
}
259+
// canvas for for cluster R in all layers
260+
mClusterRinAllLayers = std::make_unique<TCanvas>("mClusterRinAllLayers", "Cluster Radial Position in All MFT Layers");
261+
getObjectsManager()->startPublishing(mClusterRinAllLayers.get());
262+
mClusterRinAllLayersStack = std::make_unique<THStack>("mClusterRinAllLayersStack", "Cluster Radial Position in All MFT Layers; r (cm); # entries");
263+
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
264+
mClusterRinLayer[nMFTLayer]->getNum()->SetLineColor(TColor::GetColor(mColors[nMFTLayer]));
265+
mClusterRinLayer[nMFTLayer]->getNum()->SetTitle(Form("D%dF%d", static_cast<int>(std::floor(nMFTLayer / 2.)), nMFTLayer % 2 == 0 ? 0 : 1));
266+
mClusterRinAllLayersStack->Add(mClusterRinLayer[nMFTLayer]->getNum());
267+
}
257268
}
258269
}
259270

@@ -404,6 +415,7 @@ void QcMFTClusterTask::endOfCycle()
404415
mClusterXYinLayer[nMFTLayer]->update();
405416
mClusterRinLayer[nMFTLayer]->update();
406417
}
418+
updateCanvas();
407419
}
408420
}
409421

@@ -436,6 +448,7 @@ void QcMFTClusterTask::reset()
436448
mClusterXYinLayer[nMFTLayer]->Reset();
437449
mClusterRinLayer[nMFTLayer]->Reset();
438450
}
451+
mClusterRinAllLayers->Clear();
439452
}
440453
}
441454

@@ -458,4 +471,13 @@ void QcMFTClusterTask::getChipMapData()
458471
}
459472
}
460473

474+
void QcMFTClusterTask::updateCanvas()
475+
{
476+
mClusterRinAllLayers->cd();
477+
mClusterRinAllLayers->Clear();
478+
mClusterRinAllLayersStack->Draw("nostack hist");
479+
mClusterRinAllLayers->Update();
480+
gPad->BuildLegend(0.83, 0.50, 0.90, 0.90, "", "l");
481+
}
482+
461483
} // namespace o2::quality_control_modules::mft

0 commit comments

Comments
 (0)