diff --git a/Modules/MFT/include/MFT/QcMFTClusterTask.h b/Modules/MFT/include/MFT/QcMFTClusterTask.h index ad8befeb38..4eb25b77d1 100644 --- a/Modules/MFT/include/MFT/QcMFTClusterTask.h +++ b/Modules/MFT/include/MFT/QcMFTClusterTask.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "ReconstructionDataFormats/BaseCluster.h" #include "MFTBase/GeometryTGeo.h" @@ -84,7 +84,8 @@ class QcMFTClusterTask /*final*/ : public TaskInterface // todo add back the "fi std::vector> mClusterXYinLayer; std::vector> mClusterRinLayer; std::unique_ptr mClusterRinAllLayers = nullptr; - std::unique_ptr mClusterRinAllLayersStack = nullptr; + std::unique_ptr mFrame = nullptr; // dummy histogram to set the axes + std::unique_ptr mLegend = nullptr; std::unique_ptr mClustersROFSize = nullptr; std::unique_ptr mClustersBC = nullptr; @@ -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 }; diff --git a/Modules/MFT/src/QcMFTClusterTask.cxx b/Modules/MFT/src/QcMFTClusterTask.cxx index a743d0b2cc..6bc0556589 100644 --- a/Modules/MFT/src/QcMFTClusterTask.cxx +++ b/Modules/MFT/src/QcMFTClusterTask.cxx @@ -259,12 +259,11 @@ void QcMFTClusterTask::initialize(o2::framework::InitContext& /*ctx*/) // canvas for for cluster R in all layers mClusterRinAllLayers = std::make_unique("mClusterRinAllLayers", "Cluster Radial Position in All MFT Layers"); getObjectsManager()->startPublishing(mClusterRinAllLayers.get()); - mClusterRinAllLayersStack = std::make_unique("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(std::floor(nMFTLayer / 2.)), nMFTLayer % 2 == 0 ? 0 : 1)); - mClusterRinAllLayersStack->Add(mClusterRinLayer[nMFTLayer]->getNum()); - } + mFrame = std::make_unique("frame", "Cluster Radial Position in All MFT Layers; r (cm); # entries", 400, 0, 20); + mFrame->SetStats(0); + mLegend = std::make_unique(0.8, 0.5, 0.9, 0.9); + mLegend->SetBorderSize(0); + mLegend->SetFillStyle(0); } } @@ -449,6 +448,8 @@ void QcMFTClusterTask::reset() mClusterRinLayer[nMFTLayer]->Reset(); } mClusterRinAllLayers->Clear(); + mFrame->Reset(); + mLegend->Clear(); } } @@ -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(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(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