From c594c0968d762abced6b09ff9a5b578b67620c15 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 11:49:58 +0200 Subject: [PATCH 01/11] add pileup rejection --- PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 59e36311135..a09551a8284 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -84,6 +84,8 @@ struct HadronNucleiCorrelation { Configurable isMCGen{"isMCGen", false, "is isMCGen"}; Configurable isPrim{"isPrim", true, "is isPrim"}; Configurable doCorrection{"doCorrection", false, "do efficiency correction"}; + Configurable removeSameBunchPileup{"removeSameBunchPileup", false, "remove Same Bunch Pileup"}; + Configurable fCorrectionPath{"fCorrectionPath", "", "Correction path to file"}; Configurable fCorrectionHisto{"fCorrectionHisto", "", "Correction histogram"}; @@ -721,6 +723,10 @@ struct HadronNucleiCorrelation { registry.fill(HIST("hMult"), collision.mult()); for (const auto& track : tracks) { + + if (removeSameBunchPileup && !track.template singleCollSel_as>().isNoSameBunchPileup()) + continue; + if (track.tpcFractionSharedCls() > max_tpcSharedCls) continue; if (track.itsNCls() < min_itsNCls) @@ -794,6 +800,9 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks, tracks))) { + if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + continue; + if (part0.tpcFractionSharedCls() > max_tpcSharedCls) continue; if (part0.itsNCls() < min_itsNCls) @@ -836,6 +845,9 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { + if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + continue; + if (part0.tpcFractionSharedCls() > max_tpcSharedCls) continue; if (part0.itsNCls() < min_itsNCls) @@ -922,6 +934,11 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + continue; + if (removeSameBunchPileup && !part1.template singleCollSel_as>().isNoSameBunchPileup()) + continue; + if (part0.tpcFractionSharedCls() > max_tpcSharedCls) continue; if (part0.itsNCls() < min_itsNCls) From 25a678651befba763fe1be379ac2b87848d58755 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 13:23:39 +0200 Subject: [PATCH 02/11] fix format and linter --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index a09551a8284..49ba66dcae1 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -69,6 +69,12 @@ enum Modes { kPPbar }; +enum Origin { + kPrimary = 0, + kWeakDecay, + kMaterial +}; + struct HadronNucleiCorrelation { static constexpr int betahasTOFthr = -100; @@ -86,7 +92,6 @@ struct HadronNucleiCorrelation { Configurable doCorrection{"doCorrection", false, "do efficiency correction"}; Configurable removeSameBunchPileup{"removeSameBunchPileup", false, "remove Same Bunch Pileup"}; - Configurable fCorrectionPath{"fCorrectionPath", "", "Correction path to file"}; Configurable fCorrectionHisto{"fCorrectionHisto", "", "Correction histogram"}; Configurable cfgUrl{"cfgUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -124,6 +129,7 @@ struct HadronNucleiCorrelation { Configurable radiusTPC{"radiusTPC", 1.2, "TPC radius to calculate phi_star for"}; Configurable dEta{"dEta", 0.01, "minimum allowed difference in eta between two tracks in a pair"}; Configurable dPhi{"dPhi", 0.01, "minimum allowed difference in phi_star between two tracks in a pair"}; + Configurable rap{"rap", 0.5, "rapidity"}; // Mixing parameters ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 50.0f, 100.0f, 99999.f}, "Mixing bins - multiplicity"}; @@ -584,35 +590,35 @@ struct HadronNucleiCorrelation { if (doCorrection) { // Apply corrections switch (mode) { - case 0: + case kDbarPbar: corr0 = hEffpTEta_antideuteron->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_antiproton->Interpolate(part1.pt(), part1.eta()); break; - case 1: + case kDP: corr0 = hEffpTEta_deuteron->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_proton->Interpolate(part1.pt(), part1.eta()); break; - case 2: + case kDbarP: corr0 = hEffpTEta_antideuteron->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_proton->Interpolate(part1.pt(), part1.eta()); break; - case 3: + case kDPbar: corr0 = hEffpTEta_deuteron->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_antiproton->Interpolate(part1.pt(), part1.eta()); break; - case 4: + case kPbarP: corr0 = hEffpTEta_antiproton->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_proton->Interpolate(part1.pt(), part1.eta()); break; - case 5: + case kPbarPbar: corr0 = hEffpTEta_antiproton->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_antiproton->Interpolate(part1.pt(), part1.eta()); break; - case 6: + case kPP: corr0 = hEffpTEta_proton->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_proton->Interpolate(part1.pt(), part1.eta()); break; - case 7: + case kPPbar: corr0 = hEffpTEta_proton->Interpolate(part0.pt(), part0.eta()); corr1 = hEffpTEta_antiproton->Interpolate(part1.pt(), part1.eta()); break; @@ -1032,38 +1038,38 @@ struct HadronNucleiCorrelation { if (IsProton(track, +1) && track.pdgCode() == PDG_t::kProton) { registry.fill(HIST("hPrDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 0) + if (track.origin() == kPrimary) registry.fill(HIST("hPrimPrDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 1) + if (track.origin() == kWeakDecay) registry.fill(HIST("hSecWeakPrDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 2) + if (track.origin() == kMaterial) registry.fill(HIST("hSecMatPrDCAxy"), track.dcaXY(), track.pt()); } if (IsProton(track, -1) && track.pdgCode() == -PDG_t::kProton) { registry.fill(HIST("hAntiPrDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 0) + if (track.origin() == kPrimary) registry.fill(HIST("hPrimAntiPrDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 1) + if (track.origin() == kWeakDecay) registry.fill(HIST("hSecWeakAntiPrDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 2) + if (track.origin() == kMaterial) registry.fill(HIST("hSecMatAntiPrDCAxy"), track.dcaXY(), track.pt()); } if (IsDeuteron(track, +1) && track.pdgCode() == o2::constants::physics::Pdg::kDeuteron) { registry.fill(HIST("hDeDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 0) + if (track.origin() == kPrimary) registry.fill(HIST("hPrimDeDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 1) + if (track.origin() == kWeakDecay) registry.fill(HIST("hSecWeakDeDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 2) + if (track.origin() == kMaterial) registry.fill(HIST("hSecMatDeDCAxy"), track.dcaXY(), track.pt()); } if (IsDeuteron(track, -1) && track.pdgCode() == -o2::constants::physics::Pdg::kDeuteron) { registry.fill(HIST("hAntiDeDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 0) + if (track.origin() == kPrimary) registry.fill(HIST("hPrimAntiDeDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 1) + if (track.origin() == kWeakDecay) registry.fill(HIST("hSecWeakAntiDeDCAxy"), track.dcaXY(), track.pt()); - if (track.origin() == 2) + if (track.origin() == kMaterial) registry.fill(HIST("hSecMatAntiDeDCAxy"), track.dcaXY(), track.pt()); } @@ -1097,13 +1103,13 @@ struct HadronNucleiCorrelation { if (isPr) { registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); - if (track.origin() == 1 || track.origin() == 2) { // secondaries + if (track.origin() == kWeakDecay || track.origin() == kMaterial) { // secondaries registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); } } if (isAntiPr) { registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); - if (track.origin() == 1 || track.origin() == 2) { + if (track.origin() == kWeakDecay || track.origin() == kMaterial) { registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); } } @@ -1409,10 +1415,10 @@ struct HadronNucleiCorrelation { registry.fill(HIST("Generated/hQADeuterons"), 1.5); } - if (particle.pdgCode() == o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < 0.5) { + if (particle.pdgCode() == o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < rap) { registry.fill(HIST("Generated/hDeuteronsVsPt"), particle.pt()); } - if (particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < 0.5) { + if (particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < rap) { registry.fill(HIST("Generated/hAntiDeuteronsVsPt"), particle.pt()); } From f3147b3b40e3a4bdb1a1f5ebfd4408b9f10b3137 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 13:27:05 +0200 Subject: [PATCH 03/11] fix o2linter --- PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 49ba66dcae1..c4f141a04fd 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -83,7 +83,7 @@ struct HadronNucleiCorrelation { Configurable mode{"mode", 0, "0: antid-antip, 1: d-p, 2: antid-p, 3: d-antip, 4: antip-p, 5: antip-antip, 6: p-p, 7: p-antip"}; - Configurable dorapidity{"dorapidity", false, "do rapidity dependent analysis"}; + Configurable doRapidity{"doRapidity", false, "do rapidity dependent analysis"}; Configurable doQA{"doQA", true, "save QA histograms"}; Configurable doMCQA{"doMCQA", false, "save MC QA histograms"}; Configurable isMC{"isMC", false, "is MC"}; @@ -101,8 +101,8 @@ struct HadronNucleiCorrelation { // Track selection Configurable doClosePairRejection{"doClosePairRejection", false, "doClosePairRejection"}; - Configurable par0{"par0", 0.004, "par 0"}; - Configurable par1{"par1", 0.013, "par 1"}; + Configurable dcaPar0{"dcaPar0", 0.004, "par 0"}; + Configurable dcaPar1{"dcaPar1", 0.013, "par 1"}; Configurable doDCAZ{"doDCAZ", true, "do DCA z cut"}; Configurable min_TPC_nClusters{"min_TPC_nClusters", 80, "minimum number of found TPC clusters"}; Configurable min_TPC_nCrossedRowsOverFindableCls{"min_TPC_nCrossedRowsOverFindableCls", 0.8, "n TPC Crossed Rows Over Findable Cls"}; @@ -129,7 +129,7 @@ struct HadronNucleiCorrelation { Configurable radiusTPC{"radiusTPC", 1.2, "TPC radius to calculate phi_star for"}; Configurable dEta{"dEta", 0.01, "minimum allowed difference in eta between two tracks in a pair"}; Configurable dPhi{"dPhi", 0.01, "minimum allowed difference in phi_star between two tracks in a pair"}; - Configurable rap{"rap", 0.5, "rapidity"}; + Configurable yRap{"yRap", 0.5, "rapidity"}; // Mixing parameters ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 50.0f, 100.0f, 99999.f}, "Mixing bins - multiplicity"}; @@ -238,7 +238,7 @@ struct HadronNucleiCorrelation { if (!isMC) { for (int i = 0; i < nBinspT; i++) { - if (dorapidity) { + if (doRapidity) { auto htempSE_AntiDeAntiPr = registry.add(Form("hEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta y #Delta#phi (%.1f(Form("hEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta y #Delta#phi (%.1f (par0 + par1 / track.pt())) + if (std::abs(track.dcaXY()) > (dcaPar0 + dcaPar1 / track.pt())) passcut = false; - if (doDCAZ && std::abs(track.dcaZ()) > (par0 + par1 / track.pt())) + if (doDCAZ && std::abs(track.dcaZ()) > (dcaPar0 + dcaPar1 / track.pt())) passcut = false; return passcut; @@ -1415,10 +1415,10 @@ struct HadronNucleiCorrelation { registry.fill(HIST("Generated/hQADeuterons"), 1.5); } - if (particle.pdgCode() == o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < rap) { + if (particle.pdgCode() == o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < yRap) { registry.fill(HIST("Generated/hDeuteronsVsPt"), particle.pt()); } - if (particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < rap) { + if (particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && std::abs(particle.y()) < yRap) { registry.fill(HIST("Generated/hAntiDeuteronsVsPt"), particle.pt()); } From 6c9e7a87425dc1606162f4d06d2da5260bb76ebd Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 13:32:00 +0200 Subject: [PATCH 04/11] fix o2linter --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index c4f141a04fd..37e0b48119f 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -104,13 +104,13 @@ struct HadronNucleiCorrelation { Configurable dcaPar0{"dcaPar0", 0.004, "par 0"}; Configurable dcaPar1{"dcaPar1", 0.013, "par 1"}; Configurable doDCAZ{"doDCAZ", true, "do DCA z cut"}; - Configurable min_TPC_nClusters{"min_TPC_nClusters", 80, "minimum number of found TPC clusters"}; - Configurable min_TPC_nCrossedRowsOverFindableCls{"min_TPC_nCrossedRowsOverFindableCls", 0.8, "n TPC Crossed Rows Over Findable Cls"}; - Configurable max_chi2_TPC{"max_chi2_TPC", 4.0f, "maximum TPC chi^2/Ncls"}; - Configurable max_chi2_ITS{"max_chi2_ITS", 36.0f, "maximum ITS chi^2/Ncls"}; + Configurable minTPCnClusters{"minTPCnClusters", 80, "minimum number of found TPC clusters"}; + Configurable minTPCnCrossedRowsOverFindableCls{"minTPCnCrossedRowsOverFindableCls", 0.8, "n TPC Crossed Rows Over Findable Cls"}; + Configurable maxchi2TPC{"maxchi2TPC", 4.0f, "maximum TPC chi^2/Ncls"}; + Configurable maxchi2ITS{"maxchi2ITS", 36.0f, "maximum ITS chi^2/Ncls"}; Configurable etaCut{"etaCut", 0.8f, "eta cut"}; - Configurable max_DCAxy{"max_DCAxy", 0.14f, "Maximum DCAxy"}; - Configurable max_DCAz{"max_DCAz", 0.1f, "Maximum DCAz"}; + Configurable maxDCAxy{"maxDCAxy", 0.14f, "Maximum DCAxy"}; + Configurable maxDCAz{"maxDCAz", 0.1f, "Maximum DCAz"}; Configurable nsigmaTPC{"nsigmaTPC", 3.0f, "cut nsigma TPC"}; Configurable nsigmaElPr{"nsigmaElPr", 1.0f, "cut nsigma TPC El for protons"}; Configurable nsigmaElDe{"nsigmaElDe", 3.0f, "cut nsigma TPC El for protons"}; @@ -118,13 +118,13 @@ struct HadronNucleiCorrelation { Configurable nsigmaITSPr{"nsigmaITSPr", -2.0f, "cut nsigma ITS Pr"}; Configurable nsigmaITSDe{"nsigmaITSDe", -2.0f, "cut nsigma ITS De"}; Configurable doITSPID{"doITSPID", true, "do ITS PID"}; - Configurable pTthrpr_TOF{"pTthrpr_TOF", 0.8f, "threshold pT proton to use TOF"}; - Configurable pTthrpr_TPCEl{"pTthrpr_TPCEl", 1.0f, "threshold pT proton to use TPC El rejection"}; - Configurable pTthrde_TOF{"pTthrde_TOF", 1.0f, "threshold pT deuteron to use TOF"}; - Configurable pTthrde_TPCEl{"pTthrde_TPCEl", 1.0f, "threshold pT deuteron to use TPC El rejection"}; + Configurable pTthrprTOF{"pTthrprTOF", 0.8f, "threshold pT proton to use TOF"}; + Configurable pTthrprTPCEl{"pTthrprTPCEl", 1.0f, "threshold pT proton to use TPC El rejection"}; + Configurable pTthrdeTOF{"pTthrdeTOF", 1.0f, "threshold pT deuteron to use TOF"}; + Configurable pTthrdeTPCEl{"pTthrdeTPCEl", 1.0f, "threshold pT deuteron to use TPC El rejection"}; Configurable rejectionEl{"rejectionEl", true, "use TPC El rejection"}; - Configurable max_tpcSharedCls{"max_tpcSharedCls", 0.4, "maximum fraction of TPC shared clasters"}; - Configurable min_itsNCls{"min_itsNCls", 0, "minimum allowed number of ITS clasters"}; + Configurable maxtpcSharedCls{"maxtpcSharedCls", 0.4, "maximum fraction of TPC shared clasters"}; + Configurable minitsNCls{"minitsNCls", 0, "minimum allowed number of ITS clasters"}; Configurable maxmixcollsGen{"maxmixcollsGen", 100, "maxmixcollsGen"}; Configurable radiusTPC{"radiusTPC", 1.2, "TPC radius to calculate phi_star for"}; Configurable dEta{"dEta", 0.01, "minimum allowed difference in eta between two tracks in a pair"}; @@ -421,12 +421,12 @@ struct HadronNucleiCorrelation { // Filters Filter vertexFilter = nabs(o2::aod::singletrackselector::posZ) <= cutzVertex; - Filter trackFilter = o2::aod::singletrackselector::tpcNClsFound >= min_TPC_nClusters && - o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcChi2NCl) <= max_chi2_TPC && - o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcCrossedRowsOverFindableCls) >= min_TPC_nCrossedRowsOverFindableCls && - o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedItsChi2NCl) <= max_chi2_ITS && - nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY)) <= max_DCAxy && - nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY)) <= max_DCAz && + Filter trackFilter = o2::aod::singletrackselector::tpcNClsFound >= minTPCnClusters && + o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcChi2NCl) <= maxchi2TPC && + o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcCrossedRowsOverFindableCls) >= minTPCnCrossedRowsOverFindableCls && + o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedItsChi2NCl) <= maxchi2ITS && + nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY)) <= maxDCAxy && + nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY)) <= maxDCAz && nabs(o2::aod::singletrackselector::eta) <= etaCut; Filter simvertexFilter = nabs(o2::aod::mccollision::posZ) <= cutzVertex; @@ -437,11 +437,11 @@ struct HadronNucleiCorrelation { bool isProton = false; bool isTPCPID = std::abs(track.tpcNSigmaPr()) < nsigmaTPC; bool isTOFPID = std::abs(track.tofNSigmaPr()) < nsigmaTOF; - bool isTPCElRejection = rejectionEl && track.beta() < betahasTOFthr && track.pt() < pTthrpr_TPCEl && track.tpcNSigmaEl() >= nsigmaElPr; + bool isTPCElRejection = rejectionEl && track.beta() < betahasTOFthr && track.pt() < pTthrprTPCEl && track.tpcNSigmaEl() >= nsigmaElPr; bool isITSPID = track.itsNSigmaPr() > nsigmaITSPr; if (isTPCPID) { - if (track.pt() < pTthrpr_TOF) { + if (track.pt() < pTthrprTOF) { if (!doITSPID || isITSPID) { if (sign > 0) { if (track.sign() > 0) { @@ -496,11 +496,11 @@ struct HadronNucleiCorrelation { bool isDeuteron = false; bool isTPCPID = std::abs(track.tpcNSigmaDe()) < nsigmaTPC; bool isTOFPID = std::abs(track.tofNSigmaDe()) < nsigmaTOF; - bool isTPCElRejection = rejectionEl && track.beta() < betahasTOFthr && track.pt() < pTthrde_TPCEl && track.tpcNSigmaEl() >= nsigmaElDe; + bool isTPCElRejection = rejectionEl && track.beta() < betahasTOFthr && track.pt() < pTthrdeTPCEl && track.tpcNSigmaEl() >= nsigmaElDe; bool isITSPID = track.itsNSigmaDe() > nsigmaITSDe; if (isTPCPID) { - if (track.pt() < pTthrde_TOF) { + if (track.pt() < pTthrdeTOF) { if (!doITSPID || isITSPID) { if (sign > 0) { if (track.sign() > 0) { @@ -733,9 +733,9 @@ struct HadronNucleiCorrelation { if (removeSameBunchPileup && !track.template singleCollSel_as>().isNoSameBunchPileup()) continue; - if (track.tpcFractionSharedCls() > max_tpcSharedCls) + if (track.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (track.itsNCls() < min_itsNCls) + if (track.itsNCls() < minitsNCls) continue; if (IsProton(track, +1)) @@ -809,13 +809,13 @@ struct HadronNucleiCorrelation { if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) continue; - if (part0.tpcFractionSharedCls() > max_tpcSharedCls) + if (part0.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (part0.itsNCls() < min_itsNCls) + if (part0.itsNCls() < minitsNCls) continue; - if (part1.tpcFractionSharedCls() > max_tpcSharedCls) + if (part1.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (part1.itsNCls() < min_itsNCls) + if (part1.itsNCls() < minitsNCls) continue; if (!applyDCAcut(part0)) @@ -854,13 +854,13 @@ struct HadronNucleiCorrelation { if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) continue; - if (part0.tpcFractionSharedCls() > max_tpcSharedCls) + if (part0.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (part0.itsNCls() < min_itsNCls) + if (part0.itsNCls() < minitsNCls) continue; - if (part1.tpcFractionSharedCls() > max_tpcSharedCls) + if (part1.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (part1.itsNCls() < min_itsNCls) + if (part1.itsNCls() < minitsNCls) continue; if (!applyDCAcut(part0)) @@ -945,13 +945,13 @@ struct HadronNucleiCorrelation { if (removeSameBunchPileup && !part1.template singleCollSel_as>().isNoSameBunchPileup()) continue; - if (part0.tpcFractionSharedCls() > max_tpcSharedCls) + if (part0.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (part0.itsNCls() < min_itsNCls) + if (part0.itsNCls() < minitsNCls) continue; - if (part1.tpcFractionSharedCls() > max_tpcSharedCls) + if (part1.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (part1.itsNCls() < min_itsNCls) + if (part1.itsNCls() < minitsNCls) continue; if (!applyDCAcut(part0)) @@ -1031,9 +1031,9 @@ struct HadronNucleiCorrelation { if (std::abs(track.template singleCollSel_as().posZ()) > cutzVertex) continue; - if (track.tpcFractionSharedCls() > max_tpcSharedCls) + if (track.tpcFractionSharedCls() > maxtpcSharedCls) continue; - if (track.itsNCls() < min_itsNCls) + if (track.itsNCls() < minitsNCls) continue; if (IsProton(track, +1) && track.pdgCode() == PDG_t::kProton) { From ca6308b377f8f896ddaab4b10e4f43be890b82b2 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 13:34:19 +0200 Subject: [PATCH 05/11] fix o2linter --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 37e0b48119f..de1ebf03150 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -139,8 +139,8 @@ struct HadronNucleiCorrelation { // pT/A bins Configurable> pTBins{"pTBins", {0.6f, 1.0f, 1.2f, 2.f}, "p_{T} bins"}; - ConfigurableAxis AxisNSigma{"AxisNSigma", {35, -7.f, 7.f}, "n#sigma"}; - ConfigurableAxis DeltaPhiAxis = {"DeltaPhiAxis", {46, -1 * o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf}, "#Delta#phi (rad)"}; + ConfigurableAxis axisNSigma{"axisNSigma", {35, -7.f, 7.f}, "n#sigma"}; + ConfigurableAxis deltaPhiAxis = {"deltaPhiAxis", {46, -1 * o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf}, "#Delta#phi (rad)"}; using FilteredCollisions = soa::Filtered; using SimCollisions = soa::Filtered; @@ -240,24 +240,24 @@ struct HadronNucleiCorrelation { if (doRapidity) { - auto htempSE_AntiDeAntiPr = registry.add(Form("hEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta y #Delta#phi (%.1f(Form("hEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta y #Delta#phi (%.1f(Form("hEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta y #Delta#phi (%.1f(Form("hEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta y #Delta#phi (%.1f(Form("hCorrEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta y #Delta#phi (%.1f(Form("hCorrEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta y #Delta#phi (%.1f(Form("hCorrEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta y #Delta#phi (%.1f(Form("hCorrEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta y #Delta#phi (%.1f(Form("hEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f Date: Wed, 17 Jun 2026 13:54:27 +0200 Subject: [PATCH 06/11] add PID with quadratic cut --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 106 +++++++++++++----- 1 file changed, 78 insertions(+), 28 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index de1ebf03150..a3904c3a4b3 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -90,7 +90,7 @@ struct HadronNucleiCorrelation { Configurable isMCGen{"isMCGen", false, "is isMCGen"}; Configurable isPrim{"isPrim", true, "is isPrim"}; Configurable doCorrection{"doCorrection", false, "do efficiency correction"}; - Configurable removeSameBunchPileup{"removeSameBunchPileup", false, "remove Same Bunch Pileup"}; + Configurable doQuadraticPID{"doQuadraticPID", false, "do PID with sum in quadrature of TOF and TPC"}; Configurable fCorrectionPath{"fCorrectionPath", "", "Correction path to file"}; Configurable fCorrectionHisto{"fCorrectionHisto", "", "Correction histogram"}; @@ -98,6 +98,7 @@ struct HadronNucleiCorrelation { // Event selection Configurable cutzVertex{"cutzVertex", 10.0, "|vertexZ| value limit"}; + Configurable removeSameBunchPileup{"removeSameBunchPileup", false, "remove Same Bunch Pileup"}; // Track selection Configurable doClosePairRejection{"doClosePairRejection", false, "doClosePairRejection"}; @@ -281,6 +282,8 @@ struct HadronNucleiCorrelation { QA.add("QA/hDCAxy", "DCAxy", {HistType::kTH2D, {{200, -0.2f, 0.2f, "DCA xy (cm)"}, {100, 0.f, 10.f, "p_{T} GeV/c"}}}); QA.add("QA/hDCAz", "DCAz", {HistType::kTH2D, {{200, -0.2f, 0.2f, "DCA z (cm)"}, {100, 0.f, 10.f, "p_{T} GeV/c"}}}); QA.add("QA/TPCChi2VsPZ", "TPCChi2VsPZ", {HistType::kTH2D, {{100, 0.f, 10.f, "p_{TPC}/Z (GeV/c)"}, {120, 0.f, 6.f, "TPC Chi2"}}}); + QA.add("QA/h2dTPCTOF_Pr", "n#sigma TPC vs n#sigma TOF; n#sigma TPC; n#sigma TOF", {HistType::kTH2D, {axisNSigma, axisNSigma}}); + QA.add("QA/h2dTPCTOF_AntiPr", "n#sigma TPC vs n#sigma TOF; n#sigma TPC; n#sigma TOF", {HistType::kTH2D, {axisNSigma, axisNSigma}}); QA.add("QA/hnSigmaTPCVsPt_El", "n#sigma TPC vs p_{T} for e hypothesis (all tracks); p_{T} (GeV/c); n#sigma TPC", {HistType::kTH2D, {pTAxis, axisNSigma}}); QA.add("QA/hnSigmaTPCVsPt_Pr", "n#sigma TPC vs p_{T} for p hypothesis (all tracks); p_{T} (GeV/c); n#sigma TPC", {HistType::kTH2D, {pTAxis, axisNSigma}}); QA.add("QA/hnSigmaTPCVsPt_De", "n#sigma TPC vs p_{T} for d hypothesis (all tracks); p_{T} (GeV/c); n#sigma TPC", {HistType::kTH2D, {pTAxis, axisNSigma}}); @@ -306,6 +309,8 @@ struct HadronNucleiCorrelation { QA.add("QA/hnSigmaTOFVsPt_De_AfterSel", "n#sigma TOF vs p_{T} for d hypothesis (all tracks); p_{T} (GeV/c); n#sigma TOF", {HistType::kTH2D, {pTAxis, axisNSigma}}); QA.add("QA/hnSigmaITSVsPt_Pr_AfterSel", "n#sigma ITS vs p_{T} for p hypothesis (all tracks); p_{T} (GeV/c); n#sigma ITS", {HistType::kTH2D, {pTAxis, axisNSigma}}); QA.add("QA/hnSigmaITSVsPt_De_AfterSel", "n#sigma ITS vs p_{T} for d hypothesis (all tracks); p_{T} (GeV/c); n#sigma ITS", {HistType::kTH2D, {pTAxis, axisNSigma}}); + QA.add("QA/h2dTPCTOF_Pr_AfterSel", "n#sigma TPC vs n#sigma TOF; n#sigma TPC; n#sigma TOF", {HistType::kTH2D, {axisNSigma, axisNSigma}}); + QA.add("QA/h2dTPCTOF_AntiPr_AfterSel", "n#sigma TPC vs n#sigma TOF; n#sigma TPC; n#sigma TOF", {HistType::kTH2D, {axisNSigma, axisNSigma}}); } } @@ -435,14 +440,33 @@ struct HadronNucleiCorrelation { bool IsProton(Type const& track, int sign) { bool isProton = false; + bool isTPCPID = std::abs(track.tpcNSigmaPr()) < nsigmaTPC; bool isTOFPID = std::abs(track.tofNSigmaPr()) < nsigmaTOF; bool isTPCElRejection = rejectionEl && track.beta() < betahasTOFthr && track.pt() < pTthrprTPCEl && track.tpcNSigmaEl() >= nsigmaElPr; bool isITSPID = track.itsNSigmaPr() > nsigmaITSPr; - if (isTPCPID) { - if (track.pt() < pTthrprTOF) { - if (!doITSPID || isITSPID) { + bool isQuadraticPID = TMath::Sqrt(track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr()) < nsigmaTPC; + + if (!doQuadraticPID) { + if (isTPCPID) { + if (track.pt() < pTthrprTOF) { + if (!doITSPID || isITSPID) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } + } + } + } else if (isTPCElRejection) { if (sign > 0) { if (track.sign() > 0) { isProton = true; @@ -456,33 +480,55 @@ struct HadronNucleiCorrelation { isProton = true; } } - } - } else if (isTPCElRejection) { - if (sign > 0) { - if (track.sign() > 0) { - isProton = true; - } else if (track.sign() < 0) { - isProton = false; - } - } else if (sign < 0) { - if (track.sign() > 0) { - isProton = false; - } else if (track.sign() < 0) { - isProton = true; + } else if (isTOFPID) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } } } - } else if (isTOFPID) { - if (sign > 0) { - if (track.sign() > 0) { - isProton = true; - } else if (track.sign() < 0) { - isProton = false; + } + } else { + if (track.pt() < pTthrprTOF) { + if (isTPCPID) { + if (!doITSPID || isITSPID) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } + } } - } else if (sign < 0) { - if (track.sign() > 0) { - isProton = false; - } else if (track.sign() < 0) { - isProton = true; + } + } else if (isQuadraticPID) { + if (!doITSPID || isITSPID) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } } } } @@ -767,6 +813,8 @@ struct HadronNucleiCorrelation { QA.fill(HIST("QA/hnSigmaTOFVsPt_De"), track.pt() * track.sign(), track.tofNSigmaDe()); QA.fill(HIST("QA/hnSigmaITSVsPt_Pr"), track.pt() * track.sign(), track.itsNSigmaPr()); QA.fill(HIST("QA/hnSigmaITSVsPt_De"), track.pt() * track.sign(), track.itsNSigmaDe()); + QA.fill(HIST("QA/h2dTPCTOF_AntiPr"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + QA.fill(HIST("QA/h2dTPCTOF_Pr"), track.tpcNSigmaPr(), track.tofNSigmaPr()); if (IsProton(track, -1)) { QA.fill(HIST("QA/hEtaAntiPr"), track.eta()); @@ -774,6 +822,7 @@ struct HadronNucleiCorrelation { QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tofNSigmaPr()); QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); QA.fill(HIST("QA/hnSigmaITSVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.itsNSigmaPr()); + QA.fill(HIST("QA/h2dTPCTOF_AntiPr_AfterSel"), track.tpcNSigmaPr(), track.tofNSigmaPr()); } if (IsProton(track, +1)) { QA.fill(HIST("QA/hEtaPr"), track.eta()); @@ -781,6 +830,7 @@ struct HadronNucleiCorrelation { QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tofNSigmaPr()); QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); QA.fill(HIST("QA/hnSigmaITSVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.itsNSigmaPr()); + QA.fill(HIST("QA/h2dTPCTOF_Pr_AfterSel"), track.tpcNSigmaPr(), track.tofNSigmaPr()); } if (IsDeuteron(track, -1)) { QA.fill(HIST("QA/hEtaAntiDe"), track.eta()); From 8c4d378c4d09bfac806d30ec44c42df6515f32ac Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 14:09:51 +0200 Subject: [PATCH 07/11] fix --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index a3904c3a4b3..183d3879ff4 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -516,19 +516,17 @@ struct HadronNucleiCorrelation { } } } else if (isQuadraticPID) { - if (!doITSPID || isITSPID) { - if (sign > 0) { - if (track.sign() > 0) { - isProton = true; - } else if (track.sign() < 0) { - isProton = false; - } - } else if (sign < 0) { - if (track.sign() > 0) { - isProton = false; - } else if (track.sign() < 0) { - isProton = true; - } + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; } } } From 50f5ba874092e8a59f1745bdd4944182b0cb9ee8 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 14:55:01 +0200 Subject: [PATCH 08/11] fix --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 310 +++++++++++++++++- 1 file changed, 303 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 183d3879ff4..46aadac4640 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -144,6 +144,7 @@ struct HadronNucleiCorrelation { ConfigurableAxis deltaPhiAxis = {"deltaPhiAxis", {46, -1 * o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf}, "#Delta#phi (rad)"}; using FilteredCollisions = soa::Filtered; + using FilteredCollisionsExtra = soa::Filtered; using SimCollisions = soa::Filtered; using SimParticles = aod::McParticles; using FilteredTracks = soa::Filtered>; // new tables (v3) @@ -774,7 +775,198 @@ struct HadronNucleiCorrelation { for (const auto& track : tracks) { - if (removeSameBunchPileup && !track.template singleCollSel_as>().isNoSameBunchPileup()) + if (track.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (track.itsNCls() < minitsNCls) + continue; + + if (IsProton(track, +1)) + registry.fill(HIST("hPrDCAxy"), track.dcaXY(), track.pt()); + if (IsProton(track, -1)) + registry.fill(HIST("hAntiPrDCAxy"), track.dcaXY(), track.pt()); + if (IsDeuteron(track, +1)) + registry.fill(HIST("hDeDCAxy"), track.dcaXY(), track.pt()); + if (IsDeuteron(track, -1)) + registry.fill(HIST("hAntiDeDCAxy"), track.dcaXY(), track.pt()); + + if (!applyDCAcut(track)) + continue; + + if (doQA) { + QA.fill(HIST("QA/hTPCnClusters"), track.tpcNClsFound()); + QA.fill(HIST("QA/hTPCSharedClusters"), track.tpcFractionSharedCls()); + QA.fill(HIST("QA/hTPCchi2"), track.tpcChi2NCl()); + QA.fill(HIST("QA/hTPCcrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); + QA.fill(HIST("QA/hITSchi2"), track.itsChi2NCl()); + QA.fill(HIST("QA/hDCAxy"), track.dcaXY(), track.pt()); + QA.fill(HIST("QA/hDCAz"), track.dcaZ(), track.pt()); + QA.fill(HIST("QA/TPCChi2VsPZ"), track.tpcInnerParam() / track.sign(), track.tpcChi2NCl()); + QA.fill(HIST("QA/hVtxZ_trk"), collision.posZ()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_El"), track.pt() * track.sign(), track.tpcNSigmaEl()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr"), track.pt() * track.sign(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_De"), track.pt() * track.sign(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr"), track.pt() * track.sign(), track.tofNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_De"), track.pt() * track.sign(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaITSVsPt_Pr"), track.pt() * track.sign(), track.itsNSigmaPr()); + QA.fill(HIST("QA/hnSigmaITSVsPt_De"), track.pt() * track.sign(), track.itsNSigmaDe()); + QA.fill(HIST("QA/h2dTPCTOF_AntiPr"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + QA.fill(HIST("QA/h2dTPCTOF_Pr"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + + if (IsProton(track, -1)) { + QA.fill(HIST("QA/hEtaAntiPr"), track.eta()); + QA.fill(HIST("QA/hPhiAntiPr"), track.phi()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tofNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaITSVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.itsNSigmaPr()); + QA.fill(HIST("QA/h2dTPCTOF_AntiPr_AfterSel"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + } + if (IsProton(track, +1)) { + QA.fill(HIST("QA/hEtaPr"), track.eta()); + QA.fill(HIST("QA/hPhiPr"), track.phi()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tofNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaITSVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.itsNSigmaPr()); + QA.fill(HIST("QA/h2dTPCTOF_Pr_AfterSel"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + } + if (IsDeuteron(track, -1)) { + QA.fill(HIST("QA/hEtaAntiDe"), track.eta()); + QA.fill(HIST("QA/hPhiAntiDe"), track.phi()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_De_AfterSel"), track.pt() * track.sign(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_De_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaITSVsPt_De_AfterSel"), track.pt() * track.sign(), track.itsNSigmaDe()); + } + if (IsDeuteron(track, +1)) { + QA.fill(HIST("QA/hEtaDe"), track.eta()); + QA.fill(HIST("QA/hPhiDe"), track.phi()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_De_AfterSel"), track.pt() * track.sign(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_De_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaITSVsPt_De_AfterSel"), track.pt() * track.sign(), track.itsNSigmaDe()); + } + } + } + + Pair->SetMagField1(collision.magField()); + Pair->SetMagField2(collision.magField()); + + if (mode == kPbarPbar || mode == kPP) { // Identical particle combinations + + for (const auto& [part0, part1] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks, tracks))) { + + if (part0.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (part0.itsNCls() < minitsNCls) + continue; + if (part1.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (part1.itsNCls() < minitsNCls) + continue; + + if (!applyDCAcut(part0)) + continue; + if (!applyDCAcut(part1)) + continue; + + // remove tracks outside pt bins + if (part0.pt() < pTBins.value.at(0) || part0.pt() >= pTBins.value.at(nBinspT)) + continue; + if (part1.pt() < pTBins.value.at(0) || part1.pt() >= pTBins.value.at(nBinspT)) + continue; + + // mode 6 + if (mode == kPP) { + if (!IsProton(part0, +1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + // mode 5 + if (mode == kPbarPbar) { + if (!IsProton(part0, -1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + + fillHistograms(part0, part1, false, true); + } + + } else { + + for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { + + if (part0.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (part0.itsNCls() < minitsNCls) + continue; + if (part1.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (part1.itsNCls() < minitsNCls) + continue; + + if (!applyDCAcut(part0)) + continue; + if (!applyDCAcut(part1)) + continue; + + // remove tracks outside pt bins + if (part0.pt() < pTBins.value.at(0) || part0.pt() >= pTBins.value.at(nBinspT)) + continue; + if (part1.pt() < pTBins.value.at(0) || part1.pt() >= pTBins.value.at(nBinspT)) + continue; + + // modes 0,1,2,3,4,7 + if (mode == kDbarPbar) { + if (!IsDeuteron(part0, -1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + if (mode == kDP) { + if (!IsDeuteron(part0, +1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kDbarP) { + if (!IsDeuteron(part0, -1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kDPbar) { + if (!IsDeuteron(part0, +1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + if (mode == kPbarP) { + if (!IsProton(part0, -1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kPPbar) { + if (!IsProton(part0, +1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + + fillHistograms(part0, part1, false, false); + } + } + } + PROCESS_SWITCH(HadronNucleiCorrelation, processSameEvent, "processSameEvent", true); + + void processSameEventEvSel(FilteredCollisionsExtra::iterator const& collision, FilteredTracks const& tracks) + { + + registry.fill(HIST("hNEvents"), 0.5); + registry.fill(HIST("hMult"), collision.mult()); + + for (const auto& track : tracks) { + + if (removeSameBunchPileup && !track.template singleCollSel_as>().isNoSameBunchPileup()) continue; if (track.tpcFractionSharedCls() > maxtpcSharedCls) @@ -854,7 +1046,7 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks, tracks))) { - if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) continue; if (part0.tpcFractionSharedCls() > maxtpcSharedCls) @@ -899,7 +1091,7 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { - if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) continue; if (part0.tpcFractionSharedCls() > maxtpcSharedCls) @@ -964,7 +1156,7 @@ struct HadronNucleiCorrelation { } } } - PROCESS_SWITCH(HadronNucleiCorrelation, processSameEvent, "processSameEvent", true); + PROCESS_SWITCH(HadronNucleiCorrelation, processSameEventEvSel, "processSameEventEvSel", false); void processMixedEvent(FilteredCollisions const& collisions, FilteredTracks const& tracks) { @@ -988,9 +1180,113 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + if (part0.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (part0.itsNCls() < minitsNCls) + continue; + if (part1.tpcFractionSharedCls() > maxtpcSharedCls) + continue; + if (part1.itsNCls() < minitsNCls) + continue; + + if (!applyDCAcut(part0)) + continue; + if (!applyDCAcut(part1)) + continue; + + // remove tracks outside pt bins + if (part0.pt() < pTBins.value.at(0) || part0.pt() >= pTBins.value.at(nBinspT)) + continue; + if (part1.pt() < pTBins.value.at(0) || part1.pt() >= pTBins.value.at(nBinspT)) + continue; + + //{"mode", 0, "0: antid-antip, 1: d-p, 2: antid-p, 3: d-antip, 4: antip-p, 5: antip-antip, 6: p-p, 7: p-antip"}; + if (mode == kDbarPbar) { + if (!IsDeuteron(part0, -1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + if (mode == kDP) { + if (!IsDeuteron(part0, +1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kDbarP) { + if (!IsDeuteron(part0, -1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kDPbar) { + if (!IsDeuteron(part0, +1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + if (mode == kPbarP) { + if (!IsProton(part0, -1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kPbarPbar) { + if (!IsProton(part0, -1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + if (mode == kPP) { + if (!IsProton(part0, +1)) + continue; + if (!IsProton(part1, +1)) + continue; + } + if (mode == kPPbar) { + if (!IsProton(part0, +1)) + continue; + if (!IsProton(part1, -1)) + continue; + } + + bool isIdentical = false; + if (mode == kPbarPbar || mode == kPP) + isIdentical = true; + + fillHistograms(part0, part1, true, isIdentical); + } + } + } + PROCESS_SWITCH(HadronNucleiCorrelation, processMixedEvent, "processMixedEvent", true); + + void processMixedEventEvSel(FilteredCollisionsExtra const& collisions, FilteredTracks const& tracks) + { + + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, collisions, collisions)) { + + // LOGF(info, "Mixed event collisions: (%d, %d) zvtx (%.1f, %.1f) mult (%d, %d)", collision1.globalIndex(), collision2.globalIndex(), collision1.posZ(), collision2.posZ(), collision1.mult(), collision2.mult()); + + auto groupPartsOne = tracks.sliceByCached(o2::aod::singletrackselector::singleCollSelId, collision1.globalIndex(), cache); + auto groupPartsTwo = tracks.sliceByCached(o2::aod::singletrackselector::singleCollSelId, collision2.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + const float limit = 1e-4; + + if (std::abs(magFieldTesla1 - magFieldTesla2) > limit) { + continue; + } + + Pair->SetMagField1(magFieldTesla1); + Pair->SetMagField2(magFieldTesla2); + + for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + + if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) continue; - if (removeSameBunchPileup && !part1.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part1.template singleCollSel_as>().isNoSameBunchPileup()) continue; if (part0.tpcFractionSharedCls() > maxtpcSharedCls) @@ -1071,7 +1367,7 @@ struct HadronNucleiCorrelation { } } } - PROCESS_SWITCH(HadronNucleiCorrelation, processMixedEvent, "processMixedEvent", true); + PROCESS_SWITCH(HadronNucleiCorrelation, processMixedEventEvSel, "processMixedEventEvSel", false); void processMC(FilteredCollisions const&, FilteredTracksMC const& tracks) { From f07fa5684d6e09d7b8d9d820dc8f460269bea342 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 14:58:08 +0200 Subject: [PATCH 09/11] fix --- PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 46aadac4640..e56421892fb 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -1171,7 +1171,9 @@ struct HadronNucleiCorrelation { const auto& magFieldTesla1 = collision1.magField(); const auto& magFieldTesla2 = collision2.magField(); - if (std::abs(magFieldTesla1 - magFieldTesla2) > 1e-4) { + const float limit = 1e-4; + + if (std::abs(magFieldTesla1 - magFieldTesla2) > limit) { continue; } From 6b38696e3647a75dc10473bb3489f629d628195f Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 15:18:04 +0200 Subject: [PATCH 10/11] add pid for deuterons --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 70 ++++++++++++++----- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index e56421892fb..252019c07fc 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -544,9 +544,27 @@ struct HadronNucleiCorrelation { bool isTPCElRejection = rejectionEl && track.beta() < betahasTOFthr && track.pt() < pTthrdeTPCEl && track.tpcNSigmaEl() >= nsigmaElDe; bool isITSPID = track.itsNSigmaDe() > nsigmaITSDe; - if (isTPCPID) { - if (track.pt() < pTthrdeTOF) { - if (!doITSPID || isITSPID) { + bool isQuadraticPID = TMath::Sqrt(track.tpcNSigmaDe() * track.tpcNSigmaDe() + track.tofNSigmaDe() * track.tofNSigmaDe()) < nsigmaTPC; + + if (!doQuadraticPID) { + if (isTPCPID) { + if (track.pt() < pTthrdeTOF) { + if (!doITSPID || isITSPID) { + if (sign > 0) { + if (track.sign() > 0) { + isDeuteron = true; + } else if (track.sign() < 0) { + isDeuteron = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isDeuteron = false; + } else if (track.sign() < 0) { + isDeuteron = true; + } + } + } + } else if (isTPCElRejection) { if (sign > 0) { if (track.sign() > 0) { isDeuteron = true; @@ -560,22 +578,42 @@ struct HadronNucleiCorrelation { isDeuteron = true; } } - } - } else if (isTPCElRejection) { - if (sign > 0) { - if (track.sign() > 0) { - isDeuteron = true; - } else if (track.sign() < 0) { - isDeuteron = false; + } else if (isTOFPID) { + if (sign > 0) { + if (track.sign() > 0) { + isDeuteron = true; + } else if (track.sign() < 0) { + isDeuteron = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isDeuteron = false; + } else if (track.sign() < 0) { + isDeuteron = true; + } } - } else if (sign < 0) { - if (track.sign() > 0) { - isDeuteron = false; - } else if (track.sign() < 0) { - isDeuteron = true; + } + } + } else { + if (track.pt() < pTthrprTOF) { + if (isTPCPID) { + if (!doITSPID || isITSPID) { + if (sign > 0) { + if (track.sign() > 0) { + isDeuteron = true; + } else if (track.sign() < 0) { + isDeuteron = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isDeuteron = false; + } else if (track.sign() < 0) { + isDeuteron = true; + } + } } } - } else if (isTOFPID) { + } else if (isQuadraticPID) { if (sign > 0) { if (track.sign() > 0) { isDeuteron = true; From 4c75abf3bd2033152564bcf6ba4aace13025a16b Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Wed, 17 Jun 2026 17:30:27 +0200 Subject: [PATCH 11/11] fix collisions --- PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 252019c07fc..373e902644b 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -144,7 +144,7 @@ struct HadronNucleiCorrelation { ConfigurableAxis deltaPhiAxis = {"deltaPhiAxis", {46, -1 * o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf}, "#Delta#phi (rad)"}; using FilteredCollisions = soa::Filtered; - using FilteredCollisionsExtra = soa::Filtered; + using FilteredCollisionsExtra = soa::Filtered>; using SimCollisions = soa::Filtered; using SimParticles = aod::McParticles; using FilteredTracks = soa::Filtered>; // new tables (v3) @@ -1004,7 +1004,7 @@ struct HadronNucleiCorrelation { for (const auto& track : tracks) { - if (removeSameBunchPileup && !track.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !track.template singleCollSel_as().isNoSameBunchPileup()) continue; if (track.tpcFractionSharedCls() > maxtpcSharedCls) @@ -1084,7 +1084,7 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks, tracks))) { - if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part0.template singleCollSel_as().isNoSameBunchPileup()) continue; if (part0.tpcFractionSharedCls() > maxtpcSharedCls) @@ -1129,7 +1129,7 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { - if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part0.template singleCollSel_as().isNoSameBunchPileup()) continue; if (part0.tpcFractionSharedCls() > maxtpcSharedCls) @@ -1324,9 +1324,9 @@ struct HadronNucleiCorrelation { for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (removeSameBunchPileup && !part0.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part0.template singleCollSel_as().isNoSameBunchPileup()) continue; - if (removeSameBunchPileup && !part1.template singleCollSel_as>().isNoSameBunchPileup()) + if (removeSameBunchPileup && !part1.template singleCollSel_as().isNoSameBunchPileup()) continue; if (part0.tpcFractionSharedCls() > maxtpcSharedCls)