Skip to content

Commit 7208f8b

Browse files
Refactor centrality and event status handling
Updated comments and variable names related to centrality and event status for clarity.
1 parent be13808 commit 7208f8b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎PWGHF/D2H/Tasks/taskD0.cxx‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct HfTaskD0 {
100100
Configurable<int> selectionPid{"selectionPid", 1, "Selection Flag for reco PID candidates"};
101101
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"};
102102
Configurable<int> centEstimator{"centEstimator", 0, "Centrality estimation (None: 0, FT0C: 2, FT0M: 3)"};
103-
Configurable<bool> fillEventStatus{"fillEventStatus", false, "Use generated centrality in hSparseAcc and append reco-event status (requires storeCentrality)"};
103+
Configurable<bool> fillEventStatus{"fillEventStatus", false, "Append generated centrality and reco-event status to hSparseAcc (requires storeCentrality)"};
104104
Configurable<int> occEstimator{"occEstimator", 0, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"};
105105
Configurable<bool> storeCentrality{"storeCentrality", false, "Flag to store centrality information"};
106106
Configurable<bool> storeOccupancyAndIR{"storeOccupancyAndIR", false, "Flag to store occupancy information and interaction rate"};
@@ -341,7 +341,7 @@ struct HfTaskD0 {
341341
std::vector<AxisSpec> axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr};
342342

343343
if (storeCentrality) {
344-
axesAcc.emplace_back(thnConfigAxisCent, fillEventStatus ? "Generated centrality (%)" : "Centrality");
344+
axesAcc.emplace_back(thnConfigAxisCent, fillEventStatus ? "Reco centrality (%)" : "Centrality");
345345
}
346346
// interaction rate only store in Data and MC Reco. Level
347347
if (storeOccupancyAndIR) {
@@ -355,6 +355,7 @@ struct HfTaskD0 {
355355
if (centEstimator != CentralityEstimator::FT0C && centEstimator != CentralityEstimator::FT0M) {
356356
LOGP(fatal, "centEstimator must be FT0C (2) or FT0M (3).");
357357
}
358+
axesAcc.emplace_back(thnConfigAxisCent, "Generated centrality (%)");
358359
axesAcc.emplace_back(3, -0.5, 2.5, "Reco event status (0: no reco, 1: none selected, 2: selected)");
359360
}
360361
registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, axesAcc);
@@ -1315,6 +1316,7 @@ struct HfTaskD0 {
13151316
registry.fill(HIST("hPtVsYGen"), ptGen, yGen);
13161317

13171318
int eventStatus = NoRecoCollision;
1319+
float centGen{-1.f};
13181320

13191321
unsigned maxNumContrib = 0;
13201322
float cent{-1.f};
@@ -1341,14 +1343,15 @@ struct HfTaskD0 {
13411343
const auto mcCollision = particle.template mcCollision_as<McCollisionsWithCentrality>();
13421344
const auto eventEntry = recoEventStatus.find(mcCollision.globalIndex());
13431345
eventStatus = eventEntry == recoEventStatus.end() ? NoRecoCollision : eventEntry->second;
1344-
// Replace the existing centrality coordinate, including zero-reco events.
1345-
cent = centEstimator == CentralityEstimator::FT0C ? mcCollision.centFT0C() : mcCollision.centFT0M();
1346+
// Append generated centrality; retain the existing reco-centrality coordinate.
1347+
centGen = centEstimator == CentralityEstimator::FT0C ? mcCollision.centFT0C() : mcCollision.centFT0M();
13461348
}
1349+
const auto histSparseAcc = HIST("hSparseAcc");
13471350
const auto fillGeneratedSparse = [&](auto... coordinates) {
13481351
if (fillEventStatus) {
1349-
registry.fill(HIST("hSparseAcc"), coordinates..., eventStatus);
1352+
registry.fill(histSparseAcc, coordinates..., centGen, eventStatus);
13501353
} else {
1351-
registry.fill(HIST("hSparseAcc"), coordinates...);
1354+
registry.fill(histSparseAcc, coordinates...);
13521355
}
13531356
};
13541357

0 commit comments

Comments
 (0)