From f6774e6ec87d80d122bd5e702265381e65e0d781 Mon Sep 17 00:00:00 2001 From: huinaibing Date: Mon, 24 Aug 2026 22:40:35 +0800 Subject: [PATCH] [PWGCF] add data abundance weighted charged efficiency --- PWGCF/Flow/Tasks/pidFlowPtCorr.cxx | 81 +++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/PWGCF/Flow/Tasks/pidFlowPtCorr.cxx b/PWGCF/Flow/Tasks/pidFlowPtCorr.cxx index 25184c6b362..6f5cedf0485 100644 --- a/PWGCF/Flow/Tasks/pidFlowPtCorr.cxx +++ b/PWGCF/Flow/Tasks/pidFlowPtCorr.cxx @@ -360,6 +360,7 @@ struct PidFlowPtCorr { ConfigurableAxis cfgaxisAbundancePr{"cfgaxisAbundancePr", {100, 0, 50}, "axis for Abundance Pr"}; Configurable cfgOutPutAbundanceDis{"cfgOutPutAbundanceDis", false, "out put hists for pid particle Abundance QA"}; + Configurable cfgOutputAbundanceYields{"cfgOutputAbundanceYields", false, "Output detector-PID abundance yields for pion, kaon, proton, and unidentified"}; } particleAbundanceOpts; ConfigurableAxis cfgaxisVertex{"cfgaxisVertex", {20, -10, 10}, "vertex axis for histograms"}; @@ -511,8 +512,10 @@ struct PidFlowPtCorr { kPidRespPion = 0, kPidRespKaon, kPidRespProton, - kPidRespUnidentified, - kPidRespNRecoBins + kPidRespOther, + kPidRespNTrueBins, + kPidRespUnidentified = kPidRespOther, + kPidRespNRecoBins = kPidRespNTrueBins }; // graphs for NUE / NUA @@ -659,6 +662,16 @@ struct PidFlowPtCorr { // hist for Pr eff registry.add("correction/hPtCentMcRecPr", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); registry.add("correction/hPtCentMcGenPr", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + // Charged-track reconstruction efficiency split by MC true species. + // Detector PID is deliberately not used for these numerators. + registry.add("correction/hPtCentMcRecTruePi", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcRecTrueKa", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcRecTruePr", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcRecTrueOther", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcGenTruePi", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcGenTrueKa", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcGenTruePr", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("correction/hPtCentMcGenTrueOther", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); } // cfgoutputMC if (switchsOpts.cfgOutPutMC1D.value) { @@ -706,6 +719,12 @@ struct PidFlowPtCorr { registry.add("abundance/hNumOfKaEventCount", "", {HistType::kTH1D, {particleAbundanceOpts.cfgaxisAbundanceKa}}); registry.add("abundance/hNumOfPrEventCount", "", {HistType::kTH1D, {particleAbundanceOpts.cfgaxisAbundancePr}}); } + if (particleAbundanceOpts.cfgOutputAbundanceYields.value) { + registry.add("abundance/hPtCentDataPi", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("abundance/hPtCentDataKa", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("abundance/hPtCentDataPr", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + registry.add("abundance/hPtCentDataUnidentified", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}}); + } // set bin label for hEventCount // processdata @@ -802,8 +821,8 @@ struct PidFlowPtCorr { // end set bin label for eventcount if (switchsOpts.cfgAddPidResponseMatrixHistograms.value) { - registry.add("pidResponseMatrix/hPidResponseMatrix", "PID response matrix;true PID;reconstructed PID", {HistType::kTH2D, {{3, -0.5, 2.5}, {4, -0.5, 3.5}}}); - registry.add("pidResponseMatrix/hPidResponseMatrixRecPtCent", "PID response matrix vs reconstructed pT and centrality;true PID;reconstructed PID;p_{T}^{rec} (GeV/#it{c});Centrality (%)", {HistType::kTHnSparseF, {{3, -0.5, 2.5}, {4, -0.5, 3.5}, cfgaxisPt, axisMultiplicity}}); + registry.add("pidResponseMatrix/hPidResponseMatrix", "PID response matrix;true PID;reconstructed PID", {HistType::kTH2D, {{4, -0.5, 3.5}, {4, -0.5, 3.5}}}); + registry.add("pidResponseMatrix/hPidResponseMatrixRecPtCent", "PID response matrix vs reconstructed pT and centrality;true PID;reconstructed PID;p_{T}^{rec} (GeV/#it{c});Centrality (%)", {HistType::kTHnSparseF, {{4, -0.5, 3.5}, {4, -0.5, 3.5}, cfgaxisPt, axisMultiplicity}}); auto setPidResponseLabels = [](TAxis* axis, bool includeUnidentified) { axis->SetBinLabel(kPidRespPion + 1, "Pion"); @@ -811,6 +830,8 @@ struct PidFlowPtCorr { axis->SetBinLabel(kPidRespProton + 1, "Proton"); if (includeUnidentified) { axis->SetBinLabel(kPidRespUnidentified + 1, "Unidentified"); + } else { + axis->SetBinLabel(kPidRespOther + 1, "Other"); } }; setPidResponseLabels(registry.get(HIST("pidResponseMatrix/hPidResponseMatrix"))->GetXaxis(), false); @@ -1401,7 +1422,7 @@ struct PidFlowPtCorr { case PDG_t::kProton: return kPidRespProton; default: - return -1; + return kPidRespOther; } } @@ -1419,6 +1440,12 @@ struct PidFlowPtCorr { } } + template + int getTrueSpeciesBin(McParticle const& particle) + { + return getPidResponseTrueBin(particle.pdgCode()); + } + // pid util function // other utils @@ -2716,6 +2743,17 @@ struct PidFlowPtCorr { // Unified PID logic (configurable) // ------------------------------ int pid = getPidConfigurable(track); + if (particleAbundanceOpts.cfgOutputAbundanceYields.value && withinPtRefGlobal) { + if (pid == MyParticleType::kPion) { + registry.fill(HIST("abundance/hPtCentDataPi"), track.pt(), cent); + } else if (pid == MyParticleType::kKaon) { + registry.fill(HIST("abundance/hPtCentDataKa"), track.pt(), cent); + } else if (pid == MyParticleType::kProton) { + registry.fill(HIST("abundance/hPtCentDataPr"), track.pt(), cent); + } else { + registry.fill(HIST("abundance/hPtCentDataUnidentified"), track.pt(), cent); + } + } if (pid == -1 && withinPtRefGlobal) { // Unidentified tracks have no PID-specific correction. Reuse exactly // the charged NUA/NUE (including the optional local-density factor). @@ -4031,9 +4069,6 @@ struct PidFlowPtCorr { } const int truePidBin = getPidResponseTrueBin(mcParticle.pdgCode()); - if (truePidBin < 0) { - continue; - } const int recoPidBin = getPidResponseRecoBin(getPidConfigurable(track)); registry.fill(HIST("pidResponseMatrix/hPidResponseMatrix"), truePidBin, recoPidBin); @@ -4097,6 +4132,21 @@ struct PidFlowPtCorr { // graph for all particles registry.fill(HIST("correction/hPtCentMcRec"), track.pt(), cent); + switch (getTrueSpeciesBin(mcParticle)) { + case kPidRespPion: + registry.fill(HIST("correction/hPtCentMcRecTruePi"), track.pt(), cent); + break; + case kPidRespKaon: + registry.fill(HIST("correction/hPtCentMcRecTrueKa"), track.pt(), cent); + break; + case kPidRespProton: + registry.fill(HIST("correction/hPtCentMcRecTruePr"), track.pt(), cent); + break; + default: + registry.fill(HIST("correction/hPtCentMcRecTrueOther"), track.pt(), cent); + break; + } + // ------------------------------ // Unified PID logic (configurable) // ------------------------------ @@ -4179,6 +4229,21 @@ struct PidFlowPtCorr { // graph for all particles registry.fill(HIST("correction/hPtCentMcGen"), mcParticle.pt(), cent); + switch (getTrueSpeciesBin(mcParticle)) { + case kPidRespPion: + registry.fill(HIST("correction/hPtCentMcGenTruePi"), mcParticle.pt(), cent); + break; + case kPidRespKaon: + registry.fill(HIST("correction/hPtCentMcGenTrueKa"), mcParticle.pt(), cent); + break; + case kPidRespProton: + registry.fill(HIST("correction/hPtCentMcGenTruePr"), mcParticle.pt(), cent); + break; + default: + registry.fill(HIST("correction/hPtCentMcGenTrueOther"), mcParticle.pt(), cent); + break; + } + // identify particle and fill graph if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) { registry.fill(HIST("correction/hPtCentMcGenPi"), mcParticle.pt(), cent);