Skip to content

Commit d024c97

Browse files
committed
reimplement functionality
1 parent 93e369d commit d024c97

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

Modules/MFT/include/MFT/QcMFTClusterTask.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <TH2F.h>
2727
#include <TCanvas.h>
2828
#include <TString.h>
29+
#include <TLegend.h>
2930
#include <DataFormatsITSMFT/TopologyDictionary.h>
3031
#include "ReconstructionDataFormats/BaseCluster.h"
3132
#include "MFTBase/GeometryTGeo.h"
@@ -83,6 +84,8 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi
8384
std::vector<std::unique_ptr<TH2FRatio>> mClusterXYinLayer;
8485
std::vector<std::unique_ptr<TH1FRatio>> mClusterRinLayer;
8586
std::unique_ptr<TCanvas> mClusterRinAllLayers = nullptr;
87+
std::unique_ptr<TH1F> mFrame = nullptr; // dummy histogram to set the axes
88+
std::unique_ptr<TLegend> mLegend = nullptr;
8689

8790
std::unique_ptr<TH1FRatio> mClustersROFSize = nullptr;
8891
std::unique_ptr<TH1FRatio> mClustersBC = nullptr;
@@ -92,6 +95,8 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi
9295
int mOnlineQC;
9396

9497
const TString mColors[10] = { "#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#8C564B", "#E377C2", "#9467BD", "#BCBD22", "#7F7F7F", "#17BECF" };
98+
TH1F* clonedHistos[10] = { nullptr };
99+
bool firstRun = true;
95100

96101
// needed to construct the name and path of some histograms
97102
int mHalf[936] = { 0 };

Modules/MFT/src/QcMFTClusterTask.cxx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ void QcMFTClusterTask::initialize(o2::framework::InitContext& /*ctx*/)
259259
// canvas for for cluster R in all layers
260260
mClusterRinAllLayers = std::make_unique<TCanvas>("mClusterRinAllLayers", "Cluster Radial Position in All MFT Layers");
261261
getObjectsManager()->startPublishing(mClusterRinAllLayers.get());
262+
mFrame = std::make_unique<TH1F>("frame", "Cluster Radial Position in All MFT Layers; r (cm); # entries", 400, 0, 20);
263+
mFrame->SetStats(0);
264+
mLegend = std::make_unique<TLegend>(0.8, 0.5, 0.9, 0.9);
265+
mLegend->SetBorderSize(0);
266+
mLegend->SetFillStyle(0);
262267
}
263268
}
264269

@@ -443,6 +448,8 @@ void QcMFTClusterTask::reset()
443448
mClusterRinLayer[nMFTLayer]->Reset();
444449
}
445450
mClusterRinAllLayers->Clear();
451+
mFrame->Reset();
452+
mLegend->Clear();
446453
}
447454
}
448455

@@ -469,6 +476,34 @@ void QcMFTClusterTask::updateCanvas()
469476
{
470477
mClusterRinAllLayers->Clear();
471478
mClusterRinAllLayers->cd();
479+
480+
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
481+
clonedHistos[nMFTLayer] = static_cast<TH1F*>(mClusterRinLayer[nMFTLayer]->getNum()->Clone());
482+
clonedHistos[nMFTLayer]->SetDirectory(nullptr);
483+
clonedHistos[nMFTLayer]->SetStats(0);
484+
clonedHistos[nMFTLayer]->SetLineColor(TColor::GetColor(mColors[nMFTLayer]));
485+
}
486+
487+
double maxY = 0;
488+
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
489+
double localMax = clonedHistos[nMFTLayer]->GetMaximum();
490+
if (localMax > maxY) {
491+
maxY = localMax;
492+
}
493+
}
494+
mFrame->SetMaximum(maxY * 1.1);
495+
mFrame->Draw();
496+
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
497+
clonedHistos[nMFTLayer]->Draw("hist same");
498+
}
499+
if (firstRun) {
500+
mLegend->Clear();
501+
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
502+
mLegend->AddEntry(clonedHistos[nMFTLayer], Form("D%dF%d", static_cast<int>(std::floor(nMFTLayer / 2.)), nMFTLayer % 2 == 0 ? 0 : 1), "l");
503+
}
504+
firstRun = false;
505+
}
506+
mLegend->Draw();
472507
mClusterRinAllLayers->Update();
473508
}
474509

0 commit comments

Comments
 (0)