2020#include " DataFormatsTOF/TOFFEElightInfo.h"
2121#include " TOFBase/Geo.h"
2222
23- // QualityControl includes
24- #include " QualityControl/MonitorObject.h"
25- #include " QualityControl/QcInfoLogger.h"
26- #include " TOF/PostProcessHitMap.h"
27- #include " QualityControl/DatabaseInterface.h"
28-
2923// ROOT includes
3024#include < TH2F.h>
3125#include < TCanvas.h>
3226#include < TPaveText.h>
3327#include < TColor.h>
3428#include < boost/property_tree/ptree.hpp>
3529
30+ // QualityControl includes
31+ #include " QualityControl/MonitorObject.h"
32+ #include " QualityControl/QcInfoLogger.h"
33+ #include " TOF/PostProcessHitMap.h"
34+ #include " QualityControl/DatabaseInterface.h"
35+
3636using namespace std ;
3737using namespace o2 ::quality_control::postprocessing;
3838using namespace o2 ::quality_control::core;
@@ -60,6 +60,21 @@ void PostProcessHitMap::initialize(Trigger, framework::ServiceRegistryRef servic
6060{
6161 // Setting up services
6262 mDatabase = &services.get <o2::quality_control::repository::DatabaseInterface>();
63+
64+ mCanvasMo .reset ();
65+ mCanvasMo = std::make_shared<TCanvas>(" defaultMap" , " defaultMap" );
66+ getObjectsManager ()->startPublishing (mCanvasMo .get ());
67+
68+ mPhosPad .reset ();
69+ mPhosPad = std::make_shared<TPaveText>(13 .f , 38 .f , 16 .f , 53 .f , " bl" );
70+ mPhosPad ->SetTextSize (0.05 );
71+ mPhosPad ->SetBorderSize (1 );
72+ mPhosPad ->SetTextColor (kBlack );
73+ mPhosPad ->SetFillColor (kGreen );
74+ mPhosPad ->SetFillStyle (3004 );
75+ mPhosPad ->AddText (" Red: No Match" );
76+ mPhosPad ->AddText (" Blu: RefMap" );
77+ mPhosPad ->AddText (" Green: HitMap" );
6378}
6479
6580void PostProcessHitMap::update (Trigger t, framework::ServiceRegistryRef services)
@@ -126,7 +141,12 @@ void PostProcessHitMap::update(Trigger t, framework::ServiceRegistryRef services
126141 ILOG (Warning, Support) << " mHistoHitMap undefined, can't finalize" << ENDM;
127142 return ;
128143 }
129- TCanvas* canvas = new TCanvas (mHistoHitMap ->GetName (), mHistoHitMap ->GetName ());
144+
145+ mCanvasMo ->SetName (mHistoHitMap ->GetName ());
146+ mCanvasMo ->SetTitle (mHistoHitMap ->GetName ());
147+ mCanvasMo ->cd ();
148+ mCanvasMo ->Clear ();
149+
130150 mHistoRefHitMap ->GetZaxis ()->SetRangeUser (0 , 1 );
131151 mHistoHitMap ->GetZaxis ()->SetRangeUser (0 , 1 );
132152
@@ -142,27 +162,18 @@ void PostProcessHitMap::update(Trigger t, framework::ServiceRegistryRef services
142162 mHistoRefHitMap ->GetListOfFunctions ()->Clear ();
143163 mHistoRefHitMap ->Draw (" BOXsame" );
144164 }
145- TPaveText phosPad{ 13 .f , 38 .f , 16 .f , 53 .f , " bl" };
146- phosPad.SetTextSize (0.05 );
147- phosPad.SetBorderSize (1 );
148- phosPad.SetTextColor (kBlack );
149- phosPad.SetFillColor (kGreen );
150- phosPad.SetFillStyle (3004 );
151- phosPad.AddText (" Red: No Match" );
152- phosPad.AddText (" Blu: RefMap" );
153- phosPad.AddText (" Green: HitMap" );
154- phosPad.Draw ();
165+ mPhosPad ->Draw ();
155166
156167 // Draw the shifter message
157168 if (mHistoHitMap ->GetListOfFunctions ()->FindObject (Form (" %s_msg" , mHistoHitMap ->GetName ()))) {
158169 mHistoHitMap ->GetListOfFunctions ()->FindObject (Form (" %s_msg" , mHistoHitMap ->GetName ()))->Draw (" same" );
159170 }
171+ }
160172
161- auto moToStore = std::make_shared<o2::quality_control::core::MonitorObject>(canvas, getID (), " o2::quality_control_modules::tof::PostProcessDiagnosticPerCreate" , " TOF" );
162- moToStore->setIsOwner (false );
163- mDatabase ->storeMO (moToStore);
164- // It should delete everything inside. Confirmed by trying to delete histo after and getting a segfault.
165- delete canvas;
173+ void PostProcessHitMap::finalize (Trigger, framework::ServiceRegistryRef)
174+ {
175+ // Only if you don't want it to be published after finalisation.
176+ getObjectsManager ()->stopPublishing (mCanvasMo .get ());
166177}
167178
168179} // namespace o2::quality_control_modules::tof
0 commit comments