Skip to content

Commit 5628bab

Browse files
committed
Implement Vit comments
1 parent b1ae2de commit 5628bab

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ struct HfCandidateCreator2ProngExpressions {
916916
if (matchCorrBkgs) {
917917
hf_mc_gen::fillMcMatchGen2Prong<true>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
918918
} else {
919-
hf_mc_gen::fillMcMatchGen2Prong(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
919+
hf_mc_gen::fillMcMatchGen2Prong<false>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
920920
}
921921
}
922922
}

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ struct HfCandidateCreator3ProngExpressions {
12051205
if (matchCorrBkgs) {
12061206
hf_mc_gen::fillMcMatchGen3Prong<true>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground, mothersCorrBkgsPdgs.value);
12071207
} else {
1208-
hf_mc_gen::fillMcMatchGen3Prong(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
1208+
hf_mc_gen::fillMcMatchGen3Prong<false>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
12091209
}
12101210
}
12111211
}

PWGHF/TableProducer/candidateCreatorMcGen.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ struct HfCandidateCreatorMcGen {
5555
for (const auto& mcCollision : mcCollisions) {
5656
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
5757
if (fill2Prong) {
58-
hf_mc_gen::fillMcMatchGen2Prong(mcParticles, mcParticlesPerMcColl, rowMcMatchGen2Prong, rejectBackground2Prong);
58+
hf_mc_gen::fillMcMatchGen2Prong<false>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen2Prong, rejectBackground2Prong);
5959
}
6060
if (fill3Prong) {
61-
hf_mc_gen::fillMcMatchGen3Prong(mcParticles, mcParticlesPerMcColl, rowMcMatchGen3Prong, rejectBackground3Prong);
61+
hf_mc_gen::fillMcMatchGen3Prong<false>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen3Prong, rejectBackground3Prong);
6262
}
6363
}
6464
if (fillBplus) {

PWGHF/Utils/utilsMcGen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
namespace hf_mc_gen
3737
{
3838

39-
template <bool matchCorrBkgs = false, typename T, typename U, typename V>
39+
template <bool matchCorrBkgs, typename T, typename U, typename V>
4040
void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V& rowMcMatchGen, bool rejectBackground)
4141
{
4242
using namespace o2::constants::physics;
@@ -46,7 +46,7 @@ void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
4646
for (const auto& particle : mcParticlesPerMcColl) {
4747
int8_t flag = 0;
4848
int8_t origin = 0;
49-
int8_t channel = 0; // Not used in 2-prong decays
49+
int8_t channel = 0;
5050
int8_t sign = 0;
5151
std::vector<int> idxBhadMothers{};
5252
// Reject particles from background events
@@ -121,7 +121,7 @@ void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
121121
}
122122
}
123123

124-
template <bool matchCorrBkgs = false, typename T, typename U, typename V>
124+
template <bool matchCorrBkgs, typename T, typename U, typename V>
125125
void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V& rowMcMatchGen, bool rejectBackground, std::vector<int> const& corrBkgMothersPdgs = {})
126126
{
127127
using namespace o2::constants::physics;

PWGHF/Utils/utilsMcMatching.h

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,37 +163,35 @@ inline std::unordered_map<DecayChannelMain, const std::vector<int>> getDecayChan
163163
}
164164
} // namespace hf_cand_3prong
165165

166-
/// Perform the matching for a single resonant channel
167-
/// \tparam N size of the array of daughter PDG codes
168-
/// \param arrPdgResoChn array of daughter indices
169-
/// \param arrPdgDaugs array of PDG codes for the resonant decay
170-
/// \return true if the resonant channel is matched, false otherwise
166+
/// Compare an array of PDG codes with an expected array
167+
/// \tparam N size of the arrays to be compared
168+
/// \param arrPdgTested array of PDG codes to be tested
169+
/// \param arrPdgExpected array of the expected PDG codes
170+
/// \return true if the arrays are equal, false otherwise
171171
template <std::size_t N>
172-
inline bool checkDecayChannel(std::array<int, N> const& arrPdgResoChn, std::array<int, N> arrPdgDaugs)
172+
inline bool checkDecayChannel(std::array<int, N> const& arrPdgTested, std::array<int, N> arrPdgExpected)
173173
{
174174
for (std::size_t i = 0; i < N; i++) {
175-
bool findDaug = false;
175+
bool foundPdg = false;
176176
for (std::size_t j = 0; j < N; j++) {
177-
if (std::abs(arrPdgResoChn[i]) == std::abs(arrPdgDaugs[j])) {
178-
arrPdgDaugs[j] = -1; // Mark as found
179-
findDaug = true;
177+
if (std::abs(arrPdgTested[i]) == std::abs(arrPdgExpected[j])) {
178+
arrPdgExpected[j] = -1; // Mark as found
179+
foundPdg = true;
180180
break;
181181
}
182182
}
183-
if (!findDaug) {
183+
if (!foundPdg) {
184184
return false;
185185
}
186186
}
187187
return true;
188188
}
189189

190190
/// Flag the resonant decays
191-
/// Function documentation:
192-
/// \tparam is3Prong bool to specify if the mother decays with a 3-prong decay
193191
/// \tparam N size of the array of daughter PDG codes
194192
/// \param motherPdg PDG code of the mother particle
195-
/// \param channel decay channel flag to be set
196193
/// \param arrDaughPdgs array of daughter PDG codes
194+
/// \return the flag for the matched resonant decay channel
197195
template <std::size_t N>
198196
inline int8_t flagResonantDecay(const int motherPdg, std::array<int, N> const& arrDaughPdgs)
199197
{
@@ -248,16 +246,17 @@ inline int8_t flagResonantDecay(const int motherPdg, std::array<int, N> const& a
248246
}
249247

250248
/// Flip the sign of a specific PDG code in an array
251-
/// of PDG codes representing either a final or a resonant state
249+
/// of PDG codes associated to an antiparticle.
252250
/// \tparam N size of the array of PDG codes
253251
/// \param motherPdgCode PDG code of the mother particle
254-
/// \param partPdgCode PDG code of the target particle
252+
/// \param partPdgCode PDG code to be flipped
255253
/// \param arrFinalStatePdgs array of PDG codes to be modified
256254
template <std::size_t N>
257255
inline void changeFinalStatePdgSign(const int motherPdgCode, const int partPdgCode, std::array<int, N>& arrFinalStatePdgs)
258256
{
259-
if (motherPdgCode >= 0)
257+
if (motherPdgCode >= 0) {
260258
return;
259+
}
261260
for (auto& part : arrFinalStatePdgs) { // o2-linter: disable=const-ref-in-for-loop (arrFinalStatePdgs entries are modified)
262261
if (part == partPdgCode) {
263262
part = -part;

0 commit comments

Comments
 (0)