From f2675a883bbba4c42c005d2bb43885e63a9e38b6 Mon Sep 17 00:00:00 2001 From: morgmatt Date: Mon, 21 Jul 2025 09:38:14 +0200 Subject: [PATCH 01/11] Added output table to sigma minus task --- PWGLF/DataModel/LFKinkDecayTables.h | 31 +++++++++++++++ PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 46 +++++++++++++++++++--- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index 9533bd66116..257c2244de7 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -47,6 +47,17 @@ DECLARE_SOA_COLUMN(DcaMothPv, dcaMothPv, float); //! DCA of the mother to th DECLARE_SOA_COLUMN(DcaDaugPv, dcaDaugPv, float); //! DCA of the daughter kink to the primary vertex DECLARE_SOA_COLUMN(DcaKinkTopo, dcaKinkTopo, float); //! DCA of the kink topology +DECLARE_SOA_COLUMN(NSigmaTPCPi, nSigmaTPCPi, float); //! Number of sigmas for the pion candidate from Sigma kink in TPC +DECLARE_SOA_COLUMN(NSigmaTPCPr, nSigmaTPCPr, float); //! Number of sigmas for the proton candidate from Sigma kink in TPC +DECLARE_SOA_COLUMN(NSigmaTPCKa, nSigmaTPCKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TPC + +// MC Columns +DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter +DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter +DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC +DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC + + // DYNAMIC COLUMNS DECLARE_SOA_DYNAMIC_COLUMN(PxDaugNeut, pxDaugNeut, //! Px of the daughter neutral particle @@ -120,6 +131,26 @@ DECLARE_SOA_TABLE(KinkCandsUnbound, "AOD", "UBKINKCANDS", kinkcand::MSigmaPlus, kinkcand::MXiMinus); +DECLARE_SOA_TABLE(SlimKinkCands, "AOD", "SLIMKINKCANDS", + kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, + kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth, + kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, + kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, + kinkcand::MothSign, + kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa); + +DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", + kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, + kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth, + kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, + kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, + kinkcand::MothSign, + kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, + kinkcand::MothPdgCode, kinkcand::DaugPdgCode, + kinkcand::PtMC, kinkcand::MassMC); + + + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFKINKDECAYTABLES_H_ diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index ac588fb8597..a16d85292a8 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -26,11 +26,16 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; struct sigmaminustask { + + // Output Tables + Produces outputDataTable; + Produces outputDataTableMC; + // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rSigmaMinus{"sigmaminus", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -39,6 +44,8 @@ struct sigmaminustask { Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; + Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; + Preslice mPerCol = aod::track::collisionId; void init(InitContext const&) @@ -71,14 +78,26 @@ struct sigmaminustask { return; } rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); + if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } + rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + + if(fillOutputTree) { + outputDataTable(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), + kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), + kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), + kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), + kinkCand.mothSign(), dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa()); + } + } } PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true); @@ -92,7 +111,9 @@ struct sigmaminustask { rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); auto kinkCandPerColl = KinkCands.sliceBy(mPerCol, collision.globalIndex()); + for (const auto& kinkCand : kinkCandPerColl) { + auto dauTrack = kinkCand.trackDaug_as(); auto mothTrack = kinkCand.trackMoth_as(); if (dauTrack.sign() != mothTrack.sign()) { @@ -106,6 +127,7 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + // do MC association auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); auto mcLabPiDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); @@ -123,10 +145,23 @@ struct sigmaminustask { continue; } rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); + + // fill the output table with Mc information + outputDataTableMC(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), + kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), + kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), + kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), + kinkCand.mothSign(), + dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), + mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), + kinkCand.ptMoth(), kinkCand.mSigmaMinus()); + } - } - } - } + } // MC association and selection + } // kink cand loop + } // collision loop + + // Loop over all generated particles to fill MC histograms for (const auto& mcPart : particlesMC) { if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > 0.5) { continue; @@ -136,7 +171,7 @@ struct sigmaminustask { } bool hasSigmaDaughter = false; for (const auto& daughter : mcPart.daughters_as()) { - if (std::abs(daughter.pdgCode()) == 211) { // Sigma PDG code + if (std::abs(daughter.pdgCode()) == 211) { // Pi PDG code hasSigmaDaughter = true; break; // Found a pi daughter, exit loop } @@ -149,6 +184,7 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass); } } + PROCESS_SWITCH(sigmaminustask, processMC, "MC processing", false); }; From 535783b480da3ac22f98a3331cee9ef04b2a6d0d Mon Sep 17 00:00:00 2001 From: morgmatt Date: Tue, 22 Jul 2025 17:16:50 +0200 Subject: [PATCH 02/11] "removed momentarily some filters from sigma minus task" --- PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index a16d85292a8..4b61627cc11 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -74,17 +74,21 @@ struct sigmaminustask { void processData(CollisionsFull::iterator const& collision, aod::KinkCands const& KinkCands, TracksFull const&) { + /* if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) { return; } + */ rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); + /* if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } + */ rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); From 714cecae2c3f7590e2404d1b6c2b545b3fd4fb20 Mon Sep 17 00:00:00 2001 From: morgmatt Date: Wed, 23 Jul 2025 16:26:21 +0200 Subject: [PATCH 03/11] "Restored event filters, now filling the output table also for generated but not reconstructed mc particles" --- PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index 4b61627cc11..f7d3d5e940f 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -26,7 +26,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; @@ -74,21 +74,17 @@ struct sigmaminustask { void processData(CollisionsFull::iterator const& collision, aod::KinkCands const& KinkCands, TracksFull const&) { - /* if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) { return; } - */ rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); - /* if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } - */ rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); @@ -151,7 +147,8 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); // fill the output table with Mc information - outputDataTableMC(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), + if (fillOutputTree) { + outputDataTableMC(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), @@ -159,7 +156,7 @@ struct sigmaminustask { dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), kinkCand.ptMoth(), kinkCand.mSigmaMinus()); - + } } } // MC association and selection } // kink cand loop @@ -174,9 +171,13 @@ struct sigmaminustask { continue; // Skip if no daughters } bool hasSigmaDaughter = false; + std::array secVtx; + std::array momDaug; for (const auto& daughter : mcPart.daughters_as()) { if (std::abs(daughter.pdgCode()) == 211) { // Pi PDG code hasSigmaDaughter = true; + secVtx = {daughter.vx(), daughter.vy(), daughter.vz()}; + momDaug = {daughter.px(), daughter.py(), daughter.pz()}; break; // Found a pi daughter, exit loop } } @@ -186,6 +187,18 @@ struct sigmaminustask { float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p()); int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass); + + // Fill output table with non reconstructed MC candidates + if (fillOutputTree) { + outputDataTableMC(mcPart.vx(), mcPart.vy(), mcPart.vz(), + mcPart.px(), mcPart.py(), mcPart.pz(), + momDaug[0], momDaug[1], momDaug[2], + -999, -999, -999, // DCA values not reconstructed + sigmaSign, + -999, -999, -999, // NSigmaTPC values not reconstructed + mcPart.pdgCode(), 211, + mcPart.pt(), mcMass); + } } } From 097b52c73b07263ece6a8586e31c42dd781f305e Mon Sep 17 00:00:00 2001 From: morgmatt Date: Thu, 24 Jul 2025 16:45:33 +0200 Subject: [PATCH 04/11] Added NSigmaTOF columns to the tables; modified MC function to include also sigma plus decaying into protons+pi0 --- PWGLF/DataModel/LFKinkDecayTables.h | 15 ++++++--- PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 37 ++++++++++++++-------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index 257c2244de7..ff2f1442aa0 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -50,12 +50,15 @@ DECLARE_SOA_COLUMN(DcaKinkTopo, dcaKinkTopo, float); //! DCA of the kink topolog DECLARE_SOA_COLUMN(NSigmaTPCPi, nSigmaTPCPi, float); //! Number of sigmas for the pion candidate from Sigma kink in TPC DECLARE_SOA_COLUMN(NSigmaTPCPr, nSigmaTPCPr, float); //! Number of sigmas for the proton candidate from Sigma kink in TPC DECLARE_SOA_COLUMN(NSigmaTPCKa, nSigmaTPCKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TPC +DECLARE_SOA_COLUMN(NSigmaTOFPi, nSigmaTOFPi, float); //! Number of sigmas for the pion candidate from Sigma kink in TOF +DECLARE_SOA_COLUMN(NSigmaTOFPr, nSigmaTOFPr, float); //! Number of sigmas for the proton candidate from Sigma kink in TOF +DECLARE_SOA_COLUMN(NSigmaTOFKa, nSigmaTOFKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TOF // MC Columns -DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter -DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter -DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC -DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC +DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter +DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter +DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC +DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC // DYNAMIC COLUMNS @@ -137,7 +140,8 @@ DECLARE_SOA_TABLE(SlimKinkCands, "AOD", "SLIMKINKCANDS", kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, kinkcand::MothSign, - kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa); + kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, + kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa); DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, @@ -146,6 +150,7 @@ DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, kinkcand::MothSign, kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, + kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa, kinkcand::MothPdgCode, kinkcand::DaugPdgCode, kinkcand::PtMC, kinkcand::MassMC); diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index f7d3d5e940f..71d49d27276 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -26,7 +26,9 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; @@ -95,7 +97,9 @@ struct sigmaminustask { kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), - kinkCand.mothSign(), dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa()); + kinkCand.mothSign(), + dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), + dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa()); } } @@ -141,7 +145,10 @@ struct sigmaminustask { if (piMother.globalIndex() != mcTrackSigma.globalIndex()) { continue; } - if (std::abs(mcTrackSigma.pdgCode()) != 3112 || std::abs(mcTrackPiDau.pdgCode()) != 211) { + if (std::abs(mcTrackSigma.pdgCode()) != 3112) { + continue; + } + if (std::abs(mcTrackPiDau.pdgCode()) != 211 && std::abs(mcTrackPiDau.pdgCode()) != 2212) { continue; } rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); @@ -154,6 +161,7 @@ struct sigmaminustask { kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), kinkCand.mothSign(), dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), + dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), kinkCand.ptMoth(), kinkCand.mSigmaMinus()); } @@ -164,25 +172,27 @@ struct sigmaminustask { // Loop over all generated particles to fill MC histograms for (const auto& mcPart : particlesMC) { - if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > 0.5) { + if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > 1.0) { // only sigma mothers and rapidity cut continue; } if (!mcPart.has_daughters()) { continue; // Skip if no daughters } bool hasSigmaDaughter = false; + int daug_pdg = 0; std::array secVtx; std::array momDaug; for (const auto& daughter : mcPart.daughters_as()) { - if (std::abs(daughter.pdgCode()) == 211) { // Pi PDG code + if (std::abs(daughter.pdgCode()) == 211 || std::abs(daughter.pdgCode()) == 2212) { // Pi or proton daughter hasSigmaDaughter = true; secVtx = {daughter.vx(), daughter.vy(), daughter.vz()}; momDaug = {daughter.px(), daughter.py(), daughter.pz()}; - break; // Found a pi daughter, exit loop + daug_pdg = daughter.pdgCode(); + break; // Found a daughter, exit loop } } if (!hasSigmaDaughter) { - continue; // Skip if no pi daughter found + continue; // Skip if no pi/proton daughter found } float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p()); int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma @@ -190,13 +200,14 @@ struct sigmaminustask { // Fill output table with non reconstructed MC candidates if (fillOutputTree) { - outputDataTableMC(mcPart.vx(), mcPart.vy(), mcPart.vz(), - mcPart.px(), mcPart.py(), mcPart.pz(), - momDaug[0], momDaug[1], momDaug[2], - -999, -999, -999, // DCA values not reconstructed + outputDataTableMC(-999, -999, -999, + -999, -999, -999, + -999, -999, -999, + -999, -999, -999, sigmaSign, - -999, -999, -999, // NSigmaTPC values not reconstructed - mcPart.pdgCode(), 211, + -999, -999, -999, + -999, -999, -999, + mcPart.pdgCode(), daug_pdg, mcPart.pt(), mcMass); } } From d6cbe97ffd880bea325ef9166cb4fd1a5d428ca2 Mon Sep 17 00:00:00 2001 From: morgmatt Date: Fri, 25 Jul 2025 17:34:41 +0200 Subject: [PATCH 05/11] Corrected table filling for MC reconstructed particles, added mc decay radius column, added few resolution histograms --- PWGLF/DataModel/LFKinkDecayTables.h | 4 ++-- PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 27 +++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index ff2f1442aa0..306c0e9b830 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -59,7 +59,7 @@ DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma d DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC - +DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC // DYNAMIC COLUMNS @@ -152,7 +152,7 @@ DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa, kinkcand::MothPdgCode, kinkcand::DaugPdgCode, - kinkcand::PtMC, kinkcand::MassMC); + kinkcand::PtMC, kinkcand::MassMC, kinkcand::DecayRadiusMC); diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index 71d49d27276..7cef042c339 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -53,13 +53,16 @@ struct sigmaminustask { void init(InitContext const&) { // Axes - const AxisSpec ptAxis{50, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec ptAxis{100, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec nSigmaPiAxis{100, -5, 5, "n#sigma_{#pi}"}; const AxisSpec sigmaMassAxis{100, 1.1, 1.4, "m (GeV/#it{c}^{2})"}; const AxisSpec xiMassAxis{100, 1.2, 1.6, "m_{#Xi} (GeV/#it{c}^{2})"}; const AxisSpec pdgAxis{10001, -5000, 5000, "PDG code"}; const AxisSpec vertexZAxis{100, -15., 15., "vrtx_{Z} [cm]"}; + const AxisSpec ptResolutionAxis{100, -0.5, 0.5, "#it{p}_{T}^{rec} - #it{p}_{T}^{gen} (GeV/#it{c})"}; + const AxisSpec massResolutionAxis{100, -0.1, 0.1, "m_{rec} - m_{gen} (GeV/#it{c}^{2})"}; + // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); // Sigma-minus reconstruction @@ -71,6 +74,11 @@ struct sigmaminustask { // Add MC histograms if needed rSigmaMinus.add("h2MassPtMCRec", "h2MassPtMCRec", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); rSigmaMinus.add("h2MassPtMCGen", "h2MassPtMCGen", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); + + rSigmaMinus.add("h2MassResolution_minus", "h2MassResolution_minus", {HistType::kTH2F, {sigmaMassAxis, massResolutionAxis}}); + rSigmaMinus.add("h2PtResolution_minus", "h2PtResolution_minus", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); + rSigmaMinus.add("h2MassResolution_plus", "h2MassResolution_plus", {HistType::kTH2F, {sigmaMassAxis, massResolutionAxis}}); + rSigmaMinus.add("h2PtResolution_plus", "h2PtResolution_plus", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); } } @@ -151,7 +159,19 @@ struct sigmaminustask { if (std::abs(mcTrackPiDau.pdgCode()) != 211 && std::abs(mcTrackPiDau.pdgCode()) != 2212) { continue; } + + float MotherMassMC = std::sqrt(piMother.e() * piMother.e() - piMother.p() * piMother.p()); + float MotherpTMC = piMother.pt(); + float decayRadiusMC = std::sqrt(mcTrackPiDau.vx() * mcTrackPiDau.vx() + mcTrackPiDau.vy() * mcTrackPiDau.vy()); + rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); + if (mcTrackSigma.pdgCode() > 0) { + rSigmaMinus.fill(HIST("h2MassResolution_plus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); + rSigmaMinus.fill(HIST("h2PtResolution_plus"), kinkCand.ptMoth(), kinkCand.ptMoth() - MotherpTMC); + } else { + rSigmaMinus.fill(HIST("h2MassResolution_minus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); + rSigmaMinus.fill(HIST("h2PtResolution_minus"), kinkCand.ptMoth(), kinkCand.ptMoth() - MotherpTMC); + } // fill the output table with Mc information if (fillOutputTree) { @@ -163,7 +183,7 @@ struct sigmaminustask { dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), - kinkCand.ptMoth(), kinkCand.mSigmaMinus()); + MotherpTMC, MotherMassMC, decayRadiusMC); } } } // MC association and selection @@ -195,6 +215,7 @@ struct sigmaminustask { continue; // Skip if no pi/proton daughter found } float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p()); + float mcDecayRadius = std::sqrt(secVtx[0] * secVtx[0] + secVtx[1] * secVtx[1]); int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass); @@ -208,7 +229,7 @@ struct sigmaminustask { -999, -999, -999, -999, -999, -999, mcPart.pdgCode(), daug_pdg, - mcPart.pt(), mcMass); + mcPart.pt(), mcMass, mcDecayRadius); } } } From 0ce391a0894086e52f1a77dc0dcdf8cc87488692 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 25 Jul 2025 15:57:39 +0000 Subject: [PATCH 06/11] Please consider the following formatting changes --- PWGLF/DataModel/LFKinkDecayTables.h | 16 +++++----- PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 35 +++++++++++----------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index 306c0e9b830..4c097d27738 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -55,10 +55,10 @@ DECLARE_SOA_COLUMN(NSigmaTOFPr, nSigmaTOFPr, float); //! Number of sigmas for th DECLARE_SOA_COLUMN(NSigmaTOFKa, nSigmaTOFKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TOF // MC Columns -DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter -DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter -DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC -DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC +DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter +DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter +DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC +DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC // DYNAMIC COLUMNS @@ -134,16 +134,16 @@ DECLARE_SOA_TABLE(KinkCandsUnbound, "AOD", "UBKINKCANDS", kinkcand::MSigmaPlus, kinkcand::MXiMinus); -DECLARE_SOA_TABLE(SlimKinkCands, "AOD", "SLIMKINKCANDS", +DECLARE_SOA_TABLE(SlimKinkCands, "AOD", "SLIMKINKCANDS", kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth, kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, - kinkcand::MothSign, + kinkcand::MothSign, kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa); -DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", +DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth, kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, @@ -154,8 +154,6 @@ DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::MothPdgCode, kinkcand::DaugPdgCode, kinkcand::PtMC, kinkcand::MassMC, kinkcand::DecayRadiusMC); - - } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFKINKDECAYTABLES_H_ diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index 7cef042c339..4f81e1f2c72 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -26,7 +26,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using TracksFull = soa::Join; using CollisionsFull = soa::Join; @@ -47,7 +47,7 @@ struct sigmaminustask { Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; - + Preslice mPerCol = aod::track::collisionId; void init(InitContext const&) @@ -62,7 +62,7 @@ struct sigmaminustask { const AxisSpec ptResolutionAxis{100, -0.5, 0.5, "#it{p}_{T}^{rec} - #it{p}_{T}^{gen} (GeV/#it{c})"}; const AxisSpec massResolutionAxis{100, -0.1, 0.1, "m_{rec} - m_{gen} (GeV/#it{c}^{2})"}; - + // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); // Sigma-minus reconstruction @@ -99,17 +99,16 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); - - if(fillOutputTree) { + + if (fillOutputTree) { outputDataTable(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), - kinkCand.mothSign(), + kinkCand.mothSign(), dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa()); } - } } PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true); @@ -139,7 +138,7 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); - + // do MC association auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); auto mcLabPiDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); @@ -159,7 +158,7 @@ struct sigmaminustask { if (std::abs(mcTrackPiDau.pdgCode()) != 211 && std::abs(mcTrackPiDau.pdgCode()) != 2212) { continue; } - + float MotherMassMC = std::sqrt(piMother.e() * piMother.e() - piMother.p() * piMother.p()); float MotherpTMC = piMother.pt(); float decayRadiusMC = std::sqrt(mcTrackPiDau.vx() * mcTrackPiDau.vx() + mcTrackPiDau.vy() * mcTrackPiDau.vy()); @@ -176,14 +175,14 @@ struct sigmaminustask { // fill the output table with Mc information if (fillOutputTree) { outputDataTableMC(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), - kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), - kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), - kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), - kinkCand.mothSign(), - dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), - dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), - mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), - MotherpTMC, MotherMassMC, decayRadiusMC); + kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), + kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), + kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), + kinkCand.mothSign(), + dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), + dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), + mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), + MotherpTMC, MotherMassMC, decayRadiusMC); } } } // MC association and selection @@ -224,7 +223,7 @@ struct sigmaminustask { outputDataTableMC(-999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, + -999, -999, -999, sigmaSign, -999, -999, -999, -999, -999, -999, From f778389efc2338983be891fcd1894fbbeff240e9 Mon Sep 17 00:00:00 2001 From: morgmatt Date: Mon, 28 Jul 2025 17:36:17 +0200 Subject: [PATCH 07/11] Added eta cut as a configurable; added column for check on McCollisionId of reconstructed vs Mc daughter particle --- PWGLF/DataModel/LFKinkDecayTables.h | 3 ++- PWGLF/Tasks/Strangeness/sigmaminustask.cxx | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index 4c097d27738..3dd75a132de 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -60,6 +60,7 @@ DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kin DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC +DECLARE_SOA_COLUMN(CollisionIdCheck, collisionIdCheck, bool); //! Check if mcDaughter collision ID matches the reconstructed collision ID // DYNAMIC COLUMNS @@ -152,7 +153,7 @@ DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa, kinkcand::MothPdgCode, kinkcand::DaugPdgCode, - kinkcand::PtMC, kinkcand::MassMC, kinkcand::DecayRadiusMC); + kinkcand::PtMC, kinkcand::MassMC, kinkcand::DecayRadiusMC, kinkcand::CollisionIdCheck); } // namespace o2::aod diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx index 4f81e1f2c72..d60109009a5 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaminustask.cxx @@ -45,6 +45,7 @@ struct sigmaminustask { // Configurable for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; + Configurable cutEtaMotherMC{"cutEtaMotherMC", 1.0f, "Eta cut for mother Sigma in MC"}; Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; @@ -92,7 +93,7 @@ struct sigmaminustask { for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); - if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { + if (std::abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } @@ -131,7 +132,7 @@ struct sigmaminustask { LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex(); continue; // Skip if the daughter has the opposite sign as the mother } - if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { + if (std::abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } @@ -161,7 +162,13 @@ struct sigmaminustask { float MotherMassMC = std::sqrt(piMother.e() * piMother.e() - piMother.p() * piMother.p()); float MotherpTMC = piMother.pt(); - float decayRadiusMC = std::sqrt(mcTrackPiDau.vx() * mcTrackPiDau.vx() + mcTrackPiDau.vy() * mcTrackPiDau.vy()); + float deltaXMother = mcTrackPiDau.vx() - piMother.vx(); + float deltaYMother = mcTrackPiDau.vy() - piMother.vy(); + float decayRadiusMC = std::sqrt(deltaXMother * deltaXMother + deltaYMother * deltaYMother); + + // Check coherence of MCcollision Id for daughter MCparticle and reconstructed collision + auto mcCollision = mcTrackPiDau.template mcCollision_as(); + bool mcCollisionIdCheck = collision.mcCollisionId() == mcCollision.globalIndex(); rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); if (mcTrackSigma.pdgCode() > 0) { @@ -182,7 +189,7 @@ struct sigmaminustask { dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), - MotherpTMC, MotherMassMC, decayRadiusMC); + MotherpTMC, MotherMassMC, decayRadiusMC, mcCollisionIdCheck); } } } // MC association and selection @@ -191,7 +198,7 @@ struct sigmaminustask { // Loop over all generated particles to fill MC histograms for (const auto& mcPart : particlesMC) { - if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > 1.0) { // only sigma mothers and rapidity cut + if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > cutEtaMotherMC) { // only sigma mothers and rapidity cut continue; } if (!mcPart.has_daughters()) { @@ -214,7 +221,7 @@ struct sigmaminustask { continue; // Skip if no pi/proton daughter found } float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p()); - float mcDecayRadius = std::sqrt(secVtx[0] * secVtx[0] + secVtx[1] * secVtx[1]); + float mcDecayRadius = std::sqrt((secVtx[0] - mcPart.vx()) * (secVtx[0] - mcPart.vx()) + (secVtx[1] - mcPart.vy()) * (secVtx[1] - mcPart.vy())); int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass); @@ -228,7 +235,7 @@ struct sigmaminustask { -999, -999, -999, -999, -999, -999, mcPart.pdgCode(), daug_pdg, - mcPart.pt(), mcMass, mcDecayRadius); + mcPart.pt(), mcMass, mcDecayRadius, false); } } } From 137d093ab3d786c61c67ecf21fdd21dc5f1b1f8a Mon Sep 17 00:00:00 2001 From: morgmatt Date: Mon, 28 Jul 2025 17:44:32 +0200 Subject: [PATCH 08/11] Moved sigmaminus task in TableProducer/Strangeness folder --- PWGLF/TableProducer/Strangeness/CMakeLists.txt | 5 +++++ .../{Tasks => TableProducer}/Strangeness/sigmaminustask.cxx | 0 PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 ----- 3 files changed, 5 insertions(+), 5 deletions(-) rename PWGLF/{Tasks => TableProducer}/Strangeness/sigmaminustask.cxx (100%) diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 55bf4550601..5b1080cab74 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -91,6 +91,11 @@ o2physics_add_dpl_workflow(lambdakzerospawner PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(sigmaminus-task + SOURCES sigmaminustask.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(strange-tree-creator SOURCES strangeTreeCreator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx similarity index 100% rename from PWGLF/Tasks/Strangeness/sigmaminustask.cxx rename to PWGLF/TableProducer/Strangeness/sigmaminustask.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index a6bc1f60334..58e53693fb8 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -29,11 +29,6 @@ o2physics_add_dpl_workflow(cascadeanalysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(sigmaminus-task - SOURCES sigmaminustask.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(cascadeanalysismc SOURCES cascadeanalysisMC.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore From 1a2cb792f3ee3fbc56a3cf498703c4ecde9161fa Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 28 Jul 2025 15:45:13 +0000 Subject: [PATCH 09/11] Please consider the following formatting changes --- PWGLF/DataModel/LFKinkDecayTables.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index 3dd75a132de..d8df2eb865f 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -55,11 +55,11 @@ DECLARE_SOA_COLUMN(NSigmaTOFPr, nSigmaTOFPr, float); //! Number of sigmas for th DECLARE_SOA_COLUMN(NSigmaTOFKa, nSigmaTOFKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TOF // MC Columns -DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter -DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter -DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC -DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC -DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC +DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter +DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter +DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC +DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC +DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC DECLARE_SOA_COLUMN(CollisionIdCheck, collisionIdCheck, bool); //! Check if mcDaughter collision ID matches the reconstructed collision ID // DYNAMIC COLUMNS From 5627e5fee2641a048149eef671fd812df0ae364b Mon Sep 17 00:00:00 2001 From: morgmatt Date: Tue, 29 Jul 2025 16:48:55 +0200 Subject: [PATCH 10/11] Corrected error in accessing McCollision indices --- PWGLF/TableProducer/Strangeness/sigmaminustask.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index d60109009a5..4cbf907fdc8 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -114,7 +114,7 @@ struct sigmaminustask { } PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true); - void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, TracksFull const&) + void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, aod::McCollisions const&, TracksFull const&) { for (const auto& collision : collisions) { if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) { @@ -167,9 +167,11 @@ struct sigmaminustask { float decayRadiusMC = std::sqrt(deltaXMother * deltaXMother + deltaYMother * deltaYMother); // Check coherence of MCcollision Id for daughter MCparticle and reconstructed collision - auto mcCollision = mcTrackPiDau.template mcCollision_as(); - bool mcCollisionIdCheck = collision.mcCollisionId() == mcCollision.globalIndex(); - + bool mcCollisionIdCheck = false; + if (collision.has_mcCollision()) { + mcCollisionIdCheck = collision.mcCollision().globalIndex() == mcTrackPiDau.mcCollisionId(); + } + rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); if (mcTrackSigma.pdgCode() > 0) { rSigmaMinus.fill(HIST("h2MassResolution_plus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); From a5a16947ff0ab0c2f7124ee03e449d949bd992ad Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 29 Jul 2025 15:14:41 +0000 Subject: [PATCH 11/11] Please consider the following formatting changes --- PWGLF/TableProducer/Strangeness/sigmaminustask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index 4cbf907fdc8..fbf5929effc 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -171,7 +171,7 @@ struct sigmaminustask { if (collision.has_mcCollision()) { mcCollisionIdCheck = collision.mcCollision().globalIndex() == mcTrackPiDau.mcCollisionId(); } - + rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); if (mcTrackSigma.pdgCode() > 0) { rSigmaMinus.fill(HIST("h2MassResolution_plus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC);