Skip to content

Commit 1342d9e

Browse files
authored
PWGMM: Mult: fix centrality logic for mulltiple-reconstructed sim events (#6266)
1 parent c9acf01 commit 1342d9e

1 file changed

Lines changed: 70 additions & 20 deletions

File tree

PWGMM/Mult/Tasks/dndeta.cxx

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,14 @@ struct MultiplicityCounter {
14691469
return nCharged;
14701470
}
14711471

1472+
std::vector<int> NrecPerCol;
1473+
std::vector<float> c_recPerCol;
1474+
std::vector<int> NPVPerCol;
1475+
std::vector<float> NFT0APerCol;
1476+
std::vector<float> NFT0CPerCol;
1477+
std::vector<float> NFDDAPerCol;
1478+
std::vector<float> NFDDCPerCol;
1479+
14721480
template <typename MC, typename C>
14731481
void processGenGeneralAmbiguous(
14741482
typename MC::iterator const& mcCollision,
@@ -1481,19 +1489,36 @@ struct MultiplicityCounter {
14811489
c_gen = mcCollision.centrality();
14821490
}
14831491

1492+
NrecPerCol.clear();
1493+
c_recPerCol.clear();
1494+
NPVPerCol.clear();
1495+
NFT0APerCol.clear();
1496+
NFT0CPerCol.clear();
1497+
NFDDAPerCol.clear();
1498+
NFDDCPerCol.clear();
1499+
14841500
bool atLeastOne = false;
14851501
bool atLeastOne_gt0 = false;
14861502
bool atLeastOne_PVgt0 = false;
14871503
auto moreThanOne = 0;
14881504
LOGP(debug, "MC col {} has {} reco cols", mcCollision.globalIndex(), collisions.size());
14891505

1490-
std::vector<int> NrecPerCol;
1491-
std::vector<float> c_recPerCol;
1492-
std::vector<int> NPVPerCol;
1493-
std::vector<float> NFT0APerCol;
1494-
std::vector<float> NFT0CPerCol;
1495-
std::vector<float> NFDDAPerCol;
1496-
std::vector<float> NFDDCPerCol;
1506+
[[maybe_unused]] float min_c_rec = 2e2;
1507+
if constexpr (hasRecoCent<C>()) {
1508+
for (auto& collision : collisions) {
1509+
if (!useEvSel || isCollisionSelected(collision)) {
1510+
float c = -1;
1511+
if constexpr (C::template contains<aod::CentFT0Cs>()) {
1512+
c = collision.centFT0C();
1513+
} else if (C::template contains<aod::CentFT0Ms>()) {
1514+
c = collision.centFT0M();
1515+
}
1516+
if (c < min_c_rec) {
1517+
min_c_rec = c;
1518+
}
1519+
}
1520+
}
1521+
}
14971522

14981523
for (auto& collision : collisions) {
14991524
usedTracksIds.clear();
@@ -1504,17 +1529,21 @@ struct MultiplicityCounter {
15041529
} else if (C::template contains<aod::CentFT0Ms>()) {
15051530
c_rec = collision.centFT0M();
15061531
}
1507-
c_recPerCol.emplace_back(c_rec);
1508-
binnedRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec), c_gen);
1532+
if constexpr (hasSimCent<MC>()) {
1533+
binnedRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec), c_gen);
1534+
} else {
1535+
binnedRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec), min_c_rec);
1536+
}
15091537
} else {
15101538
inclusiveRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec));
15111539
}
15121540
if (!useEvSel || isCollisionSelected(collision)) {
1541+
c_recPerCol.emplace_back(c_rec);
15131542
auto z = collision.posZ();
15141543
++moreThanOne;
15151544
if constexpr (hasRecoCent<C>() && !hasSimCent<MC>()) {
15161545
if (!atLeastOne) {
1517-
c_gen = c_rec; // if there is no generator centrality info, fall back to reco (from the first reco collision)
1546+
c_gen = min_c_rec; // if there is no generator centrality info, fall back to reco (from the largest reco collision)
15181547
}
15191548
}
15201549
atLeastOne = true;
@@ -1679,13 +1708,30 @@ struct MultiplicityCounter {
16791708
auto moreThanOne = 0;
16801709
LOGP(debug, "MC col {} has {} reco cols", mcCollision.globalIndex(), collisions.size());
16811710

1682-
std::vector<int> NrecPerCol;
1683-
std::vector<float> c_recPerCol;
1684-
std::vector<int> NPVPerCol;
1685-
std::vector<float> NFT0APerCol;
1686-
std::vector<float> NFT0CPerCol;
1687-
std::vector<float> NFDDAPerCol;
1688-
std::vector<float> NFDDCPerCol;
1711+
NrecPerCol.clear();
1712+
c_recPerCol.clear();
1713+
NPVPerCol.clear();
1714+
NFT0APerCol.clear();
1715+
NFT0CPerCol.clear();
1716+
NFDDAPerCol.clear();
1717+
NFDDCPerCol.clear();
1718+
1719+
[[maybe_unused]] float min_c_rec = 2e2;
1720+
if constexpr (hasRecoCent<C>()) {
1721+
for (auto& collision : collisions) {
1722+
if (!useEvSel || isCollisionSelected(collision)) {
1723+
float c = -1;
1724+
if constexpr (C::template contains<aod::CentFT0Cs>()) {
1725+
c = collision.centFT0C();
1726+
} else if (C::template contains<aod::CentFT0Ms>()) {
1727+
c = collision.centFT0M();
1728+
}
1729+
if (c < min_c_rec) {
1730+
min_c_rec = c;
1731+
}
1732+
}
1733+
}
1734+
}
16891735

16901736
for (auto& collision : collisions) {
16911737
usedTracksIds.clear();
@@ -1696,17 +1742,21 @@ struct MultiplicityCounter {
16961742
} else if (C::template contains<aod::CentFT0Ms>()) {
16971743
c_rec = collision.centFT0M();
16981744
}
1699-
c_recPerCol.emplace_back(c_rec);
1700-
binnedRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec), c_gen);
1745+
if constexpr (hasSimCent<MC>()) {
1746+
binnedRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec), c_gen);
1747+
} else {
1748+
binnedRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec), min_c_rec);
1749+
}
17011750
} else {
17021751
inclusiveRegistry.fill(HIST(Efficiency), static_cast<float>(EvEffBins::kRec));
17031752
}
17041753
if (!useEvSel || isCollisionSelected(collision)) {
1754+
c_recPerCol.emplace_back(c_rec);
17051755
auto z = collision.posZ();
17061756
++moreThanOne;
17071757
if constexpr (hasRecoCent<C>() && !hasSimCent<MC>()) {
17081758
if (!atLeastOne) {
1709-
c_gen = c_rec; // if there is no generator centrality info, fall back to reco (from the first reco collision)
1759+
c_gen = min_c_rec; // if there is no generator centrality info, fall back to reco (from the largest reco collision)
17101760
}
17111761
}
17121762
atLeastOne = true;

0 commit comments

Comments
 (0)