From 4042932332285b0159c51abfbdbec6ef280f9b2c Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Sat, 13 Dec 2025 09:42:05 -0600 Subject: [PATCH 1/4] TVX-like selection in MC --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 39 +++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 95eaa7b8948..b6328ecc744 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -121,6 +121,10 @@ struct PiKpRAA { static constexpr float kMaxdEdxMIP{60.0f}; static constexpr float kMindEdxMIPPlateau{70.0f}; static constexpr float kMaxdEdxMIPPlateau{90.0f}; + static constexpr float kMinFT0A{3.5f}; + static constexpr float kMaxFT0A{4.9f}; + static constexpr float kMinFT0C{-3.3f}; + static constexpr float kMaxFT0C{-2.1f}; static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; static constexpr float kHighEta[kNEtaHists] = {-0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; @@ -203,6 +207,7 @@ struct PiKpRAA { Configurable isT0Ccent{"isT0Ccent", true, "Use T0C-based centrality?"}; Configurable isZvtxPosSel{"isZvtxPosSel", true, "Zvtx position selection?"}; Configurable isZvtxPosSelMC{"isZvtxPosSelMC", true, "Zvtx position selection for MC events?"}; + Configurable selTVXMC{"selTVXMC", true, "apply TVX selection in MC?"}; Configurable selINELgt0{"selINELgt0", true, "Select INEL > 0?"}; Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut"}; Configurable applyNchSel{"applyNchSel", false, "Use mid-rapidity-based Nch selection"}; @@ -523,6 +528,9 @@ struct PiKpRAA { if (doprocessSim) { + // MC events passing the TVX requirement + registry.add("NchMCcentVsTVX", ";Passed(=1.5) NOT Passed(=0.5);", kTH2F, {{{nBinsNch, minNch, maxNch}, {2, 0, 2}}}); + registry.add("NumberOfRecoCollisions", "Number of times Gen. Coll.are reconstructed;N;Entries", kTH1F, {{10, -0.5, 9.5}}); // Pt resolution @@ -1390,11 +1398,10 @@ struct PiKpRAA { // By counting number of primary charged particles in |eta| < 1 //--------------------------- int nChMC{0}; + int nChFT0A{0}; + int nChFT0C{0}; for (const auto& particle : mcParticles) { - if (std::abs(particle.eta()) > kOne) - continue; - auto charge{0.}; // Get the MC particle const auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); @@ -1412,9 +1419,35 @@ struct PiKpRAA { if (!particle.isPhysicalPrimary()) continue; + const float eta{particle.eta()}; + + // TVX requirement + if (eta > kMinFT0A && eta < kMaxFT0A) { + nChFT0A++; + } + + if (eta > kMinFT0C && eta < kMaxFT0C) { + nChFT0C++; + } + + // INEL > 0 + if (std::abs(eta) > kOne) + continue; + nChMC++; } + //--------------------------- + // Only events with at least one charged particle in the FT0A and FT0C acceptances + //--------------------------- + if (selTVXMC) { + if (!(nChFT0A > kZeroInt && nChFT0C > kZeroInt)) { + registry.fill(HIST("NchMCcentVsTVX"), nChMC, 0.5); + return; + } + registry.fill(HIST("NchMCcentVsTVX"), nChMC, 1.5); + } + //--------------------------- // Only MC events with |Vtx Z| < 10 cm //--------------------------- From 3732651e469f2aed2eb0a061e5bb7d4c5663b44d Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Mon, 9 Feb 2026 15:23:12 -0600 Subject: [PATCH 2/4] Adds RCT checker --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index b6328ecc744..093bfc2d0ad 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -66,6 +66,7 @@ using namespace o2::framework; using namespace o2::aod::evsel; using namespace o2::constants::math; using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; using ColEvSels = soa::Join; using BCsRun3 = soa::Join; @@ -252,6 +253,14 @@ struct PiKpRAA { Configurable pathPhiCutHigh{"pathPhiCutHigh", "Users/o/omvazque/PhiCut/OO/Global/High", "base path to the ccdb object"}; Configurable pathPhiCutLow{"pathPhiCutLow", "Users/o/omvazque/PhiCut/OO/Global/Low", "base path to the ccdb object"}; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable rctLabel{"rctLabel", "CBT_hadronPID", "RCT selection flag (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo)"}; + Configurable rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"}; + Configurable rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"}; + Configurable requireGoodRct{"requireGoodRct", true, "RCT flag to reject events with limited acceptance for selected detectors"}; + Configurable requireGoodPIDRct{"requireGoodPIDRct", true, "RCT flag to reject events with limited acceptance for selected detectors"}; + + // RCT Checker instance + RCTFlagsChecker rctChecker; enum EvCutLabel { All = 1, @@ -349,6 +358,12 @@ struct PiKpRAA { int currentRunNumberPhiSel; void init(InitContext const&) { + + // Initialize the rct checker + if (requireGoodRct) { + rctChecker.init(rctLabel.value, rctCheckZDC.value, rctTreatLimitedAcceptanceAsBad.value); + } + currentRunNumberNchSel = -1; currentRunNumberPhiSel = -1; trkSelGlobalOpenDCAxy = trkSelOpenDCAxy(); @@ -372,6 +387,7 @@ struct PiKpRAA { registry.add("zPos", "With Event Selection;;Entries;", kTH1F, {axisZpos}); registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); registry.add("T0CcentVsFoundFT0", ";Found(=1.5) NOT Found(=0.5);", kTH2F, {{{axisCent}, {2, 0, 2}}}); + registry.add("T0CcentVsRCTSel", "Bad RCT(=0.5) Good RCT(=1.5) Good RCT & Good PID RCT(=2.5);;RCT Status;", kTH2F, {{{axisCent}, {3, 0, 3}}}); registry.add("NchVsCent", "Measured Nch v.s. Centrality (At least Once Rec. Coll. + Sel. criteria);;Nch", kTH2F, {{axisCent, {nBinsNch, minNch, maxNch}}}); registry.add("NclVsEtaPID", ";#eta;Ncl used for PID", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPIDp", ";#eta;#LTNcl#GT used for PID", kTProfile, {axisEta}); @@ -577,6 +593,7 @@ struct PiKpRAA { registry.add("MCclosure_PtPrVsNchMC", "Gen Evts With at least one Rec. Coll. + Sel. criteria 4 MC closure;;Gen. Nch;", kTH2F, {{axisPt, {nBinsNch, minNch, maxNch}}}); } + LOG(info) << "\trequireGoodRct=" << requireGoodRct.value; LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; LOG(info) << "\tapplyNchSel=" << applyNchSel.value; LOG(info) << "\tselINELgt0=" << selINELgt0.value; @@ -640,6 +657,7 @@ struct PiKpRAA { // LOG(info) << " Collisions size: " << collisions.size() << " // Table's size: " << collisions.tableSize() << "\n"; // LOG(info) << "Run number: " << foundBC.runNumber() << "\n"; + if (!isEventSelected(collision)) { return; } @@ -650,6 +668,31 @@ struct PiKpRAA { const double nPV{collision.multNTracksPVeta1() / 1.}; const float centrality{isT0Ccent ? collision.centFT0C() : collision.centFT0M()}; + //--------------------------- + // Control histogram + //--------------------------- + if (selHasFT0 && !collision.has_foundFT0()) { + registry.fill(HIST("T0CcentVsFoundFT0"), centrality, 0.5); + } + registry.fill(HIST("T0CcentVsFoundFT0"), centrality, 1.5); + + // Apply RCT selection? + if (requireGoodRct) { + + // Checks if collisions passes RCT selection + if (!rctChecker(*collision)) { + registry.fill(HIST("T0CcentVsRCTSel"), centrality, 0.5); + return; + } + + registry.fill(HIST("T0CcentVsRCTSel"), centrality, 1.5); + // Checks if collisions passes good PID RCT status + if (requireGoodPIDRct && collision.rct_bit(kTPCBadPID)) { + return; + } + registry.fill(HIST("T0CcentVsRCTSel"), centrality, 2.5); + } + if (applyNchSel) { const int nextRunNumber{foundBC.runNumber()}; if (currentRunNumberNchSel != nextRunNumber) { From a7b466b658650ef6af0ad77ec232e41beec33c91 Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Mon, 9 Feb 2026 15:49:50 -0600 Subject: [PATCH 3/4] Adds RCT-base selection --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 093bfc2d0ad..8f38e08509d 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -386,8 +386,7 @@ struct PiKpRAA { registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); registry.add("zPos", "With Event Selection;;Entries;", kTH1F, {axisZpos}); registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); - registry.add("T0CcentVsFoundFT0", ";Found(=1.5) NOT Found(=0.5);", kTH2F, {{{axisCent}, {2, 0, 2}}}); - registry.add("T0CcentVsRCTSel", "Bad RCT(=0.5) Good RCT(=1.5) Good RCT & Good PID RCT(=2.5);;RCT Status;", kTH2F, {{{axisCent}, {3, 0, 3}}}); + registry.add("T0CcentVsFoundFT0", "Found(=1.5) NOT Found(=0.5);;Status;", kTH2F, {{{axisCent}, {2, 0, 2}}}); registry.add("NchVsCent", "Measured Nch v.s. Centrality (At least Once Rec. Coll. + Sel. criteria);;Nch", kTH2F, {{axisCent, {nBinsNch, minNch, maxNch}}}); registry.add("NclVsEtaPID", ";#eta;Ncl used for PID", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPIDp", ";#eta;#LTNcl#GT used for PID", kTProfile, {axisEta}); @@ -414,6 +413,7 @@ struct PiKpRAA { x->SetBinLabel(16, "INEL > 0"); if (doprocessCalibrationAndV0s) { + registry.add("T0CcentVsRCTSel", "Bad RCT(=0.5) Good RCT(=1.5) Good RCT & Good PID RCT(=2.5);;RCT Status;", kTH2F, {{{axisCent}, {3, 0, 3}}}); registry.add("NchVsNPV", ";Nch; NPV;", kTH2F, {{{nBinsNPV, minNpv, maxNpv}, {nBinsNch, minNch, maxNch}}}); registry.add("ExcludedEvtVsNch", ";Nch;Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("ExcludedEvtVsNPV", ";NPV;Entries;", kTH1F, {{nBinsNPV, minNpv, maxNpv}}); From 3de0deeef78af9e00851fe1e3b9b86f66a313aa2 Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Tue, 10 Feb 2026 17:29:10 -0600 Subject: [PATCH 4/4] Update on V0s selection --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 559 ++++++++++++++++++--------------- 1 file changed, 301 insertions(+), 258 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 8f38e08509d..702bb96de02 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -137,6 +137,7 @@ struct PiKpRAA { struct : ConfigurableGroup { Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + Configurable useOfficialV0sSelOfDaughters{"useOfficialV0sSelOfDaughters", true, "Use the same track selection for daughters as the V0s analysis in OO"}; // Selection criteria: acceptance Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; @@ -164,8 +165,14 @@ struct PiKpRAA { Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; Configurable dcanegtopv{"dcanegtopv", .1, "min DCA Neg To PV (cm)"}; Configurable dcapostopv{"dcapostopv", .1, "min DCA Pos To PV (cm)"}; + Configurable dcaProtonFromLambda{"dcaProtonFromLambda", .05, "min DCA Proton (from Lambda) To PV (cm)"}; + Configurable dcaPionFromLambda{"dcaPionFromLambda", .2, "min DCA Pion (from Lambda) To PV (cm)"}; + Configurable dcaElectronFromGamma{"dcaElectronFromGamma", .1, "min DCA Electron (from Gamma conversion) To PV (cm)"}; + Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + Configurable lifeTimeCutK0s{"lifeTimeCutK0s", 20.0, "lifetime cut K0s (cm)"}; + Configurable lifeTimeCutLambda{"lifeTimeCutLambda", 30.0, "lifetime cut Lambda and AntiLambda (cm)"}; // Additional selection on the AP plot (exclusive for K0Short) // original equation: lArmPt*5>TMath::Abs(lArmAlpha) @@ -174,8 +181,8 @@ struct PiKpRAA { Configurable qTSel{"qTSel", 0.01f, "Armenteros qT select (Gammas)"}; // Selection + Configurable applyInvMassSel{"applyInvMassSel", true, "Select V0s close to the Inv. mass value"}; Configurable selElecFromGammas{"selElecFromGammas", true, "track selection for electrons"}; - Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; @@ -183,7 +190,6 @@ struct PiKpRAA { Configurable dEdxPlateauSel{"dEdxPlateauSel", 50, "dEdx selection for electrons"}; Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; Configurable maxExpTOFPi{"maxExpTOFPi", 0.00005, "Maximum beta TOF selection"}; - Configurable applyTPCTOFCombinedCut{"applyTPCTOFCombinedCut", false, " Apply geometrical cut ? "}; // Phi cut Configurable applyPhiCut{"applyPhiCut", false, "Apply geometrical cut?"}; @@ -438,8 +444,6 @@ struct PiKpRAA { registry.add("MassALVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); registry.add("MassGVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); - // registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {axisPtNcl, axisNcl}); - // registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisPtNcl}); registry.add("NclVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsPhipBeforeCutPID", Form("#LTNcl#GT used for PID;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); @@ -465,9 +469,9 @@ struct PiKpRAA { registry.add("EtaVsYG", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); // registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); - registry.add("DCAxyDCAzPiK0s", ";DCA_{xy} (cm); DCA_{z} (cm)", kTH2F, {axisDCAxy, axisDCAxy}); - registry.add("DCAxyDCAzPrL", ";DCA_{xy} (cm); DCA_{z} (cm)", kTH2F, {axisDCAxy, axisDCAxy}); - registry.add("DCAxyDCAzPrAL", ";DCA_{xy} (cm); DCA_{z} (cm)", kTH2F, {axisDCAxy, axisDCAxy}); + registry.add("DCAxyPtPiK0s", ";DCA_{xy} (cm); p_{T} (GeV/c)", kTH2F, {axisDCAxy, axisPt}); + registry.add("DCAxyPtPrL", ";DCA_{xy} (cm); p_{T} (GeV/c)", kTH2F, {axisDCAxy, axisPt}); + registry.add("DCAxyPtPrAL", ";DCA_{xy} (cm); p_{T} (GeV/c)", kTH2F, {axisDCAxy, axisPt}); // registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); @@ -599,6 +603,7 @@ struct PiKpRAA { LOG(info) << "\tselINELgt0=" << selINELgt0.value; LOG(info) << "\tv0TypeSelection=" << static_cast(v0Selections.v0TypeSelection); LOG(info) << "\tselElecFromGammas=" << v0Selections.selElecFromGammas; + LOG(info) << "\tapplyInvMassSel=" << v0Selections.applyInvMassSel; LOG(info) << "\trequireITShit=" << v0Selections.requireITShit; LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; @@ -607,8 +612,6 @@ struct PiKpRAA { LOG(info) << "\tuseNclsPID=" << v0Selections.useNclsPID; LOG(info) << "\tqTSel=" << v0Selections.qTSel; LOG(info) << "\tarmAlphaSel=" << v0Selections.armAlphaSel; - LOG(info) << "\tapplyTPCTOFCombinedCut=" << v0Selections.applyTPCTOFCombinedCut; - LOG(info) << "\tapplyInvMassSel=" << v0Selections.applyInvMassSel; LOG(info) << "\tapplyNclSel=" << v0Selections.applyNclSel; LOG(info) << "\tapplyPhiCut=" << v0Selections.applyPhiCut; LOG(info) << "\tusePinPhiSelection=" << v0Selections.usePinPhiSelection; @@ -883,8 +886,6 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtap"), eta, nclFound); registry.fill(HIST("NclVsEtaPID"), eta, nclPID); registry.fill(HIST("NclVsEtaPIDp"), eta, nclPID); - // registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); - // registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclVsPhipAfterCut"), pOrPt, phiPrime, nclFound); registry.fill(HIST("NclVsPhipAfterCutPID"), pOrPt, phiPrime, nclPID); @@ -953,9 +954,11 @@ struct PiKpRAA { if (!(passesTrackSelectionDaughters(posTrack) && passesTrackSelectionDaughters(negTrack))) continue; + // Selection based on Ncl for PID if (v0Selections.applyNclSel && !(posNcl >= v0Selections.minNcl && negNcl >= v0Selections.minNcl)) continue; + // Eta calibration positive-charge track if (v0Selections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(posTrkEta))}; if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) @@ -964,6 +967,7 @@ struct PiKpRAA { continue; } + // Eta calibration negative-charge track if (v0Selections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(negTrkEta))}; if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) @@ -987,11 +991,6 @@ struct PiKpRAA { if (!passesTopoSel) continue; - const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; - const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; - const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; - const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; - int posIndexEta{-999}; int negIndexEta{-999}; for (int i = 0; i < kNEtaHists; ++i) { @@ -1018,154 +1017,125 @@ struct PiKpRAA { registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); - bool isMassK0s{true}; - bool isMassL{true}; - bool isMassAL{true}; - bool isMassG{true}; - if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? - if (!(dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) - isMassK0s = false; - - if (!(dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) - isMassL = false; - - if (!(dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) - isMassAL = false; - - if (!(dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel)) - isMassG = false; - } - - if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts - if (isMassK0s) { // apply Inv. Mass selection? - registry.fill(HIST("ArmK0NOSel"), alpha, qT); - if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection - registry.fill(HIST("V0sCounter"), V0sCounter::K0s); - registry.fill(HIST("ArmK0"), alpha, qT); - registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); - registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); - nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - registry.fill(HIST("DCAxyDCAzPiK0s"), posTrack.dcaXY(), posTrack.dcaZ()); - - if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { - registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); - } - if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { - registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); - } + if (passesK0Selection(collision, v0)) { + registry.fill(HIST("ArmK0NOSel"), alpha, qT); + if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection + registry.fill(HIST("V0sCounter"), V0sCounter::K0s); + registry.fill(HIST("ArmK0"), alpha, qT); + registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); + registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); } } } if (passesLambdaSelection(collision, v0)) { - if (isMassL) { - registry.fill(HIST("V0sCounter"), V0sCounter::Lambda); - registry.fill(HIST("ArmL"), alpha, qT); - registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); - if (posTrackCharge > kZero) { - registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); - registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); - nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - registry.fill(HIST("DCAxyDCAzPrL"), posTrack.dcaXY(), posTrack.dcaZ()); - } - if (negTrackCharge < kZero) { - registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - } + registry.fill(HIST("V0sCounter"), V0sCounter::Lambda); + registry.fill(HIST("ArmL"), alpha, qT); + registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); + if (posTrackCharge > kZero) { + registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); + nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + } + if (negTrackCharge < kZero) { + registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); + // registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + // registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); + // nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + // nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); + // nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + // nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + // dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } } if (passesAntiLambdaSelection(collision, v0)) { - if (isMassAL) { - registry.fill(HIST("V0sCounter"), V0sCounter::AntiLambda); - registry.fill(HIST("ArmAL"), alpha, qT); - registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); - if (posTrackCharge > kZero) { - registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); - nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - } - if (negTrackCharge < kZero) { - registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); - registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); - nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - registry.fill(HIST("DCAxyDCAzPrAL"), negTrack.dcaXY(), negTrack.dcaZ()); - dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - } + registry.fill(HIST("V0sCounter"), V0sCounter::AntiLambda); + registry.fill(HIST("ArmAL"), alpha, qT); + registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); + if (posTrackCharge > kZero) { + registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + // registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); + // registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); + // nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); + // nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); + // nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + // nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + // dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + } + if (negTrackCharge < kZero) { + registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); + nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } } if (passesGammaSelection(collision, v0)) { - if (isMassG) { - if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { - - if (v0Selections.applyPlateauSel && etaCal.isCalPlateauLoaded) { - const double posDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(posTrkEta))}; - const double negDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(negTrkEta))}; - if (!(std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel)) - continue; - } + if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { - registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); - registry.fill(HIST("ArmG"), alpha, qT); - registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); - registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); - registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); - registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negNcl); - nClVsPElV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpElV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPElV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpElV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsdEdxElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); - dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + if (v0Selections.applyPlateauSel && etaCal.isCalPlateauLoaded) { + const double posDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(posTrkEta))}; + const double negDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(negTrkEta))}; + if (!(std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel)) + continue; } + + registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); + registry.fill(HIST("ArmG"), alpha, qT); + registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); + registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); + registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); + registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negNcl); + nClVsPElV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpElV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPElV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpElV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); + dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } } } // v0s @@ -1932,26 +1902,14 @@ struct PiKpRAA { alpha = (pLpos - pLneg) / denom; // equivalently / pV0mag } - // Daughters DCA selection - template - bool passesDCASelectionDaughters(const T& v0) - { - - bool isSelected{false}; - const double dcaPos{std::fabs(v0.dcapostopv())}; - const double dcaNeg{std::fabs(v0.dcanegtopv())}; - - isSelected = dcaPos > v0Selections.dcapostopv && dcaNeg > v0Selections.dcanegtopv ? true : false; - return isSelected; - } - template bool passesTrackSelectionDaughters(const T& track) { - // Secondary particle selection are basically Global tracks excluding the DCAxy selection - // This approach was used in the Run 2 analyses + // Decay daughters used Global tracks excluding the DCAxy selection; this approach was used in the Run 2 analyses // https://github.com/AliceO2Group/O2Physics/blob/b178c96d03ede873ee769ef8a4d7c1e21bf78332/Common/Core/TrackSelectionDefaults.cxx + + // In the V0s analysis only the selection on eta (|eta|<0.8) and the selection on number of crossed rows was used: nCrossedRows >= 70 const float pt{track.pt()}; const float eta{track.eta()}; const int16_t nCrossedRows{track.tpcNClsCrossedRows()}; @@ -1975,54 +1933,68 @@ struct PiKpRAA { bool itshit{false}; registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::AllTrks); - if (eta > v0Selections.minEtaDaughter && eta < v0Selections.maxEtaDaughter) { - etaSel = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Eta); - } - if (pt > v0Selections.minPtDaughter && pt < v0Selections.maxPtDaughter) { - ptSel = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Pt); - } - if (nCrossedRows >= v0Selections.minNCrossedRows) { - xRows = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRows); - } - if (nCrossedRowsOverFindableCls >= v0Selections.minNCrossedRowsOverFindableCls) { - xRowsToFindCls = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRowsOverFindableCls); - } - if (chi2PerClsTPC < v0Selections.maxChi2ClsTPC) { - chi2TPC = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Chi2TPC); - } - if (chi2PerClsITS < v0Selections.maxChi2ClsITS) { - chi2ITS = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Chi2ITS); - } - if (refitITS == v0Selections.itsRefit) { - itsrefit = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Itsrefit); - } - if (refitTPC == v0Selections.tpcRefit) { - tpcrefit = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Tpcrefit); - } - if (goldeChi2 == v0Selections.chi2Golden) { - golden = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Golden); - } - if (oneHitITSib == v0Selections.its1HitIB) { - itshit = true; - registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Itshit); + if (v0Selections.useOfficialV0sSelOfDaughters) { + if (eta > v0Selections.minEtaDaughter && eta < v0Selections.maxEtaDaughter) { + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Eta); + etaSel = true; + } + if (nCrossedRows >= v0Selections.minNCrossedRows) { + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRows); + xRows = true; + } + } else { + if (eta > v0Selections.minEtaDaughter && eta < v0Selections.maxEtaDaughter) { + etaSel = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Eta); + } + if (pt > v0Selections.minPtDaughter && pt < v0Selections.maxPtDaughter) { + ptSel = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Pt); + } + if (nCrossedRows >= v0Selections.minNCrossedRows) { + xRows = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRows); + } + if (nCrossedRowsOverFindableCls >= v0Selections.minNCrossedRowsOverFindableCls) { + xRowsToFindCls = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRowsOverFindableCls); + } + if (chi2PerClsTPC < v0Selections.maxChi2ClsTPC) { + chi2TPC = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Chi2TPC); + } + if (chi2PerClsITS < v0Selections.maxChi2ClsITS) { + chi2ITS = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Chi2ITS); + } + if (refitITS == v0Selections.itsRefit) { + itsrefit = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Itsrefit); + } + if (refitTPC == v0Selections.tpcRefit) { + tpcrefit = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Tpcrefit); + } + if (goldeChi2 == v0Selections.chi2Golden) { + golden = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Golden); + } + if (oneHitITSib == v0Selections.its1HitIB) { + itshit = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Itshit); + } } bool isSelected{false}; - if (!v0Selections.selElecFromGammas && v0Selections.requireITShit) - isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && itsrefit && tpcrefit && golden && itshit ? true : false; - if (!v0Selections.selElecFromGammas && !v0Selections.requireITShit) - isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && itsrefit && tpcrefit && golden ? true : false; - if (v0Selections.selElecFromGammas) { - isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && tpcrefit && golden ? true : false; + if (v0Selections.useOfficialV0sSelOfDaughters) { + isSelected = etaSel && xRows ? true : false; + } else { + if (!v0Selections.selElecFromGammas && v0Selections.requireITShit) + isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && itsrefit && tpcrefit && golden && itshit ? true : false; + if (!v0Selections.selElecFromGammas && !v0Selections.requireITShit) + isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && itsrefit && tpcrefit && golden ? true : false; + if (v0Selections.selElecFromGammas) + isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && tpcrefit && golden ? true : false; } if (isSelected == true) @@ -2031,93 +2003,152 @@ struct PiKpRAA { return isSelected; } - // V0 topological selection + // V0 topological selection: + // *) V0 decay radius (cm) + // *) V0 cosine of pointing angle + // *) DCA between V0 daughters (cm) template bool passesV0TopologicalSelection(const T& v0) { - - bool isSelected = v0.v0radius() > v0Selections.v0radius && v0.v0radius() < v0Selections.v0radiusMax && passesDCASelectionDaughters(v0) && v0.v0cosPA() > v0Selections.v0cospa && v0.dcaV0daughters() < v0Selections.dcav0dau ? true : false; - + // bool isSelected = v0.v0radius() > v0Selections.v0radius && v0.v0radius() < v0Selections.v0radiusMax && v0.v0cosPA() > v0Selections.v0cospa && v0.dcaV0daughters() < v0Selections.dcav0dau && passesDCASelectionDaughters(v0) ? true : false; + bool isSelected = v0.v0radius() > v0Selections.v0radius && v0.v0radius() < v0Selections.v0radiusMax && v0.v0cosPA() > v0Selections.v0cospa && v0.dcaV0daughters() < v0Selections.dcav0dau ? true : false; return isSelected; } + // K0s topological selection: + // *) V0 Lifetime (cm) + // *) Rapidity selection + // *) DCA of pions to prim. vtx (cm) template bool passesK0Selection(const C& collision, const T& v0) { - // Selection on rapiditty, proper lifetime, and Nsigma Pion const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); + const double dcaPos{std::fabs(v0.dcapostopv())}; + const double dcaNeg{std::fabs(v0.dcanegtopv())}; const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaPi())}; const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaPi())}; - const float posTOFNsigma{std::fabs(posTrack.tofNSigmaPi())}; - const float negTOFNsigma{std::fabs(negTrack.tofNSigmaPi())}; - const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; - const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; - - registry.fill(HIST("EtaVsYK0s"), negTrack.eta(), v0.yK0Short()); - registry.fill(HIST("EtaVsYK0s"), posTrack.eta(), v0.yK0Short()); + const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; + const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; + const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; + const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; + const double rapidity{std::abs(v0.yK0Short())}; + const double lifeTime{v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short}; + + // Checks if DCA of daughters to PV passes selection + const bool dcaDaugToPV{dcaPos > v0Selections.dcapostopv && dcaNeg > v0Selections.dcanegtopv ? true : false}; + + // Rejects V0 if its invariant mass is not compatible with the K0s proper mass + if (v0Selections.applyInvMassSel) { + if (!(dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + return false; + } bool isSelected{false}; - if (v0Selections.applyTPCTOFCombinedCut) - isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; - else - isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + if (v0Selections.useOfficialV0sSelOfDaughters) { + isSelected = lifeTime < v0Selections.lifeTimeCutK0s && rapidity < v0Selections.rapidityCut && dcaDaugToPV ? true : false; + } else { + isSelected = lifeTime < v0Selections.lifeTimeCutK0s && rapidity < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut && dcaDaugToPV ? true : false; + } + if (isSelected) { + registry.fill(HIST("EtaVsYK0s"), negTrack.eta(), v0.yK0Short()); + registry.fill(HIST("EtaVsYK0s"), posTrack.eta(), v0.yK0Short()); + registry.fill(HIST("DCAxyPtPiK0s"), v0.dcapostopv(), posTrack.pt()); + registry.fill(HIST("DCAxyPtPiK0s"), v0.dcanegtopv(), negTrack.pt()); + } return isSelected; } + // Lambda topological selection: + // *) V0 Lifetime (cm) + // *) Rapidity selection + // *) DCA of pions and protons to prim. vtx (cm) template bool passesLambdaSelection(const C& collision, const T& v0) { - // Selection on rapiditty, proper lifetime, and Nsigma Pion const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); + const double dcaPos{std::fabs(v0.dcapostopv())}; + const double dcaNeg{std::fabs(v0.dcanegtopv())}; const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaPr())}; const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaPi())}; - const float posTOFNsigma{std::fabs(posTrack.tofNSigmaPr())}; - const float negTOFNsigma{std::fabs(negTrack.tofNSigmaPi())}; - const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; - const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; - - registry.fill(HIST("EtaVsYPiL"), negTrack.eta(), v0.yLambda()); - registry.fill(HIST("EtaVsYPrL"), posTrack.eta(), v0.yLambda()); + const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; + const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; + const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; + const double rapidity{std::abs(v0.yLambda())}; + const double lifeTime{v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0}; + + // Checks if DCA of daughters to PV passes selection + const bool dcaDaugToPV{dcaPos > v0Selections.dcaProtonFromLambda && dcaNeg > v0Selections.dcaPionFromLambda ? true : false}; + + // Rejects V0 if the invariant mass is not compatible with the Lambda proper mass + if (v0Selections.applyInvMassSel) { + if (!(dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + return false; + } bool isSelected{false}; - if (v0Selections.applyTPCTOFCombinedCut) - isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; - else - isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + if (v0Selections.useOfficialV0sSelOfDaughters) { + isSelected = lifeTime < v0Selections.lifeTimeCutLambda && rapidity < v0Selections.rapidityCut && dcaDaugToPV ? true : false; + } else { + isSelected = lifeTime < v0Selections.lifeTimeCutLambda && rapidity < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut && dcaDaugToPV ? true : false; + } + + if (isSelected) { + registry.fill(HIST("DCAxyPtPrL"), v0.dcapostopv(), posTrack.pt()); + registry.fill(HIST("EtaVsYPiL"), negTrack.eta(), v0.yLambda()); + registry.fill(HIST("EtaVsYPrL"), posTrack.eta(), v0.yLambda()); + } return isSelected; } + // Anti Lambda topological selection: + // *) V0 Lifetime (cm) + // *) Rapidity selection + // *) DCA of pions and protons to prim. vtx (cm) template bool passesAntiLambdaSelection(const C& collision, const T& v0) { - // Selection on rapiditty, proper lifetime, and Nsigma Pion const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); - + const double dcaPos{std::fabs(v0.dcapostopv())}; + const double dcaNeg{std::fabs(v0.dcanegtopv())}; const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaPi())}; const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaPr())}; - const float posTOFNsigma{std::fabs(posTrack.tofNSigmaPi())}; - const float negTOFNsigma{std::fabs(negTrack.tofNSigmaPr())}; - const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; - const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; - - registry.fill(HIST("EtaVsYPiAL"), posTrack.eta(), v0.yLambda()); - registry.fill(HIST("EtaVsYPrAL"), negTrack.eta(), v0.yLambda()); + const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; + const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; + const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; + const double rapidity{std::abs(v0.yLambda())}; + const double lifeTime{v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0}; + + // Checks if DCA of daughters to PV passes selection + const bool dcaDaugToPV{dcaPos > v0Selections.dcaPionFromLambda && dcaNeg > v0Selections.dcaProtonFromLambda ? true : false}; + + // Rejects V0 if the invariant mass is not compatible with the Lambda proper mass + if (v0Selections.applyInvMassSel) { + if (!(dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + return false; + } bool isSelected{false}; - if (v0Selections.applyTPCTOFCombinedCut) - isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; - else - isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + if (v0Selections.useOfficialV0sSelOfDaughters) { + isSelected = lifeTime < v0Selections.lifeTimeCutLambda && rapidity < v0Selections.rapidityCut && dcaDaugToPV ? true : false; + } else { + isSelected = lifeTime < v0Selections.lifeTimeCutLambda && rapidity < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut && dcaDaugToPV ? true : false; + } + + if (isSelected) { + registry.fill(HIST("DCAxyPtPrAL"), v0.dcanegtopv(), negTrack.pt()); + registry.fill(HIST("EtaVsYPiAL"), posTrack.eta(), v0.yLambda()); + registry.fill(HIST("EtaVsYPrAL"), negTrack.eta(), v0.yLambda()); + } return isSelected; } @@ -2128,26 +2159,38 @@ struct PiKpRAA { const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); + const double dcaPos{std::fabs(v0.dcapostopv())}; + const double dcaNeg{std::fabs(v0.dcanegtopv())}; const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaEl())}; const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaEl())}; - const float posTOFNsigma{std::fabs(posTrack.tofNSigmaEl())}; - const float negTOFNsigma{std::fabs(negTrack.tofNSigmaEl())}; - const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; - const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; + const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; + const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; + const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; const float yGamma = RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma); - registry.fill(HIST("EtaVsYG"), negTrack.eta(), yGamma); - registry.fill(HIST("EtaVsYG"), posTrack.eta(), yGamma); + // Checks if DCA of daughters to PV passes selection + const bool dcaDaugToPV{dcaPos > v0Selections.dcaElectronFromGamma && dcaNeg > v0Selections.dcaElectronFromGamma ? true : false}; + + if (v0Selections.applyInvMassSel) { + if (!(dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel)) + return false; + } if (!(std::abs(yGamma) < v0Selections.rapidityCut)) return false; bool isSelected{false}; - if (v0Selections.applyTPCTOFCombinedCut) - isSelected = posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + if (v0Selections.useOfficialV0sSelOfDaughters) + isSelected = dcaDaugToPV ? true : false; else isSelected = posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + if (isSelected) { + registry.fill(HIST("EtaVsYG"), negTrack.eta(), yGamma); + registry.fill(HIST("EtaVsYG"), posTrack.eta(), yGamma); + } + return isSelected; }