Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Modules/MFT/include/MFT/QcMFTClusterTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <TH2F.h>
#include <TCanvas.h>
#include <TString.h>
#include <THStack.h>
#include <TLegend.h>
#include <DataFormatsITSMFT/TopologyDictionary.h>
#include "ReconstructionDataFormats/BaseCluster.h"
#include "MFTBase/GeometryTGeo.h"
Expand Down Expand Up @@ -84,7 +84,8 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi
std::vector<std::unique_ptr<TH2FRatio>> mClusterXYinLayer;
std::vector<std::unique_ptr<TH1FRatio>> mClusterRinLayer;
std::unique_ptr<TCanvas> mClusterRinAllLayers = nullptr;
std::unique_ptr<THStack> mClusterRinAllLayersStack = nullptr;
std::unique_ptr<TH1F> mFrame = nullptr; // dummy histogram to set the axes
std::unique_ptr<TLegend> mLegend = nullptr;

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

const TString mColors[10] = { "#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#8C564B", "#E377C2", "#9467BD", "#BCBD22", "#7F7F7F", "#17BECF" };
TH1F* mClonedHistos[10] = { nullptr };
bool mFirstRun = true;

// needed to construct the name and path of some histograms
int mHalf[936] = { 0 };
Expand Down
45 changes: 36 additions & 9 deletions Modules/MFT/src/QcMFTClusterTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,11 @@ void QcMFTClusterTask::initialize(o2::framework::InitContext& /*ctx*/)
// canvas for for cluster R in all layers
mClusterRinAllLayers = std::make_unique<TCanvas>("mClusterRinAllLayers", "Cluster Radial Position in All MFT Layers");
getObjectsManager()->startPublishing(mClusterRinAllLayers.get());
mClusterRinAllLayersStack = std::make_unique<THStack>("mClusterRinAllLayersStack", "Cluster Radial Position in All MFT Layers; r (cm); # entries");
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
mClusterRinLayer[nMFTLayer]->getNum()->SetLineColor(TColor::GetColor(mColors[nMFTLayer]));
mClusterRinLayer[nMFTLayer]->getNum()->SetTitle(Form("D%dF%d", static_cast<int>(std::floor(nMFTLayer / 2.)), nMFTLayer % 2 == 0 ? 0 : 1));
mClusterRinAllLayersStack->Add(mClusterRinLayer[nMFTLayer]->getNum());
}
mFrame = std::make_unique<TH1F>("frame", "Cluster Radial Position in All MFT Layers; r (cm); # entries", 400, 0, 20);
mFrame->SetStats(0);
mLegend = std::make_unique<TLegend>(0.8, 0.5, 0.9, 0.9);
mLegend->SetBorderSize(0);
mLegend->SetFillStyle(0);
}
}

Expand Down Expand Up @@ -449,6 +448,8 @@ void QcMFTClusterTask::reset()
mClusterRinLayer[nMFTLayer]->Reset();
}
mClusterRinAllLayers->Clear();
mFrame->Reset();
mLegend->Clear();
}
}

Expand All @@ -473,11 +474,37 @@ void QcMFTClusterTask::getChipMapData()

void QcMFTClusterTask::updateCanvas()
{
mClusterRinAllLayers->cd();
mClusterRinAllLayers->Clear();
mClusterRinAllLayersStack->Draw("nostack hist");
mClusterRinAllLayers->cd();

for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
mClonedHistos[nMFTLayer] = static_cast<TH1F*>(mClusterRinLayer[nMFTLayer]->getNum()->Clone());
mClonedHistos[nMFTLayer]->SetDirectory(nullptr);
mClonedHistos[nMFTLayer]->SetStats(0);
mClonedHistos[nMFTLayer]->SetLineColor(TColor::GetColor(mColors[nMFTLayer]));
}

double maxY = 0;
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
double localMax = mClonedHistos[nMFTLayer]->GetMaximum();
if (localMax > maxY) {
maxY = localMax;
}
}
mFrame->SetMaximum(maxY * 1.1);
mFrame->Draw();
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
mClonedHistos[nMFTLayer]->Draw("hist same");
}
if (mFirstRun) {
mLegend->Clear();
for (auto nMFTLayer = 0; nMFTLayer < 10; nMFTLayer++) {
mLegend->AddEntry(mClonedHistos[nMFTLayer], Form("D%dF%d", static_cast<int>(std::floor(nMFTLayer / 2.)), nMFTLayer % 2 == 0 ? 0 : 1), "l");
}
mFirstRun = false;
}
mLegend->Draw();
mClusterRinAllLayers->Update();
gPad->BuildLegend(0.83, 0.50, 0.90, 0.90, "", "l");
}

} // namespace o2::quality_control_modules::mft
Loading