From 0ede89c2367fc8d6bf6fa77f7a62ee2f5090b39c Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Thu, 24 Sep 2026 20:50:21 +0200 Subject: [PATCH 1/6] [PWGJE] Fix leading-jet selection (Rec) and event normalization --- PWGJE/Tasks/nucleiInJets.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 5b57190673e..22a09c2f5cb 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -2570,13 +2570,12 @@ struct nucleiInJets { } // Select the accepted detector-level leading jet before considering matches. - int32_t leadingDetJetId = -1; + int64_t leadingDetJetId = -1; float leadingDetJetPt = -1.f; if (isWithLeadingJet) { for (const auto& mcdjet : mcdjets) { - const float mcdJetPtForResponseSel = usebkgSubractionMC ? mcdjet.pt() - backgroundRho * jetArea : mcdjet.pt(); - if (isConeAxisAccepted(mcdjet.eta()) && mcdJetPtForResponseSel > leadingDetJetPt) { - leadingDetJetPt = mcdJetPtForResponseSel; + if (isConeAxisAccepted(mcdjet.eta()) && mcdjet.pt() > leadingDetJetPt) { + leadingDetJetPt = mcdjet.pt(); leadingDetJetId = mcdjet.globalIndex(); } } @@ -2585,7 +2584,7 @@ struct nucleiInJets { } } - std::vector mcdJetIds{}; + std::vector mcdJetIds{}; std::vector mcdJetPt{}; std::vector mcdJetPhi{}; std::vector mcdJetEta{}; From e789ea53ca9185107384620fd0f01d144e74b372 Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Fri, 25 Sep 2026 11:20:13 +0200 Subject: [PATCH 2/6] Use corrected jet pT for leading-jet selection --- PWGJE/Tasks/nucleiInJets.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 22a09c2f5cb..a15bbd98bdb 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -2574,8 +2574,9 @@ struct nucleiInJets { float leadingDetJetPt = -1.f; if (isWithLeadingJet) { for (const auto& mcdjet : mcdjets) { - if (isConeAxisAccepted(mcdjet.eta()) && mcdjet.pt() > leadingDetJetPt) { - leadingDetJetPt = mcdjet.pt(); + const float mcdJetPtForResponseSel = usebkgSubractionMC ? mcdjet.pt() - backgroundRho * jetArea : mcdjet.pt(); + if (isConeAxisAccepted(mcdjet.eta()) && mcdJetPtForResponseSel > leadingDetJetPt) { + leadingDetJetPt = mcdJetPtForResponseSel; leadingDetJetId = mcdjet.globalIndex(); } } From a3813ca740524b46ee00247ef7a4cb004c29da17 Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Tue, 29 Sep 2026 19:31:47 +0200 Subject: [PATCH 3/6] [PWGJE] Use int32_t for jet-ID --- PWGJE/Tasks/nucleiInJets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index a15bbd98bdb..5b57190673e 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -2570,7 +2570,7 @@ struct nucleiInJets { } // Select the accepted detector-level leading jet before considering matches. - int64_t leadingDetJetId = -1; + int32_t leadingDetJetId = -1; float leadingDetJetPt = -1.f; if (isWithLeadingJet) { for (const auto& mcdjet : mcdjets) { @@ -2585,7 +2585,7 @@ struct nucleiInJets { } } - std::vector mcdJetIds{}; + std::vector mcdJetIds{}; std::vector mcdJetPt{}; std::vector mcdJetPhi{}; std::vector mcdJetEta{}; From bb41d1a78f83f1714329faf6609c749ecf20d589 Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Sat, 7 Nov 2026 21:43:32 +0100 Subject: [PATCH 4/6] [PWGJE] Add ITS PID veto and pO rapidity QA to nuclei-in-jets analysis --- PWGJE/Tasks/nucleiInJets.cxx | 211 ++++++++++++++++++++++++++--------- 1 file changed, 159 insertions(+), 52 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 5b57190673e..a75970ca089 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -23,6 +23,7 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/Zorro.h" #include "Common/Core/ZorroSummary.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -90,9 +91,9 @@ struct nucleiInJets { case -321: // k- return -Particle::kKaon; - case 2212: // p + case PDG_t::kProton: // p return Particle::kProton; - case -2212: // antip + case PDG_t::kProtonBar: // antip return -Particle::kProton; case Pdg::kDeuteron: // Deuteron @@ -165,6 +166,17 @@ struct nucleiInJets { Configurable cfgnTPCPIDHeTOF{"cfgnTPCPIDHeTOF", 3, "nTPC PID He"}; Configurable cfgnTPCPIDTrTOF{"cfgnTPCPIDTrTOF", 3, "nTPC PID Tr"}; + // Enable an ITS nSigma veto on inclusive TPC PID selections; disabled by default. + struct ItsPid : ConfigurableGroup { + std::string prefix = "itsPid"; + Configurable applyItsPidInc{"applyItsPidInc", false, "apply ITS PID veto to inclusive TPC selections"}; + Configurable ptMaxItsPidProt{"ptMaxItsPidProt", 1.0, "maximum pT for proton ITS PID"}; + Configurable ptMaxItsPidDeut{"ptMaxItsPidDeut", 1.0, "maximum pT for deuteron ITS PID"}; + Configurable ptMaxItsPidHel{"ptMaxItsPidHel", 1.0, "maximum pT for helium ITS PID"}; + Configurable nSigmaItsMin{"nSigmaItsMin", -3.0, "minimum ITS nSigma"}; + Configurable nSigmaItsMax{"nSigmaItsMax", 3.0, "maximum ITS nSigma"}; + } itsPid; + Configurable cEnableProtonQA{"cEnableProtonQA", true, "nTPC PID Pr"}; Configurable cEnableDeuteronQA{"cEnableDeuteronQA", true, "nTPC PID De"}; Configurable cEnableHeliumQA{"cEnableHeliumQA", true, "nTPC PID He"}; @@ -284,6 +296,10 @@ struct nucleiInJets { void init(o2::framework::InitContext&) { + if (isMC) { + o2::aod::ITSResponse::setMCDefaultParameters(); + } + if (doprocessJetTracksData && doprocessJetTracksDataLfPid) { LOGP(fatal, "only one process function should be enabled!!!"); } @@ -308,6 +324,8 @@ struct nucleiInJets { const AxisSpec dedxAxis{binsdEdx, "d#it{E}/d#it{x} A.U."}; const AxisSpec vzAxis{300, -15.f, 15.f, "Vz (cm)"}; const AxisSpec EtaAxis{40, -1.f, 1.f, "#eta"}; + const AxisSpec RapidityQAAxis{60, -2.f, 2.f, "y"}; + const AxisSpec PtRapidityQAAxis{50, 0.f, 10.f, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec ParticleOriginAxis{3, 0.5, 3.5, "origin: 1 primary, 2 secondary/material, 3 weak decay"}; const AxisSpec betaAxis{binsBeta, "TOF #beta"}; @@ -346,6 +364,29 @@ struct nucleiInJets { jetHist.add("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt", "pT(d) vs NSigmaTPC (d) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); jetHist.add("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt", "pT(#bar{d}) vs NSigmaTPC (#bar{d}) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); + // Compare lab and shifted rapidity before the rapidity selection, for pO QA. + if (isPOCollision) { + for (const auto& sample : {std::string("tracksInc"), std::string("recInc")}) { + for (const auto& species : {std::string("proton"), std::string("antiproton"), std::string("deuteron"), std::string("antideuteron")}) { + const auto base = sample + "/qa/rapidity/" + species; + const bool isMcTruth = sample == "recInc"; + const char* yLabTitle = isMcTruth ? "matched primary MC truth; #it{p}_{T} (GeV/#it{c}); #eta; y_{lab}" : "inclusive data; #it{p}_{T} (GeV/#it{c}); #eta; y_{lab}"; + const char* yCmsTitle = isMcTruth ? "matched primary MC truth; #it{p}_{T} (GeV/#it{c}); #eta; y_{CMS}" : "inclusive data; #it{p}_{T} (GeV/#it{c}); #eta; y_{CMS}"; + jetHist.add(base + "YLabVsPtEta", yLabTitle, HistType::kTH3F, {PtRapidityQAAxis, EtaAxis, RapidityQAAxis}); + jetHist.add(base + "YCmsVsPtEta", yCmsTitle, HistType::kTH3F, {PtRapidityQAAxis, EtaAxis, RapidityQAAxis}); + } + } + } + + if (itsPid.applyItsPidInc) { + jetHist.add("tracksInc/qa/h2ITSNsigmaProtonVsPt", "inclusive proton ITS PID before veto; #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS}(p)", HistType::kTH2F, {PtAxis, {200, -10, 10}}); + jetHist.add("tracksInc/qa/h2ITSNsigmaDeuteronVsPt", "inclusive deuteron ITS PID before veto; #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS}(d)", HistType::kTH2F, {PtAxis, {200, -10, 10}}); + jetHist.add("tracksInc/qa/h2ITSNsigmaHeliumVsPt", "inclusive helium ITS PID before veto; #it{p}_{T}/|z| (GeV/#it{c}); n#sigma_{ITS}(He)", HistType::kTH2F, {PtAxis, {200, -10, 10}}); + jetHist.add("recInc/qa/h2ITSNsigmaProtonVsPt", "reconstructed MC proton ITS PID before veto; #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS}(p)", HistType::kTH2F, {PtAxis, {200, -10, 10}}); + jetHist.add("recInc/qa/h2ITSNsigmaDeuteronVsPt", "reconstructed MC deuteron ITS PID before veto; #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS}(d)", HistType::kTH2F, {PtAxis, {200, -10, 10}}); + jetHist.add("recInc/qa/h2ITSNsigmaHeliumVsPt", "reconstructed MC helium ITS PID before veto; #it{p}_{T}/|z| (GeV/#it{c}); n#sigma_{ITS}(He)", HistType::kTH2F, {PtAxis, {200, -10, 10}}); + } + // jet property jetHist.add("jet/h1JetPt", "jet_{p_{T}}", kTH1F, {PtJetAxis}); jetHist.add("jet/h1JetPtBkgSub", "jet_{p_{T}} background subtracted", kTH1F, {PtJetAxis}); @@ -2078,21 +2119,36 @@ struct nucleiInJets { continue; } - auto rapidityData = [&](float m2z) { - return isRapiditySelectedForPID(trk.rapidity(m2z)); - }; + double nSigmaITSPr = 0.0; + double nSigmaITSDe = 0.0; + double nSigmaITSHe = 0.0; + if (itsPid.applyItsPidInc) { + nSigmaITSPr = o2::aod::ITSResponse::nSigmaITS(trk); + nSigmaITSDe = o2::aod::ITSResponse::nSigmaITS(trk); + nSigmaITSHe = o2::aod::ITSResponse::nSigmaITS(trk); + } + const bool passItsPidPr = !itsPid.applyItsPidInc || trk.pt() >= itsPid.ptMaxItsPidProt || (nSigmaITSPr >= itsPid.nSigmaItsMin && nSigmaITSPr <= itsPid.nSigmaItsMax); + const bool passItsPidDe = !itsPid.applyItsPidInc || trk.pt() >= itsPid.ptMaxItsPidDeut || (nSigmaITSDe >= itsPid.nSigmaItsMin && nSigmaITSDe <= itsPid.nSigmaItsMax); + const bool passItsPidHe = !itsPid.applyItsPidInc || 2.0 * trk.pt() >= itsPid.ptMaxItsPidHel || (nSigmaITSHe >= itsPid.nSigmaItsMin && nSigmaITSHe <= itsPid.nSigmaItsMax); - auto prRapidityWithinRange = rapidityData(o2::constants::physics::MassProton); - auto deRapidityWithinRange = rapidityData(o2::constants::physics::MassDeuteron); + const double yLabPr = trk.rapidity(o2::constants::physics::MassProton); + const double yLabDe = trk.rapidity(o2::constants::physics::MassDeuteron); + auto prRapidityWithinRange = isRapiditySelectedForPID(yLabPr); + auto deRapidityWithinRange = isRapiditySelectedForPID(yLabDe); if (std::fabs(trk.eta()) > cfgtrkMaxEta) continue; - bool hasTOF = trk.hasTOF(); + if (itsPid.applyItsPidInc) { + jetHist.fill(HIST("tracksInc/qa/h2ITSNsigmaProtonVsPt"), trk.pt(), nSigmaITSPr); + jetHist.fill(HIST("tracksInc/qa/h2ITSNsigmaDeuteronVsPt"), trk.pt(), nSigmaITSDe); + jetHist.fill(HIST("tracksInc/qa/h2ITSNsigmaHeliumVsPt"), 2.0 * trk.pt(), nSigmaITSHe); + } + bool hasTOF = trk.hasTOF(); if (trk.sign() > 0) { // particles - if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { + if (passItsPidPr && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracksInc/dcaxy/rec/proton/tpcPtVsDcaxy3D"), trk.pt(), centrality, trk.dcaXY()); if (useTOFVeto && hasTOF) { if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) { @@ -2104,7 +2160,7 @@ struct nucleiInJets { } } // proton - if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { + if (passItsPidDe && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracksInc/dcaxy/rec/deuteron/tpcPtVsDcaxy3D"), trk.pt(), centrality, trk.dcaXY()); if (useTOFVeto && hasTOF) { if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) { @@ -2128,7 +2184,7 @@ struct nucleiInJets { } } // Triton - if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { + if (passItsPidHe && std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracksInc/dcaxy/rec/helium/tpcPtVsDcaxy3D"), trk.pt(), centrality, trk.dcaXY()); if (useTOFVeto && hasTOF) { if (std::abs(trk.tofNSigmaHe()) < cfgnTPCPIDHeTOF) { @@ -2142,7 +2198,7 @@ struct nucleiInJets { } else { // antiparticles - if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { + if (passItsPidPr && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracksInc/dcaxy/rec/antiProton/tpcPtVsDcaxy3D"), trk.pt(), centrality, trk.dcaXY()); if (useTOFVeto && hasTOF) { if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) { @@ -2154,7 +2210,7 @@ struct nucleiInJets { } } // proton - if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { + if (passItsPidDe && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracksInc/dcaxy/rec/antiDeuteron/tpcPtVsDcaxy3D"), trk.pt(), centrality, trk.dcaXY()); if (useTOFVeto && hasTOF) { if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) { @@ -2178,7 +2234,7 @@ struct nucleiInJets { } } // Triton - if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { + if (passItsPidHe && std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracksInc/dcaxy/rec/antiHelium/tpcPtVsDcaxy3D"), trk.pt(), centrality, trk.dcaXY()); if (useTOFVeto && hasTOF) { if (std::abs(trk.tofNSigmaHe()) < cfgnTPCPIDHeTOF) { @@ -2198,38 +2254,52 @@ struct nucleiInJets { if (std::fabs(trk.dcaXY()) > dcaXYPtDepCut(trk.pt()) && useDcaxyPtDepCut) continue; + if (isPOCollision) { + if (trk.sign() > 0) { + jetHist.fill(HIST("tracksInc/qa/rapidity/protonYLabVsPtEta"), trk.pt(), trk.eta(), yLabPr); + jetHist.fill(HIST("tracksInc/qa/rapidity/protonYCmsVsPtEta"), trk.pt(), trk.eta(), rapidityInSelectedFrame(yLabPr)); + jetHist.fill(HIST("tracksInc/qa/rapidity/deuteronYLabVsPtEta"), trk.pt(), trk.eta(), yLabDe); + jetHist.fill(HIST("tracksInc/qa/rapidity/deuteronYCmsVsPtEta"), trk.pt(), trk.eta(), rapidityInSelectedFrame(yLabDe)); + } else { + jetHist.fill(HIST("tracksInc/qa/rapidity/antiprotonYLabVsPtEta"), trk.pt(), trk.eta(), yLabPr); + jetHist.fill(HIST("tracksInc/qa/rapidity/antiprotonYCmsVsPtEta"), trk.pt(), trk.eta(), rapidityInSelectedFrame(yLabPr)); + jetHist.fill(HIST("tracksInc/qa/rapidity/antideuteronYLabVsPtEta"), trk.pt(), trk.eta(), yLabDe); + jetHist.fill(HIST("tracksInc/qa/rapidity/antideuteronYCmsVsPtEta"), trk.pt(), trk.eta(), rapidityInSelectedFrame(yLabDe)); + } + } + if (trk.sign() > 0) { // particle info if (useTOFNsigmaPreSel && trk.hasTOF()) { - if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF && (!useRapidityCutForPID || prRapidityWithinRange)) { + if (passItsPidPr && std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF && (!useRapidityCutForPID || prRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); } - if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF && (!useRapidityCutForPID || deRapidityWithinRange)) { + if (passItsPidDe && std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF && (!useRapidityCutForPID || deRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } } else if (!useTOFNsigmaPreSel && !useTOFVeto) { - if (!useRapidityCutForPID || prRapidityWithinRange) { + if (passItsPidPr && (!useRapidityCutForPID || prRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); } - if (!useRapidityCutForPID || deRapidityWithinRange) { + if (passItsPidDe && (!useRapidityCutForPID || deRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } } else if (!useTOFNsigmaPreSel && useTOFVeto) { if (trk.hasTOF()) { if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) { - if (!useRapidityCutForPID || prRapidityWithinRange) + if (passItsPidPr && (!useRapidityCutForPID || prRapidityWithinRange)) jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); } } else { - if (!useRapidityCutForPID || prRapidityWithinRange) + if (passItsPidPr && (!useRapidityCutForPID || prRapidityWithinRange)) jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); } if (trk.hasTOF()) { if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) { - if (!useRapidityCutForPID || deRapidityWithinRange) + if (passItsPidDe && (!useRapidityCutForPID || deRapidityWithinRange)) jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } } else { - if (!useRapidityCutForPID || deRapidityWithinRange) + if (passItsPidDe && (!useRapidityCutForPID || deRapidityWithinRange)) jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } } @@ -2247,12 +2317,12 @@ struct nucleiInJets { jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } else { - if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr && (!useRapidityCutForPID || prRapidityWithinRange)) { + if (passItsPidPr && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr && (!useRapidityCutForPID || prRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } - if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe && (!useRapidityCutForPID || deRapidityWithinRange)) { + if (passItsPidDe && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe && (!useRapidityCutForPID || deRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); @@ -2260,41 +2330,41 @@ struct nucleiInJets { } } - if (cEnableProtonQA && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr && (!useRapidityCutForPID || prRapidityWithinRange)) { + if (cEnableProtonQA && passItsPidPr && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr && (!useRapidityCutForPID || prRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAxyVsPtProton"), trk.dcaXY(), trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAzVsPtProton"), trk.dcaZ(), trk.pt(), centrality); } - if (cEnableDeuteronQA && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe && (!useRapidityCutForPID || deRapidityWithinRange)) { + if (cEnableDeuteronQA && passItsPidDe && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe && (!useRapidityCutForPID || deRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron"), trk.dcaXY(), trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron"), trk.dcaZ(), trk.pt(), centrality); } } else { // anti-particle info if (useTOFNsigmaPreSel && trk.hasTOF()) { - if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF && (!useRapidityCutForPID || prRapidityWithinRange)) + if (passItsPidPr && std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF && (!useRapidityCutForPID || prRapidityWithinRange)) jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); - if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF && (!useRapidityCutForPID || deRapidityWithinRange)) + if (passItsPidDe && std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF && (!useRapidityCutForPID || deRapidityWithinRange)) jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } else if (!useTOFNsigmaPreSel && !useTOFVeto) { - if (!useRapidityCutForPID || prRapidityWithinRange) + if (passItsPidPr && (!useRapidityCutForPID || prRapidityWithinRange)) jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); - if (!useRapidityCutForPID || deRapidityWithinRange) + if (passItsPidDe && (!useRapidityCutForPID || deRapidityWithinRange)) jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } else if (!useTOFNsigmaPreSel && useTOFVeto) { if (trk.hasTOF()) { - if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF && (!useRapidityCutForPID || prRapidityWithinRange)) { + if (passItsPidPr && std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF && (!useRapidityCutForPID || prRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); } } else { - if (!useRapidityCutForPID || prRapidityWithinRange) + if (passItsPidPr && (!useRapidityCutForPID || prRapidityWithinRange)) jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); } if (trk.hasTOF()) { - if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF && (!useRapidityCutForPID || deRapidityWithinRange)) { + if (passItsPidDe && std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF && (!useRapidityCutForPID || deRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } } else { - if (!useRapidityCutForPID || deRapidityWithinRange) + if (passItsPidDe && (!useRapidityCutForPID || deRapidityWithinRange)) jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); } } @@ -2312,12 +2382,12 @@ struct nucleiInJets { jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } else { - if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr && (!useRapidityCutForPID || prRapidityWithinRange)) { + if (passItsPidPr && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr && (!useRapidityCutForPID || prRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } - if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe && (!useRapidityCutForPID || deRapidityWithinRange)) { + if (passItsPidDe && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe && (!useRapidityCutForPID || deRapidityWithinRange)) { jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); @@ -2692,7 +2762,7 @@ struct nucleiInJets { int origin = 4; if (track.has_mcParticle()) { const auto mcTrack = track.mcParticle_as(); - if (mcTrack.pdgCode() == -2212) + if (mcTrack.pdgCode() == PDG_t::kProtonBar) origin = getParticleOriginType(mcTrack); } const bool tofPassed = completeTrack.hasTOF() && std::abs(completeTrack.tofNSigmaPr()) < cfgnTPCPIDPrTOF; @@ -3253,11 +3323,28 @@ struct nucleiInJets { if (!isTrackSelectedWithoutDcaxy(track)) { continue; } - if (!track.has_mcParticle()) - continue; if (std::fabs(track.eta()) > cfgtrkMaxEta) continue; + double nSigmaITSPr = 0.0; + double nSigmaITSDe = 0.0; + double nSigmaITSHe = 0.0; + if (itsPid.applyItsPidInc) { + nSigmaITSPr = o2::aod::ITSResponse::nSigmaITS(track); + nSigmaITSDe = o2::aod::ITSResponse::nSigmaITS(track); + nSigmaITSHe = o2::aod::ITSResponse::nSigmaITS(track); + } + const bool passItsPidPr = !itsPid.applyItsPidInc || track.pt() >= itsPid.ptMaxItsPidProt || (nSigmaITSPr >= itsPid.nSigmaItsMin && nSigmaITSPr <= itsPid.nSigmaItsMax); + const bool passItsPidDe = !itsPid.applyItsPidInc || track.pt() >= itsPid.ptMaxItsPidDeut || (nSigmaITSDe >= itsPid.nSigmaItsMin && nSigmaITSDe <= itsPid.nSigmaItsMax); + const bool passItsPidHe = !itsPid.applyItsPidInc || 2.0 * track.pt() >= itsPid.ptMaxItsPidHel || (nSigmaITSHe >= itsPid.nSigmaItsMin && nSigmaITSHe <= itsPid.nSigmaItsMax); + if (itsPid.applyItsPidInc) { + jetHist.fill(HIST("recInc/qa/h2ITSNsigmaProtonVsPt"), track.pt(), nSigmaITSPr); + jetHist.fill(HIST("recInc/qa/h2ITSNsigmaDeuteronVsPt"), track.pt(), nSigmaITSDe); + jetHist.fill(HIST("recInc/qa/h2ITSNsigmaHeliumVsPt"), 2.0 * track.pt(), nSigmaITSHe); + } + if (!track.has_mcParticle()) + continue; + auto mcTrack = track.mcParticle_as(); // require mc getProcess to get Decay and Material secondaries @@ -3281,7 +3368,7 @@ struct nucleiInJets { // Fill DCAxy histograms jetHist.fill(HIST("recInc/dcaxy/rec/tpcPtVsDcaxy3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality, track.dcaXY(), particleOriginType); - if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) + if (passItsPidPr && std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) jetHist.fill(HIST("recInc/dcaxy/rec/tpcPtVsDcaxy3DPIDselected"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality, track.dcaXY(), particleOriginType); if (!isMcPrimary) @@ -3293,16 +3380,36 @@ struct nucleiInJets { if (std::fabs(track.dcaXY()) > dcaXYPtDepCut(track.pt()) && useDcaxyPtDepCut) continue; + if (isPOCollision && isMcPrimary) { + if (mcTrack.pdgCode() == PDG_t::kProton) { + const double yLab = mcTrack.y(); + jetHist.fill(HIST("recInc/qa/rapidity/protonYLabVsPtEta"), mcTrack.pt(), mcTrack.eta(), yLab); + jetHist.fill(HIST("recInc/qa/rapidity/protonYCmsVsPtEta"), mcTrack.pt(), mcTrack.eta(), rapidityInSelectedFrame(yLab)); + } else if (mcTrack.pdgCode() == PDG_t::kProtonBar) { + const double yLab = mcTrack.y(); + jetHist.fill(HIST("recInc/qa/rapidity/antiprotonYLabVsPtEta"), mcTrack.pt(), mcTrack.eta(), yLab); + jetHist.fill(HIST("recInc/qa/rapidity/antiprotonYCmsVsPtEta"), mcTrack.pt(), mcTrack.eta(), rapidityInSelectedFrame(yLab)); + } else if (mcTrack.pdgCode() == Pdg::kDeuteron) { + const double yLab = mcTrack.y(); + jetHist.fill(HIST("recInc/qa/rapidity/deuteronYLabVsPtEta"), mcTrack.pt(), mcTrack.eta(), yLab); + jetHist.fill(HIST("recInc/qa/rapidity/deuteronYCmsVsPtEta"), mcTrack.pt(), mcTrack.eta(), rapidityInSelectedFrame(yLab)); + } else if (mcTrack.pdgCode() == -Pdg::kDeuteron) { + const double yLab = mcTrack.y(); + jetHist.fill(HIST("recInc/qa/rapidity/antideuteronYLabVsPtEta"), mcTrack.pt(), mcTrack.eta(), yLab); + jetHist.fill(HIST("recInc/qa/rapidity/antideuteronYCmsVsPtEta"), mcTrack.pt(), mcTrack.eta(), rapidityInSelectedFrame(yLab)); + } + } + // auto mass = TDatabasePDG::Instance()->GetParticle(abs(mcTrack.pdgCode()))->Mass(); // auto rapidity = RecoDecay::y(std::array{track.px(), track.py(), track.pz()}, mass); if (!isRapiditySelectedForPID(mcTrack.y())) continue; // Proton - if (std::abs(mcTrack.pdgCode()) == 2212) { // Proton + if (std::abs(mcTrack.pdgCode()) == PDG_t::kProton) { // Proton jetHist.fill(HIST("recInc/eff/tpcTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); if (track.hasTOF()) jetHist.fill(HIST("recInc/eff/tpcTofTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); - if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) { + if (passItsPidPr && std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } @@ -3311,7 +3418,7 @@ struct nucleiInJets { jetHist.fill(HIST("recInc/eff/tpcTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); if (track.hasTOF()) jetHist.fill(HIST("recInc/eff/tpcTofTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); - if (std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe) { + if (passItsPidDe && std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } @@ -3320,49 +3427,49 @@ struct nucleiInJets { jetHist.fill(HIST("recInc/eff/tpcTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); if (track.hasTOF()) jetHist.fill(HIST("recInc/eff/tpcTofTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); - if (std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe) { + if (passItsPidHe && std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } // TPCTOF and TPCTOFVeto histograms // Proton - if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr && track.hasTOF()) { - if (std::abs(mcTrack.pdgCode()) == 2212) { + if (passItsPidPr && std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr && track.hasTOF()) { + if (std::abs(mcTrack.pdgCode()) == PDG_t::kProton) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); if (std::abs(track.tofNSigmaPr()) < cfgnTPCPIDPrTOF) jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } else { - if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) { - if (std::abs(mcTrack.pdgCode()) == 2212) { + if (passItsPidPr && std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) { + if (std::abs(mcTrack.pdgCode()) == PDG_t::kProton) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } } // Deuteron - if (std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe && track.hasTOF()) { + if (passItsPidDe && std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe && track.hasTOF()) { if (std::abs(mcTrack.pdgCode()) == Pdg::kDeuteron) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); if (std::abs(track.tofNSigmaDe()) < cfgnTPCPIDDeTOF) jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } else { - if (std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe) { + if (passItsPidDe && std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe) { if (std::abs(mcTrack.pdgCode()) == Pdg::kDeuteron) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } } // Helium - if (std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe && track.hasTOF()) { + if (passItsPidHe && std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe && track.hasTOF()) { if (std::abs(mcTrack.pdgCode()) == Pdg::kHelium3) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); if (std::abs(track.tofNSigmaHe()) < cfgnTPCPIDHeTOF) jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } } else { - if (std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe) { + if (passItsPidHe && std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe) { if (std::abs(mcTrack.pdgCode()) == Pdg::kHelium3) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); } From ab531bf4026e299e325e422c629d6807e6f38b6f Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Sun, 8 Nov 2026 10:33:15 +0100 Subject: [PATCH 5/6] code check error solved --- PWGJE/Tasks/nucleiInJets.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index a75970ca089..587612d8eeb 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -49,8 +49,11 @@ #include #include #include +#include #include +#include + #include #include #include @@ -303,7 +306,7 @@ struct nucleiInJets { if (doprocessJetTracksData && doprocessJetTracksDataLfPid) { LOGP(fatal, "only one process function should be enabled!!!"); } - if (!(mcClosureTrainingFraction >= 0.f && mcClosureTrainingFraction <= 1.f)) { + if (!(mcClosureTrainingFraction >= 0.f) || !(mcClosureTrainingFraction <= 1.f)) { LOGP(fatal, "mcClosureTrainingFraction must be between 0 and 1, inclusive"); } if (mcClosureSplitSeed == 0) { @@ -368,7 +371,9 @@ struct nucleiInJets { if (isPOCollision) { for (const auto& sample : {std::string("tracksInc"), std::string("recInc")}) { for (const auto& species : {std::string("proton"), std::string("antiproton"), std::string("deuteron"), std::string("antideuteron")}) { - const auto base = sample + "/qa/rapidity/" + species; + auto base = sample; + base += "/qa/rapidity/"; + base += species; const bool isMcTruth = sample == "recInc"; const char* yLabTitle = isMcTruth ? "matched primary MC truth; #it{p}_{T} (GeV/#it{c}); #eta; y_{lab}" : "inclusive data; #it{p}_{T} (GeV/#it{c}); #eta; y_{lab}"; const char* yCmsTitle = isMcTruth ? "matched primary MC truth; #it{p}_{T} (GeV/#it{c}); #eta; y_{CMS}" : "inclusive data; #it{p}_{T} (GeV/#it{c}); #eta; y_{CMS}"; @@ -1029,10 +1034,7 @@ struct nucleiInJets { bool isOccupancyAccepted(const coll& collision) { auto occupancy{collision.trackOccupancyInTimeRange()}; - if (occupancy < cfgOccupancyRange->at(0) || occupancy > cfgOccupancyRange->at(1)) - return false; - else - return true; + return !(occupancy < cfgOccupancyRange->at(0) || occupancy > cfgOccupancyRange->at(1)); } int nEvents = 0; From 9ef971970c34ffdbc25c21aadefde5b1acb219d0 Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Sun, 8 Nov 2026 10:40:52 +0100 Subject: [PATCH 6/6] clang-format --- PWGJE/Tasks/nucleiInJets.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 587612d8eeb..88c47017811 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -52,8 +53,6 @@ #include #include -#include - #include #include #include