diff --git a/PWGLF/DataModel/LFSpinAlignVecMesonTables.h b/PWGLF/DataModel/LFSpinAlignVecMesonTables.h index 10ad0207c54..216b58122a4 100644 --- a/PWGLF/DataModel/LFSpinAlignVecMesonTables.h +++ b/PWGLF/DataModel/LFSpinAlignVecMesonTables.h @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file LFSpinAlignVecMesonTables.h -/// \brief Derived-data tables for K*0 and phi spin-alignment studies +/// \brief Derived-data tables for K*0 and phi spin-alignment studies (tracks only: the K*0 and phi pairs are built in the analysis) #ifndef PWGLF_DATAMODEL_LFSPINALIGNVECMESONTABLES_H_ #define PWGLF_DATAMODEL_LFSPINALIGNVECMESONTABLES_H_ @@ -22,11 +22,13 @@ #include #include +#include +#include #include namespace o2::aod { -DECLARE_SOA_TABLE(SpinAlignEvents, "AOD", "SAVMEVENT", +DECLARE_SOA_TABLE(SpinAlignEvents, "AOD", "SPINALIGNEVENT", o2::soa::Index<>, bc::RunNumber, collision::PosZ, @@ -40,85 +42,52 @@ DECLARE_SOA_TABLE(SpinAlignEvents, "AOD", "SAVMEVENT", epcalibrationtable::QTPC); using SpinAlignEvent = SpinAlignEvents::iterator; -namespace savmcand +namespace savmtrack { DECLARE_SOA_INDEX_COLUMN(SpinAlignEvent, spinAlignEvent); -DECLARE_SOA_COLUMN(Mass, mass, float); -DECLARE_SOA_COLUMN(Px, px, float); -DECLARE_SOA_COLUMN(Py, py, float); -DECLARE_SOA_COLUMN(Pz, pz, float); -DECLARE_SOA_COLUMN(PosPx, posPx, float); -DECLARE_SOA_COLUMN(PosPy, posPy, float); -DECLARE_SOA_COLUMN(PosPz, posPz, float); -DECLARE_SOA_COLUMN(PosTPCNSigma, posTPCNSigma, float); -DECLARE_SOA_COLUMN(PosTOFNSigma, posTOFNSigma, float); -DECLARE_SOA_COLUMN(PosHasTOF, posHasTOF, bool); -DECLARE_SOA_COLUMN(NegPx, negPx, float); -DECLARE_SOA_COLUMN(NegPy, negPy, float); -DECLARE_SOA_COLUMN(NegPz, negPz, float); -DECLARE_SOA_COLUMN(NegTPCNSigma, negTPCNSigma, float); -DECLARE_SOA_COLUMN(NegTOFNSigma, negTOFNSigma, float); -DECLARE_SOA_COLUMN(NegHasTOF, negHasTOF, bool); -DECLARE_SOA_COLUMN(Flavour, flavour, int8_t); -} // namespace savmcand - -DECLARE_SOA_TABLE(SAKstarCands, "AOD", "SAKSTARCAND", - o2::soa::Index<>, - savmcand::SpinAlignEventId, - savmcand::Flavour, - savmcand::Mass, - savmcand::Px, - savmcand::Py, - savmcand::Pz, - savmcand::PosPx, - savmcand::PosPy, - savmcand::PosPz, - savmcand::NegPx, - savmcand::NegPy, - savmcand::NegPz, - savmcand::PosTPCNSigma, - savmcand::PosTOFNSigma, - savmcand::PosHasTOF, - savmcand::NegTPCNSigma, - savmcand::NegTOFNSigma, - savmcand::NegHasTOF); -using SAKstarCand = SAKstarCands::iterator; +// Compact storage (the table is the bulk of the derived data): +// - momentum components keep MomentumMantissaBits of the 23 float mantissa bits (relative precision 6e-5, far below +// the tracking resolution), which makes them compress much better; +// - n-sigma values are stored as int8 in steps of 0.1, rounded away from zero, so that |stored| <= cut is the same +// as |n-sigma| <= cut for every cut on the 0.1 grid (2.0, 2.5, 3.0, ...). Range +-12.7. +constexpr int MomentumMantissaBits = 14; -DECLARE_SOA_TABLE(SAPhiCands, "AOD", "SAPHICAND", - o2::soa::Index<>, - savmcand::SpinAlignEventId, - savmcand::Mass, - savmcand::Px, - savmcand::Py, - savmcand::Pz, - savmcand::PosPx, - savmcand::PosPy, - savmcand::PosPz, - savmcand::NegPx, - savmcand::NegPy, - savmcand::NegPz, - savmcand::PosTPCNSigma, - savmcand::PosTOFNSigma, - savmcand::PosHasTOF, - savmcand::NegTPCNSigma, - savmcand::NegTOFNSigma, - savmcand::NegHasTOF); -using SAPhiCand = SAPhiCands::iterator; +inline float truncateMomentum(float value) +{ + constexpr uint32_t Mask = ~((1u << (23 - MomentumMantissaBits)) - 1u); + return std::bit_cast(std::bit_cast(value) & Mask); +} -namespace savmtrack +inline int8_t packNSigma(float nSigma) { -DECLARE_SOA_INDEX_COLUMN(SpinAlignEvent, spinAlignEvent); -DECLARE_SOA_COLUMN(Px, px, float); -DECLARE_SOA_COLUMN(Py, py, float); -DECLARE_SOA_COLUMN(Pz, pz, float); + constexpr float Steps = 10.f; + constexpr float MaxSteps = 127.f; + const float steps = std::ceil(std::abs(nSigma) * Steps); + if (!(steps < MaxSteps)) { // also catches NaN and infinity + return static_cast(nSigma < 0.f ? -MaxSteps : MaxSteps); + } + return static_cast(nSigma < 0.f ? -steps : steps); +} + +DECLARE_SOA_COLUMN(Px, px, float); //! truncated to MomentumMantissaBits +DECLARE_SOA_COLUMN(Py, py, float); //! truncated to MomentumMantissaBits +DECLARE_SOA_COLUMN(Pz, pz, float); //! truncated to MomentumMantissaBits DECLARE_SOA_COLUMN(Sign, sign, int8_t); -DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, float); -DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, float); -DECLARE_SOA_COLUMN(TOFNSigmaKa, tofNSigmaKa, float); -DECLARE_SOA_COLUMN(TOFNSigmaPi, tofNSigmaPi, float); +DECLARE_SOA_COLUMN(TPCNSigmaKa10, tpcNSigmaKa10, int8_t); //! TPC n-sigma (kaon) x 10, see packNSigma +DECLARE_SOA_COLUMN(TPCNSigmaPi10, tpcNSigmaPi10, int8_t); //! TPC n-sigma (pion) x 10 +DECLARE_SOA_COLUMN(TOFNSigmaKa10, tofNSigmaKa10, int8_t); //! TOF n-sigma (kaon) x 10 +DECLARE_SOA_COLUMN(TOFNSigmaPi10, tofNSigmaPi10, int8_t); //! TOF n-sigma (pion) x 10 DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); DECLARE_SOA_COLUMN(IsKaon, isKaon, bool); DECLARE_SOA_COLUMN(IsPion, isPion, bool); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa, tpcNSigmaKa, //! TPC n-sigma (kaon) + [](int8_t tpcNSigmaKa10) { return static_cast(tpcNSigmaKa10) / 10.f; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, //! TPC n-sigma (pion) + [](int8_t tpcNSigmaPi10) { return static_cast(tpcNSigmaPi10) / 10.f; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaKa, tofNSigmaKa, //! TOF n-sigma (kaon) + [](int8_t tofNSigmaKa10) { return static_cast(tofNSigmaKa10) / 10.f; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPi, tofNSigmaPi, //! TOF n-sigma (pion) + [](int8_t tofNSigmaPi10) { return static_cast(tofNSigmaPi10) / 10.f; }); } // namespace savmtrack DECLARE_SOA_TABLE(SAVMTracks, "AOD", "SAVMTRACK", @@ -128,13 +97,17 @@ DECLARE_SOA_TABLE(SAVMTracks, "AOD", "SAVMTRACK", savmtrack::Py, savmtrack::Pz, savmtrack::Sign, - savmtrack::TPCNSigmaKa, - savmtrack::TPCNSigmaPi, - savmtrack::TOFNSigmaKa, - savmtrack::TOFNSigmaPi, + savmtrack::TPCNSigmaKa10, + savmtrack::TPCNSigmaPi10, + savmtrack::TOFNSigmaKa10, + savmtrack::TOFNSigmaPi10, savmtrack::HasTOF, savmtrack::IsKaon, - savmtrack::IsPion); + savmtrack::IsPion, + savmtrack::TPCNSigmaKa, + savmtrack::TPCNSigmaPi, + savmtrack::TOFNSigmaKa, + savmtrack::TOFNSigmaPi); using SAVMTrack = SAVMTracks::iterator; } // namespace o2::aod diff --git a/PWGLF/TableProducer/Resonances/spinAlignVecMesonTable.cxx b/PWGLF/TableProducer/Resonances/spinAlignVecMesonTable.cxx index 19f50a9974a..62c9087a478 100644 --- a/PWGLF/TableProducer/Resonances/spinAlignVecMesonTable.cxx +++ b/PWGLF/TableProducer/Resonances/spinAlignVecMesonTable.cxx @@ -10,7 +10,8 @@ // or submit itself to any jurisdiction. /// \file spinAlignVecMesonTable.cxx -/// \brief Derived-data producer for K*0 and phi spin alignment +/// \brief Derived-data producer for K*0 and phi spin alignment: selected events and their kaon and pion tracks. +/// The K*0 and phi candidates are built from these tracks in the analysis (kstarpbpb). #include "PWGLF/DataModel/EPCalibrationTables.h" #include "PWGLF/DataModel/LFSpinAlignVecMesonTables.h" @@ -24,7 +25,6 @@ #include "Common/DataModel/TrackSelectionTables.h" #include -#include #include #include #include @@ -35,9 +35,6 @@ #include #include -#include // IWYU pragma: keep -#include - #include #include #include @@ -50,8 +47,6 @@ using namespace o2::aod::rctsel; struct SpinAlignVecMesonTable { Produces eventTable; - Produces kstarTable; - Produces phiTable; Produces trackTable; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Maximum |Vz| (cm)"}; @@ -74,32 +69,20 @@ struct SpinAlignVecMesonTable { Configurable cfgNSigmaTOFPi{"cfgNSigmaTOFPi", 3.0f, "Pion: maximum |n-sigma TOF|"}; Configurable cfgRequireTOF{"cfgRequireTOF", false, "Require a TOF hit above cfgPtTOFRequired"}; Configurable cfgPtTOFRequired{"cfgPtTOFRequired", 0.5f, "pT (GeV/c) above which TOF is required"}; - - Configurable cfgKstarMassMin{"cfgKstarMassMin", 0.70f, "Minimum K pi mass (GeV/c^2)"}; - Configurable cfgKstarMassMax{"cfgKstarMassMax", 1.10f, "Maximum K pi mass (GeV/c^2)"}; - Configurable cfgPhiMassMin{"cfgPhiMassMin", 0.99f, "Minimum K K mass (GeV/c^2)"}; - Configurable cfgPhiMassMax{"cfgPhiMassMax", 1.07f, "Maximum K K mass (GeV/c^2)"}; - Configurable cfgPairRapidity{"cfgPairRapidity", 0.5f, "Maximum pair |y|"}; - Configurable cfgStoreTracks{"cfgStoreTracks", true, "Store the selected single kaon and pion tracks (SAVMTracks), needed for the v2 like-sign and mixed-event pairs (not for rho00)"}; + Configurable cfgStorePions{"cfgStorePions", true, "Store pion tracks (needed for K*0); false gives a phi-only production with kaon tracks only"}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; RCTFlagsChecker rctChecker; - static constexpr double MassKa = o2::constants::physics::MassKaonCharged; - static constexpr double MassPi = o2::constants::physics::MassPionCharged; - void init(InitContext&) { rctChecker.init(cfgRCTLabel.value, false, true); histos.add("hEvents", "Number of events;;Events", kTH1F, {{2, 0.0f, 2.0f}}); histos.add("hCent", "Selected events;FT0C centrality (%);Events", kTH1F, {{100, 0.0f, 100.0f}}); - histos.add("hKstarMass", "K* candidates;M_{K#pi} (GeV/c^{2});Counts", kTH1F, {{200, 0.6f, 1.2f}}); - histos.add("hPhiMass", "#phi candidates;M_{KK} (GeV/c^{2});Counts", kTH1F, {{200, 0.98f, 1.08f}}); histos.add("hPsiFT0C", "Selected events;FT0C centrality (%);#Psi_{2}^{FT0C}", kTH2F, {{8, 0.0f, 80.0f}, {100, -o2::constants::math::PIHalf, o2::constants::math::PIHalf}}); - if (cfgStoreTracks) { - histos.add("hNTracks", "Stored kaon/pion tracks per event;N_{tracks};Events", kTH1F, {{500, 0.0f, 2000.0f}}); - } + histos.add("hNKaons", "Stored kaon tracks per event;N_{K};Events", kTH1F, {{500, 0.0f, 1000.0f}}); + histos.add("hNPions", "Stored pion tracks per event;N_{#pi};Events", kTH1F, {{500, 0.0f, 2000.0f}}); } Filter vertexFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -190,14 +173,6 @@ struct SpinAlignVecMesonTable { return true; } - template - ROOT::Math::PxPyPzMVector makePair(T const& pos, double massPos, T const& neg, double massNeg) - { - ROOT::Math::PxPyPzMVector p4Pos(pos.px(), pos.py(), pos.pz(), massPos); - ROOT::Math::PxPyPzMVector p4Neg(neg.px(), neg.py(), neg.pz(), massNeg); - return p4Pos + p4Neg; - } - void processData(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCsWithTimestamps const&) @@ -216,80 +191,32 @@ struct SpinAlignVecMesonTable { collision.qFT0C(), collision.qFT0A(), collision.qTPC()); auto eventIndex = eventTable.lastIndex(); - if (cfgStoreTracks) { - int nStored = 0; - for (const auto& track : tracks) { - if (track.sign() == 0 || !isGoodTrack(track)) { - continue; - } - const bool kaon = isKaon(track); - const bool pion = isPion(track); - if (!kaon && !pion) { - continue; - } - trackTable(eventIndex, track.px(), track.py(), track.pz(), static_cast(track.sign()), - track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPi(), - track.hasTOF(), kaon, pion); - ++nStored; - } - histos.fill(HIST("hNTracks"), nStored); - } - - for (const auto& pos : tracks) { - if (pos.sign() <= 0 || !isGoodTrack(pos)) { + int nKaons = 0; + int nPions = 0; + for (const auto& track : tracks) { + if (track.sign() == 0 || !isGoodTrack(track)) { continue; } - - for (const auto& neg : tracks) { - if (neg.sign() >= 0 || !isGoodTrack(neg)) { - continue; - } - - if (isKaon(pos) && isKaon(neg)) { - auto phi = makePair(pos, MassKa, neg, MassKa); - float mass = phi.M(); - if (mass > cfgPhiMassMin && mass < cfgPhiMassMax && std::abs(phi.Rapidity()) < cfgPairRapidity) { - phiTable(eventIndex, mass, - static_cast(phi.Px()), static_cast(phi.Py()), static_cast(phi.Pz()), - pos.px(), pos.py(), pos.pz(), - neg.px(), neg.py(), neg.pz(), - pos.tpcNSigmaKa(), pos.tofNSigmaKa(), pos.hasTOF(), - neg.tpcNSigmaKa(), neg.tofNSigmaKa(), neg.hasTOF()); - histos.fill(HIST("hPhiMass"), mass); - } - } - - if (isKaon(pos) && isPion(neg)) { - auto kstar = makePair(pos, MassKa, neg, MassPi); - float mass = kstar.M(); - if (mass > cfgKstarMassMin && mass < cfgKstarMassMax && std::abs(kstar.Rapidity()) < cfgPairRapidity) { - kstarTable(eventIndex, static_cast(1), mass, - static_cast(kstar.Px()), static_cast(kstar.Py()), static_cast(kstar.Pz()), - pos.px(), pos.py(), pos.pz(), - neg.px(), neg.py(), neg.pz(), - pos.tpcNSigmaKa(), pos.tofNSigmaKa(), pos.hasTOF(), - neg.tpcNSigmaPi(), neg.tofNSigmaPi(), neg.hasTOF()); - histos.fill(HIST("hKstarMass"), mass); - } - } - - if (isPion(pos) && isKaon(neg)) { - auto kstar = makePair(pos, MassPi, neg, MassKa); - float mass = kstar.M(); - if (mass > cfgKstarMassMin && mass < cfgKstarMassMax && std::abs(kstar.Rapidity()) < cfgPairRapidity) { - kstarTable(eventIndex, static_cast(-1), mass, - static_cast(kstar.Px()), static_cast(kstar.Py()), static_cast(kstar.Pz()), - pos.px(), pos.py(), pos.pz(), - neg.px(), neg.py(), neg.pz(), - pos.tpcNSigmaPi(), pos.tofNSigmaPi(), pos.hasTOF(), - neg.tpcNSigmaKa(), neg.tofNSigmaKa(), neg.hasTOF()); - histos.fill(HIST("hKstarMass"), mass); - } - } + const bool kaon = isKaon(track); + const bool pion = cfgStorePions && isPion(track); + if (!kaon && !pion) { + continue; } - } + // compact storage (see LFSpinAlignVecMesonTables.h): truncated momentum, n-sigma x 10 as int8; + // the kaon/pion flags above use the full-precision n-sigma + trackTable(eventIndex, + aod::savmtrack::truncateMomentum(track.px()), aod::savmtrack::truncateMomentum(track.py()), aod::savmtrack::truncateMomentum(track.pz()), + static_cast(track.sign()), + aod::savmtrack::packNSigma(track.tpcNSigmaKa()), aod::savmtrack::packNSigma(track.tpcNSigmaPi()), + aod::savmtrack::packNSigma(track.tofNSigmaKa()), aod::savmtrack::packNSigma(track.tofNSigmaPi()), + track.hasTOF(), kaon, pion); + nKaons += kaon; + nPions += pion; + } + histos.fill(HIST("hNKaons"), nKaons); + histos.fill(HIST("hNPions"), nPions); } - PROCESS_SWITCH(SpinAlignVecMesonTable, processData, "Fill K* and phi derived tables", true); + PROCESS_SWITCH(SpinAlignVecMesonTable, processData, "Fill the event and kaon/pion track tables", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Resonances/kstarpbpb.cxx b/PWGLF/Tasks/Resonances/kstarpbpb.cxx index a938143c0ba..78590b7533f 100644 --- a/PWGLF/Tasks/Resonances/kstarpbpb.cxx +++ b/PWGLF/Tasks/Resonances/kstarpbpb.cxx @@ -2562,43 +2562,69 @@ struct Kstarpbpb { } } - template - MomDaughter getPosDaughter(const TCand& cand) - { - return {cand.posPx(), cand.posPy(), cand.posPz(), cand.posTPCNSigma(), cand.posTOFNSigma(), cand.posHasTOF()}; - } + // One stored track of the event, with its kaon and pion PID as the derived analysis accepts them: the producer flag + // (isKaon/isPion, the PID at production) and passDerivedPID (the tighter candidate.nSigmaTPC/TOF cuts) + struct DerivedTrack { + MomDaughter asKaon; + MomDaughter asPion; + bool isKaon; + bool isPion; + }; - template - MomDaughter getNegDaughter(const TCand& cand) - { - return {cand.negPx(), cand.negPy(), cand.negPz(), cand.negTPCNSigma(), cand.negTOFNSigma(), cand.negHasTOF()}; - } + struct DerivedTracks { + std::vector pos; + std::vector neg; + }; - template - void forEachDerivedCand(const TCands& cands, const F& f) + template + DerivedTracks splitDerivedTracks(const TTracks& tracks) { - ROOT::Math::PxPyPzMVector mother; - for (const auto& cand : cands) { - const auto pos = getPosDaughter(cand); - const auto neg = getNegDaughter(cand); - if (!passDerivedPID(pos) || !passDerivedPID(neg)) { + DerivedTracks split; + for (const auto& track : tracks) { + DerivedTrack t{.asKaon = {track.px(), track.py(), track.pz(), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.hasTOF()}, + .asPion = {track.px(), track.py(), track.pz(), track.tpcNSigmaPi(), track.tofNSigmaPi(), track.hasTOF()}, + .isKaon = false, + .isPion = false}; + t.isKaon = track.isKaon() && passDerivedPID(t.asKaon); + t.isPion = track.isPion() && passDerivedPID(t.asPion); + if (!t.isKaon && !t.isPion) { continue; } - if constexpr (IsPhi) { - if (makeCandPair(pos.px, pos.py, pos.pz, neg.px, neg.py, neg.pz, mother)) { - f(mother, ROOT::Math::PxPyPzMVector(neg.px, neg.py, neg.pz, MassKa)); - } + if (track.sign() > 0) { + split.pos.push_back(t); } else { - const auto& kaon = cand.flavour() > 0 ? pos : neg; - const auto& pion = cand.flavour() > 0 ? neg : pos; - if (makeCandPair(kaon.px, kaon.py, kaon.pz, pion.px, pion.py, pion.pz, mother)) { - f(mother, ROOT::Math::PxPyPzMVector(kaon.px, kaon.py, kaon.pz, MassKa)); + split.neg.push_back(t); + } + } + return split; + } + + // Unlike-sign candidates of one event, built from its stored tracks in the same way and order as the pair producer: + // phi = K+ K-, K*0 = K+ pi- and anti-K*0 = pi+ K- (a track that passes both PIDs enters both K* orientations). + // f(mother, daughter) gets the kaon (K*) or the K- (phi), the daughter used for cos(theta*). + template + void forEachDerivedCand(const DerivedTracks& tracks, const F& f) + { + ROOT::Math::PxPyPzMVector mother; + for (const auto& pos : tracks.pos) { + for (const auto& neg : tracks.neg) { + if constexpr (IsPhi) { + if (pos.isKaon && neg.isKaon && makeCandPair(pos.asKaon.px, pos.asKaon.py, pos.asKaon.pz, neg.asKaon.px, neg.asKaon.py, neg.asKaon.pz, mother)) { + f(mother, ROOT::Math::PxPyPzMVector(neg.asKaon.px, neg.asKaon.py, neg.asKaon.pz, MassKa)); + } + } else { + if (pos.isKaon && neg.isPion && makeCandPair(pos.asKaon.px, pos.asKaon.py, pos.asKaon.pz, neg.asPion.px, neg.asPion.py, neg.asPion.pz, mother)) { + f(mother, ROOT::Math::PxPyPzMVector(pos.asKaon.px, pos.asKaon.py, pos.asKaon.pz, MassKa)); + } + if (pos.isPion && neg.isKaon && makeCandPair(neg.asKaon.px, neg.asKaon.py, neg.asKaon.pz, pos.asPion.px, pos.asPion.py, pos.asPion.pz, mother)) { + f(mother, ROOT::Math::PxPyPzMVector(neg.asKaon.px, neg.asKaon.py, neg.asKaon.pz, MassKa)); + } } } } } - void processMomentDerivedSE(aod::SpinAlignEvent const& event, aod::SAKstarCands const& kstars, aod::SAPhiCands const& phis) + void processMomentDerivedSE(aod::SpinAlignEvent const& event, aod::SAVMTracks const& tracks) { const double psiSA = getSAEventAngle(event.psiFT0C()); const double centrality = event.centFT0C(); @@ -2606,10 +2632,11 @@ struct Kstarpbpb { histos.fill(HIST("moment/ResFT0CTPC"), centrality, std::cos(2.0 * (event.psiFT0C() - event.psiTPC()))); histos.fill(HIST("moment/ResFT0CFT0A"), centrality, std::cos(2.0 * (event.psiFT0C() - event.psiFT0A()))); histos.fill(HIST("moment/ResFT0ATPC"), centrality, std::cos(2.0 * (event.psiTPC() - event.psiFT0A()))); - forEachDerivedCand(kstars, [&](const auto& mother, const auto& daughter) { + const auto split = splitDerivedTracks(tracks); + forEachDerivedCand(split, [&](const auto& mother, const auto& daughter) { fillMoments(mother.M(), mother.Pt(), centrality, kMomSEUnlike, subsample, getCosThetaStar(mother, daughter, getSAAxis(mother, psiSA))); }); - forEachDerivedCand(phis, [&](const auto& mother, const auto& daughter) { + forEachDerivedCand(split, [&](const auto& mother, const auto& daughter) { fillMoments(mother.M(), mother.Pt(), centrality, kMomSEUnlike, subsample, getCosThetaStar(mother, daughter, getSAAxis(mother, psiSA))); }); } @@ -2648,8 +2675,7 @@ struct Kstarpbpb { static constexpr int64_t ReplCellStride = 4096; static constexpr double ReplEtaOffset = 10.0; - PresliceOptional kstarPerEventDerived = aod::savmcand::spinAlignEventId; - PresliceOptional phiPerEventDerived = aod::savmcand::spinAlignEventId; + PresliceOptional trackPerEventDerived = aod::savmtrack::spinAlignEventId; int64_t getReplCell(double pt, double eta, double phi) { @@ -2858,7 +2884,7 @@ struct Kstarpbpb { } PROCESS_SWITCH(Kstarpbpb, processMCClosureReplacementMEPhi, "rho00 phi MC closure: replacement ME of the test sample with injected weights (sample 1), plane correlation hXD and hXC", false); - void processMomentDerivedMERepl(aod::SpinAlignEvents const& events, aod::SAKstarCands const& kstars, aod::SAPhiCands const& phis) + void processMomentDerivedMERepl(aod::SpinAlignEvents const& events, aod::SAVMTracks const& tracks) { BinningTypeRepl binning{{moment.replAxisVertex, moment.axisCentrality}, true}; std::vector pools(binning.getAllBinsCount()); @@ -2871,10 +2897,11 @@ struct Kstarpbpb { event.index = ev.globalIndex(); event.psi = getSAEventAngle(ev.psiFT0C()); event.centrality = ev.centFT0C(); - forEachDerivedCand(kstars.sliceBy(kstarPerEventDerived, ev.globalIndex()), [&](const auto& mother, const auto& daughter) { + const auto split = splitDerivedTracks(tracks.sliceBy(trackPerEventDerived, ev.globalIndex())); + forEachDerivedCand(split, [&](const auto& mother, const auto& daughter) { addReplCand(event, mother, daughter); }); - forEachDerivedCand(phis.sliceBy(phiPerEventDerived, ev.globalIndex()), [&](const auto& mother, const auto& daughter) { + forEachDerivedCand(split, [&](const auto& mother, const auto& daughter) { addReplCand(event, mother, daughter); }); mixReplacement(event, pools[bin]); @@ -2902,7 +2929,6 @@ struct Kstarpbpb { }; using BinningTypeV2Derived = ColumnBinningPolicy; - PresliceOptional trackPerEventV2 = aod::savmtrack::spinAlignEventId; template V2Event buildV2Event(const TEvent& event, const TTracks& tracks) @@ -3001,7 +3027,7 @@ struct Kstarpbpb { } } - void processV2DerivedSE(aod::SpinAlignEvent const& event, aod::SAKstarCands const& kstars, aod::SAPhiCands const& phis, aod::SAVMTracks const& tracks) + void processV2DerivedSE(aod::SpinAlignEvent const& event, aod::SAVMTracks const& tracks) { const double centrality = event.centFT0C(); const double psi = event.psiFT0C(); @@ -3010,10 +3036,11 @@ struct Kstarpbpb { histos.fill(HIST("v2derived/ResFT0CFT0ASP"), centrality, event.qFT0C() * event.qFT0A() * std::cos(2.0 * (event.psiFT0C() - event.psiFT0A()))); histos.fill(HIST("v2derived/ResFT0ATPCSP"), centrality, event.qFT0A() * event.qTPC() * std::cos(2.0 * (event.psiFT0A() - event.psiTPC()))); - forEachDerivedCand(kstars, [&](const auto& mother, const auto&) { + const auto split = splitDerivedTracks(tracks); + forEachDerivedCand(split, [&](const auto& mother, const auto&) { histos.fill(HIST("v2derived/kstar/hSEUnlike"), mother.M(), mother.Pt(), q * std::cos(2.0 * (mother.Phi() - psi)), centrality); }); - forEachDerivedCand(phis, [&](const auto& mother, const auto&) { + forEachDerivedCand(split, [&](const auto& mother, const auto&) { histos.fill(HIST("v2derived/phi/hSEUnlike"), mother.M(), mother.Pt(), q * std::cos(2.0 * (mother.Phi() - psi)), centrality); }); @@ -3030,7 +3057,7 @@ struct Kstarpbpb { if (bin < 0) { continue; } - auto tracksThisEvent = tracks.sliceBy(trackPerEventV2, event.globalIndex()); + auto tracksThisEvent = tracks.sliceBy(trackPerEventDerived, event.globalIndex()); V2Event current = buildV2Event(event, tracksThisEvent); for (const auto& previous : pools[bin]) { histos.fill(HIST("v2derived/hMixedEventPairs"), current.centrality);