From 88da7d35b122bd6be1cdbb40491c11506fbf1dec Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Mon, 31 Mar 2025 19:28:16 +0800 Subject: [PATCH 01/10] Fix unbund issue at collision lever In Xic0VsMult --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 123 ++++++++++++---------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index 22beaa2d202..487b61d9a53 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -158,6 +158,7 @@ DECLARE_SOA_COLUMN(TofNSigmaPiFromCharmBaryon, tofNSigmaPiFromCharmBaryon, float DECLARE_SOA_COLUMN(TofNSigmaPiFromCasc, tofNSigmaPiFromCasc, float); DECLARE_SOA_COLUMN(TofNSigmaPiFromLambda, tofNSigmaPiFromLambda, float); DECLARE_SOA_COLUMN(TofNSigmaPrFromLambda, tofNSigmaPrFromLambda, float); +DECLARE_SOA_COLUMN(CollInf, collInf, int); } // namespace full @@ -177,8 +178,10 @@ DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV", full::CentFDDM, full::MultZeqNTracksPV); +DECLARE_SOA_TABLE(HfToXiPiBase, "AOD", "HFTOXIPIBASE", + full::CollInf); + DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", - full::CollisionId, full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon, full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade, @@ -245,6 +248,7 @@ struct HfTreeCreatorToXiPi { Produces rowCandidateFull; Produces rowCandidateLite; Produces rowEv; + Produces rowCandidateBase; Configurable zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"}; @@ -253,9 +257,8 @@ struct HfTreeCreatorToXiPi { using Cents = soa::Join; using MyTrackTable = soa::Join; using MyEventTable = soa::Join; - using MyEventTableWithCent = soa::Join; - Preslice candXicPerCollision = aod::hf_cand_xic0_omegac0::collisionId; + Preslice> candXicPerCollision = aod::hf_cand_xic0_omegac0::collisionId; void init(InitContext const&) { @@ -299,11 +302,10 @@ struct HfTreeCreatorToXiPi { multZeqNTracksPV); } - template + template void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched) { rowCandidateFull( - rowEv.lastIndex(), candidate.xPv(), candidate.yPv(), candidate.zPv(), @@ -415,17 +417,24 @@ struct HfTreeCreatorToXiPi { collisionMatched); } - template + template void fillCandidateLite(const T& candidate, int8_t flagMc, int8_t originMc, bool collisionMatched) { if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) { + float numContrib = -999.f; + float chi2 = -999.f; + if constexpr (!useCentrality) { + numContrib = candidate.template collision_as().numContrib(); + chi2 = candidate.template collision_as().chi2(); + } + rowCandidateLite( candidate.xPv(), candidate.yPv(), candidate.zPv(), - candidate.template collision_as().numContrib(), - candidate.template collision_as().chi2(), + numContrib, + chi2, candidate.xDecayVtxCharmBaryon(), candidate.yDecayVtxCharmBaryon(), candidate.zDecayVtxCharmBaryon(), @@ -490,6 +499,9 @@ struct HfTreeCreatorToXiPi { flagMc, originMc, collisionMatched); + if constexpr (useCentrality) { + rowCandidateBase(rowEv.lastIndex()); + } } } @@ -505,31 +517,11 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false); + fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataFull, "Process data with full information w/o centrality", true); - void processDataFullWithCentrality(MyEventTableWithCent const& collisions, MyTrackTable const&, - soa::Join const& candidates) - { - // Filling event properties - rowEv.reserve(collisions.size()); - for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); - auto sizeTableCand = groupedXicCandidates.size(); - fillEvent(collision, zPvCut); - - // Filling candidate properties - rowCandidateFull.reserve(sizeTableCand); - for (const auto& candidate : groupedXicCandidates) { - fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false); - } - } - } - PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataFullWithCentrality, "Process data with full information with centrality", false); - void processMcFullXic0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) { @@ -542,31 +534,11 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullXic0, "Process MC with full information for xic0 w/o centrality", false); - void processMcFullXic0WithCentrality(MyEventTableWithCent const& collisions, MyTrackTable const&, - soa::Join const& candidates) - { - // Filling event properties - rowEv.reserve(collisions.size()); - for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); - auto sizeTableCand = groupedXicCandidates.size(); - fillEvent(collision, zPvCut); - - // Filling candidate properties - rowCandidateFull.reserve(sizeTableCand); - for (const auto& candidate : groupedXicCandidates) { - fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); - } - } - } - PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullXic0WithCentrality, "Process MC with full information for xic0 with centrality", false); - void processMcFullOmegac0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) { @@ -579,7 +551,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullOmegac0, "Process MC with full information for omegac0", false); @@ -596,11 +568,33 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLite, "Process data and produce lite table version", false); + void processDataLiteWithCentrality(soa::Join const& collisions, MyTrackTable const&, + soa::Join const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); + auto sizeTableCand = groupedXicCandidates.size(); + fillEvent(collision, zPvCut); + + // Filling candidate properties + rowCandidateLite.reserve(sizeTableCand); + rowCandidateBase.reserve(sizeTableCand); + LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowEv.lastIndex() + 1); + for (const auto& candidate : groupedXicCandidates) { + fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + } + } + } + PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithCentrality, "Process data with full information with centrality", false); + void processMcLiteXic0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) { @@ -613,11 +607,32 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0, "Process MC and produce lite table version for xic0", false); + void processMcLiteXic0WithCentrality(soa::Join const& collisions, MyTrackTable const&, + soa::Join const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); + auto sizeTableCand = groupedXicCandidates.size(); + fillEvent(collision, zPvCut); + + // Filling candidate properties + rowCandidateFull.reserve(sizeTableCand); + rowCandidateBase.reserve(sizeTableCand); + for (const auto& candidate : groupedXicCandidates) { + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + } + } + } + PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithCentrality, "Process MC with full information for xic0 with centrality", false); + void processMcLiteOmegac0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) { @@ -630,7 +645,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteOmegac0, "Process MC and produce lite table version for omegac0", false); From 55044ed5aba61c7082b72163cba54ac415e5d2a7 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:17:58 +0800 Subject: [PATCH 02/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index 487b61d9a53..ea339b49117 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -158,7 +158,6 @@ DECLARE_SOA_COLUMN(TofNSigmaPiFromCharmBaryon, tofNSigmaPiFromCharmBaryon, float DECLARE_SOA_COLUMN(TofNSigmaPiFromCasc, tofNSigmaPiFromCasc, float); DECLARE_SOA_COLUMN(TofNSigmaPiFromLambda, tofNSigmaPiFromLambda, float); DECLARE_SOA_COLUMN(TofNSigmaPrFromLambda, tofNSigmaPrFromLambda, float); -DECLARE_SOA_COLUMN(CollInf, collInf, int); } // namespace full @@ -178,8 +177,18 @@ DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV", full::CentFDDM, full::MultZeqNTracksPV); -DECLARE_SOA_TABLE(HfToXiPiBase, "AOD", "HFTOXIPIBASE", - full::CollInf); +using HfToXiPiEv = HfToXiPiEvs::iterator; //通过这个来连接Evs表 + +namespace full +{ +namespace collInf +{ +DECLARE_SOA_INDEX_COLUMN_CUSTOM(HfToXiPiEv, hfEvBase, "HfXic0CollBase"); +} +} + +DECLARE_SOA_TABLE(HfToXiPiEvBase, "AOD", "HFTOXIPIEVBASE", + full::collInf::HfToXiPiEvId); DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, @@ -248,7 +257,7 @@ struct HfTreeCreatorToXiPi { Produces rowCandidateFull; Produces rowCandidateLite; Produces rowEv; - Produces rowCandidateBase; + Produces rowEvBase; Configurable zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"}; @@ -500,7 +509,7 @@ struct HfTreeCreatorToXiPi { originMc, collisionMatched); if constexpr (useCentrality) { - rowCandidateBase(rowEv.lastIndex()); + rowEvBase(rowEv.lastIndex()); } } } @@ -586,7 +595,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(sizeTableCand); - rowCandidateBase.reserve(sizeTableCand); + rowEvBase.reserve(sizeTableCand); LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowEv.lastIndex() + 1); for (const auto& candidate : groupedXicCandidates) { fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); @@ -625,7 +634,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(sizeTableCand); - rowCandidateBase.reserve(sizeTableCand); + rowEvBase.reserve(sizeTableCand); for (const auto& candidate : groupedXicCandidates) { fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); } From 8c3e62f69c10360909d185640defd632e8552089 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:26:18 +0800 Subject: [PATCH 03/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index ea339b49117..ae6aa12ad09 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -177,12 +177,12 @@ DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV", full::CentFDDM, full::MultZeqNTracksPV); -using HfToXiPiEv = HfToXiPiEvs::iterator; //通过这个来连接Evs表 +using HfToXiPiEv = HfToXiPiEvs::iterator; namespace full -{ +{ namespace collInf -{ +{ DECLARE_SOA_INDEX_COLUMN_CUSTOM(HfToXiPiEv, hfEvBase, "HfXic0CollBase"); } } From fd00c53fcb4bd4e975193b3bd8a636d4d0392fbf Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:55:18 +0800 Subject: [PATCH 04/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index ae6aa12ad09..39f3a429615 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -179,16 +179,13 @@ DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV", using HfToXiPiEv = HfToXiPiEvs::iterator; -namespace full -{ namespace collInf { DECLARE_SOA_INDEX_COLUMN_CUSTOM(HfToXiPiEv, hfEvBase, "HfXic0CollBase"); } -} DECLARE_SOA_TABLE(HfToXiPiEvBase, "AOD", "HFTOXIPIEVBASE", - full::collInf::HfToXiPiEvId); + collInf::HfToXiPiEvId); DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, From 7b085baf507c3b1b81b2214a65e47c94e9b8ac87 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:15:17 +0800 Subject: [PATCH 05/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 227 +++++++++++----------- 1 file changed, 110 insertions(+), 117 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index 39f3a429615..87546030d7e 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -15,15 +15,13 @@ /// /// \author Federica Zanone , Heidelberg University -#include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" - #include "Common/Core/RecoDecay.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -35,20 +33,10 @@ namespace o2::aod namespace full { // collision info -DECLARE_SOA_INDEX_COLUMN(Collision, collision); -DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); DECLARE_SOA_COLUMN(IsEventSel8, isEventSel8, bool); DECLARE_SOA_COLUMN(IsEventSelZ, isEventSelZ, bool); -DECLARE_SOA_COLUMN(RunNumber, runNumber, int); -DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); -DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); -DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); -DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); -DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); -DECLARE_SOA_COLUMN(CentFDDM, centFDDM, float); -DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); +DECLARE_SOA_COLUMN(Centrality, centrality, float); // from creator -DECLARE_SOA_COLUMN(Cent, cent, float); DECLARE_SOA_COLUMN(XPv, xPv, float); DECLARE_SOA_COLUMN(YPv, yPv, float); DECLARE_SOA_COLUMN(ZPv, zPv, float); @@ -162,30 +150,7 @@ DECLARE_SOA_COLUMN(TofNSigmaPrFromLambda, tofNSigmaPrFromLambda, float); } // namespace full DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV", - full::IsEventSel8, full::IsEventSelZ, - full::McCollisionId, - collision::NumContrib, - collision::PosX, - collision::PosY, - collision::PosZ, - full::IsEventReject, - full::RunNumber, - full::CentFT0A, - full::CentFT0C, - full::CentFT0M, - full::CentFV0A, - full::CentFDDM, - full::MultZeqNTracksPV); - -using HfToXiPiEv = HfToXiPiEvs::iterator; - -namespace collInf -{ -DECLARE_SOA_INDEX_COLUMN_CUSTOM(HfToXiPiEv, hfEvBase, "HfXic0CollBase"); -} - -DECLARE_SOA_TABLE(HfToXiPiEvBase, "AOD", "HFTOXIPIEVBASE", - collInf::HfToXiPiEvId); + full::IsEventSel8, full::IsEventSelZ); DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, @@ -222,7 +187,7 @@ DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", full::FlagMcMatchRec, full::DebugMcRec, full::OriginRec, full::CollisionMatched); DECLARE_SOA_TABLE(HfToXiPiLites, "AOD", "HFTOXIPILITE", - full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, + full::XPv, full::YPv, full::ZPv, full::Centrality, collision::NumContrib, collision::Chi2, full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon, full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade, full::XDecayVtxV0, full::YDecayVtxV0, full::ZDecayVtxV0, @@ -254,17 +219,15 @@ struct HfTreeCreatorToXiPi { Produces rowCandidateFull; Produces rowCandidateLite; Produces rowEv; - Produces rowEvBase; Configurable zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"}; - SliceCache cache; - using Cents = soa::Join; using MyTrackTable = soa::Join; using MyEventTable = soa::Join; - - Preslice> candXicPerCollision = aod::hf_cand_xic0_omegac0::collisionId; + using MyEventTableWithFT0C = soa::Join; + using MyEventTableWithFT0M = soa::Join; + using MyEventTableWithNTracksPV = soa::Join; void init(InitContext const&) { @@ -276,47 +239,19 @@ struct HfTreeCreatorToXiPi { template void fillEvent(const T& collision, float cutZPv) { - float centFT0A = -1.f; - float centFT0C = -1.f; - float centFT0M = -1.f; - float centFV0A = -1.f; - float centFDDM = -1.f; - float multZeqNTracksPV = -1.f; - if constexpr (useCentrality) { - centFT0A = collision.centFT0A(); - centFT0C = collision.centFT0C(); - centFT0M = collision.centFT0M(); - centFV0A = collision.centFV0A(); - centFDDM = collision.centFDDM(); - multZeqNTracksPV = collision.multZeqNTracksPV(); - } - rowEv( - collision.sel8(), std::abs(collision.posZ()) < cutZPv, - -1, - collision.numContrib(), - collision.posX(), - collision.posY(), - collision.posZ(), - 0, - 1, - centFT0A, - centFT0C, - centFT0M, - centFV0A, - centFDDM, - multZeqNTracksPV); + collision.sel8(), std::abs(collision.posZ()) < cutZPv); } - template + template void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched) { rowCandidateFull( candidate.xPv(), candidate.yPv(), candidate.zPv(), - candidate.template collision_as().numContrib(), - candidate.template collision_as().chi2(), + candidate.template collision_as().numContrib(), + candidate.template collision_as().chi2(), candidate.xDecayVtxCharmBaryon(), candidate.yDecayVtxCharmBaryon(), candidate.zDecayVtxCharmBaryon(), @@ -423,24 +358,24 @@ struct HfTreeCreatorToXiPi { collisionMatched); } - template + template void fillCandidateLite(const T& candidate, int8_t flagMc, int8_t originMc, bool collisionMatched) { if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) { - float numContrib = -999.f; - float chi2 = -999.f; - if constexpr (!useCentrality) { - numContrib = candidate.template collision_as().numContrib(); - chi2 = candidate.template collision_as().chi2(); + float centrality = -999.f; + if constexpr (useCentrality) { + auto const& collision = candidate.template collision_as(); + centrality = o2::hf_centrality::getCentralityPercentile(collision); } rowCandidateLite( candidate.xPv(), candidate.yPv(), candidate.zPv(), - numContrib, - chi2, + centrality, + candidate.template collision_as().numContrib(), + candidate.template collision_as().chi2(), candidate.xDecayVtxCharmBaryon(), candidate.yDecayVtxCharmBaryon(), candidate.zDecayVtxCharmBaryon(), @@ -505,9 +440,6 @@ struct HfTreeCreatorToXiPi { flagMc, originMc, collisionMatched); - if constexpr (useCentrality) { - rowEvBase(rowEv.lastIndex()); - } } } @@ -523,7 +455,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false); + fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataFull, "Process data with full information w/o centrality", true); @@ -540,7 +472,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullXic0, "Process MC with full information for xic0 w/o centrality", false); @@ -557,7 +489,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullOmegac0, "Process MC with full information for omegac0", false); @@ -574,32 +506,61 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLite, "Process data and produce lite table version", false); - void processDataLiteWithCentrality(soa::Join const& collisions, MyTrackTable const&, + void processDataLiteWithFT0M(MyEventTableWithFT0M const& collisions, MyTrackTable const&, soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); - auto sizeTableCand = groupedXicCandidates.size(); fillEvent(collision, zPvCut); + } - // Filling candidate properties - rowCandidateLite.reserve(sizeTableCand); - rowEvBase.reserve(sizeTableCand); - LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowEv.lastIndex() + 1); - for (const auto& candidate : groupedXicCandidates) { - fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); - } + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + } + } + PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithFT0M, "Process data and produce lite table version with FT0M", false); + + void processDataLiteWithFT0C(MyEventTableWithFT0C const& collisions, MyTrackTable const&, + soa::Join const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + } + } + PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithFT0C, "Process data and produce lite table version with FT0C", false); + + void processDataLiteWithNTracksPV(MyEventTableWithNTracksPV const& collisions, MyTrackTable const&, + soa::Join const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); } } - PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithCentrality, "Process data with full information with centrality", false); + PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithNTracksPV, "Process data and produce lite table version with NTracksPV", false); void processMcLiteXic0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) @@ -613,31 +574,63 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0, "Process MC and produce lite table version for xic0", false); - void processMcLiteXic0WithCentrality(soa::Join const& collisions, MyTrackTable const&, + void processMcLiteXic0WithFT0C(MyEventTableWithFT0C const& collisions, MyTrackTable const&, soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); - auto sizeTableCand = groupedXicCandidates.size(); fillEvent(collision, zPvCut); + } - // Filling candidate properties - rowCandidateFull.reserve(sizeTableCand); - rowEvBase.reserve(sizeTableCand); - for (const auto& candidate : groupedXicCandidates) { - fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); - } + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); } } - PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithCentrality, "Process MC with full information for xic0 with centrality", false); + PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithFT0C, "Process MC and produce lite table version for Xic0 with FT0C", false); + + void processMcLiteXic0WithFT0M(MyEventTableWithFT0M const& collisions, MyTrackTable const&, + soa::Join const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + } + } + PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithFT0M, "Process MC and produce lite table version for Xic0 with FT0M", false); + + + void processMcLiteXic0WithNTracksPV(MyEventTableWithNTracksPV const& collisions, MyTrackTable const&, + soa::Join const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + } + } + PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithNTracksPV, "Process MC and produce lite table version for Xic0 with NTracksPV", false); + void processMcLiteOmegac0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) @@ -651,7 +644,7 @@ struct HfTreeCreatorToXiPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); + fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originRec(), candidate.collisionMatched()); } } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteOmegac0, "Process MC and produce lite table version for omegac0", false); From 13daa156671d656d21822da24acedfe1468e9165 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:24:17 +0800 Subject: [PATCH 06/10] Update treeCreatorToXiPi.cxx From 0035eb8d92669ee11b75683408b60e73b7f37729 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 3 Apr 2025 10:25:09 +0000 Subject: [PATCH 07/10] Please consider the following formatting changes --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index 87546030d7e..349bfcae38b 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -512,7 +512,7 @@ struct HfTreeCreatorToXiPi { PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLite, "Process data and produce lite table version", false); void processDataLiteWithFT0M(MyEventTableWithFT0M const& collisions, MyTrackTable const&, - soa::Join const& candidates) + soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -529,7 +529,7 @@ struct HfTreeCreatorToXiPi { PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithFT0M, "Process data and produce lite table version with FT0M", false); void processDataLiteWithFT0C(MyEventTableWithFT0C const& collisions, MyTrackTable const&, - soa::Join const& candidates) + soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -546,7 +546,7 @@ struct HfTreeCreatorToXiPi { PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataLiteWithFT0C, "Process data and produce lite table version with FT0C", false); void processDataLiteWithNTracksPV(MyEventTableWithNTracksPV const& collisions, MyTrackTable const&, - soa::Join const& candidates) + soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -580,7 +580,7 @@ struct HfTreeCreatorToXiPi { PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0, "Process MC and produce lite table version for xic0", false); void processMcLiteXic0WithFT0C(MyEventTableWithFT0C const& collisions, MyTrackTable const&, - soa::Join const& candidates) + soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -597,7 +597,7 @@ struct HfTreeCreatorToXiPi { PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithFT0C, "Process MC and produce lite table version for Xic0 with FT0C", false); void processMcLiteXic0WithFT0M(MyEventTableWithFT0M const& collisions, MyTrackTable const&, - soa::Join const& candidates) + soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -613,9 +613,8 @@ struct HfTreeCreatorToXiPi { } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithFT0M, "Process MC and produce lite table version for Xic0 with FT0M", false); - void processMcLiteXic0WithNTracksPV(MyEventTableWithNTracksPV const& collisions, MyTrackTable const&, - soa::Join const& candidates) + soa::Join const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -631,7 +630,6 @@ struct HfTreeCreatorToXiPi { } PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcLiteXic0WithNTracksPV, "Process MC and produce lite table version for Xic0 with NTracksPV", false); - void processMcLiteOmegac0(MyEventTable const& collisions, MyTrackTable const&, soa::Join const& candidates) { From f66cdb0036baae004e1850da90142569556a4ee5 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:44:49 +0800 Subject: [PATCH 08/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index 349bfcae38b..e46e5b138e2 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -366,7 +366,7 @@ struct HfTreeCreatorToXiPi { float centrality = -999.f; if constexpr (useCentrality) { auto const& collision = candidate.template collision_as(); - centrality = o2::hf_centrality::getCentralityPercentile(collision); + centrality = o2::hf_centrality::getCentralityColl(collision); } rowCandidateLite( From c4d74cf30baceb35013a4f5cde25df34bf455b97 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 4 Apr 2025 20:56:25 +0800 Subject: [PATCH 09/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index e46e5b138e2..acf20f800e0 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -153,7 +153,7 @@ DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV", full::IsEventSel8, full::IsEventSelZ); DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", - full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, + full::XPv, full::YPv, full::ZPv, full::Centrality, collision::NumContrib, collision::Chi2, full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon, full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade, full::XDecayVtxV0, full::YDecayVtxV0, full::ZDecayVtxV0, @@ -246,10 +246,18 @@ struct HfTreeCreatorToXiPi { template void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched) { + + float centrality = -999.f; + if constexpr (useCentrality) { + auto const& collision = candidate.template collision_as(); + centrality = o2::hf_centrality::getCentralityColl(collision); + } + rowCandidateFull( candidate.xPv(), candidate.yPv(), candidate.zPv(), + centrality, candidate.template collision_as().numContrib(), candidate.template collision_as().chi2(), candidate.xDecayVtxCharmBaryon(), From 440ef0f8a749ee6f0afd07dafd4fe38456c6014f Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:26:17 +0800 Subject: [PATCH 10/10] Update treeCreatorToXiPi.cxx --- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index acf20f800e0..f19642f5151 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -246,7 +246,7 @@ struct HfTreeCreatorToXiPi { template void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched) { - + float centrality = -999.f; if constexpr (useCentrality) { auto const& collision = candidate.template collision_as();