diff --git a/Common/Core/RecoDecay.h b/Common/Core/RecoDecay.h index 6e87ea9672b..8186128329d 100644 --- a/Common/Core/RecoDecay.h +++ b/Common/Core/RecoDecay.h @@ -562,6 +562,7 @@ class RecoDecay } /// Finds the mother of an MC particle by looking for the expected PDG code in the mother chain. + /// \param particlesMC table with MC particles /// \param particle MC particle /// \param PDGMother expected mother PDG code /// \param acceptAntiParticles switch to accept the antiparticle of the expected mother @@ -569,55 +570,67 @@ class RecoDecay /// \param depthMax maximum decay tree level to check; Mothers up to this level will be considered. If -1, all levels are considered. /// \return index of the mother particle if found, -1 otherwise template - static int getMother(const T& particle, + static int getMother(const T& particlesMC, + const typename T::iterator& particle, int PDGMother, bool acceptAntiParticles = false, int8_t* sign = nullptr, int8_t depthMax = -1) { - int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother) - int indexMother = -1; // index of the final matched mother, if found - auto particleMother = particle; // Initialise loop over mothers. - int stage = 0; // mother tree level (just for debugging) + int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother) + int indexMother = -1; // index of the final matched mother, if found + int stage = 0; // mother tree level (just for debugging) + bool motherFound = false; // true when the desired mother particle is found in the kine tree if (sign) { *sign = sgn; } - std::vector listId; - listId.push_back(particleMother.globalIndex()); - while (particleMother.has_mothers()) { - if (depthMax > -1 && -stage >= depthMax) { // Maximum depth has been reached. - return -1; - } - if (particleMother.mothersIds()[0] == -1) { // Additional check for converted Run 2 MC - return -1; - } - particleMother = particleMother.template mothers_first_as::parent_t>(); // get mother 0 - auto indexMotherTmp = particleMother.globalIndex(); - // Check mother's PDG code. - auto PDGParticleIMother = particleMother.pdgCode(); // PDG code of the mother - // printf("getMother: "); - // for (int i = stage; i < 0; i++) // Indent to make the tree look nice. - // printf(" "); - // printf("Stage %d: Mother PDG: %d, Index: %d\n", stage, PDGParticleIMother, indexMotherTmp); - if (std::find(listId.begin(), listId.end(), indexMotherTmp) != listId.end()) { - LOGF(fatal, "Circular mothership at particle index %d", indexMotherTmp); - return -1; - } - listId.push_back(indexMotherTmp); - if (PDGParticleIMother == PDGMother) { // exact PDG match - sgn = 1; - indexMother = indexMotherTmp; - break; - } else if (acceptAntiParticles && PDGParticleIMother == -PDGMother) { // antiparticle PDG match - sgn = -1; - indexMother = indexMotherTmp; - break; + + // vector of vectors with mother indices; each line corresponds to a "stage" + std::vector> arrayIds{}; + std::vector initVec{particle.globalIndex()}; + arrayIds.push_back(initVec); // the first vector contains the index of the original particle + + while (!motherFound && arrayIds[-stage].size() > 0 && (depthMax < 0 || -stage < depthMax)) { + // vector of mother indices for the current stage + std::vector arrayIdsStage{}; + for (auto& iPart : arrayIds[-stage]) { // check all the particles that were the mothers at the previous stage + auto particleMother = particlesMC.rawIteratorAt(iPart - particlesMC.offset()); + if (particleMother.has_mothers()) { + for (auto iMother = particleMother.mothersIds().front(); iMother <= particleMother.mothersIds().back(); ++iMother) { // loop over the mother particles of the analysed particle + if (std::find(arrayIdsStage.begin(), arrayIdsStage.end(), iMother) != arrayIdsStage.end()) { // if a mother is still present in the vector, do not check it again + continue; + } + auto mother = particlesMC.rawIteratorAt(iMother - particlesMC.offset()); + // Check mother's PDG code. + auto PDGParticleIMother = mother.pdgCode(); // PDG code of the mother + // printf("getMother: "); + // for (int i = stage; i < 0; i++) // Indent to make the tree look nice. + // printf(" "); + // printf("Stage %d: Mother PDG: %d, Index: %d\n", stage, PDGParticleIMother, iMother); + if (PDGParticleIMother == PDGMother) { // exact PDG match + sgn = 1; + indexMother = iMother; + motherFound = true; + break; + } else if (acceptAntiParticles && PDGParticleIMother == -PDGMother) { // antiparticle PDG match + sgn = -1; + indexMother = iMother; + motherFound = true; + break; + } + // add mother index in the vector for the current stage + arrayIdsStage.push_back(iMother); + } + } } + // add vector of mother indices for the current stage + arrayIds.push_back(arrayIdsStage); stage--; } if (sign) { *sign = sgn; } + return indexMother; } @@ -723,7 +736,7 @@ class RecoDecay if (iProng == 0) { // Get the mother index and its sign. // PDG code of the first daughter's mother determines whether the expected mother is a particle or antiparticle. - indexMother = getMother(particleI, PDGMother, acceptAntiParticles, &sgn, depthMax); + indexMother = getMother(particlesMC, particleI, PDGMother, acceptAntiParticles, &sgn, depthMax); // Check whether mother was found. if (indexMother <= -1) { //Printf("MC Rec: Rejected: bad mother index or PDG"); diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index 41efb4b7184..5e6434f8386 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -979,7 +979,7 @@ struct HfFilter { // Main struct for HF triggers auto indexRec = RecoDecay::getMatchedMCRec(particlesMC, std::array{trackPos, trackNeg}, pdg::Code::kD0, array{+kPiPlus, -kKPlus}, true, &sign); if (indexRec > -1) { auto particle = particlesMC.rawIteratorAt(indexRec); - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); if (origin == OriginType::NonPrompt) { flag = kNonPrompt; } else { @@ -1038,7 +1038,7 @@ struct HfFilter { // Main struct for HF triggers if (indexRec > -1) { auto particle = particlesMC.rawIteratorAt(indexRec); - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); if (origin == OriginType::NonPrompt) { flag = kNonPrompt; } else { diff --git a/PWGHF/TableProducer/HFCandidateCreator2Prong.cxx b/PWGHF/TableProducer/HFCandidateCreator2Prong.cxx index 35a0fe485b7..d5b459020ac 100644 --- a/PWGHF/TableProducer/HFCandidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/HFCandidateCreator2Prong.cxx @@ -210,7 +210,7 @@ struct HFCandidateCreator2ProngExpressions { // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { auto particle = particlesMC.rawIteratorAt(indexRec); - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); } rowMCMatchRec(flag, origin); @@ -246,7 +246,7 @@ struct HFCandidateCreator2ProngExpressions { // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); } rowMCMatchGen(flag, origin); diff --git a/PWGHF/TableProducer/HFCandidateCreator3Prong.cxx b/PWGHF/TableProducer/HFCandidateCreator3Prong.cxx index bcd3fb4cc09..c48d70c8abb 100644 --- a/PWGHF/TableProducer/HFCandidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/HFCandidateCreator3Prong.cxx @@ -251,7 +251,7 @@ struct HFCandidateCreator3ProngExpressions { // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { auto particle = particlesMC.rawIteratorAt(indexRec); - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); } rowMCMatchRec(flag, origin, swapping, channel); @@ -305,7 +305,7 @@ struct HFCandidateCreator3ProngExpressions { // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); } rowMCMatchGen(flag, origin, channel); diff --git a/PWGHF/TableProducer/HFCandidateCreatorChic.cxx b/PWGHF/TableProducer/HFCandidateCreatorChic.cxx index 7ba67c463f7..1173eae2cde 100644 --- a/PWGHF/TableProducer/HFCandidateCreatorChic.cxx +++ b/PWGHF/TableProducer/HFCandidateCreatorChic.cxx @@ -231,8 +231,8 @@ struct HFCandidateCreatorChicMC { if (indexRec > -1) { hMassJpsiToMuMuMatched->Fill(InvMassJpsiToMuMu(candidate.index0())); - int indexMother = RecoDecay::getMother(particlesMC.rawIteratorAt(indexRec), pdg::Code::kChic1); - int indexMotherGamma = RecoDecay::getMother(particlesMC.rawIteratorAt(candidate.index1().mcparticleId()), pdg::Code::kChic1); + int indexMother = RecoDecay::getMother(particlesMC, particlesMC.rawIteratorAt(indexRec), pdg::Code::kChic1); + int indexMotherGamma = RecoDecay::getMother(particlesMC, particlesMC.rawIteratorAt(candidate.index1().mcparticleId()), pdg::Code::kChic1); if (indexMother > -1 && indexMotherGamma == indexMother && candidate.index1().mcparticle().pdgCode() == kGamma) { auto particleMother = particlesMC.rawIteratorAt(indexMother); hEphotonMatched->Fill(candidate.index1().e()); @@ -249,7 +249,7 @@ struct HFCandidateCreatorChicMC { } if (flag != 0) { auto particle = particlesMC.rawIteratorAt(indexRec); - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? NonPrompt : Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? NonPrompt : Prompt); } rowMCMatchRec(flag, origin, channel); } diff --git a/PWGHF/TableProducer/HFCandidateCreatorX.cxx b/PWGHF/TableProducer/HFCandidateCreatorX.cxx index e6cfffff006..159ffa34084 100644 --- a/PWGHF/TableProducer/HFCandidateCreatorX.cxx +++ b/PWGHF/TableProducer/HFCandidateCreatorX.cxx @@ -305,7 +305,7 @@ struct HFCandidateCreatorXMC { // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { auto particle = particlesMC.rawIteratorAt(indexRec); - origin = (RecoDecay::getMother(particle, 5, true) > -1 ? NonPrompt : Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, 5, true) > -1 ? NonPrompt : Prompt); } rowMCMatchRec(flag, origin, channel); @@ -338,7 +338,7 @@ struct HFCandidateCreatorXMC { // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { - origin = (RecoDecay::getMother(particle, 5, true) > -1 ? NonPrompt : Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, 5, true) > -1 ? NonPrompt : Prompt); } rowMCMatchGen(flag, origin, channel); diff --git a/PWGHF/Tasks/HFMCValidation.cxx b/PWGHF/Tasks/HFMCValidation.cxx index 9528dbd8b43..1995ca63d5f 100644 --- a/PWGHF/Tasks/HFMCValidation.cxx +++ b/PWGHF/Tasks/HFMCValidation.cxx @@ -153,7 +153,7 @@ struct ValidationGenLevel { std::size_t arrayPDGsize = arrPDGFinal[iD].size() - std::count(arrPDGFinal[iD].begin(), arrPDGFinal[iD].end(), 0); int origin = -1; if (listDaughters.size() == arrayPDGsize) { - origin = (RecoDecay::getMother(particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); + origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); if (origin == OriginType::Prompt) { counterPrompt[iD]++; } else if (origin == OriginType::NonPrompt) { @@ -282,7 +282,7 @@ struct ValidationRecLevel { if (whichHad >= 0 && whichOrigin >= 0) { int indexParticle = 0; if (cand2Prong.index0_as().has_mcParticle()) { - indexParticle = RecoDecay::getMother(cand2Prong.index0_as().mcParticle(), PDGArrayParticle[whichHad], true); + indexParticle = RecoDecay::getMother(particlesMC, cand2Prong.index0_as().mcParticle(), PDGArrayParticle[whichHad], true); } auto mother = particlesMC.rawIteratorAt(indexParticle); histDeltaPt[whichHad]->Fill(cand2Prong.pt() - mother.pt()); @@ -347,7 +347,7 @@ struct ValidationRecLevel { if (whichHad >= 0) { int indexParticle = 0; if (cand3Prong.index0_as().has_mcParticle()) { - indexParticle = RecoDecay::getMother(cand3Prong.index0_as().mcParticle(), PDGArrayParticle[whichHad], true); + indexParticle = RecoDecay::getMother(particlesMC, cand3Prong.index0_as().mcParticle(), PDGArrayParticle[whichHad], true); } auto mother = particlesMC.rawIteratorAt(indexParticle); histDeltaPt[whichHad]->Fill(cand3Prong.pt() - mother.pt()); diff --git a/PWGHF/Tasks/taskBPlus.cxx b/PWGHF/Tasks/taskBPlus.cxx index 6edeee500b3..f2828741a6a 100644 --- a/PWGHF/Tasks/taskBPlus.cxx +++ b/PWGHF/Tasks/taskBPlus.cxx @@ -182,7 +182,7 @@ struct HfTaskBplusMc { } if (std::abs(candidate.flagMCMatchRec()) == 1 << hf_cand_bplus::DecayType::BPlusToD0Pi) { - auto indexMother = RecoDecay::getMother(candidate.index1_as().mcParticle_as>(), pdg::Code::kBPlus, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index1_as().mcParticle_as>(), pdg::Code::kBPlus, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); registry.fill(HIST("hPtRecSig"), candidate.pt()); diff --git a/PWGHF/Tasks/taskChic.cxx b/PWGHF/Tasks/taskChic.cxx index c4609f57218..60e5591129b 100644 --- a/PWGHF/Tasks/taskChic.cxx +++ b/PWGHF/Tasks/taskChic.cxx @@ -165,7 +165,7 @@ struct TaskChicMC { } if (candidate.flagMCMatchRec() == 1 << decayMode) { //FIXME the access to the MC particle gen not yet functional - //int indexMother = RecoDecay::getMother(particlesMC.rawIteratorAt(candidate.index1().mcParticle_as().globalIndex()), 20443); + //int indexMother = RecoDecay::getMother(particlesMC, particlesMC.rawIteratorAt(candidate.index1().mcParticle_as().globalIndex()), 20443); //auto particleMother = particlesMC.rawIteratorAt(indexMother); //registry.fill(HIST("hPtGenSig"), particleMother.pt()); registry.fill(HIST("hPtRecSig"), candidate.pt()); diff --git a/PWGHF/Tasks/taskD0.cxx b/PWGHF/Tasks/taskD0.cxx index e8d78519d73..20aa1376e64 100644 --- a/PWGHF/Tasks/taskD0.cxx +++ b/PWGHF/Tasks/taskD0.cxx @@ -182,7 +182,7 @@ struct TaskD0 { } if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::D0ToPiK) { // Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as>(), pdg::Code::kD0, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), pdg::Code::kD0, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT auto ptRec = candidate.pt(); diff --git a/PWGHF/Tasks/taskDPlus.cxx b/PWGHF/Tasks/taskDPlus.cxx index 6579493b7b3..b0ec4bfddd9 100644 --- a/PWGHF/Tasks/taskDPlus.cxx +++ b/PWGHF/Tasks/taskDPlus.cxx @@ -144,7 +144,7 @@ struct TaskDPlus { } if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::DPlusToPiKPi) { // Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as>(), pdg::Code::kDPlus, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), pdg::Code::kDPlus, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT auto ptRec = candidate.pt(); diff --git a/PWGHF/Tasks/taskJpsi.cxx b/PWGHF/Tasks/taskJpsi.cxx index 7c77bca2ccc..82448650ccb 100644 --- a/PWGHF/Tasks/taskJpsi.cxx +++ b/PWGHF/Tasks/taskJpsi.cxx @@ -231,7 +231,7 @@ struct TaskJpsiMC { } if (candidate.flagMCMatchRec() == 1 << decayMode) { //Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as(), pdg::Code::kJpsi, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as(), pdg::Code::kJpsi, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT diff --git a/PWGHF/Tasks/taskLb.cxx b/PWGHF/Tasks/taskLb.cxx index cbb30eb0e80..e4d4782a32d 100644 --- a/PWGHF/Tasks/taskLb.cxx +++ b/PWGHF/Tasks/taskLb.cxx @@ -188,7 +188,7 @@ struct HfTaskLbMc { auto candLc = candidate.index0_as(); if (std::abs(candidate.flagMCMatchRec()) == 1 << hf_cand_lb::DecayType::LbToLcPi) { - auto indexMother = RecoDecay::getMother(candidate.index1_as().mcParticle_as>(), pdg::Code::kLambdaB0, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index1_as().mcParticle_as>(), pdg::Code::kLambdaB0, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); registry.fill(HIST("hPtRecSig"), candidate.pt()); diff --git a/PWGHF/Tasks/taskLc.cxx b/PWGHF/Tasks/taskLc.cxx index cb997b34162..549384cc195 100644 --- a/PWGHF/Tasks/taskLc.cxx +++ b/PWGHF/Tasks/taskLc.cxx @@ -146,7 +146,7 @@ struct TaskLc { } if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::LcToPKPi) { // Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as>(), pdg::Code::kLambdaCPlus, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), pdg::Code::kLambdaCPlus, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT auto ptRec = candidate.pt(); diff --git a/PWGHF/Tasks/taskLcCentrality.cxx b/PWGHF/Tasks/taskLcCentrality.cxx index 81dc2ba952c..98c19f3ff61 100644 --- a/PWGHF/Tasks/taskLcCentrality.cxx +++ b/PWGHF/Tasks/taskLcCentrality.cxx @@ -155,7 +155,7 @@ struct TaskLcCentralityMC { } if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::LcToPKPi) { // Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as>(), pdg::Code::kLambdaCPlus, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), pdg::Code::kLambdaCPlus, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT auto ptRec = candidate.pt(); diff --git a/PWGHF/Tasks/taskLcK0sP.cxx b/PWGHF/Tasks/taskLcK0sP.cxx index 0b0f1e8356b..9470a6ff31f 100644 --- a/PWGHF/Tasks/taskLcK0sP.cxx +++ b/PWGHF/Tasks/taskLcK0sP.cxx @@ -115,7 +115,7 @@ struct TaskLcK0SpMC { } if (std::abs(candidate.flagMCMatchRec()) == 1) { // Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as>(), pdg::Code::kLambdaCPlus, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), pdg::Code::kLambdaCPlus, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT diff --git a/PWGHF/Tasks/taskX.cxx b/PWGHF/Tasks/taskX.cxx index 2daa02f7240..4b4a6b42263 100644 --- a/PWGHF/Tasks/taskX.cxx +++ b/PWGHF/Tasks/taskX.cxx @@ -167,7 +167,7 @@ struct TaskXMC { continue; } if (candidate.flagMCMatchRec() == 1 << decayMode) { - auto indexMother = RecoDecay::getMother(candidate.index1_as().mcParticle_as>(), 9920443, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index1_as().mcParticle_as>(), 9920443, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); registry.fill(HIST("hPtRecSig"), candidate.pt()); diff --git a/PWGHF/Tasks/taskXic.cxx b/PWGHF/Tasks/taskXic.cxx index f9abfab9a64..45334b35d65 100644 --- a/PWGHF/Tasks/taskXic.cxx +++ b/PWGHF/Tasks/taskXic.cxx @@ -175,7 +175,7 @@ struct HfTaskXicMc { if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::XicToPKPi) { // Signal - auto indexMother = RecoDecay::getMother(candidate.index0_as().mcParticle_as>(), pdg::Code::kXiCPlus, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), pdg::Code::kXiCPlus, true); auto particleMother = particlesMC.rawIteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT diff --git a/PWGHF/Tasks/taskXicc.cxx b/PWGHF/Tasks/taskXicc.cxx index 73efb26c567..6f4ceb0c813 100644 --- a/PWGHF/Tasks/taskXicc.cxx +++ b/PWGHF/Tasks/taskXicc.cxx @@ -185,7 +185,7 @@ struct HfTaskXiccMc { } if (std::abs(candidate.flagMCMatchRec()) == 1 << DecayType::XiccToXicPi) { // Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(candidate.index1_as().mcParticle_as>(), 4422, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index1_as().mcParticle_as>(), 4422, true); auto particleXicc = particlesMC.rawIteratorAt(indexMother); auto particleXic = particlesMC.rawIteratorAt(particleXicc.daughtersIds().front()); /*