From ba4285449d5bc1c505275ce07c2676504ecc7fc0 Mon Sep 17 00:00:00 2001 From: shahoian Date: Sun, 10 Oct 2021 16:13:15 +0200 Subject: [PATCH] Make sure Vtx label is set before using it --- Modules/REC/src/VertexingQcTask.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/REC/src/VertexingQcTask.cxx b/Modules/REC/src/VertexingQcTask.cxx index 22a9348535..a32aaf3a19 100644 --- a/Modules/REC/src/VertexingQcTask.cxx +++ b/Modules/REC/src/VertexingQcTask.cxx @@ -115,8 +115,9 @@ void VertexingQcTask::monitorData(o2::framework::ProcessingContext& ctx) // get the payload of a specific input, which is a char array. "random" is the binding specified in the config file. const auto pvertices = ctx.inputs().get>("pvtx"); + gsl::span mcLbl; if (mUseMC) { - gsl::span mcLbl = ctx.inputs().get>("pvtxLbl"); + mcLbl = ctx.inputs().get>("pvtxLbl"); for (const auto& lbl : mcLbl) { if (lbl.getSourceID() != 0) { // using only underlying event, which is source 0 continue; @@ -166,8 +167,7 @@ void VertexingQcTask::monitorData(o2::framework::ProcessingContext& ctx) mNContributors->Fill(nContr); mTimeUncVsNContrib->Fill(nContr, timeUnc); - if (mUseMC) { - gsl::span mcLbl = ctx.inputs().get>("pvtxLbl"); + if (mUseMC && mcLbl[i].isSet()) { // make sure the label was set auto header = mMCReader.getMCEventHeader(mcLbl[i].getSourceID(), mcLbl[i].getEventID()); auto purity = mcLbl[i].getCorrWeight(); auto mult = header.GetNPrim();