Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 73 additions & 8 deletions PWGCF/Flow/Tasks/pidFlowPtCorr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ struct PidFlowPtCorr {
ConfigurableAxis cfgaxisAbundancePr{"cfgaxisAbundancePr", {100, 0, 50}, "axis for Abundance Pr"};

Configurable<bool> cfgOutPutAbundanceDis{"cfgOutPutAbundanceDis", false, "out put hists for pid particle Abundance QA"};
Configurable<bool> 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"};
Expand Down Expand Up @@ -511,8 +512,10 @@ struct PidFlowPtCorr {
kPidRespPion = 0,
kPidRespKaon,
kPidRespProton,
kPidRespUnidentified,
kPidRespNRecoBins
kPidRespOther,
kPidRespNTrueBins,
kPidRespUnidentified = kPidRespOther,
kPidRespNRecoBins = kPidRespNTrueBins
};

// graphs for NUE / NUA
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -802,15 +821,17 @@ 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");
axis->SetBinLabel(kPidRespKaon + 1, "Kaon");
axis->SetBinLabel(kPidRespProton + 1, "Proton");
if (includeUnidentified) {
axis->SetBinLabel(kPidRespUnidentified + 1, "Unidentified");
} else {
axis->SetBinLabel(kPidRespOther + 1, "Other");
}
};
setPidResponseLabels(registry.get<TH2>(HIST("pidResponseMatrix/hPidResponseMatrix"))->GetXaxis(), false);
Expand Down Expand Up @@ -1401,7 +1422,7 @@ struct PidFlowPtCorr {
case PDG_t::kProton:
return kPidRespProton;
default:
return -1;
return kPidRespOther;
}
}

Expand All @@ -1419,6 +1440,12 @@ struct PidFlowPtCorr {
}
}

template <typename McParticle>
int getTrueSpeciesBin(McParticle const& particle)
{
return getPidResponseTrueBin(particle.pdgCode());
}

// pid util function

// other utils
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
// ------------------------------
Expand Down Expand Up @@ -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);
Expand Down
Loading