Skip to content

Commit 269f780

Browse files
[PWGLF] Added switch to calculate the generated mc centrality (#17763)
1 parent fbfbf91 commit 269f780

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

PWGLF/Tasks/Resonances/deltaAnalysis.cxx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ struct DeltaAnalysis {
100100
Configurable<int> cfgCentralityEstimator{"cfgCentralityEstimator", 0, "Centrality estimator: 0=FT0M 1=FT0A 2=FT0C 3=FV0A 4=NTPV"};
101101
Configurable<float> cfgCentMin{"cfgCentMin", 0.f, "Minimum centrality percentile"};
102102
Configurable<float> cfgCentMax{"cfgCentMax", 100.f, "Maximum centrality percentile"};
103+
Configurable<bool> cfgUseMCTruthCentrality{"cfgUseMCTruthCentrality", false, "Use MC truth centrality for generated Delta histograms"};
103104
} evSel;
104105

105106
struct : ConfigurableGroup {
@@ -189,7 +190,6 @@ struct DeltaAnalysis {
189190
struct : ConfigurableGroup {
190191
ConfigurableAxis cfgPtAxis{"cfgPtAxis", {VARIABLE_WIDTH, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4.0, 5.0, 7.0, 10.0}, "#it{p}_{T} (GeV/#it{c})"};
191192
ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.f, 10.f, 20.f, 30.f, 40.f, 50.f, 60.f, 70.f, 80.f, 90.f, 100.f}, "Centrality (%)"};
192-
Configurable<int> cfgCentDistBins{"cfgCentDistBins", 1500, "Number of bins for centrality distribution"};
193193
ConfigurableAxis cfgVtxAxis{"cfgVtxAxis", {VARIABLE_WIDTH, -12.f, -10.f, -9.f, -8.f, -7.f, -6.f, -5.f, -4.f, -3.f, -2.f, -1.f, 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 12.f}, "Vertex z [cm]"};
194194
ConfigurableAxis cfgRapAxis{"cfgRapAxis", {20, -1.0, 1.0}, "Rapidity y"};
195195
} axes;
@@ -241,7 +241,6 @@ struct DeltaAnalysis {
241241
const AxisSpec ptAxis{200, 0., 10., "p_{T} (GeV/c)"};
242242
const AxisSpec massAxis{trackCuts.numberOfInvMassBins, 1.0, 8.0, "M_{inv} (GeV/#it{c}^{2})"};
243243
const AxisSpec centAxis{axes.cfgCentAxis, "Centrality (%)"};
244-
const AxisSpec centDistAxis{axes.cfgCentDistBins, 0., 105., "Centrality (%)"};
245244
const AxisSpec vtxAxis{axes.cfgVtxAxis, "Vertex z [cm]"};
246245
const AxisSpec rapAxis{axes.cfgRapAxis, "Rapidity y"};
247246
const AxisSpec nSigmaTPCaxis{100, -10., 10., "n#sigma^{TPC}"};
@@ -260,7 +259,7 @@ struct DeltaAnalysis {
260259
histos.add("Event/hNcontributor", "PV contributors; N", kTH1F, {{2001, -0.5f, 2000.5f}});
261260
histos.add("Event/hCentrality", "Centrality", kTH1F, {centAxis});
262261
histos.add("Event/hOccupancy", "Occupancy in time range", kTH1F, {occupancyAxis});
263-
histos.add("Event/centralitydistribution", "Centrality distribution (Data);vCentFT0M;Entries", kTH1F, {centDistAxis});
262+
histos.add("Event/centralitydistribution", "Centrality distribution (Data);vCentFT0M;Entries", kTH1F, {centAxis});
264263

265264
histos.add("CentQA/hCentralityVsVtxZ", "Centrality vs vertex z", kTH2F, {vtxAxis, centAxis});
266265
histos.add("CentQA/hCentralityVsOccupancy", "Centrality vs occupancy", kTH2F, {occupancyAxis, centAxis});
@@ -430,7 +429,7 @@ struct DeltaAnalysis {
430429
histos.add("QAMC/hEtaPhi_rec", "MC Reco #eta vs #varphi; #eta; #varphi", kTH2F, {etaAxis, {72, 0, 6.2832}});
431430

432431
histos.add("MCRecoEvent/hRecoEvents", "Reconstructed INEL>0 events (Nrec, MC reco)", kTH1F, {centAxis});
433-
histos.add("MCRecoEvent/centralitydistribution", "Centrality distribution (MC);vCentFT0M;Entries", kTH1F, {centDistAxis});
432+
histos.add("MCRecoEvent/centralitydistribution", "Centrality distribution (MC);vCentFT0M;Entries", kTH1F, {centAxis});
434433
}
435434

436435
// ── MC reconstructed event mixing: histograms (gated by the dedicated MC mixing switch,
@@ -1899,15 +1898,23 @@ struct DeltaAnalysis {
18991898
histos.fill(HIST("CutFlow/MCGen/hEventCutFlow"), 4.f); // Final generated event
19001899
histos.fill(HIST("EfficiencyQA/hGeneratedEventCutFlow"), 3.f); // Final generated event
19011900

1901+
// ── MODIFIED BLOCK (per user request): centrality-source switch for generated Delta ────
1902+
// Added: evSel.cfgUseMCTruthCentrality (see Configurable added in evSel group above).
19021903
bool hasAcceptedReco = false;
1903-
float genCentrality = mcCollision.centFT0M(); // fallback: MC-truth centrality proxy (see note above)
1904+
float genCentrality = mcCollision.centFT0M();
1905+
19041906
for (auto const& collision : collisions) {
19051907
if (passesEventSelection(collision)) {
19061908
hasAcceptedReco = true;
1907-
genCentrality = getCentrality(collision); // real reconstructed centrality of an accepted associated collision
1909+
1910+
if (!evSel.cfgUseMCTruthCentrality) {
1911+
genCentrality = getCentrality(collision);
1912+
}
1913+
19081914
break;
19091915
}
19101916
}
1917+
19111918
if (hasAcceptedReco) {
19121919
histos.fill(HIST("EfficiencyQA/hGeneratedEventCutFlow"), 4.f); // Associated reconstructed event accepted
19131920
}

0 commit comments

Comments
 (0)