@@ -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