From e06d8d58017a5264020a8c60b33826e000c90d98 Mon Sep 17 00:00:00 2001 From: ariffero Date: Fri, 31 Jul 2026 12:20:32 +0200 Subject: [PATCH 1/6] Improve ptSpectraInclusiveUpc.cxx Make the DCAxy 2-dim to allow fits of the DCAxy vs pT. Include tracks that do not pass the DCAxy selctions in the DCAxy distribustions for the fits. Apply the selection on TPC cluster only to tracks that have TPC info. Do not reject tracks that are compatible with a particle but do not pass rapidity cut before checking the compatibility with other particles. --- PWGUD/Tasks/ptSpectraInclusiveUpc.cxx | 362 ++++++++++++++++---------- 1 file changed, 221 insertions(+), 141 deletions(-) diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index ce4feb743db..bf5e92c7b5e 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -50,8 +50,17 @@ 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})"}; + + Configurable nBinsDCAxy{ + "nBinsDCAxy", + 100, + "Number of bins in DCA_{xy} histograms"}; Configurable applyKineCutsInGen{"applyKineCutsInGen", false, "Apply kinematic cuts in the generated level"}; // define abbreviations @@ -73,42 +82,121 @@ struct PtSpectraInclusiveUpc { { // 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{ + nBinsDCAxy, + -0.6, + 0.6, + "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_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}); + + histos.add( + "DCAxy_primary_pions", + "Primary pions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_secondary_pions", + "Secondary pions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_primary_kaons", + "Primary kaons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_secondary_kaons", + "Secondary kaons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_primary_protons", + "Primary protons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_secondary_protons", + "Secondary protons from decays;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_material_protons", + "Secondary protons from material;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_data_pions", + "Data pion candidates;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_data_kaons", + "Data kaon candidates;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); + + histos.add( + "DCAxy_data_protons", + "Data proton candidates;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + kTH2F, + {axisPt, axisDCAxy}); } void processSim(aod::UDMcCollision const&, aod::UDMcParticles const& mcParticles) @@ -155,6 +243,7 @@ struct PtSpectraInclusiveUpc { { double dcaXyLimit = 0; + bool passDCAxyCut = true; auto nSigmaPi = -999.; auto nSigmaKa = -999.; @@ -163,11 +252,13 @@ struct PtSpectraInclusiveUpc { std::array trackMomentum; for (const auto& track : tracks) { + passDCAxyCut = true; + if (!track.isPVContributor()) { continue; } - if (track.tpcNClsFindable() < nFindableMin) { + if (track.hasTPC() && track.tpcNClsFindable() < nFindableMin) { continue; } @@ -180,19 +271,20 @@ 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; } - trackMomentum[0] = track.px(); - trackMomentum[1] = track.py(); - trackMomentum[2] = track.pz(); - if (!track.has_udMcParticle()) { continue; } auto mcParticle = track.udMcParticle(); + trackMomentum[0] = track.px(); + trackMomentum[1] = track.py(); + trackMomentum[2] = track.pz(); + + // compute rapidity for each ma bool hasTpc = false; // TPC tracks if (track.hasTPC()) { @@ -202,102 +294,92 @@ struct PtSpectraInclusiveUpc { 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 (mcParticle.isPhysicalPrimary()) { + if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCPion"), track.pt()); + histos.fill(HIST("DCAxy_primary_pions"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_secondary_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 (mcParticle.isPhysicalPrimary()) { + if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCKaon"), track.pt()); + histos.fill(HIST("DCAxy_primary_kaons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_secondary_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 (mcParticle.isPhysicalPrimary()) { + if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCProton"), track.pt()); + histos.fill(HIST("DCAxy_primary_protons"), track.pt(), track.dcaXY()); } else { - histos.fill(HIST("DCAxy_material_protons"), track.dcaXY()); + if (mcParticle.getProcess() == kPDecay) { + histos.fill(HIST("DCAxy_secondary_protons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_material_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 (mcParticle.isPhysicalPrimary()) { + if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFPion"), track.pt()); + if (!hasTpc) + histos.fill(HIST("DCAxy_primary_pions"), track.pt(), track.dcaXY()); + } else { + if (!hasTpc) + histos.fill(HIST("DCAxy_secondary_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 (mcParticle.isPhysicalPrimary()) { + if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFKaon"), track.pt()); + if (!hasTpc) + histos.fill(HIST("DCAxy_primary_kaons"), track.pt(), track.dcaXY()); + } else { + if (!hasTpc) + histos.fill(HIST("DCAxy_secondary_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()); - } else { - histos.fill(HIST("DCAxy_material_protons"), track.dcaXY()); + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { + if (mcParticle.isPhysicalPrimary()) { + if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFProton"), track.pt()); + if (!hasTpc) + histos.fill(HIST("DCAxy_primary_protons"), track.pt(), track.dcaXY()); + } else { + if (!hasTpc) { + if (mcParticle.getProcess() == kPDecay) { + histos.fill(HIST("DCAxy_secondary_protons"), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST("DCAxy_material_protons"), track.pt(), track.dcaXY()); + } } } } } + } } } @@ -306,7 +388,8 @@ struct PtSpectraInclusiveUpc { { double dcaXyLimit = 0; - + bool passDCAxyCut = true; + auto nSigmaPi = -999.; auto nSigmaKa = -999.; auto nSigmaPr = -999.; @@ -314,11 +397,13 @@ struct PtSpectraInclusiveUpc { std::array trackMomentum; for (const auto& track : tracks) { + passDCAxyCut = true; + if (!track.isPVContributor()) { continue; } - if (track.tpcNClsFindable() < nFindableMin) { + if (track.hasTPC() && track.tpcNClsFindable() < nFindableMin) { continue; } @@ -331,8 +416,8 @@ 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; } trackMomentum[0] = track.px(); @@ -348,60 +433,55 @@ struct PtSpectraInclusiveUpc { nSigmaPr = track.tpcNSigmaPr(); if (std::abs(nSigmaPi) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) > yMax) { - continue; + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { + if(passDCAxyCut) histos.fill(HIST("ptDataTPCPion"), track.pt()); + histos.fill(HIST("DCAxy_data_pions"), track.pt(), track.dcaXY()); } - 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; + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { + if(passDCAxyCut) histos.fill(HIST("ptDataTPCKaon"), track.pt()); + histos.fill(HIST("DCAxy_data_kaons"), track.pt(), track.dcaXY()); } - 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; + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { + if(passDCAxyCut) histos.fill(HIST("ptDataTPCProton"), track.pt()); + histos.fill(HIST("DCAxy_data_protons"), track.pt(), track.dcaXY()); } - histos.fill(HIST("ptDataTPCProton"), track.pt()); - histos.fill(HIST("DCAxy_data_protons"), 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 (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { + if(passDCAxyCut) histos.fill(HIST("ptDataTOFPion"), track.pt()); + if (!hasTpc) + histos.fill(HIST("DCAxy_data_pions"), track.pt(), track.dcaXY()); } - 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; + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { + if(passDCAxyCut) histos.fill(HIST("ptDataTOFKaon"), track.pt()); + if (!hasTpc) + histos.fill(HIST("DCAxy_data_kaons"), track.pt(), track.dcaXY()); } - 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; + if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { + if(passDCAxyCut) histos.fill(HIST("ptDataTOFProton"), track.pt()); + if (!hasTpc) + histos.fill(HIST("DCAxy_data_protons"), track.pt(), track.dcaXY()); } - histos.fill(HIST("ptDataTOFProton"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_protons"), track.dcaXY()); } } } From 6a83636171ca66b72295066752020a323aadc0b5 Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 1 Oct 2026 15:31:33 +0200 Subject: [PATCH 2/6] Major updates Use templated function to use the same function for data and reco. Save DCAxy as a function of pT, and separated for TPC and TOF PID. --- PWGUD/Tasks/ptSpectraInclusiveUpc.cxx | 344 +++++++++++++------------- 1 file changed, 171 insertions(+), 173 deletions(-) diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index bf5e92c7b5e..6961a8bfa07 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -12,7 +12,9 @@ /// \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 +/// 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 @@ -77,6 +79,8 @@ struct PtSpectraInclusiveUpc { const int nFindableMin = 70; const double sigmaMax = 3.; const double dcaZlimit = 2.; + const double maxChi2TPC = 4.; + const double maxChi2ITS = 36.; void init(InitContext const&) { @@ -127,74 +131,123 @@ struct PtSpectraInclusiveUpc { histos.add("myEventCounter", "Event counter;Event type;Counts", 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}); + 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_primary_pions", - "Primary pions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TPC_secondary_protons", + "Secondary protons from decays (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_secondary_pions", - "Secondary pions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TPC_material_protons", + "Secondary protons from material (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_primary_kaons", - "Primary kaons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TPC_data_pions", + "Data pion candidates (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_secondary_kaons", - "Secondary kaons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TPC_data_kaons", + "Data kaon candidates (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_primary_protons", - "Primary protons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TPC_data_protons", + "Data proton candidates (TPC);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_secondary_protons", - "Secondary protons from decays;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TOF_primary_pions", + "Primary pions (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_material_protons", - "Secondary protons from material;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TOF_secondary_pions", + "Secondary pions (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_data_pions", - "Data pion candidates;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TOF_primary_kaons", + "Primary kaons (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_data_kaons", - "Data kaon candidates;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "DCAxy_TOF_secondary_kaons", + "Secondary kaons (TOF);#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", kTH2F, {axisPt, axisDCAxy}); histos.add( - "DCAxy_data_protons", - "Data proton candidates;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm)", + "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}); } @@ -239,7 +292,8 @@ struct PtSpectraInclusiveUpc { } } - void processReco(CCMC const&, TCMCs const& tracks, aod::UDMcParticles const&) + template + void selectDataAndFillHistos(TCollision const& /*collision*/, TTracks const& tracks) { double dcaXyLimit = 0; @@ -258,7 +312,17 @@ struct PtSpectraInclusiveUpc { continue; } - if (track.hasTPC() && 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; } @@ -275,56 +339,75 @@ struct PtSpectraInclusiveUpc { passDCAxyCut = false; } - if (!track.has_udMcParticle()) { - continue; + 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; } - auto mcParticle = track.udMcParticle(); trackMomentum[0] = track.px(); trackMomentum[1] = track.py(); trackMomentum[2] = track.pz(); // compute rapidity for each ma - 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) { - if (mcParticle.isPhysicalPrimary()) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCPion"), track.pt()); - histos.fill(HIST("DCAxy_primary_pions"), track.pt(), track.dcaXY()); + 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 { - histos.fill(HIST("DCAxy_secondary_pions"), track.pt(), track.dcaXY()); + 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) { - if (mcParticle.isPhysicalPrimary()) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCKaon"), track.pt()); - histos.fill(HIST("DCAxy_primary_kaons"), track.pt(), track.dcaXY()); + 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 { - histos.fill(HIST("DCAxy_secondary_kaons"), track.pt(), track.dcaXY()); + 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) { - if (mcParticle.isPhysicalPrimary()) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCProton"), track.pt()); - histos.fill(HIST("DCAxy_primary_protons"), track.pt(), track.dcaXY()); - } else { - if (mcParticle.getProcess() == kPDecay) { - histos.fill(HIST("DCAxy_secondary_protons"), track.pt(), track.dcaXY()); + 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 { - histos.fill(HIST("DCAxy_material_protons"), track.pt(), track.dcaXY()); + 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 { + if(passDCAxyCut) histos.fill(HIST("ptDataTPCProton"), track.pt()); + histos.fill(HIST("DCAxy_TPC_data_protons"), track.pt(), track.dcaXY()); } } } @@ -338,44 +421,52 @@ struct PtSpectraInclusiveUpc { if (std::abs(nSigmaPi) < sigmaMax) { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { - if (mcParticle.isPhysicalPrimary()) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFPion"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_primary_pions"), track.pt(), track.dcaXY()); + 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 (!hasTpc) - histos.fill(HIST("DCAxy_secondary_pions"), track.pt(), track.dcaXY()); + 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) { - if (mcParticle.isPhysicalPrimary()) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFKaon"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_primary_kaons"), track.pt(), track.dcaXY()); + 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 (!hasTpc) - histos.fill(HIST("DCAxy_secondary_kaons"), track.pt(), track.dcaXY()); + 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) { - if (mcParticle.isPhysicalPrimary()) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFProton"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_primary_protons"), track.pt(), track.dcaXY()); - } else { - if (!hasTpc) { - if (mcParticle.getProcess() == kPDecay) { - histos.fill(HIST("DCAxy_secondary_protons"), track.pt(), track.dcaXY()); + 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 { + if (isDecay) { + histos.fill(HIST("DCAxy_TOF_secondary_protons"), track.pt(), track.dcaXY()); } else { - histos.fill(HIST("DCAxy_material_protons"), track.pt(), track.dcaXY()); + 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()); } } } @@ -384,107 +475,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; - bool passDCAxyCut = true; - - auto nSigmaPi = -999.; - auto nSigmaKa = -999.; - auto nSigmaPr = -999.; - - std::array trackMomentum; - - for (const auto& track : tracks) { - passDCAxyCut = true; - - if (!track.isPVContributor()) { - continue; - } - - if (track.hasTPC() && 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)) { - passDCAxyCut = false; - } - - 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) { - if(passDCAxyCut) histos.fill(HIST("ptDataTPCPion"), track.pt()); - histos.fill(HIST("DCAxy_data_pions"), track.pt(), track.dcaXY()); - } - } - - if (std::abs(nSigmaKa) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { - if(passDCAxyCut) histos.fill(HIST("ptDataTPCKaon"), track.pt()); - histos.fill(HIST("DCAxy_data_kaons"), track.pt(), track.dcaXY()); - } - } - - if (std::abs(nSigmaPr) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { - if(passDCAxyCut) histos.fill(HIST("ptDataTPCProton"), track.pt()); - histos.fill(HIST("DCAxy_data_protons"), track.pt(), track.dcaXY()); - } - } - } - - // 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) { - if(passDCAxyCut) histos.fill(HIST("ptDataTOFPion"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_pions"), track.pt(), track.dcaXY()); - } - } - - if (std::abs(nSigmaKa) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { - if(passDCAxyCut) histos.fill(HIST("ptDataTOFKaon"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_kaons"), track.pt(), track.dcaXY()); - } - } - - if (std::abs(nSigmaPr) < sigmaMax) { - if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { - if(passDCAxyCut) histos.fill(HIST("ptDataTOFProton"), track.pt()); - if (!hasTpc) - histos.fill(HIST("DCAxy_data_protons"), track.pt(), track.dcaXY()); - } - } - } - } + void processData(CC const& collision, TCs const& tracks) + { + selectDataAndFillHistos(collision, tracks); } PROCESS_SWITCH(PtSpectraInclusiveUpc, processSim, "processSim", false); From e4339b28afdcf27deaae62f21ca61dbc510baefb Mon Sep 17 00:00:00 2001 From: ariffero Date: Fri, 2 Oct 2026 14:16:51 +0200 Subject: [PATCH 3/6] Make cut limits configurables --- PWGUD/Tasks/ptSpectraInclusiveUpc.cxx | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index 6961a8bfa07..d177292b9c9 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -59,12 +59,18 @@ struct PtSpectraInclusiveUpc { 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})"}; - Configurable nBinsDCAxy{ - "nBinsDCAxy", - 100, - "Number of bins in DCA_{xy} histograms"}; + Configurable nBinsDCAxy{"nBinsDCAxy", 1000, "Number of bins in DCA_{xy} histograms"}; 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; @@ -73,15 +79,6 @@ 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.; - const double maxChi2TPC = 4.; - const double maxChi2ITS = 36.; - void init(InitContext const&) { From 6a7efcdee8ea79c89859fd514bc50cbcbe0017a5 Mon Sep 17 00:00:00 2001 From: ariffero Date: Mon, 5 Oct 2026 12:07:26 +0200 Subject: [PATCH 4/6] Fix o2linter warnings --- PWGUD/Tasks/ptSpectraInclusiveUpc.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index d177292b9c9..a4e7f319cc7 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -11,10 +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. +/// \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. +/// selections will contribute to both histograms. /// /// \author Andrea Giovanni Riffero andrea.giovanni.riffero@cern.ch @@ -52,8 +52,7 @@ struct PtSpectraInclusiveUpc { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - ConfigurableAxis ptBinning{ - "ptBinning", + 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}, @@ -70,7 +69,7 @@ struct PtSpectraInclusiveUpc { 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; From 0dc5dc8f3fd06528f82fa3c4aad6fc47755ef40b Mon Sep 17 00:00:00 2001 From: ariffero Date: Mon, 5 Oct 2026 14:12:20 +0200 Subject: [PATCH 5/6] Make the axis for DCA xy fully configurable --- PWGUD/Tasks/ptSpectraInclusiveUpc.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index a4e7f319cc7..ce5b9982b2b 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -58,7 +58,7 @@ struct PtSpectraInclusiveUpc { 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})"}; - Configurable nBinsDCAxy{"nBinsDCAxy", 1000, "Number of bins in DCA_{xy} histograms"}; + 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"}; @@ -94,9 +94,7 @@ struct PtSpectraInclusiveUpc { "Event type"}; const AxisSpec axisDCAxy{ - nBinsDCAxy, - -0.6, - 0.6, + dcaXYaxis, "DCA_{xy} (cm)"}; // histograms From 4e5c48e666568832d25f68726ac5bdc894f24b76 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 9 Oct 2026 06:47:35 +0000 Subject: [PATCH 6/6] Please consider the following formatting changes --- PWGUD/Tasks/ptSpectraInclusiveUpc.cxx | 47 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx index ce5b9982b2b..0ffc5ee5f6d 100644 --- a/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx +++ b/PWGUD/Tasks/ptSpectraInclusiveUpc.cxx @@ -53,10 +53,10 @@ struct PtSpectraInclusiveUpc { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; 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})"}; + {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"}; @@ -316,7 +316,7 @@ struct PtSpectraInclusiveUpc { } } - if(track.itsChi2NCl() > maxChi2ITS) { + if (track.itsChi2NCl() > maxChi2ITS) { continue; } @@ -359,13 +359,15 @@ struct PtSpectraInclusiveUpc { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { if constexpr (isMc) { if (isPrimary) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCPion"), track.pt()); + 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()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTPCPion"), track.pt()); histos.fill(HIST("DCAxy_TPC_data_pions"), track.pt(), track.dcaXY()); } } @@ -374,13 +376,15 @@ struct PtSpectraInclusiveUpc { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { if constexpr (isMc) { if (isPrimary) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCKaon"), track.pt()); + 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()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTPCKaon"), track.pt()); histos.fill(HIST("DCAxy_TPC_data_kaons"), track.pt(), track.dcaXY()); } } @@ -390,7 +394,8 @@ struct PtSpectraInclusiveUpc { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { if constexpr (isMc) { if (isPrimary) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTPCProton"), track.pt()); + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTPCProton"), track.pt()); histos.fill(HIST("DCAxy_TPC_primary_protons"), track.pt(), track.dcaXY()); } else { if (isDecay) { @@ -400,7 +405,8 @@ struct PtSpectraInclusiveUpc { } } } else { - if(passDCAxyCut) histos.fill(HIST("ptDataTPCProton"), track.pt()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTPCProton"), track.pt()); histos.fill(HIST("DCAxy_TPC_data_protons"), track.pt(), track.dcaXY()); } } @@ -417,13 +423,15 @@ struct PtSpectraInclusiveUpc { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassPionCharged)) < yMax) { if constexpr (isMc) { if (isPrimary) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFPion"), track.pt()); + 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()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTOFPion"), track.pt()); histos.fill(HIST("DCAxy_TOF_data_pions"), track.pt(), track.dcaXY()); } } @@ -433,13 +441,15 @@ struct PtSpectraInclusiveUpc { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassKaonCharged)) < yMax) { if constexpr (isMc) { if (isPrimary) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFKaon"), track.pt()); + 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()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTOFKaon"), track.pt()); histos.fill(HIST("DCAxy_TOF_data_kaons"), track.pt(), track.dcaXY()); } } @@ -449,7 +459,8 @@ struct PtSpectraInclusiveUpc { if (std::abs(RecoDecay::y(trackMomentum, o2::constants::physics::MassProton)) < yMax) { if constexpr (isMc) { if (isPrimary) { - if(passDCAxyCut) histos.fill(HIST("ptReconstructedTOFProton"), track.pt()); + if (passDCAxyCut) + histos.fill(HIST("ptReconstructedTOFProton"), track.pt()); histos.fill(HIST("DCAxy_TOF_primary_protons"), track.pt(), track.dcaXY()); } else { if (isDecay) { @@ -459,12 +470,12 @@ struct PtSpectraInclusiveUpc { } } } else { - if(passDCAxyCut) histos.fill(HIST("ptDataTOFProton"), track.pt()); + if (passDCAxyCut) + histos.fill(HIST("ptDataTOFProton"), track.pt()); histos.fill(HIST("DCAxy_TOF_data_protons"), track.pt(), track.dcaXY()); } } } - } } }