diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index ce4feb743db..0ffc5ee5f6d 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -11,8 +11,10 @@ /// /// \file ptSpectraInclusiveUpc.cxx /// \executable o2-analysis-ud-pt-spectra-inclusive-upc -/// \brief Task for the of pT spectra of pions, kaons and protons in inclusive UPC events. -/// Used to obtain the templates for the DCA_xy fits for the primary fractions +/// \brief Task for pT spectra of pions, kaons and protons in inclusive UPC events. +/// Used to obtain the templates for the DCA_xy fits for the primary fractions. +/// Fractions are obtained separately for TPC and TOF spectra: a particle passing both PID +/// selections will contribute to both histograms. /// /// \author Andrea Giovanni Riffero andrea.giovanni.riffero@cern.ch @@ -50,10 +52,24 @@ struct PtSpectraInclusiveUpc { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histos"}; - Configurable nBinsDCAxy{"nBinsDCAxy", 100, "N bins in DCA_{xy} histos"}; + ConfigurableAxis ptBinning{"ptBinning", + {VARIABLE_WIDTH, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, + 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0}, + "#it{p}_{T} (GeV/#it{c})"}; + + ConfigurableAxis dcaXYaxis{"dcaXYaxis", {1000, -0.6, 0.6}, "DCA_{xy} (cm) binning"}; Configurable applyKineCutsInGen{"applyKineCutsInGen", false, "Apply kinematic cuts in the generated level"}; + Configurable etaMax{"etaMax", 0.9, "Maximum track pseudorapidity"}; + Configurable yMax{"yMax", 0.9, "Maximum particle rapidity"}; + Configurable ptMin{"ptMin", 0.1, "Minimum track transverse momentum (GeV/c)"}; + Configurable nFindableMin{"nFindableMin", 70, "Minimum number of findable TPC clusters"}; + Configurable sigmaMax{"sigmaMax", 3., "Maximum absolute PID n-sigma"}; + Configurable dcaZlimit{"dcaZlimit", 2., "Maximum absolute DCA in z (cm)"}; + Configurable maxChi2TPC{"maxChi2TPC", 4., "Maximum TPC chi2 per cluster"}; + Configurable maxChi2ITS{"maxChi2ITS", 36., "Maximum ITS chi2 per cluster"}; + // define abbreviations using CCs = soa::Join; using CC = CCs::iterator; @@ -62,53 +78,172 @@ struct PtSpectraInclusiveUpc { using TCs = soa::Join; using TCMCs = soa::Join; - const double etaMax = 0.9; - const double yMax = 0.9; - const double ptMin = 0.1; - const int nFindableMin = 70; - const double sigmaMax = 3.; - const double dcaZlimit = 2.; - void init(InitContext const&) { // axes - const AxisSpec axisPt{nBinsPt, 0, 5, "#it{p}_{T} GeV/#it{c}"}; - const AxisSpec axisEventCounter{2, 0.5, 2.5, "Event type"}; - const AxisSpec axisDCAxy{nBinsDCAxy, -0.6, 0.6, "DCA_{xy} cm"}; + const AxisSpec axisPt{ + ptBinning, + "#it{p}_{T} (GeV/#it{c})", + "axisPt"}; + + const AxisSpec axisEventCounter{ + 2, + 0.5, + 2.5, + "Event type"}; + + const AxisSpec axisDCAxy{ + dcaXYaxis, + "DCA_{xy} (cm)"}; // histograms - histos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {axisPt}); - histos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {axisPt}); - histos.add("ptGeneratedProton", "ptGeneratedProton", kTH1F, {axisPt}); - - histos.add("ptReconstructedTPCPion", "ptReconstructedTPCPion", kTH1F, {axisPt}); - histos.add("ptReconstructedTPCKaon", "ptReconstructedTPCKaon", kTH1F, {axisPt}); - histos.add("ptReconstructedTPCProton", "ptReconstructedTPCProton", kTH1F, {axisPt}); - - histos.add("ptReconstructedTOFPion", "ptReconstructedTOFPion", kTH1F, {axisPt}); - histos.add("ptReconstructedTOFKaon", "ptReconstructedTOFKaon", kTH1F, {axisPt}); - histos.add("ptReconstructedTOFProton", "ptReconstructedTOFProton", kTH1F, {axisPt}); - - histos.add("ptDataTPCPion", "ptDataTPCPion", kTH1F, {axisPt}); - histos.add("ptDataTPCKaon", "ptDataTPCKaon", kTH1F, {axisPt}); - histos.add("ptDataTPCProton", "ptDataTPCProton", kTH1F, {axisPt}); - - histos.add("ptDataTOFPion", "ptDataTOFPion", kTH1F, {axisPt}); - histos.add("ptDataTOFKaon", "ptDataTOFKaon", kTH1F, {axisPt}); - histos.add("ptDataTOFProton", "ptDataTOFProton", kTH1F, {axisPt}); - - histos.add("myEventCounter", "myEventCounter", kTH1F, {axisEventCounter}); - histos.add("DCAxy_primary_pions", "DCAxy_primary_pions", kTH1F, {axisDCAxy}); - histos.add("DCAxy_secondary_pions", "DCAxy_secondary_pions", kTH1F, {axisDCAxy}); - histos.add("DCAxy_primary_kaons", "DCAxy_primary_kaons", kTH1F, {axisDCAxy}); - histos.add("DCAxy_secondary_kaons", "DCAxy_secondary_kaons", kTH1F, {axisDCAxy}); - histos.add("DCAxy_primary_protons", "DCAxy_primary_protons", kTH1F, {axisDCAxy}); - histos.add("DCAxy_secondary_protons", "DCAxy_secondary_protons", kTH1F, {axisDCAxy}); - histos.add("DCAxy_material_protons", "DCAxy_material_protons", kTH1F, {axisDCAxy}); - histos.add("DCAxy_data_pions", "DCAxy_data_pions", kTH1F, {axisDCAxy}); - histos.add("DCAxy_data_kaons", "DCAxy_data_kaons", kTH1F, {axisDCAxy}); - histos.add("DCAxy_data_protons", "DCAxy_data_protons", kTH1F, {axisDCAxy}); + // generated pT spectra + histos.add("ptGeneratedPion", "Generated pions;#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptGeneratedKaon", "Generated kaons;#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptGeneratedProton", "Generated protons;#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + + // reconstructed pT spectra with TPC PID + histos.add("ptReconstructedTPCPion", "Reconstructed pions (TPC);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptReconstructedTPCKaon", "Reconstructed kaons (TPC);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptReconstructedTPCProton", "Reconstructed protons (TPC);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + + // reconstructed pT spectra with TOF PID + histos.add("ptReconstructedTOFPion", "Reconstructed TOF pions;#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptReconstructedTOFKaon", "Reconstructed TOF kaons;#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptReconstructedTOFProton", "Reconstructed TOF protons;#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + + // data pT spectra with TPC PID + histos.add("ptDataTPCPion", "Data pions (TPC);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptDataTPCKaon", "Data kaons (TPC);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptDataTPCProton", "Data protons (TPC);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + + // data pT spectra with TOF PID + histos.add("ptDataTOFPion", "Data pions (TOF);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptDataTOFKaon", "Data kaons (TOF);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + histos.add("ptDataTOFProton", "Data protons (TOF);#it{p}_{T} (GeV/#it{c});Counts", kTH1F, {axisPt}); + + histos.add("myEventCounter", "Event counter;Event type;Counts", kTH1F, {axisEventCounter}); + + histos.add( + "DCAxy_TPC_primary_pions", + "Primary pions (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_secondary_pions", + "Secondary pions (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_primary_kaons", + "Primary kaons (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_secondary_kaons", + "Secondary kaons (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_primary_protons", + "Primary protons (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_secondary_protons", + "Secondary protons from decays (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_material_protons", + "Secondary protons from material (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_data_pions", + "Data pion candidates (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_data_kaons", + "Data kaon candidates (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TPC_data_protons", + "Data proton candidates (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_primary_pions", + "Primary pions (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_secondary_pions", + "Secondary pions (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_primary_kaons", + "Primary kaons (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_secondary_kaons", + "Secondary kaons (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_primary_protons", + "Primary protons (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_secondary_protons", + "Secondary protons from decays (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_material_protons", + "Secondary protons from material (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_data_pions", + "Data pion candidates (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_data_kaons", + "Data kaon candidates (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_TOF_data_protons", + "Data proton candidates (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); } void processSim(aod::UDMcCollision const&, aod::UDMcParticles const& mcParticles) @@ -151,10 +286,12 @@ struct PtSpectraInclusiveUpc { } } - void processReco(CCMC const&, TCMCs const& tracks, aod::UDMcParticles const&) + template + void selectDataAndFillHistos(TCollision const& /*collision*/, TTracks const& tracks) { double dcaXyLimit = 0; + bool passDCAxyCut = true; auto nSigmaPi = -999.; auto nSigmaKa = -999.; @@ -163,11 +300,23 @@ struct PtSpectraInclusiveUpc { std::array trackMomentum; for (const auto& track : tracks) { + passDCAxyCut = true; + if (!track.isPVContributor()) { continue; } - if (track.tpcNClsFindable() < nFindableMin) { + // here TPC selection on findable number of clusters + if (track.hasTPC()) { + if (track.tpcNClsFindable() < nFindableMin) { + continue; + } + if (track.tpcChi2NCl() > maxChi2TPC) { + continue; + } + } + + if (track.itsChi2NCl() > maxChi2ITS) { continue; } @@ -180,121 +329,150 @@ struct PtSpectraInclusiveUpc { } dcaXyLimit = 0.0105 + 0.035 / std::pow(track.pt(), 1.1); - if (!(std::abs(track.dcaXY()) < dcaXyLimit)) { - continue; + if ((std::abs(track.dcaXY()) > dcaXyLimit)) { + passDCAxyCut = false; + } + + bool isPrimary = false; + bool isDecay = false; + if constexpr (isMc) { + if (!track.has_udMcParticle()) { + continue; + } + const auto mcParticle = track.udMcParticle(); + isPrimary = mcParticle.isPhysicalPrimary(); + isDecay = mcParticle.getProcess() == kPDecay; } trackMomentum[0] = track.px(); trackMomentum[1] = track.py(); trackMomentum[2] = track.pz(); - if (!track.has_udMcParticle()) { - continue; - } - auto mcParticle = track.udMcParticle(); - - bool hasTpc = false; + // compute rapidity for each ma // TPC tracks if (track.hasTPC()) { - hasTpc = true; nSigmaPi = track.tpcNSigmaPi(); nSigmaKa = track.tpcNSigmaKa(); nSigmaPr = track.tpcNSigmaPr(); if (std::abs(nSigmaPi) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) > yMax) { - continue; - } - - if (mcParticle.isPhysicalPrimary()) { - histos.fill(HIST("ptReconstructedTPCPion"), track.pt()); - histos.fill(HIST("DCAxy_primary_pions"), track.dcaXY()); - } else { - histos.fill(HIST("DCAxy_secondary_pions"), track.dcaXY()); + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { + if constexpr (isMc) { + if (isPrimary) { + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTPCPion"), track.pt()); + histos.fill(HIST("DCAxy_TPC_primary_pions"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_TPC_secondary_pions"), track.pt(), track.dcaXY()); + } + } else { + if (passDCAxyCut) + histos.fill(HIST("ptDataTPCPion"), track.pt()); + histos.fill(HIST("DCAxy_TPC_data_pions"), track.pt(), track.dcaXY()); + } } } if (std::abs(nSigmaKa) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) > yMax) { - continue; - } - - if (mcParticle.isPhysicalPrimary()) { - histos.fill(HIST("ptReconstructedTPCKaon"), track.pt()); - histos.fill(HIST("DCAxy_primary_kaons"), track.dcaXY()); - } else { - histos.fill(HIST("DCAxy_secondary_kaons"), track.dcaXY()); + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { + if constexpr (isMc) { + if (isPrimary) { + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTPCKaon"), track.pt()); + histos.fill(HIST("DCAxy_TPC_primary_kaons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_TPC_secondary_kaons"), track.pt(), track.dcaXY()); + } + } else { + if (passDCAxyCut) + histos.fill(HIST("ptDataTPCKaon"), track.pt()); + histos.fill(HIST("DCAxy_TPC_data_kaons"), track.pt(), track.dcaXY()); + } } } if (std::abs(nSigmaPr) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) > yMax) { - continue; - } - - if (mcParticle.isPhysicalPrimary()) { - histos.fill(HIST("ptReconstructedTPCProton"), track.pt()); - histos.fill(HIST("DCAxy_primary_protons"), track.dcaXY()); - } else { - if (mcParticle.getProcess() == kPDecay) { - histos.fill(HIST("DCAxy_secondary_protons"), track.dcaXY()); + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { + if constexpr (isMc) { + if (isPrimary) { + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTPCProton"), track.pt()); + histos.fill(HIST("DCAxy_TPC_primary_protons"), track.pt(), track.dcaXY()); + } else { + if (isDecay) { + histos.fill(HIST("DCAxy_TPC_secondary_protons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_TPC_material_protons"), track.pt(), track.dcaXY()); + } + } } else { - histos.fill(HIST("DCAxy_material_protons"), track.dcaXY()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTPCProton"), track.pt()); + histos.fill(HIST("DCAxy_TPC_data_protons"), track.pt(), track.dcaXY()); } } } } - // TPC tracks + // TOF tracks if (track.hasTOF()) { nSigmaPi = track.tofNSigmaPi(); nSigmaKa = track.tofNSigmaKa(); nSigmaPr = track.tofNSigmaPr(); if (std::abs(nSigmaPi) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) > yMax) { - continue; - } - - if (mcParticle.isPhysicalPrimary()) { - histos.fill(HIST("ptReconstructedTOFPion"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_primary_pions"), track.dcaXY()); - } else { - if (!hasTpc) - histos.fill(HIST("DCAxy_secondary_pions"), track.dcaXY()); + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { + if constexpr (isMc) { + if (isPrimary) { + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTOFPion"), track.pt()); + histos.fill(HIST("DCAxy_TOF_primary_pions"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_TOF_secondary_pions"), track.pt(), track.dcaXY()); + } + } else { + if (passDCAxyCut) + histos.fill(HIST("ptDataTOFPion"), track.pt()); + histos.fill(HIST("DCAxy_TOF_data_pions"), track.pt(), track.dcaXY()); + } } } - if (std::abs(nSigmaKa) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) > yMax) { - continue; - } - if (mcParticle.isPhysicalPrimary()) { - histos.fill(HIST("ptReconstructedTOFKaon"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_primary_kaons"), track.dcaXY()); - } else { - if (!hasTpc) - histos.fill(HIST("DCAxy_secondary_kaons"), track.dcaXY()); + if (std::abs(nSigmaKa) < sigmaMax) { + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { + if constexpr (isMc) { + if (isPrimary) { + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTOFKaon"), track.pt()); + histos.fill(HIST("DCAxy_TOF_primary_kaons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_TOF_secondary_kaons"), track.pt(), track.dcaXY()); + } + } else { + if (passDCAxyCut) + histos.fill(HIST("ptDataTOFKaon"), track.pt()); + histos.fill(HIST("DCAxy_TOF_data_kaons"), track.pt(), track.dcaXY()); + } } } if (std::abs(nSigmaPr) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) > yMax) { - continue; - } - - if (mcParticle.isPhysicalPrimary()) { - histos.fill(HIST("ptReconstructedTOFProton"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_primary_protons"), track.dcaXY()); - } else { - if (!hasTpc) { - if (mcParticle.getProcess() == kPDecay) { - histos.fill(HIST("DCAxy_secondary_protons"), track.dcaXY()); + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { + if constexpr (isMc) { + if (isPrimary) { + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTOFProton"), track.pt()); + histos.fill(HIST("DCAxy_TOF_primary_protons"), track.pt(), track.dcaXY()); } else { - histos.fill(HIST("DCAxy_material_protons"), track.dcaXY()); + if (isDecay) { + histos.fill(HIST("DCAxy_TOF_secondary_protons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_TOF_material_protons"), track.pt(), track.dcaXY()); + } } + } else { + if (passDCAxyCut) + histos.fill(HIST("ptDataTOFProton"), track.pt()); + histos.fill(HIST("DCAxy_TOF_data_protons"), track.pt(), track.dcaXY()); } } } @@ -302,109 +480,14 @@ struct PtSpectraInclusiveUpc { } } - void processData(CC const&, TCs const& tracks) + void processReco(CCMC const& collision, TCMCs const& tracks, aod::UDMcParticles const&) { + selectDataAndFillHistos(collision, tracks); + } - double dcaXyLimit = 0; - - auto nSigmaPi = -999.; - auto nSigmaKa = -999.; - auto nSigmaPr = -999.; - - std::array trackMomentum; - - for (const auto& track : tracks) { - if (!track.isPVContributor()) { - continue; - } - - if (track.tpcNClsFindable() < nFindableMin) { - continue; - } - - if (track.pt() < ptMin) { - continue; - } - - if (!(std::abs(track.dcaZ()) < dcaZlimit)) { - continue; - } - - dcaXyLimit = 0.0105 + 0.035 / std::pow(track.pt(), 1.1); - if (!(std::abs(track.dcaXY()) < dcaXyLimit)) { - continue; - } - - trackMomentum[0] = track.px(); - trackMomentum[1] = track.py(); - trackMomentum[2] = track.pz(); - - bool hasTpc = false; - // TPC tracks - if (track.hasTPC()) { - hasTpc = true; - nSigmaPi = track.tpcNSigmaPi(); - nSigmaKa = track.tpcNSigmaKa(); - nSigmaPr = track.tpcNSigmaPr(); - - if (std::abs(nSigmaPi) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) > yMax) { - continue; - } - histos.fill(HIST("ptDataTPCPion"), track.pt()); - histos.fill(HIST("DCAxy_data_pions"), track.dcaXY()); - } - - if (std::abs(nSigmaKa) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) > yMax) { - continue; - } - histos.fill(HIST("ptDataTPCKaon"), track.pt()); - histos.fill(HIST("DCAxy_data_kaons"), track.dcaXY()); - } - - if (std::abs(nSigmaPr) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) > yMax) { - continue; - } - histos.fill(HIST("ptDataTPCProton"), track.pt()); - histos.fill(HIST("DCAxy_data_protons"), track.dcaXY()); - } - } - - // TPC tracks - if (track.hasTOF()) { - nSigmaPi = track.tofNSigmaPi(); - nSigmaKa = track.tofNSigmaKa(); - nSigmaPr = track.tofNSigmaPr(); - - if (std::abs(nSigmaPi) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) > yMax) { - continue; - } - histos.fill(HIST("ptDataTOFPion"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_pions"), track.dcaXY()); - } - if (std::abs(nSigmaKa) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) > yMax) { - continue; - } - histos.fill(HIST("ptDataTOFKaon"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_kaons"), track.dcaXY()); - } - - if (std::abs(nSigmaPr) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) > yMax) { - continue; - } - histos.fill(HIST("ptDataTOFProton"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_protons"), track.dcaXY()); - } - } - } + void processData(CC const& collision, TCs const& tracks) + { + selectDataAndFillHistos(collision, tracks); } PROCESS_SWITCH(PtSpectraInclusiveUpc, processSim, "processSim", false);