From 4d6d9e037d7d71789a94ea7728d8bb471dce3f71 Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Wed, 27 Aug 2025 12:20:25 -0500 Subject: [PATCH 1/3] Adds V0 process method --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 581 ++++++++++++++++++++++++--------- 1 file changed, 419 insertions(+), 162 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 9df38d8eb36..0c2b729c9c8 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -64,13 +64,32 @@ using namespace o2::framework::expressions; using ColEvSels = soa::Join; using BCsRun3 = soa::Join; -using TracksFull = soa::Join; +// using TracksFull = soa::Join; + +using TracksFull = soa::Join; + +static constexpr int knEtaHists{9}; + +std::array, knEtaHists> dEdxPiV0{}; +std::array, knEtaHists> dEdxPrV0{}; +std::array, knEtaHists> dEdxElV0{}; +std::array, knEtaHists> dEdxPiTOF{}; +std::array, knEtaHists> dEdxElTOF{}; struct piKpRAA { - static constexpr float kZero{0.}; - static constexpr float kOne{1.}; + static constexpr float kZero{0.0f}; + static constexpr float kOne{1.0f}; static constexpr float kMinCharge{3.f}; + static constexpr float kMinPMIP{0.4f}; + static constexpr float kMaxPMIP{0.6f}; + static constexpr float kMindEdxMIP{40.0f}; + static constexpr float kMaxdEdxMIP{60.0f}; + static constexpr float kMindEdxMIPPlateau{65.0f}; + static constexpr float kMaxdEdxMIPPlateau{95.0f}; + + static constexpr float lowEta[knEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; + static constexpr float highEta[knEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; @@ -98,17 +117,21 @@ struct piKpRAA { Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; // Selection - Configurable applyInvMassSel{"applyInvMassSel", true, "Select V0s close to the Inv. mass value"}; - Configurable minMassK0s{"minMassK0", 0.4f, "Min. Inv. Mass K0"}; - Configurable maxMassK0s{"maxMassK0", 0.6f, "Max. Inv. Mass K0"}; - Configurable minMassLambda{"minMassLambda", 1.1f, "Min. Inv. Mass Lambda"}; - Configurable maxMassLambda{"maxMassLambda", 1.2f, "Max. Inv. Mass Lambda"}; - Configurable minMassGamma{"minMassGamma", 0.000922f, "Min. Inv. Mass Gamma"}; - Configurable maxMassGamma{"maxMassGamma", 0.002022f, "Max. Inv. Mass Gamma"}; + Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; + Configurable applyqTSel{"applyqTSel", true, "Select Gammas based on Armenters distribution"}; + Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; + Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; // PID (TPC/TOF) Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; - + Configurable maxPiTOFBeta{"maxPiTOFBeta", 0.00005, "Maximum beta TOF selection"}; + Configurable maxElTOFBeta{"maxElTOFBeta", 0.1, "Maximum beta TOF selection"}; + Configurable applyTPCTOFCombinedCut{"applyTPCTOFCombinedCut", false, " Apply geometrical cut ? "}; + + // Phi cut + Configurable applyPhiCut{"applyPhiCut", true, "Apply geometrical cut?"}; + Configurable applyEtaCal{"applyEtaCal", false, "Apply eta calibration?"}; + Configurable usePinPhiSelection{"usePinPhiSelection", true, "Uses Phi selection as a function of P or Pt?"}; } v0Selections; // Configurables Event Selection @@ -144,10 +167,9 @@ struct piKpRAA { ConfigurableAxis axisdEdx{"axisdEdx", {140, 20.0, 160.0}, "dEdx binning"}; // CCDB paths - Configurable paTHEff{"paTHEff", "Users/o/omvazque/MCcorrection/perTimeStamp/TrackingEff", "base path to the ccdb object"}; - Configurable paTHFD{"paTHFD", "Users/o/omvazque/MCcorrection/perTimeStamp/FeedDown", "base path to the ccdb object"}; - Configurable paTHmeanNch{"paTHmeanNch", "Users/o/omvazque/FitMeanNch_9May2025", "base path to the ccdb object"}; - Configurable paTHsigmaNch{"paTHsigmaNch", "Users/o/omvazque/FitSigmaNch_9May2025", "base path to the ccdb object"}; + Configurable pathEtaCal{"pathEtaCal", "Users/o/omvazque/EtaCal/OO/Global", "base path to the ccdb object"}; + 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"}; enum EvCutLabel { @@ -173,17 +195,16 @@ struct piKpRAA { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Service ccdb; - struct Config { - TH2F* hEfficiency = nullptr; - TH2F* hFeedDown = nullptr; - bool correctionsLoaded = false; - } cfg; + struct ConfigPhiCut { + TH1F* hPhiCutHigh = nullptr; + TH1F* hPhiCutLow = nullptr; + bool isPhiCutLoaded = false; + } phiCut; - struct NchConfig { - TH1F* hMeanNch = nullptr; - TH1F* hSigmaNch = nullptr; - bool calibrationsLoaded = false; - } cfgNch; + struct ConfigEtaCalib { + TProfile* pEtaCal = nullptr; + bool isCalLoaded = false; + } etaCal; TrackSelection trkSelDaugthers; TrackSelection trkSelGlobal; @@ -205,11 +226,13 @@ struct piKpRAA { // define axes you want to use const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; const AxisSpec axisEvent{14, 0.5, 14.5, ""}; - const AxisSpec axisEta{40, -1., +1., "#eta"}; + const AxisSpec axisEta{100, -1., +1., "#eta"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtPhiCut{binsPtPhiCut, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtV0s{binsPtV0s, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisCent{binsCent, "T0C centrality"}; + const char* endingEta[knEtaHists] = {"88", "86", "64", "42", "20", "02", "24", "46", "68"}; + const char* latexEta[knEtaHists] = {"|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); @@ -234,57 +257,98 @@ struct piKpRAA { registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); - registry.add("nSigmaPiFromK0", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPiFromLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPrFromLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPiFromAntiLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPrFromAntiLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaElFromGammaConv", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPiFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPrFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPiFromAL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPrFromAL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigElFromG", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); registry.add("ArmAll", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); registry.add("ArmAfterTopoSel", "Armenteros-Podolanski anfter topological selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); registry.add("ArmK0NOSel", "Armenteros-Podolanski WITH OUT 5 #times q_{T} > #alpha selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); registry.add("ArmK0", "Armenteros-Podolanski WITH 5 #times q_{T} > #alpha selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("ArmLambda", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("ArmAntiLambda", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("ArmGamma", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("MassK0ShortVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisK0Mass}); - registry.add("MassLambdaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); - registry.add("MassAntiLambdaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); - registry.add("MassGammaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); - registry.add("dEdxPiPos", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxPiNeg", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxPrPos", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxPrNeg", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxEl", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("ArmL", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmAL", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmG", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("MassK0sVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisK0Mass}); + registry.add("MassLVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); + 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("NclFindableVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); registry.add("NclFindableVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); registry.add("NclFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); registry.add("NclFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclFindableMinusFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {21, -0.5, 20.5}}}); - registry.add("NclFindableMinusFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclFoundVsPtVsPhip", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPVsPhipBeforeCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPtVsPhipBeforeCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPVsPhipAfterCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPtVsPhipAfterCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsEta", ";#eta; Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + + registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPiV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsPPiV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclVsPPiV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPrV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsPPrV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclVsPPrV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaElV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsPElV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclVsPElV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + + registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + + registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); registry.add("dEdxVsMomentum", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxVsEtaPiMIP", ";#eta; dE/dx MIP Pions (0.4 < #it{p} < 0.6 GeV/#it{c})", kTH2F, {{{axisEta}, {50, 20, 70}}}); - registry.add("dEdxVsEtaPiMIPp", ";#eta; #LTdE/dx#GT MIP Pions", kTProfile, {axisEta}); + registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPp", "MIP e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaPiMIPV0", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaPiMIPV0p", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + + for (int i = 0; i < knEtaHists; ++i) { + dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxElTOF[i] = registry.add(Form("dEdxElTOF_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + } } LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; - LOG(info) << "\tpaTHEff=" << paTHEff.value; - LOG(info) << "\tpaTHFD=" << paTHFD.value; LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; - LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; - LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; + LOG(info) << "\tapplyTPCTOFCombinedCut=" << v0Selections.applyTPCTOFCombinedCut; + LOG(info) << "\tapplyInvMassSel=" << v0Selections.applyInvMassSel; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + + if (v0Selections.applyPhiCut) { + LOG(info) << "\tLoading Phi cut!"; + LOG(info) << "\t pathPhiCutLow=" << pathPhiCutLow.value; + LOG(info) << "\t pathPhiCutHigh=" << pathPhiCutHigh.value; + loadPhiCutSelections(); + } + + if (v0Selections.applyEtaCal) { + LOG(info) << "\tLoading Eta Cal!"; + LOG(info) << "\t pathEtaCal=" << pathEtaCal.value; + loadEtaCalibration(); + } } void processCalibrationAndV0s(ColEvSels::iterator const& collision, BCsRun3 const& /**/, aod::V0Datas const& v0s, aod::FV0As const& /**/, aod::FT0s const& /**/, TracksFull const& tracks) @@ -303,6 +367,15 @@ struct piKpRAA { registry.fill(HIST("zPos"), collision.posZ()); registry.fill(HIST("T0Ccent"), collision.centFT0C()); + // bool hasT0{false}; + // float colTime{0.0}; + // if (foundBC.has_ft0()) { + // if (foundBC.ft0().isValidTimeA() && foundBC.ft0().isValidTimeC()) { + // colTime = foundBC.ft0().collTime(); + // hasT0 = true; + // } + // } + for (const auto& track : tracks) { if (!trkSelGlobal.IsSelected(track)) @@ -315,27 +388,78 @@ struct piKpRAA { const float pt{track.pt()}; const float phi{track.phi()}; const float eta{track.eta()}; - const float dedx{track.tpcSignal()}; + float dedx{track.tpcSignal()}; + const int charge{track.sign()}; + + float phiPrime{phi}; + PhiPrime(phiPrime, magField, charge); + registry.fill(HIST("NclFoundVsPVsPhipBeforeCut"), momentum, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPtVsPhipBeforeCut"), pt, phiPrime, track.tpcNClsFound()); + + float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; + if (!passesPhiSelection(pOrPt, phiPrime)) + continue; + + if (v0Selections.applyEtaCal) { + const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(eta))}; + if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) + dedx *= (50.0 / dedxCal); + else + continue; + } - if (momentum > 0.4 && momentum < 0.6 && dedx < 65.0) { + if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIP && dedx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); registry.fill(HIST("dEdxVsEtaPiMIPp"), eta, dedx); + registry.fill(HIST("NclVsEtaPiMIP"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiMIPp"), eta, track.tpcNClsFound()); } registry.fill(HIST("NclFindableVsPt"), pt, track.tpcNClsFindable()); registry.fill(HIST("NclFindableVsPtp"), pt, track.tpcNClsFindable()); registry.fill(HIST("NclFoundVsPt"), pt, track.tpcNClsFound()); registry.fill(HIST("NclFoundVsPtp"), pt, track.tpcNClsFound()); - registry.fill(HIST("NclFindableMinusFoundVsPt"), pt, track.tpcNClsFindableMinusFound()); - registry.fill(HIST("NclFindableMinusFoundVsPtp"), pt, track.tpcNClsFindableMinusFound()); registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPVsPhipAfterCut"), momentum, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPtVsPhipAfterCut"), pt, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); - float phiPrime{phi}; - const int charge{track.sign()}; - PhiPrime(phiPrime, magField, charge); - registry.fill(HIST("NclFoundVsPtVsPhip"), pt, phiPrime, track.tpcNClsFound()); + int indexEta{0}; + for (int i = 1; i < knEtaHists; ++i) { + if (eta >= lowEta[i] && eta < highEta[i]) { + indexEta = i; + break; + } + } - registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); + if (track.hasTOF() && track.goodTOFMatch()) { + const float tTOF{track.tofSignal()}; + const float trkLength{track.length()}; + const float tExpPiTOF{track.tofExpSignalPi(tTOF)}; + const float tExpElTOF{track.tofExpSignalEl(tTOF)}; + // const float dTOFPi{tTOF - tExpPiTOF - colTime}; + // const float dTOFEl{tTOF - tExpElTOF - colTime}; + + if (trkLength > kZero && tTOF > kZero) { + registry.fill(HIST("betaVsMomentum"), momentum, track.beta()); + registry.fill(HIST("TOFExpPi2TOF"), momentum, tExpPiTOF / tTOF); + registry.fill(HIST("TOFExpEl2TOF"), momentum, tExpElTOF / tTOF); + if (std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxElTOFBeta) { + dEdxElTOF[0]->Fill(momentum, dedx); + dEdxElTOF[indexEta]->Fill(momentum, dedx); + } + + if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIPPlateau && dedx < kMaxdEdxMIPPlateau && std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxElTOFBeta) { + registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); + registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); + } + + if (std::abs((tExpPiTOF / tTOF) - kOne) < v0Selections.maxPiTOFBeta) { + dEdxPiTOF[0]->Fill(momentum, dedx); + dEdxPiTOF[indexEta]->Fill(momentum, dedx); + } + } + } } for (const auto& v0 : v0s) { @@ -347,13 +471,52 @@ struct piKpRAA { // Positive-(negative-)charged tracks (daughters) const auto& posTrack = v0.posTrack_as(); const auto& negTrack = v0.negTrack_as(); - + const int posTrackCharge{posTrack.sign()}; + const int negTrackCharge{negTrack.sign()}; + const float posTrkP{posTrack.p()}; + const float negTrkP{negTrack.p()}; + const float posTrkPt{posTrack.pt()}; + const float negTrkPt{negTrack.pt()}; + const float posTrkEta{posTrack.eta()}; + const float negTrkEta{negTrack.eta()}; + float posTrkdEdx{posTrack.tpcSignal()}; + float negTrkdEdx{negTrack.tpcSignal()}; + float posTrackPhiPrime{posTrack.phi()}; + float negTrackPhiPrime{negTrack.phi()}; + PhiPrime(posTrackPhiPrime, magField, posTrackCharge); + PhiPrime(negTrackPhiPrime, magField, negTrackCharge); + + // Skip v0s with like-sig daughters if (posTrack.sign() == negTrack.sign()) continue; + float pOrPtPos{v0Selections.usePinPhiSelection ? posTrkP : posTrkPt}; + float pOrPtNeg{v0Selections.usePinPhiSelection ? negTrkP : negTrkPt}; + + // Passes Geometrical (Phi) cut? + if (!(passesPhiSelection(pOrPtPos, posTrackPhiPrime) && passesPhiSelection(pOrPtNeg, negTrackPhiPrime))) + continue; + + // Passes daughters track-selection? if (!(passesTrackSelectionDaughters(posTrack) && passesTrackSelectionDaughters(negTrack))) continue; + if (v0Selections.applyEtaCal) { + const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(posTrkEta))}; + if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) + posTrkdEdx *= (50.0 / dedxCal); + else + continue; + } + + if (v0Selections.applyEtaCal) { + const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(negTrkEta))}; + if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) + negTrkdEdx *= (50.0 / dedxCal); + else + continue; + } + const TVector3 ppos(posTrack.px(), posTrack.py(), posTrack.pz()); const TVector3 pneg(negTrack.px(), negTrack.py(), negTrack.pz()); double alpha, qT; @@ -361,78 +524,161 @@ struct piKpRAA { GetArmeterosVariables(ppos, pneg, alpha, qT); registry.fill(HIST("ArmAll"), alpha, qT); + // Passes V0 topological cuts? if (!passesV0TopologicalSelection(v0)) continue; + // const float px[2] = {posTrack.px(), negTrack.px()}; + // const float py[2] = {posTrack.py(), negTrack.py()}; + // const float pz[2] = {posTrack.pz(), negTrack.pz()}; + // const double ePos{static_cast(posTrack.energy(o2::constants::physics::MassPositron))}; + // const double eEle{static_cast(negTrack.energy(o2::constants::physics::MassElectron))}; + // const double massG = std::sqrt(std::pow(ePos + eEle, 2.0) - (std::pow(px[0] + px[1], 2.0) + std::pow(py[0] + py[1], 2.0) + std::pow(pz[0] + pz[1], 2.0))); + + 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)}; + registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); - if (passesK0Selection(collision, v0)) { - registry.fill(HIST("nSigmaPiFromK0"), posTrack.pt(), posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigmaPiFromK0"), negTrack.pt(), negTrack.tpcNSigmaPi()); - registry.fill(HIST("ArmK0NOSel"), alpha, qT); - if (v0Selections.armPodCut * qT > std::abs(alpha)) { - if (v0Selections.applyInvMassSel) { - if (!(v0.mK0Short() > v0Selections.minMassK0s && v0.mK0Short() < v0Selections.maxMassK0s)) - continue; - } - registry.fill(HIST("ArmK0"), alpha, qT); - registry.fill(HIST("MassK0ShortVsPt"), v0.pt(), v0.mK0Short()); - - registry.fill(HIST("dEdxPiPos"), posTrack.p(), posTrack.tpcSignal()); - registry.fill(HIST("dEdxPiNeg"), negTrack.p(), negTrack.tpcSignal()); + int posIndexEta{0}; + int negIndexEta{0}; + for (int i = 1; i < knEtaHists; ++i) { + if (posTrkEta >= lowEta[i] && posTrkEta < highEta[i]) { + posIndexEta = i; + break; } } - if (passesLambdaSelection(collision, v0)) { - if (v0Selections.applyInvMassSel) { - if (!(v0.mLambda() > v0Selections.minMassLambda && v0.mLambda() < v0Selections.maxMassLambda)) - continue; + for (int i = 1; i < knEtaHists; ++i) { + if (negTrkEta >= lowEta[i] && negTrkEta < highEta[i]) { + negIndexEta = i; + break; } - registry.fill(HIST("nSigmaPrFromLambda"), posTrack.pt(), posTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigmaPiFromLambda"), negTrack.pt(), negTrack.tpcNSigmaPi()); - registry.fill(HIST("ArmLambda"), alpha, qT); - registry.fill(HIST("MassLambdaVsPt"), v0.pt(), v0.mLambda()); - registry.fill(HIST("dEdxPiNeg"), negTrack.p(), negTrack.tpcSignal()); - registry.fill(HIST("dEdxPrPos"), posTrack.p(), posTrack.tpcSignal()); - // std::cout << "pos charge = " << posTrack.sign() << " | neg charge = " << negTrack.sign() << '\n'; } - if (passesAntiLambdaSelection(collision, v0)) { - if (v0Selections.applyInvMassSel) { - if (!(v0.mAntiLambda() > v0Selections.minMassLambda && v0.mAntiLambda() < v0Selections.maxMassLambda)) - continue; + if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? + if (dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { // Mass cut + if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts + registry.fill(HIST("ArmK0NOSel"), alpha, qT); + if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection + 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, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPPiV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxPiV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + + 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); + } + } + } } - registry.fill(HIST("nSigmaPrFromAntiLambda"), posTrack.pt(), posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigmaPiFromAntiLambda"), negTrack.pt(), negTrack.tpcNSigmaPr()); - registry.fill(HIST("ArmAntiLambda"), alpha, qT); - registry.fill(HIST("MassAntiLambdaVsPt"), v0.pt(), v0.mAntiLambda()); - - registry.fill(HIST("dEdxPiPos"), posTrack.p(), posTrack.tpcSignal()); - registry.fill(HIST("dEdxPrNeg"), negTrack.p(), negTrack.tpcSignal()); } - if (passesGammaSelection(collision, v0)) { - - // const double ePos{static_cast(posTrack.energy(o2::constants::physics::MassElectron))}; - // const double eEle{static_cast(negTrack.energy(o2::constants::physics::MassElectron))}; - // const float px[2] = {posTrack.px(), negTrack.px()}; - // const float py[2] = {posTrack.py(), negTrack.py()}; - // const float pz[2] = {posTrack.pz(), negTrack.pz()}; - // const double invMass = std::sqrt(std::pow(ePos + eEle, 2.0) - (std::pow(px[0] + px[1], 2.0) + std::pow(py[0] + py[1], 2.0) + std::pow(pz[0] + pz[1], 2.0))); - - if (v0Selections.applyInvMassSel) { - if (!(v0.mGamma() > v0Selections.minMassGamma && v0.mGamma() < v0Selections.maxMassGamma)) - continue; + + if (v0Selections.applyInvMassSel) { + if (dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { + if (passesLambdaSelection(collision, v0)) { + registry.fill(HIST("ArmL"), alpha, qT); + registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); + registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); + + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPPrV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPrV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxPrV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + } } + } - registry.fill(HIST("MassGammaVsPt"), v0.pt(), v0.mGamma()); - registry.fill(HIST("dEdxEl"), posTrack.p(), posTrack.tpcSignal()); - registry.fill(HIST("dEdxEl"), negTrack.p(), negTrack.tpcSignal()); + if (v0Selections.applyInvMassSel && dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { + if (passesAntiLambdaSelection(collision, v0)) { + registry.fill(HIST("ArmAL"), alpha, qT); + registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); + registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPPiV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPrV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPrV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxPiV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxPrV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + } + } - registry.fill(HIST("nSigmaElFromGammaConv"), negTrack.pt(), negTrack.tpcNSigmaEl()); - registry.fill(HIST("nSigmaElFromGammaConv"), posTrack.pt(), posTrack.tpcNSigmaEl()); - registry.fill(HIST("ArmGamma"), alpha, qT); + if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { + if (passesGammaSelection(collision, v0)) { + 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, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPElV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPElV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPElV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPElV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxElV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxElV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); + } + } } } } @@ -490,6 +736,7 @@ struct piKpRAA { { bool isSelected = trkSelDaugthers.IsSelected(track) ? true : false; + return isSelected; } @@ -518,8 +765,11 @@ struct piKpRAA { 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.))}; - // bool 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; - bool 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; + 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; return isSelected; } @@ -539,7 +789,11 @@ struct piKpRAA { 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.))}; - bool 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; + 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; return isSelected; } @@ -559,7 +813,11 @@ struct piKpRAA { 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.))}; - bool 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; + 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; return isSelected; } @@ -581,11 +839,11 @@ struct piKpRAA { if (!(std::abs(yGamma) < v0Selections.rapidityCut)) return false; - if (!(posTrack.hasTOF() && negTrack.hasTOF())) - return false; - - bool isSelected = posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; - // bool 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; + bool isSelected{false}; + if (v0Selections.applyTPCTOFCombinedCut) + isSelected = posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + else + isSelected = posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; return isSelected; } @@ -605,11 +863,6 @@ struct piKpRAA { return grpo->getNominalL3Field(); } - bool passesGeometricalCut() - { - return true; - } - void PhiPrime(float& phi, const int& magField, const int& charge) { @@ -622,6 +875,21 @@ struct piKpRAA { phi = std::fmod(phi, o2::constants::math::PI / 9.0f); } + bool passesPhiSelection(const float& pt, const float& phi) + { + + bool isSelected{false}; + if (v0Selections.applyPhiCut && phiCut.isPhiCutLoaded) { + const int binLow{phiCut.hPhiCutLow->FindBin(pt)}; + const int binHigh{phiCut.hPhiCutHigh->FindBin(pt)}; + const double phiCutLow{phiCut.hPhiCutLow->GetBinContent(binLow)}; + const double phiCutHigh{phiCut.hPhiCutHigh->GetBinContent(binHigh)}; + if (phi < phiCutLow || phi > phiCutHigh) + isSelected = true; + } + return isSelected; + } + template bool isEventSelected(CheckCol const& col) { @@ -729,49 +997,38 @@ struct piKpRAA { } } - void loadCorrections(uint64_t timeStamp) + void loadPhiCutSelections() { - // if (cfg.correctionsLoaded) return; - - if (paTHEff.value.empty() == false) { - cfg.hEfficiency = - ccdb->getForTimeStamp(paTHEff, timeStamp); - if (cfg.hEfficiency == nullptr) { - LOGF(fatal, "Could not load efficiency histogram from %s", - paTHEff.value.c_str()); + + if (pathPhiCutHigh.value.empty() == false) { + phiCut.hPhiCutHigh = ccdb->getForTimeStamp(pathPhiCutHigh, ccdbNoLaterThan.value); + if (phiCut.hPhiCutHigh == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", pathPhiCutHigh.value.c_str()); } } - if (paTHFD.value.empty() == false) { - cfg.hFeedDown = ccdb->getForTimeStamp(paTHFD, timeStamp); - if (cfg.hFeedDown == nullptr) { - LOGF(fatal, "Could not load feed down histogram from %s", - paTHFD.value.c_str()); + if (pathPhiCutLow.value.empty() == false) { + phiCut.hPhiCutLow = ccdb->getForTimeStamp(pathPhiCutLow, ccdbNoLaterThan.value); + if (phiCut.hPhiCutLow == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", pathPhiCutLow.value.c_str()); } } - cfg.correctionsLoaded = true; + + if (phiCut.hPhiCutHigh && phiCut.hPhiCutLow) + phiCut.isPhiCutLoaded = true; } - void loadNchCalibrations(uint64_t timeStamp) + void loadEtaCalibration() { - if (paTHmeanNch.value.empty() == false) { - cfgNch.hMeanNch = - ccdb->getForTimeStamp(paTHmeanNch, timeStamp); - if (cfgNch.hMeanNch == nullptr) { - LOGF(fatal, "Could not load hMeanNch histogram from %s", - paTHmeanNch.value.c_str()); + if (pathEtaCal.value.empty() == false) { + etaCal.pEtaCal = ccdb->getForTimeStamp(pathEtaCal, ccdbNoLaterThan.value); + if (etaCal.pEtaCal == nullptr) { + LOGF(fatal, "Could not load pEtaCal from %s", pathEtaCal.value.c_str()); } } - if (paTHsigmaNch.value.empty() == false) { - cfgNch.hSigmaNch = - ccdb->getForTimeStamp(paTHsigmaNch, timeStamp); - if (cfgNch.hSigmaNch == nullptr) { - LOGF(fatal, "Could not load hSigmaNch histogram from %s", - paTHsigmaNch.value.c_str()); - } - } - cfgNch.calibrationsLoaded = true; + if (etaCal.pEtaCal) + etaCal.isCalLoaded = true; } }; From 0220c1ccbe354069bd17c695e35abf5160d67295 Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Wed, 27 Aug 2025 12:46:49 -0500 Subject: [PATCH 2/3] Adds V0 process method --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 56 ++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 0c2b729c9c8..5a4c8dcddc7 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -10,6 +10,10 @@ // or submit itself to any jurisdiction. /// \file piKpRAA.cxx +/// +/// \brief task for analysis of piKp RAA +/// \author Omar Vazquez (omar.vazquez.rueda@cern.ch) +/// \since August 10, 2025 #include "PWGLF/DataModel/LFStrangenessTables.h" @@ -49,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -68,18 +71,19 @@ using BCsRun3 = soa::Join; -static constexpr int knEtaHists{9}; +static constexpr int kNEtaHists{9}; -std::array, knEtaHists> dEdxPiV0{}; -std::array, knEtaHists> dEdxPrV0{}; -std::array, knEtaHists> dEdxElV0{}; -std::array, knEtaHists> dEdxPiTOF{}; -std::array, knEtaHists> dEdxElTOF{}; +std::array, kNEtaHists> dEdxPiV0{}; +std::array, kNEtaHists> dEdxPrV0{}; +std::array, kNEtaHists> dEdxElV0{}; +std::array, kNEtaHists> dEdxPiTOF{}; +std::array, kNEtaHists> dEdxElTOF{}; struct piKpRAA { static constexpr float kZero{0.0f}; static constexpr float kOne{1.0f}; + static constexpr float kTenToMinusNine{1e-9}; static constexpr float kMinCharge{3.f}; static constexpr float kMinPMIP{0.4f}; static constexpr float kMaxPMIP{0.6f}; @@ -88,8 +92,8 @@ struct piKpRAA { static constexpr float kMindEdxMIPPlateau{65.0f}; static constexpr float kMaxdEdxMIPPlateau{95.0f}; - static constexpr float lowEta[knEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; - static constexpr float highEta[knEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; + static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; + static constexpr float kHighEta[kNEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; @@ -231,8 +235,8 @@ struct piKpRAA { const AxisSpec axisPtPhiCut{binsPtPhiCut, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtV0s{binsPtV0s, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisCent{binsCent, "T0C centrality"}; - const char* endingEta[knEtaHists] = {"88", "86", "64", "42", "20", "02", "24", "46", "68"}; - const char* latexEta[knEtaHists] = {"|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; + const char* endingEta[kNEtaHists] = {"88", "86", "64", "42", "20", "02", "24", "46", "68"}; + const char* latexEta[kNEtaHists] = {"|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); @@ -314,7 +318,7 @@ struct piKpRAA { registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); - for (int i = 0; i < knEtaHists; ++i) { + for (int i = 0; i < kNEtaHists; ++i) { dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); @@ -392,7 +396,7 @@ struct piKpRAA { const int charge{track.sign()}; float phiPrime{phi}; - PhiPrime(phiPrime, magField, charge); + phiPrimeFunc(phiPrime, magField, charge); registry.fill(HIST("NclFoundVsPVsPhipBeforeCut"), momentum, phiPrime, track.tpcNClsFound()); registry.fill(HIST("NclFoundVsPtVsPhipBeforeCut"), pt, phiPrime, track.tpcNClsFound()); @@ -425,8 +429,8 @@ struct piKpRAA { registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); int indexEta{0}; - for (int i = 1; i < knEtaHists; ++i) { - if (eta >= lowEta[i] && eta < highEta[i]) { + for (int i = 1; i < kNEtaHists; ++i) { + if (eta >= kLowEta[i] && eta < kHighEta[i]) { indexEta = i; break; } @@ -483,8 +487,8 @@ struct piKpRAA { float negTrkdEdx{negTrack.tpcSignal()}; float posTrackPhiPrime{posTrack.phi()}; float negTrackPhiPrime{negTrack.phi()}; - PhiPrime(posTrackPhiPrime, magField, posTrackCharge); - PhiPrime(negTrackPhiPrime, magField, negTrackCharge); + phiPrimeFunc(posTrackPhiPrime, magField, posTrackCharge); + phiPrimeFunc(negTrackPhiPrime, magField, negTrackCharge); // Skip v0s with like-sig daughters if (posTrack.sign() == negTrack.sign()) @@ -521,7 +525,7 @@ struct piKpRAA { const TVector3 pneg(negTrack.px(), negTrack.py(), negTrack.pz()); double alpha, qT; - GetArmeterosVariables(ppos, pneg, alpha, qT); + getArmeterosVariables(ppos, pneg, alpha, qT); registry.fill(HIST("ArmAll"), alpha, qT); // Passes V0 topological cuts? @@ -546,15 +550,15 @@ struct piKpRAA { int posIndexEta{0}; int negIndexEta{0}; - for (int i = 1; i < knEtaHists; ++i) { - if (posTrkEta >= lowEta[i] && posTrkEta < highEta[i]) { + for (int i = 1; i < kNEtaHists; ++i) { + if (posTrkEta >= kLowEta[i] && posTrkEta < kHighEta[i]) { posIndexEta = i; break; } } - for (int i = 1; i < knEtaHists; ++i) { - if (negTrkEta >= lowEta[i] && negTrkEta < highEta[i]) { + for (int i = 1; i < kNEtaHists; ++i) { + if (negTrkEta >= kLowEta[i] && negTrkEta < kHighEta[i]) { negIndexEta = i; break; } @@ -685,13 +689,13 @@ struct piKpRAA { PROCESS_SWITCH(piKpRAA, processCalibrationAndV0s, "Process QA", true); template - void GetArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) + void getArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) { alpha = 0., qT = 0.; TVector3 pV0 = ppos + pneg; double pV0mag = pV0.Mag(); - if (pV0mag < 1e-9) + if (pV0mag < kTenToMinusNine) return; // protect against zero momentum const TVector3 u = pV0 * (1.0 / pV0mag); @@ -705,7 +709,7 @@ struct piKpRAA { // α: longitudinal asymmetry (uses + and − labels by charge) double denom = pLpos + pLneg; - if (std::abs(denom) < 1e-9) + if (std::abs(denom) < kTenToMinusNine) return; // avoid 0 division (unphysical for V0s) alpha = (pLpos - pLneg) / denom; // equivalently / pV0mag @@ -863,7 +867,7 @@ struct piKpRAA { return grpo->getNominalL3Field(); } - void PhiPrime(float& phi, const int& magField, const int& charge) + void phiPrimeFunc(float& phi, const int& magField, const int& charge) { if (magField < 0) // for negatve polarity field From 4cdfb0996cd00cce68b95ae51cb0e2d1dbc45c0d Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Wed, 27 Aug 2025 12:53:44 -0500 Subject: [PATCH 3/3] Adds V0 process method --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 5a4c8dcddc7..2006c19f7fe 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -79,7 +79,7 @@ std::array, kNEtaHists> dEdxElV0{}; std::array, kNEtaHists> dEdxPiTOF{}; std::array, kNEtaHists> dEdxElTOF{}; -struct piKpRAA { +struct PiKpRAA { static constexpr float kZero{0.0f}; static constexpr float kOne{1.0f}; @@ -686,7 +686,7 @@ struct piKpRAA { } } } - PROCESS_SWITCH(piKpRAA, processCalibrationAndV0s, "Process QA", true); + PROCESS_SWITCH(PiKpRAA, processCalibrationAndV0s, "Process QA", true); template void getArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) @@ -1038,5 +1038,5 @@ struct piKpRAA { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; }