From ed579a50c530819522c5ecf83717a7f0fd913f64 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 4 Dec 2023 12:45:55 +0100 Subject: [PATCH] Mother mcParticle label added (#4059) * Mother mcParticle label added * Please consider the following formatting changes (#197) --------- Co-authored-by: ALICE Builder --- PWGLF/DataModel/LFStrangenessTables.h | 6 ++++-- PWGLF/TableProducer/cascademcbuilder.cxx | 7 ++++--- PWGLF/TableProducer/lambdakzeromcbuilder.cxx | 5 +++-- PWGLF/TableProducer/strangederivedbuilder.cxx | 12 ++++++------ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 81d339eb02a..4db1d3d6cce 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -895,10 +895,11 @@ DECLARE_SOA_TABLE(CascTags, "AOD", "CASCTAGS", namespace mcv0label { DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for V0 +DECLARE_SOA_INDEX_COLUMN_FULL(McMotherParticle, mcMotherParticle, int, McParticles, "_Mother"); //! } // namespace mcv0label DECLARE_SOA_TABLE(McV0Labels, "AOD", "MCV0LABEL", //! Table joinable with V0Data containing the MC labels - mcv0label::McParticleId); + mcv0label::McParticleId, mcv0label::McMotherParticleId); using McV0Label = McV0Labels::iterator; // Definition of labels for V0s // Full table, joinable with V0 (CAUTION: NOT WITH V0DATA) @@ -915,11 +916,12 @@ using McFullV0Label = McFullV0Labels::iterator; namespace mccasclabel { DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Cascade +DECLARE_SOA_INDEX_COLUMN_FULL(McMotherParticle, mcMotherParticle, int, McParticles, "_Mother"); //! DECLARE_SOA_COLUMN(IsBachBaryonCandidate, isBachBaryonCandidate, bool); //! will this be built or not? } // namespace mccasclabel DECLARE_SOA_TABLE(McCascLabels, "AOD", "MCCASCLABEL", //! Table joinable with CascData containing the MC labels - mccasclabel::McParticleId); + mccasclabel::McParticleId, mccasclabel::McMotherParticleId); DECLARE_SOA_TABLE(McCascBBTags, "AOD", "MCCASCBBTAG", //! Table joinable with CascData containing yes / no for BB correlation mccasclabel::IsBachBaryonCandidate); using McCascLabel = McCascLabels::iterator; diff --git a/PWGLF/TableProducer/cascademcbuilder.cxx b/PWGLF/TableProducer/cascademcbuilder.cxx index da299d8bab7..9eb313cb25c 100644 --- a/PWGLF/TableProducer/cascademcbuilder.cxx +++ b/PWGLF/TableProducer/cascademcbuilder.cxx @@ -73,11 +73,11 @@ struct cascademcbuilder { // Loop over those that actually have the corresponding V0 associated to them auto v0 = casc.v0_as(); if (!(v0.has_v0Data())) { - casclabels(-1); + casclabels(-1, -1); continue; // skip those cascades for which V0 doesn't exist (but: should never happen) } auto v0data = v0.v0Data(); // de-reference index to correct v0data in case it exists - int lLabel = -1; + int lLabel = -1, lMotherLabel = -1; // Acquire all three daughter tracks, please auto lBachTrack = casc.bachelor_as(); @@ -132,6 +132,7 @@ struct cascademcbuilder { if (lV0Mother.has_mothers()) { for (auto& lV0GrandMother : lV0Mother.mothers_as()) { pdgCodeMother = lV0GrandMother.pdgCode(); + lMotherLabel = lV0GrandMother.globalIndex(); } } } @@ -144,7 +145,7 @@ struct cascademcbuilder { } // end association check // Construct label table (note: this will be joinable with CascDatas) casclabels( - lLabel); + lLabel, lMotherLabel); if (populateCascMCCores) { cascmccores( pdgCode, pdgCodeMother, pdgCodeV0, isPhysicalPrimary, diff --git a/PWGLF/TableProducer/lambdakzeromcbuilder.cxx b/PWGLF/TableProducer/lambdakzeromcbuilder.cxx index 52fd19a7ec4..118210b66ca 100644 --- a/PWGLF/TableProducer/lambdakzeromcbuilder.cxx +++ b/PWGLF/TableProducer/lambdakzeromcbuilder.cxx @@ -54,7 +54,7 @@ struct lambdakzeromcbuilder { void process(aod::V0Datas const& v0table, aod::McTrackLabels const&, aod::McParticles const& particlesMC) { for (auto& v0 : v0table) { - int lLabel = -1; + int lLabel = -1, lMotherLabel = -1; int pdgCode = -1, pdgCodeMother = -1, pdgCodePositive = -1, pdgCodeNegative = -1; bool isPhysicalPrimary = false; float xmc = -999.0f, ymc = -999.0f, zmc = -999.0f; @@ -91,6 +91,7 @@ struct lambdakzeromcbuilder { if (lNegMother.has_mothers()) { for (auto& lNegGrandMother : lNegMother.mothers_as()) { pdgCodeMother = lNegGrandMother.pdgCode(); + lMotherLabel = lNegGrandMother.globalIndex(); } } } @@ -100,7 +101,7 @@ struct lambdakzeromcbuilder { } // end association check // Construct label table (note: this will be joinable with V0Datas!) v0labels( - lLabel); + lLabel, lMotherLabel); if (populateV0MCCores) { v0mccores( pdgCode, pdgCodeMother, pdgCodePositive, pdgCodeNegative, diff --git a/PWGLF/TableProducer/strangederivedbuilder.cxx b/PWGLF/TableProducer/strangederivedbuilder.cxx index 78075a4b870..465eb8db4fd 100644 --- a/PWGLF/TableProducer/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/strangederivedbuilder.cxx @@ -332,11 +332,11 @@ struct strangederivedbuilder { //__________________________________________________ // mark mcParticles for referencing for (auto const& v0 : V0s) - if (v0.has_mcParticle()) - motherReference[v0.mcParticleId()] = 0; + if (v0.has_mcMotherParticle()) + motherReference[v0.mcMotherParticleId()] = 0; for (auto const& ca : Cascades) - if (ca.has_mcParticle()) - motherReference[ca.mcParticleId()] = 0; + if (ca.has_mcMotherParticle()) + motherReference[ca.mcMotherParticleId()] = 0; //__________________________________________________ // Figure out the numbering of the new mcMother table // assume filling per order @@ -349,9 +349,9 @@ struct strangederivedbuilder { //__________________________________________________ // populate track references for (auto const& v0 : V0s) - v0mothers(motherReference[v0.mcParticleId()]); // joinable with V0Datas + v0mothers(motherReference[v0.mcMotherParticleId()]); // joinable with V0Datas for (auto const& ca : Cascades) - cascmothers(motherReference[ca.mcParticleId()]); // joinable with CascDatas + cascmothers(motherReference[ca.mcMotherParticleId()]); // joinable with CascDatas //__________________________________________________ // populate motherMCParticles for (auto const& tr : mcParticles) {