From 62654f5a5cc8fbc8bab36e67a73ce4d4cc68a5d1 Mon Sep 17 00:00:00 2001 From: Anoop1379 Date: Thu, 8 Oct 2026 00:05:37 +0530 Subject: [PATCH] LambdaProtonBalanceFunction-Update 5 --- .../Tasks/lambdaProtonBalanceFunction.cxx | 458 ++++++------------ 1 file changed, 157 insertions(+), 301 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaProtonBalanceFunction.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaProtonBalanceFunction.cxx index f6b7b71026f..8fe2fd62647 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaProtonBalanceFunction.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaProtonBalanceFunction.cxx @@ -76,12 +76,8 @@ float displayDeltaPhi(float dPhi) // Per-centrality-bin histogram set. Defined at file scope (NOT inside the task struct), // otherwise O2's struct reflection in adaptAnalysisTask fails to compile. struct CentRho2Set { - // eta space (only booked if cFillEtaSpace && cFillCentEtaSpace) - std::shared_ptr Lp, LAp, ALp, ALAp, pp, pAp, App, ApAp, LL, LAL, ALL, ALAL; // y space std::shared_ptr Lp_y, LAp_y, ALp_y, ALAp_y, pp_y, pAp_y, App_y, ApAp_y, LL_y, LAL_y, ALL_y, ALAL_y; - // rho1 eta - std::shared_ptr rho1_Proton, rho1_AntiProton, rho1_Lambda, rho1_AntiLambda; // rho1 y std::shared_ptr rho1_Proton_y, rho1_AntiProton_y, rho1_Lambda_y, rho1_AntiLambda_y; // event counter @@ -124,7 +120,7 @@ struct LambdaProtonBalanceFunction { // ConfigurableAxis, Filter, HistogramRegistry): those must remain top-level. // ════════════════════════════════════════════════════════════════════════ struct TaskState { - // pT bins 0.6 → 3.6 in steps of 0.2 (used for per-bin rho2 / mass histograms) + // pT bins 0.6 → 3.6 in steps of 0.2 (used for per-bin pT-spectra / mass histograms) std::vector ptEdges; // ════════════════════════════════════════════════════════════════════════ @@ -147,32 +143,8 @@ struct LambdaProtonBalanceFunction { std::vector>> hMassAntiLambdaExtended; // ════════════════════════════════════════════════════════════════════════ - // SECTION B — rho2 eta-space histograms - // Naming: hRho2_ = per-pT-bin vector - // hRho2__AllPt = merged (full pT range as - // set by the pT cuts: protons 0.5-3.6, Lambdas 0.6-3.6 GeV/c; - // "015" is a legacy name and does NOT reflect the actual lower cut) - // ════════════════════════════════════════════════════════════════════════ - // Lambda–proton family - std::shared_ptr hRho2_Lp_AllPt; - std::shared_ptr hRho2_LAp_AllPt; - std::shared_ptr hRho2_ALp_AllPt; - std::shared_ptr hRho2_ALAp_AllPt; - // Proton–proton family - std::shared_ptr hRho2_pp_AllPt; - std::shared_ptr hRho2_pAp_AllPt; - std::shared_ptr hRho2_App_AllPt; - std::shared_ptr hRho2_ApAp_AllPt; - // Lambda–Lambda family - std::shared_ptr hRho2_LL_AllPt; - std::shared_ptr hRho2_LAL_AllPt; - std::shared_ptr hRho2_ALL_AllPt; - std::shared_ptr hRho2_ALAL_AllPt; - - // ════════════════════════════════════════════════════════════════════════ - // SECTION C — rho2 rapidity-space histograms - // Same channels as Section B but filled with unrolledIndexY(y, phi) - // Naming: hRho2__y / hRho2__y_AllPt + // SECTION C — rho2 rapidity-space histograms, filled with unrolledIndexY(y, phi). + // Naming: hRho2__y_AllPt. // ════════════════════════════════════════════════════════════════════════ // Lambda–proton family (y) std::shared_ptr hRho2_Lp_y_AllPt; @@ -224,13 +196,9 @@ struct LambdaProtonBalanceFunction { // Runtime copies populated from Configurables in init(). // Not static, not constexpr — values are known only after O2 delivers the config. - int mRhoEtaBins = 0; int mRhoPhiBins = 0; int mRhoYBins = 0; - int mRhoUnrolledBins = 0; // mRhoEtaBins * mRhoPhiBins int mRhoUnrolledBinsY = 0; // mRhoYBins * mRhoPhiBins - float mRhoEtaMin = 0.f; - float mRhoEtaMax = 0.f; float mRhoYMin = 0.f; float mRhoYMax = 0.f; }; @@ -242,7 +210,6 @@ struct LambdaProtonBalanceFunction { // ── Configurables ───────────────────────────────────────────────────── Configurable cPPandV0ZVertexCut{"cPPandV0ZVertexCut", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable cFillEtaSpace{"cFillEtaSpace", false, "Fill eta-space rho1/rho2 histograms"}; Configurable cUseQinvCut{"cUseQinvCut", false, "Apply q_inv > cQinvCutValue pair cut (false = no q_inv rejection)"}; Configurable cQinvCutValue{"cQinvCutValue", 0.01f, "q_inv cut value (GeV/c)"}; Configurable cQinvQABins{"cQinvQABins", 6000, "Number of bins for QA q_inv histograms"}; @@ -320,12 +287,9 @@ struct LambdaProtonBalanceFunction { Configurable cV0DauMinTpcCrossedRows{"cV0DauMinTpcCrossedRows", 70, "Daughter TPC min crossed rows"}; // ── Rho1/Rho2 grid — configurable at runtime (Hyperloop-friendly) ──────── // These replace the former static constexpr k* constants. Default values - // reproduce the original hardcoded grid (eta: 40×72, y: 10×72). - Configurable cRhoEtaBins{"cRhoEtaBins", 40, "Number of eta bins for rho1/rho2"}; + // reproduce the original hardcoded grid (y: 10×72). Configurable cRhoPhiBins{"cRhoPhiBins", 72, "Number of phi bins for rho1/rho2"}; Configurable cRhoYBins{"cRhoYBins", 10, "Number of y bins for rho1/rho2"}; - Configurable cRhoEtaMin{"cRhoEtaMin", -0.5f, "Min eta for rho1/rho2"}; - Configurable cRhoEtaMax{"cRhoEtaMax", 0.5f, "Max eta for rho1/rho2"}; Configurable cRhoYMin{"cRhoYMin", -0.5f, "Min y for rho1/rho2"}; Configurable cRhoYMax{"cRhoYMax", 0.5f, "Max y for rho1/rho2"}; // ───────────────────────────────────────────────────────────────────────── @@ -341,15 +305,6 @@ struct LambdaProtonBalanceFunction { } } - int etaBinIndex(float eta) const - { - if (eta < state.mRhoEtaMin || eta >= state.mRhoEtaMax) { - return -1; - } - const float binWidth = (state.mRhoEtaMax - state.mRhoEtaMin) / state.mRhoEtaBins; - return static_cast((eta - state.mRhoEtaMin) / binWidth); - } - int phiBinIndex(float phi) const { constexpr float phiMin = 0.0f; @@ -361,16 +316,6 @@ struct LambdaProtonBalanceFunction { return static_cast((phi - phiMin) / binWidth); } - int unrolledIndex(float eta, float phi) const - { - const int iEta = etaBinIndex(eta); - const int iPhi = phiBinIndex(phi); - if (iEta < 0 || iPhi < 0) { - return -1; - } - return iEta * state.mRhoPhiBins + iPhi; - } - int yBinIndex(float y) const { if (y < state.mRhoYMin || y >= state.mRhoYMax) { @@ -444,6 +389,11 @@ struct LambdaProtonBalanceFunction { return cUseQinvCut.value && (qinv <= cQinvCutValue.value); } + // QA-only: true => pair would survive the q_inv cut, regardless of the cUseQinvCut master switch. + // Used ONLY for the "After_qinvCut" QA histograms so they always show the mathematical effect of the cut. + // Physics logic must keep using failsQinvCut(). + bool passesQinvQA(float qinv) const { return qinv > cQinvCutValue.value; } + // Returns the active centrality estimator's percentile for this collision, // selected at runtime via cUseFT0C (false = FT0M, true = FT0C). template @@ -491,6 +441,30 @@ struct LambdaProtonBalanceFunction { return std::abs(trk.tofNSigmaPr()) < pProtonTOFNsigma.value; } + // Bitmask of contaminant hypotheses that REJECT the track (bit0 = pi, bit1 = K, bit2 = e). + // A hypothesis rejects only if the track is inside its veto window AND closer to it than to the proton. + // Detector: TOF at/above the TPC/TOF switch momentum when TOF is available, TPC otherwise. + template + int contaminantVetoMask(TTrack const& trk, bool& usedTOF) const + { + usedTOF = cVetoUseTOF.value && trk.hasTOF() && trk.tpcInnerParam() >= pProtonTPCTOFSwitchP.value; + const float nsP = std::abs(usedTOF ? trk.tofNSigmaPr() : trk.tpcNSigmaPr()); + const float nsPi = std::abs(usedTOF ? trk.tofNSigmaPi() : trk.tpcNSigmaPi()); + const float nsK = std::abs(usedTOF ? trk.tofNSigmaKa() : trk.tpcNSigmaKa()); + const float nsE = std::abs(usedTOF ? trk.tofNSigmaEl() : trk.tpcNSigmaEl()); + int mask = 0; + if (nsPi < pProtonVetoPionNsigma.value && nsPi < nsP) { + mask |= 1; + } + if (nsK < pProtonVetoKaonNsigma.value && nsK < nsP) { + mask |= 2; + } + if (nsE < pProtonVetoElectronNsigma.value && nsE < nsP) { + mask |= 4; + } + return mask; + } + // true => track survives the pi/K/e contaminant veto template bool passesContaminantVeto(TTrack const& trk) const @@ -498,19 +472,27 @@ struct LambdaProtonBalanceFunction { if (!cUseContaminantVeto.value) { return true; } - if (std::abs(trk.tpcNSigmaPi()) < pProtonVetoPionNsigma.value || - std::abs(trk.tpcNSigmaKa()) < pProtonVetoKaonNsigma.value || - std::abs(trk.tpcNSigmaEl()) < pProtonVetoElectronNsigma.value) { - return false; - } - if (cVetoUseTOF.value && trk.hasTOF()) { - if (std::abs(trk.tofNSigmaPi()) < pProtonVetoPionNsigma.value || - std::abs(trk.tofNSigmaKa()) < pProtonVetoKaonNsigma.value || - std::abs(trk.tofNSigmaEl()) < pProtonVetoElectronNsigma.value) { - return false; - } + bool usedTOF = false; + return contaminantVetoMask(trk, usedTOF) == 0; + } + + // 2D cutflow vs pT only (used directly for the veto-reason bins 16-21) + template + void fillCutFlow2D(float stage, TTrack const& trk) + { + if (trk.sign() > 0) { + registryQaDetector.fill(HIST("Selection/TOF_Matching/h2f_CutFlow_vs_pt_Proton"), trk.pt(), stage); + } else { + registryQaDetector.fill(HIST("Selection/TOF_Matching/h2f_CutFlow_vs_pt_AntiProton"), trk.pt(), stage); } - return true; + } + + // 1D hCutFlow + 2D cutflow (sequential stages 1-15) + template + void fillCutFlow(float stage, TTrack const& trk) + { + registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), stage); + fillCutFlow2D(stage, trk); } // ───────────────────────────────────────────────────────────────────── @@ -777,6 +759,8 @@ struct LambdaProtonBalanceFunction { const float pt = trk.pt(); const float beta = trk.beta(); const float nsTOF = trk.tofNSigmaPr(); + const float nsTPC = trk.tpcNSigmaPr(); + const float radius = std::sqrt(nsTPC * nsTPC + nsTOF * nsTOF); if (stage == ProtonQAStage::RawAfterTrackSel) { if constexpr (IsProton) { registryQaDetector.fill(HIST("Proton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_beta_vs_p"), p, beta); @@ -787,6 +771,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("Proton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/01_RAW_AfterTrackSel/h1f_circular_radius"), radius); } else { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_beta_vs_p"), p, beta); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_beta_vs_pTPC"), pTPC, beta); @@ -796,6 +782,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/01_RAW_AfterTrackSel/h1f_circular_radius"), radius); } } else if (stage == ProtonQAStage::TpcPid) { if constexpr (IsProton) { @@ -807,6 +795,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("Proton/04_TOF_QA/02_TPC_PID/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/02_TPC_PID/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/02_TPC_PID/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/02_TPC_PID/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/02_TPC_PID/h1f_circular_radius"), radius); } else { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h2f_beta_vs_p"), p, beta); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h2f_beta_vs_pTPC"), pTPC, beta); @@ -816,6 +806,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/02_TPC_PID/h1f_circular_radius"), radius); } } else if (stage == ProtonQAStage::TpcTofPid) { if constexpr (IsProton) { @@ -827,6 +819,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("Proton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/03_TPC_TOF_PID/h1f_circular_radius"), radius); } else { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h2f_beta_vs_p"), p, beta); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h2f_beta_vs_pTPC"), pTPC, beta); @@ -836,6 +830,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/03_TPC_TOF_PID/h1f_circular_radius"), radius); } } else { // FinalSelected if constexpr (IsProton) { @@ -847,6 +843,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("Proton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("Proton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("Proton/04_TOF_QA/04_Final_SelectedProton/h1f_circular_radius"), radius); } else { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h2f_beta_vs_p"), p, beta); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h2f_beta_vs_pTPC"), pTPC, beta); @@ -856,6 +854,8 @@ struct LambdaProtonBalanceFunction { registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaPr_vs_pTPC"), pTPC, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaPr_vs_pt"), pt, nsTOF); registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaPr_vs_pTOF"), pTOF, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h2f_nsigmaTPC_vs_nsigmaTOF"), nsTPC, nsTOF); + registryQaDetector.fill(HIST("AntiProton/04_TOF_QA/04_Final_SelectedProton/h1f_circular_radius"), radius); } } } @@ -1200,8 +1200,7 @@ struct LambdaProtonBalanceFunction { struct PartInfo { int64_t gid = 0; float px = 0.f, py = 0.f, pz = 0.f, E = 0.f; - float eta = 0.f, phi = 0.f, y = 0.f, pt = 0.f; - int idxEta = -1; + float phi = 0.f, y = 0.f, pt = 0.f; int idxY = -1; }; @@ -1214,11 +1213,9 @@ struct LambdaProtonBalanceFunction { p.py = t.py(); p.pz = t.pz(); p.E = std::sqrt(p.px * p.px + p.py * p.py + p.pz * p.pz + kMassProton * kMassProton); - p.eta = t.eta(); p.phi = t.phi(); p.pt = t.pt(); p.y = protonRapidity(t); - p.idxEta = unrolledIndex(p.eta, p.phi); p.idxY = unrolledIndexY(p.y, p.phi); return p; } @@ -1226,14 +1223,10 @@ struct LambdaProtonBalanceFunction { void init(InitContext const&) { // ── Populate rho1/rho2 grid members from Configurables ────────────────── - state.mRhoEtaBins = cRhoEtaBins.value; state.mRhoPhiBins = cRhoPhiBins.value; state.mRhoYBins = cRhoYBins.value; - state.mRhoEtaMin = cRhoEtaMin.value; - state.mRhoEtaMax = cRhoEtaMax.value; state.mRhoYMin = cRhoYMin.value; state.mRhoYMax = cRhoYMax.value; - state.mRhoUnrolledBins = state.mRhoEtaBins * state.mRhoPhiBins; state.mRhoUnrolledBinsY = state.mRhoYBins * state.mRhoPhiBins; // ──────────────────────────────────────────────────────────────────────── @@ -1260,9 +1253,7 @@ struct LambdaProtonBalanceFunction { const std::string centLabel = cUseFT0C.value ? "FT0C" : "FT0M"; const std::string centAxisTitle = centLabel + " Percentile (%)"; AxisSpec multAxis = {100, 0.0f, 100.0f, centAxisTitle}; - AxisSpec etaAxis = {state.mRhoEtaBins, state.mRhoEtaMin, state.mRhoEtaMax, "#eta"}; AxisSpec phiAxis = {state.mRhoPhiBins, 0.0f, o2::constants::math::TwoPI, "#varphi"}; - AxisSpec unrolledAxis = {state.mRhoUnrolledBins, 0.0f, static_cast(state.mRhoUnrolledBins), "index(#eta,#varphi)"}; AxisSpec unrolledAxisY = {state.mRhoUnrolledBinsY, 0.0f, static_cast(state.mRhoUnrolledBinsY), "index(y,#varphi)"}; AxisSpec rapidityAxis = {state.mRhoYBins, state.mRhoYMin, state.mRhoYMax, "y"}; AxisSpec yAxis = {state.mRhoYBins, state.mRhoYMin, state.mRhoYMax, "y"}; @@ -1344,6 +1335,14 @@ struct LambdaProtonBalanceFunction { registryQaDetector.add(Form("%s/04_TOF_QA/%s/h2f_nsigmaPr_vs_pTPC", species, stage), "TOF n#sigma_{p} vs p_{TPC};p_{TPC} (GeV/c);n#sigma", {HistType::kTH2F, {axisPTPC, nsigmaAxis}}); registryQaDetector.add(Form("%s/04_TOF_QA/%s/h2f_nsigmaPr_vs_pt", species, stage), "TOF n#sigma_{p} vs p_{T};p_{T} (GeV/c);n#sigma", {HistType::kTH2F, {axisPtProton, nsigmaAxis}}); registryQaDetector.add(Form("%s/04_TOF_QA/%s/h2f_nsigmaPr_vs_pTOF", species, stage), "TOF n#sigma_{p} vs p_{TOF};p_{TOF} (GeV/c);n#sigma", {HistType::kTH2F, {axisPTOF, nsigmaAxis}}); + + // --- 2D TPC vs TOF n-sigma and 1D circular radius (competitive-veto vs circle comparison) --- + registryQaDetector.add(Form("%s/04_TOF_QA/%s/h2f_nsigmaTPC_vs_nsigmaTOF", species, stage), + "TPC vs TOF n#sigma_{p};n#sigma^{TPC}_{p};n#sigma^{TOF}_{p}", + {HistType::kTH2F, {nsigmaAxis, nsigmaAxis}}); + registryQaDetector.add(Form("%s/04_TOF_QA/%s/h1f_circular_radius", species, stage), + "Circular PID Radius;R = #sqrt{(n#sigma^{TPC}_{p})^{2} + (n#sigma^{TOF}_{p})^{2}};Counts", + {HistType::kTH1F, {{100, 0.0f, 10.0f, "R"}}}); }; static constexpr std::array localProtonStages = { @@ -1465,6 +1464,23 @@ struct LambdaProtonBalanceFunction { hCF->GetXaxis()->SetBinLabel(15, "Selected"); } + // 2D cutflow vs pT, separate for protons and antiprotons. + // y bins 1-15 = sequential stages (same as hCutFlow); 16-21 = veto REASONS (not sequential, a track can fill several) + registryQaDetector.add("Selection/TOF_Matching/h2f_CutFlow_vs_pt_Proton", "Proton cutflow vs p_{T};p_{T} (GeV/c);Stage", {HistType::kTH2F, {axisPtProton, {21, 0.5f, 21.5f}}}); + registryQaDetector.add("Selection/TOF_Matching/h2f_CutFlow_vs_pt_AntiProton", "AntiProton cutflow vs p_{T};p_{T} (GeV/c);Stage", {HistType::kTH2F, {axisPtProton, {21, 0.5f, 21.5f}}}); + { + const char* cfLabels2D[21] = {"All tracks", "hasTPC", "TPC crossed rows", "TPC rows/findable", "TPC chi2", "ITS Ncls", "ITS chi2", + "TPC signal", "p_TPC & pT window", "|y| window", "DCA xy,z", "PID (TPC/TOF)", "pi/K/e veto", + "V0-daughter veto", "Selected", "veto: TPC pi", "veto: TPC K", "veto: TPC e", + "veto: TOF pi", "veto: TOF K", "veto: TOF e"}; + auto hCFp = registryQaDetector.get(HIST("Selection/TOF_Matching/h2f_CutFlow_vs_pt_Proton")); + auto hCFa = registryQaDetector.get(HIST("Selection/TOF_Matching/h2f_CutFlow_vs_pt_AntiProton")); + for (int ib = 0; ib < 21; ++ib) { + hCFp->GetYaxis()->SetBinLabel(ib + 1, cfLabels2D[ib]); + hCFa->GetYaxis()->SetBinLabel(ib + 1, cfLabels2D[ib]); + } + } + // ══════════════════════════════════════════════════════════════════════════ // EXISTING QA_Detec REGISTRATION (Preserved for backward compatibility) // ══════════════════════════════════════════════════════════════════════════ @@ -1508,7 +1524,6 @@ struct LambdaProtonBalanceFunction { "Proton V0-daughter veto QA: fraction_{removed} = N_{removed}/N_{before} per event;fraction_{removed};Events", {HistType::kTH1F, {{110, 0.0f, 1.1f}}}); // ───────────────────────────────────────────────────────────────────── - // ───────────────────────────────────────────────────────────────────── // ── Item 5: Event-level pileup rejection QA ─────────────────────────── // hPileupFlags: each bin corresponds to a different event-selection bit. @@ -1554,11 +1569,6 @@ struct LambdaProtonBalanceFunction { // ── Rho histograms ─────────────────────────────────────────────────── registryRho.add("hEventCounter", "Events", {HistType::kTH1F, {{1, 0.0, 1.0}}}); - // eta-based rho1 - registryRho.add("h2_rho1_Proton", "#rho_{1}(p) in (#eta,#varphi) (after V0-daughter veto)", {HistType::kTH2F, {etaAxis, phiAxis}}); - registryRho.add("h2_rho1_AntiProton", "#rho_{1}(#bar{p}) in (#eta,#varphi) (after V0-daughter veto)", {HistType::kTH2F, {etaAxis, phiAxis}}); - registryRho.add("h2_rho1_Lambda", "#rho_{1}(#Lambda) in (#eta,#varphi)", {HistType::kTH2F, {etaAxis, phiAxis}}); - registryRho.add("h2_rho1_AntiLambda", "#rho_{1}(#bar{#Lambda}) in (#eta,#varphi)", {HistType::kTH2F, {etaAxis, phiAxis}}); // rapidity-based rho1 registryRho.add("h2_rho1_Proton_y", "#rho_{1}(p) in (y,#varphi) (after V0-daughter veto)", {HistType::kTH2F, {yAxis, phiAxis}}); registryRho.add("h2_rho1_AntiProton_y", "#rho_{1}(#bar{p}) in (y,#varphi) (after V0-daughter veto)", {HistType::kTH2F, {yAxis, phiAxis}}); @@ -1862,58 +1872,8 @@ struct LambdaProtonBalanceFunction { // ───────────────────────────────────────────────────────────────────── // ── Merged / AllPt histograms ─────────────────────────────────── - state.hRho2_Lp_AllPt = - registryRho.add("h2_rho2_Lp_AllPt", - "#rho_{2}(#Lambda, p) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #Lambda (trigger);index(#eta,#varphi) of p (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_LAp_AllPt = - registryRho.add("h2_rho2_LAp_AllPt", - "#rho_{2}(#Lambda, #bar{p}) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #Lambda (trigger);index(#eta,#varphi) of #bar{p} (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_ALp_AllPt = - registryRho.add("h2_rho2_ALp_AllPt", - "#rho_{2}(#bar{#Lambda}, p) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #bar{#Lambda} (trigger);index(#eta,#varphi) of p (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_ALAp_AllPt = - registryRho.add("h2_rho2_ALAp_AllPt", - "#rho_{2}(#bar{#Lambda}, #bar{p}) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #bar{#Lambda} (trigger);index(#eta,#varphi) of #bar{p} (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_pp_AllPt = - registryRho.add("h2_rho2_pp_AllPt", - "#rho_{2}(p, p) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of p (trigger);index(#eta,#varphi) of p (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_pAp_AllPt = - registryRho.add("h2_rho2_pAp_AllPt", - "#rho_{2}(p, #bar{p}) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of p (trigger);index(#eta,#varphi) of #bar{p} (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_App_AllPt = - registryRho.add("h2_rho2_App_AllPt", - "#rho_{2}(#bar{p}, p) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #bar{p} (trigger);index(#eta,#varphi) of p (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_ApAp_AllPt = - registryRho.add("h2_rho2_ApAp_AllPt", - "#rho_{2}(#bar{p}, #bar{p}) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #bar{p} (trigger);index(#eta,#varphi) of #bar{p} (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_LL_AllPt = - registryRho.add("h2_rho2_LL_AllPt", - "#rho_{2}(#Lambda, #Lambda) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #Lambda (trigger);index(#eta,#varphi) of #Lambda (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_LAL_AllPt = - registryRho.add("h2_rho2_LAL_AllPt", - "#rho_{2}(#Lambda, #bar{#Lambda}) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #Lambda (trigger);index(#eta,#varphi) of #bar{#Lambda} (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_ALL_AllPt = - registryRho.add("h2_rho2_ALL_AllPt", - "#rho_{2}(#bar{#Lambda}, #Lambda) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #bar{#Lambda} (trigger);index(#eta,#varphi) of #Lambda (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - state.hRho2_ALAL_AllPt = - registryRho.add("h2_rho2_ALAL_AllPt", - "#rho_{2}(#bar{#Lambda}, #bar{#Lambda}) in (#eta,#varphi) space, q_{inv} > 0.01 GeV/#it{c};index(#eta,#varphi) of #bar{#Lambda} (trigger);index(#eta,#varphi) of #bar{#Lambda} (associate)", - {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - // ── Rapidity merged rho2 histograms ───────────────────────────────────── // NOTE: these must use unrolledAxisY (mRhoYBins*mRhoPhiBins bins), - // NOT the eta-space unrolledAxis (mRhoEtaBins*mRhoPhiBins bins). // GetUnrolledIndexY() below produces indices in [0, mRhoUnrolledBinsY), // so the booked axis must match that range or downstream R2/BF code that // expects y-space-sized histograms will see a dimension mismatch. @@ -1970,7 +1930,7 @@ struct LambdaProtonBalanceFunction { {HistType::kTH1F, {lambdaMassAxis}}); // ───────────────────────────────────────────────────────────────────── - // ── Per-pT-bin histograms (Lambda pT bins 0.6 → 6.0) ───────────────── + // ── Per-pT-bin histograms (Lambda pT bins 0.6 → 3.6) ───────────────── state.hMassLambdaPtBins.clear(); state.hMassAntiLambdaPtBins.clear(); state.hPtPrimProton_Lambda.clear(); @@ -2125,30 +2085,6 @@ struct LambdaProtonBalanceFunction { addY(S.LAL_y, "h2_rho2_LAL_y_AllPt", "#rho_{2}(#Lambda,#bar{#Lambda}) (y,#varphi)"); addY(S.ALL_y, "h2_rho2_ALL_y_AllPt", "#rho_{2}(#bar{#Lambda},#Lambda) (y,#varphi)"); addY(S.ALAL_y, "h2_rho2_ALAL_y_AllPt", "#rho_{2}(#bar{#Lambda},#bar{#Lambda}) (y,#varphi)"); - - // ── eta space (only if BOTH switches on: memory heavy) ── - if (cFillEtaSpace.value) { - S.rho1_Proton = registryCent.add((dir + "/h2_rho1_Proton").c_str(), ("#rho_{1}(p) in (#eta,#varphi), " + ctag).c_str(), {HistType::kTH2F, {etaAxis, phiAxis}}); - S.rho1_AntiProton = registryCent.add((dir + "/h2_rho1_AntiProton").c_str(), ("#rho_{1}(#bar{p}) in (#eta,#varphi), " + ctag).c_str(), {HistType::kTH2F, {etaAxis, phiAxis}}); - S.rho1_Lambda = registryCent.add((dir + "/h2_rho1_Lambda").c_str(), ("#rho_{1}(#Lambda) in (#eta,#varphi), " + ctag).c_str(), {HistType::kTH2F, {etaAxis, phiAxis}}); - S.rho1_AntiLambda = registryCent.add((dir + "/h2_rho1_AntiLambda").c_str(), ("#rho_{1}(#bar{#Lambda}) in (#eta,#varphi), " + ctag).c_str(), {HistType::kTH2F, {etaAxis, phiAxis}}); - - auto addEta = [&](std::shared_ptr& h, const char* name, const char* title) { - h = registryCent.add((dir + "/" + name).c_str(), (std::string(title) + ", " + ctag).c_str(), {HistType::kTH2F, {unrolledAxis, unrolledAxis}}); - }; - addEta(S.Lp, "h2_rho2_Lp_AllPt", "#rho_{2}(#Lambda,p) (#eta,#varphi)"); - addEta(S.LAp, "h2_rho2_LAp_AllPt", "#rho_{2}(#Lambda,#bar{p}) (#eta,#varphi)"); - addEta(S.ALp, "h2_rho2_ALp_AllPt", "#rho_{2}(#bar{#Lambda},p) (#eta,#varphi)"); - addEta(S.ALAp, "h2_rho2_ALAp_AllPt", "#rho_{2}(#bar{#Lambda},#bar{p}) (#eta,#varphi)"); - addEta(S.pp, "h2_rho2_pp_AllPt", "#rho_{2}(p,p) (#eta,#varphi)"); - addEta(S.pAp, "h2_rho2_pAp_AllPt", "#rho_{2}(p,#bar{p}) (#eta,#varphi)"); - addEta(S.App, "h2_rho2_App_AllPt", "#rho_{2}(#bar{p},p) (#eta,#varphi)"); - addEta(S.ApAp, "h2_rho2_ApAp_AllPt", "#rho_{2}(#bar{p},#bar{p}) (#eta,#varphi)"); - addEta(S.LL, "h2_rho2_LL_AllPt", "#rho_{2}(#Lambda,#Lambda) (#eta,#varphi)"); - addEta(S.LAL, "h2_rho2_LAL_AllPt", "#rho_{2}(#Lambda,#bar{#Lambda}) (#eta,#varphi)"); - addEta(S.ALL, "h2_rho2_ALL_AllPt", "#rho_{2}(#bar{#Lambda},#Lambda) (#eta,#varphi)"); - addEta(S.ALAL, "h2_rho2_ALAL_AllPt", "#rho_{2}(#bar{#Lambda},#bar{#Lambda}) (#eta,#varphi)"); - } } } } @@ -2191,9 +2127,7 @@ struct LambdaProtonBalanceFunction { // ALAp : trigger=AntiLambda,assoc=antiproton // LL/LAL/ALL/ALAL: both V0s from respective selected lists (self-pairs rejected) // - // Each channel has both eta-space (unrolledIndex) and - // rapidity-space (unrolledIndexY) versions filled in the same loop; the - // eta-space fills are gated by cFillEtaSpace. + // Every channel fills y-space only (unrolledIndexY). // ───────────────────────────────────────────────────────────────────── // ── Event cutflow bin 1 — enters process (after sel8 + posZ filters) ── @@ -2218,7 +2152,6 @@ struct LambdaProtonBalanceFunction { for (auto const& trk : tracks) { if (std::abs(trk.eta()) < kMaxInelEta) { ++nTracksINEL; - continue; } } if (nTracksINEL < 1) { @@ -2570,15 +2503,9 @@ struct LambdaProtonBalanceFunction { fillDaughterQA(DaughterQAStage::Final, v0PosDau); fillDaughterQA(DaughterQAStage::Final, v0NegDau); - if (cFillEtaSpace.value) { - registryRho.fill(HIST("h2_rho1_Lambda"), v0.eta(), v0.phi()); - } registryRho.fill(HIST("h2_rho1_Lambda_y"), v0.rapidity(1), v0.phi()); if (cs) { cs->rho1_Lambda_y->Fill(v0.rapidity(1), v0.phi()); - if (cs->rho1_Lambda) { - cs->rho1_Lambda->Fill(v0.eta(), v0.phi()); - } } registryOther.fill(HIST("hPtSelLambda"), pt); state.hPtSelLambda_AllPt->Fill(pt); @@ -2594,15 +2521,9 @@ struct LambdaProtonBalanceFunction { fillDaughterQA(DaughterQAStage::Final, v0NegDau); fillDaughterQA(DaughterQAStage::Final, v0PosDau); - if (cFillEtaSpace.value) { - registryRho.fill(HIST("h2_rho1_AntiLambda"), v0.eta(), v0.phi()); - } registryRho.fill(HIST("h2_rho1_AntiLambda_y"), v0.rapidity(2), v0.phi()); if (cs) { cs->rho1_AntiLambda_y->Fill(v0.rapidity(2), v0.phi()); - if (cs->rho1_AntiLambda) { - cs->rho1_AntiLambda->Fill(v0.eta(), v0.phi()); - } } registryOther.fill(HIST("hPtSelAntiLambda"), pt); state.hPtSelAntiLambda_AllPt->Fill(pt); @@ -2639,35 +2560,35 @@ struct LambdaProtonBalanceFunction { // ───────────────────────────────────────────────────────────────── // ── Track quality cuts ──────────────────────────────────────────── - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 1.0f); + fillCutFlow(1.0f, trk); if (!trk.hasTPC()) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 2.0f); + fillCutFlow(2.0f, trk); if (trk.tpcNClsCrossedRows() < pProtonTPCMinRows.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 3.0f); + fillCutFlow(3.0f, trk); if (trk.tpcCrossedRowsOverFindableCls() < pProtonTPCMinRowsOverFindable.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 4.0f); + fillCutFlow(4.0f, trk); if (trk.tpcChi2NCl() > pProtonTPCMaxChi2PerCluster.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 5.0f); + fillCutFlow(5.0f, trk); if (trk.itsNCls() < pProtonITSMinClusters.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 6.0f); + fillCutFlow(6.0f, trk); if (trk.itsChi2NCl() > pProtonITSMaxChi2PerCluster.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 7.0f); + fillCutFlow(7.0f, trk); if (trk.tpcSignal() < cPPMinTpcSignal.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 8.0f); + fillCutFlow(8.0f, trk); // ───────────────────────────────────────────────────────────────── // ── p_TPC and pT acceptance cuts ───────────────────────────────────────────── @@ -2678,7 +2599,7 @@ struct LambdaProtonBalanceFunction { if (trk.pt() < pProtonMinPt.value || trk.pt() > pProtonMaxPt.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 9.0f); + fillCutFlow(9.0f, trk); // ───────────────────────────────────────────────────────────────── // ── Proton kinematic acceptance ─────────────────────────────────── @@ -2688,7 +2609,7 @@ struct LambdaProtonBalanceFunction { if (std::abs(y) > pProtonMaxY.value) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 10.0f); + fillCutFlow(10.0f, trk); // ───────────────────────────────────────────────────────────────── // ── DCA cuts ───────────────────────────────────────────────────── const bool passDCA = (std::abs(trk.dcaXY()) < pProtonMaxDCAxy.value) && @@ -2696,7 +2617,7 @@ struct LambdaProtonBalanceFunction { if (!passDCA) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 11.0f); + fillCutFlow(11.0f, trk); // ───────────────────────────────────────────────────────────────── // FIX-4: ProtonCounts_byPID_Check — protons only (sign > 0 guard added) @@ -2757,13 +2678,20 @@ struct LambdaProtonBalanceFunction { if (!passesPrimProtonPid(trk)) { continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 12.0f); + fillCutFlow(12.0f, trk); // pi/K/e contaminant veto if (!passesContaminantVeto(trk)) { + bool vetoUsedTOF = false; + const int vetoMask = contaminantVetoMask(trk, vetoUsedTOF); + for (int ib = 0; ib < 3; ++ib) { + if (vetoMask & (1 << ib)) { + fillCutFlow2D((vetoUsedTOF ? 19.0f : 16.0f) + ib, trk); + } + } continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 13.0f); + fillCutFlow(13.0f, trk); // TOF Matching Fraction check on selected protons registryQaDetector.fill(HIST("Selection/TOF_Matching/hTOFMatchedFractionVsPt"), trk.pt(), trk.hasTOF() ? 1.0f : 0.0f); @@ -2818,11 +2746,11 @@ struct LambdaProtonBalanceFunction { } continue; } - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 14.0f); + fillCutFlow(14.0f, trk); // ───────────────────────────────────────────────────────────────── // ── Classify into proton / antiproton lists ─────────────────────── - registryQaDetector.fill(HIST("Selection/TOF_Matching/hCutFlow"), 15.0f); + fillCutFlow(15.0f, trk); // VS Code: commented out unused variables. // const float pz = trk.pt() * std::sinh(trk.eta()); // const float eta = trk.eta(); @@ -2891,31 +2819,19 @@ struct LambdaProtonBalanceFunction { } // ───────────────────────────────────────────────────────────────────── - // ── Single-particle density for protons (eta and y) ────────────────── + // ── Single-particle density for protons (y) ────────────────── for (auto const& primProton : selectedPrimProtons) { - if (cFillEtaSpace.value) { - registryRho.fill(HIST("h2_rho1_Proton"), primProton.eta(), primProton.phi()); - } const float yp = protonRapidity(primProton); registryRho.fill(HIST("h2_rho1_Proton_y"), yp, primProton.phi()); if (cs) { cs->rho1_Proton_y->Fill(yp, primProton.phi()); - if (cs->rho1_Proton) { - cs->rho1_Proton->Fill(primProton.eta(), primProton.phi()); - } } } for (auto const& primAntiProton : selectedPrimAntiProtons) { - if (cFillEtaSpace.value) { - registryRho.fill(HIST("h2_rho1_AntiProton"), primAntiProton.eta(), primAntiProton.phi()); - } const float yap = protonRapidity(primAntiProton); registryRho.fill(HIST("h2_rho1_AntiProton_y"), yap, primAntiProton.phi()); if (cs) { cs->rho1_AntiProton_y->Fill(yap, primAntiProton.phi()); - if (cs->rho1_AntiProton) { - cs->rho1_AntiProton->Fill(primAntiProton.eta(), primAntiProton.phi()); - } } } // ───────────────────────────────────────────────────────────────────── @@ -2935,7 +2851,7 @@ struct LambdaProtonBalanceFunction { std::back_inserter(antiProtonInfo), [this](auto const& t) { return makeProtonInfo(t); }); - // ── pp rho2 fills (eta and y) ─────────────────────────────────────────── + // ── pp rho2 fills (y) ─────────────────────────────────────────────────── for (auto const& p1 : selectedPrimProtons) { const float y1_pp = protonRapidity(p1); for (auto const& p2 : selectedPrimProtons) { @@ -2963,7 +2879,7 @@ struct LambdaProtonBalanceFunction { const float E2 = std::sqrt(p2mag * p2mag + kMassProton * kMassProton); const float qinvPP = computeQinv(p1.px(), p1.py(), p1.pz(), E1, p2.px(), p2.py(), p2.pz(), E2); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_PP_Before_qinvCut"), qinvPP); - if (!failsQinvCut(qinvPP)) { + if (passesQinvQA(qinvPP)) { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_PP_After_qinvCut"), qinvPP); } } @@ -2995,20 +2911,14 @@ struct LambdaProtonBalanceFunction { } registryCorrelationQA.fill(HIST("QA3/PairCleaning/h1f_pairCleaning"), 4); } - const int idx1 = unrolledIndex(p1.eta(), p1.phi()); - const int idx2 = unrolledIndex(p2.eta(), p2.phi()); const float y2_pp = protonRapidity(p2); const int idxY1 = unrolledIndexY(y1_pp, p1.phi()); const int idxY2 = unrolledIndexY(y2_pp, p2.phi()); // Physics pair correlations (rho2): q_inv cut applied (pairs with q_inv <= kQinvCut are rejected above) - if (cFillEtaSpace.value && idx1 >= 0 && idx2 >= 0) { - state.hRho2_pp_AllPt->Fill(idx1, idx2); - } if (idxY1 >= 0 && idxY2 >= 0) { state.hRho2_pp_y_AllPt->Fill(idxY1, idxY2); } if (cs) { - fillIdx(cs->pp, idx1, idx2); fillIdx(cs->pp_y, idxY1, idxY2); } } @@ -3017,18 +2927,16 @@ struct LambdaProtonBalanceFunction { for (auto const& b : antiProtonInfo) { const float qinvPAp = computeQinv(a.px, a.py, a.pz, a.E, b.px, b.py, b.pz, b.E); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_pAp_Before_qinvCut"), qinvPAp); + if (passesQinvQA(qinvPAp)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_pAp_After_qinvCut"), qinvPAp); + } if (failsQinvCut(qinvPAp)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_pAp_After_qinvCut"), qinvPAp); - if (cFillEtaSpace.value && a.idxEta >= 0 && b.idxEta >= 0) { - state.hRho2_pAp_AllPt->Fill(a.idxEta, b.idxEta); - } if (a.idxY >= 0 && b.idxY >= 0) { state.hRho2_pAp_y_AllPt->Fill(a.idxY, b.idxY); } if (cs) { - fillIdx(cs->pAp, a.idxEta, b.idxEta); fillIdx(cs->pAp_y, a.idxY, b.idxY); } } @@ -3037,18 +2945,16 @@ struct LambdaProtonBalanceFunction { for (auto const& b : protonInfo) { const float qinvApp = computeQinv(a.px, a.py, a.pz, a.E, b.px, b.py, b.pz, b.E); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_App_Before_qinvCut"), qinvApp); + if (passesQinvQA(qinvApp)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_App_After_qinvCut"), qinvApp); + } if (failsQinvCut(qinvApp)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_App_After_qinvCut"), qinvApp); - if (cFillEtaSpace.value && a.idxEta >= 0 && b.idxEta >= 0) { - state.hRho2_App_AllPt->Fill(a.idxEta, b.idxEta); - } if (a.idxY >= 0 && b.idxY >= 0) { state.hRho2_App_y_AllPt->Fill(a.idxY, b.idxY); } if (cs) { - fillIdx(cs->App, a.idxEta, b.idxEta); fillIdx(cs->App_y, a.idxY, b.idxY); } } @@ -3060,18 +2966,16 @@ struct LambdaProtonBalanceFunction { } const float qinvApAp = computeQinv(a.px, a.py, a.pz, a.E, b.px, b.py, b.pz, b.E); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_ApAp_Before_qinvCut"), qinvApAp); + if (passesQinvQA(qinvApAp)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_ApAp_After_qinvCut"), qinvApAp); + } if (failsQinvCut(qinvApAp)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_ApAp_After_qinvCut"), qinvApAp); - if (cFillEtaSpace.value && a.idxEta >= 0 && b.idxEta >= 0) { - state.hRho2_ApAp_AllPt->Fill(a.idxEta, b.idxEta); - } if (a.idxY >= 0 && b.idxY >= 0) { state.hRho2_ApAp_y_AllPt->Fill(a.idxY, b.idxY); } if (cs) { - fillIdx(cs->ApAp, a.idxEta, b.idxEta); fillIdx(cs->ApAp_y, a.idxY, b.idxY); } } @@ -3108,7 +3012,7 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_Before_qinvCut"), qinvLP); } // QA3/SplitTrackQA: q_inv Before and After cut - if (!failsQinvCut(qinvLP)) { + if (passesQinvQA(qinvLP)) { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_After_qinvCut"), qinvLP); } // QA3/QinvVsAngles: 3D fills for Lambda(V0)-primProton and Lambda dau proton-primProton @@ -3153,8 +3057,6 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_sharedClsFraction_t2"), primProton.tpcFractionSharedCls()); } } - const int idxLambda = unrolledIndex(v0.eta(), v0.phi()); - const int idxPrimP = unrolledIndex(primProton.eta(), primProton.phi()); const float yL = v0.rapidity(1); const float yP = protonRapidity(primProton); const int idxYL = unrolledIndexY(yL, v0.phi()); @@ -3179,19 +3081,13 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/Kstar/h1f_kstar_Lp"), computeKstar(v0.px(), v0.py(), v0.pz(), kMassLambda, primProton.px(), primProton.py(), primProton.pz(), kMassProton)); - if (idxLambda >= 0 && idxPrimP >= 0) { - if (bin >= 0) { - state.hPtPrimProton_Lambda[bin]->Fill(primProton.pt()); - } - if (cFillEtaSpace.value) { - state.hRho2_Lp_AllPt->Fill(idxLambda, idxPrimP); - } + if (idxYL >= 0 && idxYP >= 0 && bin >= 0) { + state.hPtPrimProton_Lambda[bin]->Fill(primProton.pt()); } if (idxYL >= 0 && idxYP >= 0) { state.hRho2_Lp_y_AllPt->Fill(idxYL, idxYP); } if (cs) { - fillIdx(cs->Lp, idxLambda, idxPrimP); fillIdx(cs->Lp_y, idxYL, idxYP); } ++nPairs_Lambda_PrimProton; @@ -3211,7 +3107,7 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_Before_qinvCut"), qinvLAp); } // QA3/SplitTrackQA: q_inv Before and After cut - if (!failsQinvCut(qinvLAp)) { + if (passesQinvQA(qinvLAp)) { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_After_qinvCut"), qinvLAp); } // QA3/QinvVsAngles: 3D fills for Lambda(V0)-primAntiProton and Lambda dau proton-primAntiProton @@ -3249,8 +3145,6 @@ struct LambdaProtonBalanceFunction { v0.eta() - primAntiProton.eta(), RecoDecay::constrainAngle((v0.phi() - primAntiProton.phi()), -PIHalf)); } - const int idxLambda = unrolledIndex(v0.eta(), v0.phi()); - const int idxPrimPbar = unrolledIndex(primAntiProton.eta(), primAntiProton.phi()); const float yL2 = v0.rapidity(1); const float yAp = protonRapidity(primAntiProton); const int idxYL2 = unrolledIndexY(yL2, v0.phi()); @@ -3265,19 +3159,13 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/Kstar/h1f_kstar_LAp"), computeKstar(v0.px(), v0.py(), v0.pz(), kMassLambda, primAntiProton.px(), primAntiProton.py(), primAntiProton.pz(), kMassProton)); - if (idxLambda >= 0 && idxPrimPbar >= 0) { - if (bin >= 0) { - state.hPtPrimAntiProton_Lambda[bin]->Fill(primAntiProton.pt()); - } - if (cFillEtaSpace.value) { - state.hRho2_LAp_AllPt->Fill(idxLambda, idxPrimPbar); - } + if (idxYL2 >= 0 && idxYAp >= 0 && bin >= 0) { + state.hPtPrimAntiProton_Lambda[bin]->Fill(primAntiProton.pt()); } if (idxYL2 >= 0 && idxYAp >= 0) { state.hRho2_LAp_y_AllPt->Fill(idxYL2, idxYAp); } if (cs) { - fillIdx(cs->LAp, idxLambda, idxPrimPbar); fillIdx(cs->LAp_y, idxYL2, idxYAp); } ++nPairs_Lambda_PrimAntiProton; @@ -3369,7 +3257,7 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_Before_qinvCut"), qinvALp); } // QA3/SplitTrackQA: q_inv Before and After cut - if (!failsQinvCut(qinvALp)) { + if (passesQinvQA(qinvALp)) { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_After_qinvCut"), qinvALp); } // QA3/QinvVsAngles: 3D fills for AntiLambda(V0)-primProton and AntiLambda dau antiproton-primProton @@ -3407,8 +3295,6 @@ struct LambdaProtonBalanceFunction { v0.eta() - primProton.eta(), RecoDecay::constrainAngle((v0.phi() - primProton.phi()), -PIHalf)); } - const int idxAL = unrolledIndex(v0.eta(), v0.phi()); - const int idxPrimP = unrolledIndex(primProton.eta(), primProton.phi()); const float yAL = v0.rapidity(2); const float yP2 = protonRapidity(primProton); const int idxYAL = unrolledIndexY(yAL, v0.phi()); @@ -3423,19 +3309,13 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/Kstar/h1f_kstar_ALp"), computeKstar(v0.px(), v0.py(), v0.pz(), kMassLambda, primProton.px(), primProton.py(), primProton.pz(), kMassProton)); - if (idxAL >= 0 && idxPrimP >= 0) { - if (bin >= 0) { - state.hPtPrimProton_AntiLambda[bin]->Fill(primProton.pt()); - } - if (cFillEtaSpace.value) { - state.hRho2_ALp_AllPt->Fill(idxAL, idxPrimP); - } + if (idxYAL >= 0 && idxYP2 >= 0 && bin >= 0) { + state.hPtPrimProton_AntiLambda[bin]->Fill(primProton.pt()); } if (idxYAL >= 0 && idxYP2 >= 0) { state.hRho2_ALp_y_AllPt->Fill(idxYAL, idxYP2); } if (cs) { - fillIdx(cs->ALp, idxAL, idxPrimP); fillIdx(cs->ALp_y, idxYAL, idxYP2); } ++nPairs_AntiLambda_PrimProton; @@ -3455,7 +3335,7 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_Before_qinvCut"), qinvALAp); } // QA3/SplitTrackQA: q_inv Before and After cut - if (!failsQinvCut(qinvALAp)) { + if (passesQinvQA(qinvALAp)) { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LP_After_qinvCut"), qinvALAp); } // QA3/QinvVsAngles: 3D fills for AntiLambda(V0)-primAntiProton and AntiLambda dau antiproton-primAntiProton @@ -3500,8 +3380,6 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_sharedClsFraction_t2"), primAntiProton.tpcFractionSharedCls()); } } - const int idxAL2 = unrolledIndex(v0.eta(), v0.phi()); - const int idxPrimPb = unrolledIndex(primAntiProton.eta(), primAntiProton.phi()); const float yAL2 = v0.rapidity(2); const float yAp2 = protonRapidity(primAntiProton); const int idxYAL2 = unrolledIndexY(yAL2, v0.phi()); @@ -3516,19 +3394,13 @@ struct LambdaProtonBalanceFunction { registryCorrelationQA.fill(HIST("QA3/Kstar/h1f_kstar_ALAp"), computeKstar(v0.px(), v0.py(), v0.pz(), kMassLambda, primAntiProton.px(), primAntiProton.py(), primAntiProton.pz(), kMassProton)); - if (idxAL2 >= 0 && idxPrimPb >= 0) { - if (bin >= 0) { - state.hPtPrimAntiProton_AntiLambda[bin]->Fill(primAntiProton.pt()); - } - if (cFillEtaSpace.value) { - state.hRho2_ALAp_AllPt->Fill(idxAL2, idxPrimPb); - } + if (idxYAL2 >= 0 && idxYAp2 >= 0 && bin >= 0) { + state.hPtPrimAntiProton_AntiLambda[bin]->Fill(primAntiProton.pt()); } if (idxYAL2 >= 0 && idxYAp2 >= 0) { state.hRho2_ALAp_y_AllPt->Fill(idxYAL2, idxYAp2); } if (cs) { - fillIdx(cs->ALAp, idxAL2, idxPrimPb); fillIdx(cs->ALAp_y, idxYAL2, idxYAp2); } ++nPairs_AntiLambda_PrimAntiProton; @@ -3629,24 +3501,20 @@ struct LambdaProtonBalanceFunction { const float Ev2 = std::sqrt(v2pmag * v2pmag + kMassLambda * kMassLambda); const float qinvLL = computeQinv(v1.px(), v1.py(), v1.pz(), Ev1, v2.px(), v2.py(), v2.pz(), Ev2); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_Before_qinvCut"), qinvLL); + if (passesQinvQA(qinvLL)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvLL); + } if (failsQinvCut(qinvLL)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvLL); } - const int idx1 = unrolledIndex(v1.eta(), v1.phi()); - const int idx2 = unrolledIndex(v2.eta(), v2.phi()); const int idxY1 = unrolledIndexY(yv1L, v1.phi()); const int idxY2 = unrolledIndexY(v2.rapidity(1), v2.phi()); // Physics pair correlations (rho2): q_inv cut applied (pairs with q_inv <= kQinvCut are rejected above) - if (cFillEtaSpace.value && idx1 >= 0 && idx2 >= 0) { - state.hRho2_LL_AllPt->Fill(idx1, idx2); - } if (idxY1 >= 0 && idxY2 >= 0) { state.hRho2_LL_y_AllPt->Fill(idxY1, idxY2); } if (cs) { - fillIdx(cs->LL, idx1, idx2); fillIdx(cs->LL_y, idxY1, idxY2); } } @@ -3683,24 +3551,20 @@ struct LambdaProtonBalanceFunction { const float Ev2L = std::sqrt(v2pmagL * v2pmagL + kMassLambda * kMassLambda); const float qinvLAL = computeQinv(v1.px(), v1.py(), v1.pz(), Ev1L, v2.px(), v2.py(), v2.pz(), Ev2L); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_Before_qinvCut"), qinvLAL); + if (passesQinvQA(qinvLAL)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvLAL); + } if (failsQinvCut(qinvLAL)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvLAL); } - const int idx1 = unrolledIndex(v1.eta(), v1.phi()); - const int idx2 = unrolledIndex(v2.eta(), v2.phi()); const int idxY1 = unrolledIndexY(yv1LAL, v1.phi()); const int idxY2 = unrolledIndexY(v2.rapidity(2), v2.phi()); // Physics pair correlations (rho2): q_inv cut applied (pairs with q_inv <= kQinvCut are rejected above) - if (cFillEtaSpace.value && idx1 >= 0 && idx2 >= 0) { - state.hRho2_LAL_AllPt->Fill(idx1, idx2); - } if (idxY1 >= 0 && idxY2 >= 0) { state.hRho2_LAL_y_AllPt->Fill(idxY1, idxY2); } if (cs) { - fillIdx(cs->LAL, idx1, idx2); fillIdx(cs->LAL_y, idxY1, idxY2); } } @@ -3737,24 +3601,20 @@ struct LambdaProtonBalanceFunction { const float Ev2AL = std::sqrt(v2pmagAL * v2pmagAL + kMassLambda * kMassLambda); const float qinvALL = computeQinv(v1.px(), v1.py(), v1.pz(), Ev1AL, v2.px(), v2.py(), v2.pz(), Ev2AL); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_Before_qinvCut"), qinvALL); + if (passesQinvQA(qinvALL)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvALL); + } if (failsQinvCut(qinvALL)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvALL); } - const int idx1 = unrolledIndex(v1.eta(), v1.phi()); - const int idx2 = unrolledIndex(v2.eta(), v2.phi()); const int idxY1 = unrolledIndexY(yv1ALL, v1.phi()); const int idxY2 = unrolledIndexY(v2.rapidity(1), v2.phi()); // Physics pair correlations (rho2): q_inv cut applied (pairs with q_inv <= kQinvCut are rejected above) - if (cFillEtaSpace.value && idx1 >= 0 && idx2 >= 0) { - state.hRho2_ALL_AllPt->Fill(idx1, idx2); - } if (idxY1 >= 0 && idxY2 >= 0) { state.hRho2_ALL_y_AllPt->Fill(idxY1, idxY2); } if (cs) { - fillIdx(cs->ALL, idx1, idx2); fillIdx(cs->ALL_y, idxY1, idxY2); } } @@ -3794,24 +3654,20 @@ struct LambdaProtonBalanceFunction { const float Ev2AL2 = std::sqrt(v2pmagAL2 * v2pmagAL2 + kMassLambda * kMassLambda); const float qinvALAL = computeQinv(v1.px(), v1.py(), v1.pz(), Ev1AL2, v2.px(), v2.py(), v2.pz(), Ev2AL2); registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_Before_qinvCut"), qinvALAL); + if (passesQinvQA(qinvALAL)) { + registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvALAL); + } if (failsQinvCut(qinvALAL)) { continue; } - registryCorrelationQA.fill(HIST("QA3/SplitTrackQA/h1f_qinv_LL_After_qinvCut"), qinvALAL); } - const int idx1 = unrolledIndex(v1.eta(), v1.phi()); - const int idx2 = unrolledIndex(v2.eta(), v2.phi()); const int idxY1 = unrolledIndexY(yv1ALAL, v1.phi()); const int idxY2 = unrolledIndexY(v2.rapidity(2), v2.phi()); // Physics pair correlations (rho2): q_inv cut applied (pairs with q_inv <= kQinvCut are rejected above) - if (cFillEtaSpace.value && idx1 >= 0 && idx2 >= 0) { - state.hRho2_ALAL_AllPt->Fill(idx1, idx2); - } if (idxY1 >= 0 && idxY2 >= 0) { state.hRho2_ALAL_y_AllPt->Fill(idxY1, idxY2); } if (cs) { - fillIdx(cs->ALAL, idx1, idx2); fillIdx(cs->ALAL_y, idxY1, idxY2); } }