1414
1515#include " TLine.h"
1616#include " TH2D.h"
17+ #include " QualityControl/QcInfoLogger.h"
1718
1819namespace o2 ::quality_control_modules::emcal
1920{
@@ -36,6 +37,24 @@ class DrawGridlines : public quality_control::postprocessing::PostProcessingInte
3637 if (histo == nullptr ) {
3738 return ;
3839 }
40+
41+ // check if the gridlines are already drawn by looking for a line at the first SM boundary
42+ auto * funcs = histo->GetListOfFunctions ();
43+ if (!funcs) {
44+ return ;
45+ }
46+
47+ // Remove previously added grid lines
48+ TIter it (funcs);
49+ TObject* obj = nullptr ;
50+ while ((obj = it ())) {
51+ if (obj->InheritsFrom (TLine::Class ())) {
52+ ILOG (Debug, Support) << " Removing existing grid line from histogram " << histo->GetName () << ENDM;
53+ funcs->Remove (obj);
54+ delete obj;
55+ }
56+ }
57+
3958 // EMCAL
4059 for (int iside = 0 ; iside <= 48 ; iside += 24 ) {
4160 auto smline = new TLine (static_cast <double >(iside) - 0.5 , -0.5 , static_cast <double >(iside) - 0.5 , 63.5 );
@@ -115,6 +134,63 @@ class DrawGridlines : public quality_control::postprocessing::PostProcessingInte
115134 }
116135 };
117136
137+ // / \brief Draw the gridlines in the standard cell geometry
138+ static void DrawSMGridInStdGeo (TH2* histo = nullptr )
139+ {
140+ if (histo == nullptr ) {
141+ return ;
142+ }
143+ // EMCAL
144+ for (int iside = 0 ; iside <= 96 ; iside += 48 ) {
145+ auto smline = new TLine (static_cast <double >(iside) - 0.5 , -0.5 , static_cast <double >(iside) - 0.5 , 127.5 );
146+ smline->SetLineWidth (6 );
147+
148+ histo->GetListOfFunctions ()->Add (smline);
149+ }
150+ for (int iphi = 0 ; iphi < 120 ; iphi += 24 ) {
151+ auto smline = new TLine (-0.5 , static_cast <double >(iphi) - 0.5 , 95.5 , static_cast <double >(iphi) - 0.5 );
152+ smline->SetLineWidth (6 );
153+
154+ histo->GetListOfFunctions ()->Add (smline);
155+ }
156+ for (auto iphi = 120 ; iphi <= 128 ; iphi += 8 ) {
157+ auto smline = new TLine (-0.5 , static_cast <double >(iphi) - 0.5 , 95.5 , static_cast <double >(iphi) - 0.5 );
158+ smline->SetLineWidth (6 );
159+
160+ histo->GetListOfFunctions ()->Add (smline);
161+ }
162+
163+ // DCAL
164+ for (int side = 0 ; side < 2 ; side++) {
165+ int sideoffset = (side == 0 ) ? 0 : 64 ;
166+ for (int isepeta = 0 ; isepeta < 2 ; isepeta++) {
167+ int etaoffset = sideoffset + isepeta * 32 ;
168+ auto smline = new TLine (static_cast <double >(etaoffset) - 0.5 , 127.5 , static_cast <double >(etaoffset) - 0.5 , 199.5 );
169+ smline->SetLineWidth (6 );
170+
171+ histo->GetListOfFunctions ()->Add (smline);
172+ }
173+ for (auto iphi = 152 ; iphi <= 176 ; iphi += 24 ) {
174+ auto smline = new TLine (static_cast <double >(sideoffset) - 0.5 , static_cast <double >(iphi) - 0.5 , static_cast <double >(sideoffset + 32 ) - 0.5 , static_cast <double >(iphi) - 0.5 );
175+ smline->SetLineWidth (6 );
176+
177+ histo->GetListOfFunctions ()->Add (smline);
178+ }
179+ }
180+ for (auto iphi = 200 ; iphi <= 208 ; iphi += 8 ) {
181+ auto smline = new TLine (-0.5 , static_cast <double >(iphi) - 0.5 , 95.5 , static_cast <int >(iphi) - 0.5 );
182+ smline->SetLineWidth (6 );
183+
184+ histo->GetListOfFunctions ()->Add (smline);
185+ }
186+ for (auto ieta = 0 ; ieta <= 96 ; ieta += 48 ) {
187+ auto smline = new TLine (static_cast <double >(ieta) - 0.5 , 199.5 , static_cast <double >(ieta) - 0.5 , 207.5 );
188+ smline->SetLineWidth (6 );
189+
190+ histo->GetListOfFunctions ()->Add (smline);
191+ }
192+ };
193+
118194 // / \brief Draw the gridlines for the FastOR limits
119195 static void DrawFastORGrid (TH2* histo = nullptr )
120196 {
0 commit comments