Skip to content

Commit 1f563b9

Browse files
committed
Fix magic numbers
1 parent b3ed255 commit 1f563b9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

PWGHF/Utils/utilsMcGen.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ template <typename T, typename U, typename V>
8383
void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V& rowMcMatchGen, bool rejectBackground)
8484
{
8585
using namespace o2::constants::physics;
86+
constexpr std::size_t NDaughtersResonant{2u};
8687

8788
// Match generated particles.
8889
for (const auto& particle : mcParticlesPerMcColl) {
@@ -92,12 +93,12 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
9293
int8_t sign = 0;
9394
std::vector<int> arrDaughIndex;
9495
std::vector<int> idxBhadMothers{};
95-
std::array<int, 2> arrPDGDaugh;
96-
std::array<int, 2> arrPDGResonant1 = {kProton, 313}; // Λc± → p± K*
97-
std::array<int, 2> arrPDGResonant2 = {2224, kKPlus}; // Λc± → Δ(1232)±± K∓
98-
std::array<int, 2> arrPDGResonant3 = {102134, kPiPlus}; // Λc± → Λ(1520) π±
99-
std::array<int, 2> arrPDGResonantDPhiPi = {333, kPiPlus}; // Ds± → Phi π± and D± → Phi π±
100-
std::array<int, 2> arrPDGResonantDKstarK = {313, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K±
96+
std::array<int, NDaughtersResonant> arrPDGDaugh;
97+
std::array<int, NDaughtersResonant> arrPDGResonant1 = {kProton, Pdg::kK0Star892}; // Λc± → p± K*
98+
std::array<int, NDaughtersResonant> arrPDGResonant2 = {2224, kKPlus}; // Λc± → Δ(1232)±± K∓
99+
std::array<int, NDaughtersResonant> arrPDGResonant3 = {102134, kPiPlus}; // Λc± → Λ(1520) π±
100+
std::array<int, NDaughtersResonant> arrPDGResonantDPhiPi = {Pdg::kPhi, kPiPlus}; // Ds± → Phi π± and D± → Phi π±
101+
std::array<int, NDaughtersResonant> arrPDGResonantDKstarK = {Pdg::kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K±
101102
// Reject particles from background events
102103
if (particle.fromBackgroundEvent() && rejectBackground) {
103104
rowMcMatchGen(flag, origin, channel, -1);
@@ -126,7 +127,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
126127
}
127128
if (flag != 0) {
128129
RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{0}, 1);
129-
if (arrDaughIndex.size() == 2) {
130+
if (arrDaughIndex.size() == NDaughtersResonant) {
130131
for (auto jProng = 0u; jProng < arrDaughIndex.size(); ++jProng) {
131132
auto daughJ = mcParticles.rawIteratorAt(arrDaughIndex[jProng]);
132133
arrPDGDaugh[jProng] = std::abs(daughJ.pdgCode());
@@ -154,7 +155,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
154155

155156
// Flagging the different Λc± → p± K∓ π± decay channels
156157
RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{0}, 1);
157-
if (arrDaughIndex.size() == 2) {
158+
if (arrDaughIndex.size() == NDaughtersResonant) {
158159
for (auto jProng = 0u; jProng < arrDaughIndex.size(); ++jProng) {
159160
auto daughJ = mcParticles.rawIteratorAt(arrDaughIndex[jProng]);
160161
arrPDGDaugh[jProng] = std::abs(daughJ.pdgCode());

0 commit comments

Comments
 (0)