@@ -110,8 +110,6 @@ class EfficiencyCorrection
110110 LOGF (fatal, notify (" Unknown configuration for efficiency variables" ));
111111 break ;
112112 }
113- } else {
114- hLoaded[idx] = nullptr ;
115113 }
116114 }
117115 }
@@ -201,17 +199,18 @@ class EfficiencyCorrection
201199
202200 auto bin = -1 ;
203201 if (config->confEffCorVariables .value == " pt" ) {
204- bin = hLoaded[partNo - 1 ] ->FindBin (particle.pt ());
202+ bin = hWeights ->FindBin (particle.pt ());
205203 } else if (config->confEffCorVariables .value == " pt,eta" ) {
206- bin = hLoaded[partNo - 1 ] ->FindBin (particle.pt (), particle.eta ());
204+ bin = hWeights ->FindBin (particle.pt (), particle.eta ());
207205 } else if (config->confEffCorVariables .value == " pt,mult" ) {
208- bin = hLoaded[partNo - 1 ] ->FindBin (particle.pt (), particle.fdCollision ().multV0M ());
206+ bin = hWeights ->FindBin (particle.pt (), particle.fdCollision ().multV0M ());
209207 } else if (config->confEffCorVariables .value == " pt,eta,mult" ) {
210- bin = hLoaded[partNo - 1 ] ->FindBin (particle.pt (), particle.eta (), particle.fdCollision ().multV0M ());
208+ bin = hWeights ->FindBin (particle.pt (), particle.eta (), particle.fdCollision ().multV0M ());
211209 } else {
212210 LOGF (fatal, notify (" Unknown configuration for efficiency variables" ));
213211 return weight;
214212 }
213+
215214 weight = hWeights->GetBinContent (bin);
216215 }
217216
@@ -229,11 +228,21 @@ class EfficiencyCorrection
229228 if (!hist) {
230229 return true ;
231230 }
232- for (auto idx = 0 ; idx <= hist->GetNbinsX () + 1 ; idx++) {
233- if (hist->GetBinContent (idx) > 0 ) {
234- return false ;
231+
232+ const int nBinsX = hist->GetNbinsX () + 2 ;
233+ const int nBinsY = hist->GetNbinsY () + 2 ;
234+ const int nBinsZ = hist->GetNbinsZ () + 2 ;
235+
236+ for (int x = 0 ; x < nBinsX; ++x) {
237+ for (int y = 0 ; y < nBinsY; ++y) {
238+ for (int z = 0 ; z < nBinsZ; ++z) {
239+ if (hist->GetBinContent (x, y, z) != 0 ) {
240+ return false ;
241+ }
242+ }
235243 }
236244 }
245+
237246 return true ;
238247 }
239248
@@ -247,11 +256,14 @@ class EfficiencyCorrection
247256 }
248257
249258 if (isHistEmpty (hWeights)) {
250- LOGF (warn, notify (" Histogram \" %s/%ld\" has been loaded, but it is empty" ), config->confEffCorCCDBUrl .value , timestamp);
259+ LOGF (warn, notify (" Histogram \" %s/%ld\" has been loaded, but it is empty" ), config->confEffCorCCDBPath .value , timestamp);
251260 }
252261
262+ auto clonedHist = static_cast <H*>(hWeights->Clone ());
263+ clonedHist->SetDirectory (nullptr );
264+
253265 LOGF (info, notify (" Successfully loaded %ld" ), timestamp);
254- return hWeights ;
266+ return clonedHist ;
255267 }
256268
257269 auto getDimensionFromVariables () -> size_t
@@ -266,7 +278,7 @@ class EfficiencyCorrection
266278 bool shouldFillHistograms{false };
267279
268280 o2::ccdb::BasicCCDBManager& ccdb{o2::ccdb::BasicCCDBManager::instance ()};
269- std::array<TH1*, 2 > hLoaded{};
281+ std::array<TH1*, 2 > hLoaded{nullptr , nullptr };
270282
271283 framework::HistogramRegistry* histRegistry{};
272284 static constexpr std::string_view histDirectory{" EfficiencyCorrection" };
0 commit comments