Skip to content
Merged
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
6 changes: 5 additions & 1 deletion Modules/TOF/include/TOF/PostProcessHitMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

class TH1F;
class TH2F;
class TCanvas;
class TPaveText;

namespace o2::quality_control_modules::tof
{
Expand Down Expand Up @@ -63,7 +65,7 @@ class PostProcessHitMap final : public quality_control::postprocessing::PostProc
/// registry with singleton interfaces.
/// \param trigger Trigger which caused the initialization, for example Trigger::EOR
/// \param services Interface containing optional interfaces, for example DatabaseInterface
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override{};
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;

private:
o2::quality_control::repository::DatabaseInterface* mDatabase = nullptr;
Expand All @@ -74,6 +76,8 @@ class PostProcessHitMap final : public quality_control::postprocessing::PostProc
/// Reference hit map taken from the CCDB and translated into QC binning
std::shared_ptr<TH2F> mHistoRefHitMap = nullptr; /// TOF reference hit map
std::shared_ptr<TH2F> mHistoHitMap = nullptr; /// TOF hit map
std::shared_ptr<TCanvas> mCanvasMo = nullptr; /// Canvas with hit map and ref. map
std::shared_ptr<TPaveText> mPhosPad = nullptr; /// PHOS pad to draw
bool mDrawRefOnTop; /// flag to enable the drawing of the refmap on top of the hit map. if false drawing on top the hitmap (initialized from the configure method)
};

Expand Down
55 changes: 33 additions & 22 deletions Modules/TOF/src/PostProcessHitMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
#include "DataFormatsTOF/TOFFEElightInfo.h"
#include "TOFBase/Geo.h"

// QualityControl includes
#include "QualityControl/MonitorObject.h"
#include "QualityControl/QcInfoLogger.h"
#include "TOF/PostProcessHitMap.h"
#include "QualityControl/DatabaseInterface.h"

// ROOT includes
#include <TH2F.h>
#include <TCanvas.h>
#include <TPaveText.h>
#include <TColor.h>
#include <boost/property_tree/ptree.hpp>

// QualityControl includes
#include "QualityControl/MonitorObject.h"
#include "QualityControl/QcInfoLogger.h"
#include "TOF/PostProcessHitMap.h"
#include "QualityControl/DatabaseInterface.h"

using namespace std;
using namespace o2::quality_control::postprocessing;
using namespace o2::quality_control::core;
Expand Down Expand Up @@ -60,6 +60,21 @@ void PostProcessHitMap::initialize(Trigger, framework::ServiceRegistryRef servic
{
// Setting up services
mDatabase = &services.get<o2::quality_control::repository::DatabaseInterface>();

mCanvasMo.reset();
mCanvasMo = std::make_shared<TCanvas>("defaultMap", "defaultMap");
getObjectsManager()->startPublishing(mCanvasMo.get());

mPhosPad.reset();
mPhosPad = std::make_shared<TPaveText>(13.f, 38.f, 16.f, 53.f, "bl");
mPhosPad->SetTextSize(0.05);
mPhosPad->SetBorderSize(1);
mPhosPad->SetTextColor(kBlack);
mPhosPad->SetFillColor(kGreen);
mPhosPad->SetFillStyle(3004);
mPhosPad->AddText("Red: No Match");
mPhosPad->AddText("Blu: RefMap");
mPhosPad->AddText("Green: HitMap");
}

void PostProcessHitMap::update(Trigger t, framework::ServiceRegistryRef services)
Expand Down Expand Up @@ -126,7 +141,12 @@ void PostProcessHitMap::update(Trigger t, framework::ServiceRegistryRef services
ILOG(Warning, Support) << "mHistoHitMap undefined, can't finalize" << ENDM;
return;
}
TCanvas* canvas = new TCanvas(mHistoHitMap->GetName(), mHistoHitMap->GetName());

mCanvasMo->SetName(mHistoHitMap->GetName());
mCanvasMo->SetTitle(mHistoHitMap->GetName());
mCanvasMo->cd();
mCanvasMo->Clear();

mHistoRefHitMap->GetZaxis()->SetRangeUser(0, 1);
mHistoHitMap->GetZaxis()->SetRangeUser(0, 1);

Expand All @@ -142,27 +162,18 @@ void PostProcessHitMap::update(Trigger t, framework::ServiceRegistryRef services
mHistoRefHitMap->GetListOfFunctions()->Clear();
mHistoRefHitMap->Draw("BOXsame");
}
TPaveText phosPad{ 13.f, 38.f, 16.f, 53.f, "bl" };
phosPad.SetTextSize(0.05);
phosPad.SetBorderSize(1);
phosPad.SetTextColor(kBlack);
phosPad.SetFillColor(kGreen);
phosPad.SetFillStyle(3004);
phosPad.AddText("Red: No Match");
phosPad.AddText("Blu: RefMap");
phosPad.AddText("Green: HitMap");
phosPad.Draw();
mPhosPad->Draw();

// Draw the shifter message
if (mHistoHitMap->GetListOfFunctions()->FindObject(Form("%s_msg", mHistoHitMap->GetName()))) {
mHistoHitMap->GetListOfFunctions()->FindObject(Form("%s_msg", mHistoHitMap->GetName()))->Draw("same");
}
}

auto moToStore = std::make_shared<o2::quality_control::core::MonitorObject>(canvas, getID(), "o2::quality_control_modules::tof::PostProcessDiagnosticPerCreate", "TOF");
moToStore->setIsOwner(false);
mDatabase->storeMO(moToStore);
// It should delete everything inside. Confirmed by trying to delete histo after and getting a segfault.
delete canvas;
void PostProcessHitMap::finalize(Trigger, framework::ServiceRegistryRef)
{
// Only if you don't want it to be published after finalisation.
getObjectsManager()->stopPublishing(mCanvasMo.get());
}

} // namespace o2::quality_control_modules::tof