Skip to content

Commit 4dcfbef

Browse files
committed
Fix magic numbers
1 parent 33b4e53 commit 4dcfbef

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
@@ -86,6 +86,7 @@ template <typename T, typename U, typename V>
8686
void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V& rowMcMatchGen, bool rejectBackground)
8787
{
8888
using namespace o2::constants::physics;
89+
constexpr std::size_t NDaughtersResonant{2u};
8990

9091
// Match generated particles.
9192
for (const auto& particle : mcParticlesPerMcColl) {
@@ -95,12 +96,12 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
9596
int8_t sign = 0;
9697
std::vector<int> arrDaughIndex;
9798
std::vector<int> idxBhadMothers{};
98-
std::array<int, 2> arrPDGDaugh;
99-
std::array<int, 2> arrPDGResonant1 = {kProton, 313}; // Λc± → p± K*
100-
std::array<int, 2> arrPDGResonant2 = {2224, kKPlus}; // Λc± → Δ(1232)±± K∓
101-
std::array<int, 2> arrPDGResonant3 = {102134, kPiPlus}; // Λc± → Λ(1520) π±
102-
std::array<int, 2> arrPDGResonantDPhiPi = {333, kPiPlus}; // Ds± → Phi π± and D± → Phi π±
103-
std::array<int, 2> arrPDGResonantDKstarK = {313, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K±
99+
std::array<int, NDaughtersResonant> arrPDGDaugh;
100+
std::array<int, NDaughtersResonant> arrPDGResonant1 = {kProton, Pdg::kK0Star892}; // Λc± → p± K*
101+
std::array<int, NDaughtersResonant> arrPDGResonant2 = {2224, kKPlus}; // Λc± → Δ(1232)±± K∓
102+
std::array<int, NDaughtersResonant> arrPDGResonant3 = {102134, kPiPlus}; // Λc± → Λ(1520) π±
103+
std::array<int, NDaughtersResonant> arrPDGResonantDPhiPi = {Pdg::kPhi, kPiPlus}; // Ds± → Phi π± and D± → Phi π±
104+
std::array<int, NDaughtersResonant> arrPDGResonantDKstarK = {Pdg::kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K±
104105
// Reject particles from background events
105106
if (particle.fromBackgroundEvent() && rejectBackground) {
106107
rowMcMatchGen(flag, origin, channel, -1);
@@ -129,7 +130,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
129130
}
130131
if (flag != 0) {
131132
RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{0}, 1);
132-
if (arrDaughIndex.size() == 2) {
133+
if (arrDaughIndex.size() == NDaughtersResonant) {
133134
for (auto jProng = 0u; jProng < arrDaughIndex.size(); ++jProng) {
134135
auto daughJ = mcParticles.rawIteratorAt(arrDaughIndex[jProng]);
135136
arrPDGDaugh[jProng] = std::abs(daughJ.pdgCode());
@@ -157,7 +158,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
157158

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

0 commit comments

Comments
 (0)