Skip to content

Commit 7a470ef

Browse files
committed
Remove unused variables
1 parent fa82106 commit 7a470ef

File tree

8 files changed

+100
-208
lines changed

8 files changed

+100
-208
lines changed

PWGHF/Core/DecayChannels.h

Lines changed: 21 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <cstdint>
2525
#include <unordered_map>
2626
#include <array>
27-
#include <variant>
2827

2928
using namespace o2::constants::physics;
3029

@@ -64,9 +63,9 @@ std::unordered_map<DecayChannelMain, std::vector<int> > finalStates2Prongs =
6463
{
6564
{DecayChannelMain::D0ToPiK, std::vector<int>{+kKMinus, +kPiPlus}},
6665
{DecayChannelMain::D0ToKK, std::vector<int>{+kKMinus, +kKPlus}},
67-
{DecayChannelMain::D0ToPiKPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPi0}},
66+
{DecayChannelMain::D0ToPiKPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPi0}},
6867
{DecayChannelMain::D0ToPiPi, std::vector<int>{+kPiMinus, +kPiPlus}},
69-
{DecayChannelMain::D0ToPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPi0}}
68+
{DecayChannelMain::D0ToPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPi0}}
7069
};
7170

7271
std::unordered_map<DecayChannelResonant, std::array<int, 2> > resoStatesD0 =
@@ -167,7 +166,7 @@ std::unordered_map<DecayChannelMain, std::vector<int> > finalStatesDPlus =
167166
{
168167
{DecayChannelMain::DplusToPiKPi, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus}},
169168
{DecayChannelMain::DplusToPiKK, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus}},
170-
{DecayChannelMain::DplusToPiKPiPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
169+
{DecayChannelMain::DplusToPiKPiPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
171170
{DecayChannelMain::DplusToPiPiPi, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus}},
172171
};
173172

@@ -188,10 +187,10 @@ std::unordered_map<DecayChannelResonant, std::array<int, 2> > resoStatesDs =
188187
std::unordered_map<DecayChannelMain, std::vector<int> > finalStatesDs =
189188
{
190189
{DecayChannelMain::DsToPiKK, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus}},
191-
{DecayChannelMain::DsToPiKKPi0, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus, +kPi0}},
190+
{DecayChannelMain::DsToPiKKPi0, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus, +kPi0}},
192191
{DecayChannelMain::DsToPiPiK, std::vector<int>{+kKPlus, +kPiPlus, +kPiMinus}},
193192
{DecayChannelMain::DsToPiPiPi, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus}},
194-
{DecayChannelMain::DsToPiPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus, +kPi0}},
193+
{DecayChannelMain::DsToPiPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus, +kPi0}},
195194
};
196195

197196
// Dstar → K± K∓ π±
@@ -201,22 +200,22 @@ std::unordered_map<DecayChannelResonant, std::array<int, 2> > resoStatesDstar =
201200
{DecayChannelResonant::DstarToD0ToRhoplusK, std::array<int, 2>{213, +kKMinus}},
202201
{DecayChannelResonant::DstarToD0ToKstar0Pi0, std::array<int, 2>{-kK0Star892, +kPi0}},
203202
{DecayChannelResonant::DstarToD0ToKstarPi, std::array<int, 2>{-kKPlusStar892, +kPiPlus}},
204-
{DecayChannelResonant::DstarToDplusToPhiPi, std::array<int, 2>{+kPhi, +kPiPlus}},
205-
{DecayChannelResonant::DstarToDplusToKstar0K, std::array<int, 2>{-kK0Star892, +kKPlus}},
206-
{DecayChannelResonant::DstarToDplusToKstar1430_0K, std::array<int, 2>{+10311, +kKPlus}},
207-
{DecayChannelResonant::DstarToDplusToRho0Pi, std::array<int, 2>{+113, +kPiPlus}},
208-
{DecayChannelResonant::DstarToDplusToF2_1270Pi, std::array<int, 2>{+225, +kPiPlus}},
203+
{DecayChannelResonant::DstarToDplusToPhiPi, std::array<int, 2>{+kPhi, +kPiPlus}},
204+
{DecayChannelResonant::DstarToDplusToKstar0K, std::array<int, 2>{-kK0Star892, +kKPlus}},
205+
{DecayChannelResonant::DstarToDplusToKstar1430_0K, std::array<int, 2>{+10311, +kKPlus}},
206+
{DecayChannelResonant::DstarToDplusToRho0Pi, std::array<int, 2>{+113, +kPiPlus}},
207+
{DecayChannelResonant::DstarToDplusToF2_1270Pi, std::array<int, 2>{+225, +kPiPlus}},
209208
};
210209

211210
std::unordered_map<DecayChannelMain, std::vector<int> > finalStatesDstar =
212211
{
213212
{DecayChannelMain::DstarToPiKPi, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus}},
214-
{DecayChannelMain::DstarToPiKPiPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
215-
{DecayChannelMain::DstarToPiKPiPi0Pi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0, +kPi0}},
213+
{DecayChannelMain::DstarToPiKPiPi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
214+
{DecayChannelMain::DstarToPiKPiPi0Pi0, std::vector<int>{+kKMinus, +kPiPlus, +kPiPlus, +kPi0, +kPi0}},
216215
{DecayChannelMain::DstarToPiKK, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus}},
217-
{DecayChannelMain::DstarToPiKKPi0, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus, +kPi0}},
216+
{DecayChannelMain::DstarToPiKKPi0, std::vector<int>{+kKMinus, +kKPlus, +kPiPlus, +kPi0}},
218217
{DecayChannelMain::DstarToPiPiPi, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus}},
219-
{DecayChannelMain::DstarToPiPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus, +kPi0}},
218+
{DecayChannelMain::DstarToPiPiPiPi0, std::vector<int>{+kPiMinus, +kPiPlus, +kPiPlus, +kPi0}},
220219
};
221220

222221
// Lc → p K∓ π±
@@ -230,7 +229,7 @@ std::unordered_map<DecayChannelResonant, std::array<int, 2> > resoStatesLambdaC
230229
std::unordered_map<DecayChannelMain, std::vector<int> > finalStatesLc =
231230
{
232231
{DecayChannelMain::LcToPKPi, std::vector<int>{+kProton, +kKMinus, +kPiPlus}},
233-
{DecayChannelMain::LcToPKPiPi0, std::vector<int>{+kProton, +kKMinus, +kPiPlus, +kPi0}},
232+
{DecayChannelMain::LcToPKPiPi0, std::vector<int>{+kProton, +kKMinus, +kPiPlus, +kPi0}},
234233
{DecayChannelMain::LcToPPiPi, std::vector<int>{+kProton, +kPiMinus, +kPiPlus}},
235234
{DecayChannelMain::LcToPKK, std::vector<int>{+kProton, +kKMinus, +kKPlus}}
236235
};
@@ -244,8 +243,8 @@ std::unordered_map<DecayChannelResonant, std::array<int, 2> > resoStatesXiC =
244243

245244
std::unordered_map<DecayChannelMain, std::vector<int> > finalStatesXic =
246245
{
247-
{DecayChannelMain::XicToPKPi, std::vector<int>{+kProton, +kKMinus, +kPiPlus}},
248-
{DecayChannelMain::XicToPKK, std::vector<int>{+kProton, +kKMinus, +kKPlus}},
246+
{DecayChannelMain::XicToPKPi, std::vector<int>{+kProton, +kKMinus, +kPiPlus}},
247+
{DecayChannelMain::XicToPKK, std::vector<int>{+kProton, +kKMinus, +kKPlus}},
249248
{DecayChannelMain::XicToSPiPi, std::vector<int>{+kSigmaPlus, +kPiMinus, +kPiPlus}},
250249
};
251250
} // namespace hf_cand_3prong
@@ -378,9 +377,7 @@ namespace o2::hf_corrbkg
378377
}
379378

380379
template <std::size_t N>
381-
bool checkResonantDecay(std::vector<int> arrDaughIndex, std::array<int, N> arrPDGResonant) {
382-
// LOG(info) << "Entered checkResonantDecay with daughters: " << arrDaughIndex[0] << ", " << arrDaughIndex[1] << " and resonant PDG codes: " << arrPDGResonant[0] << ", " << arrPDGResonant[1];
383-
// LOG(info) << "arrDaughIndex.size(): " << arrDaughIndex.size() << ", arrPDGResonant.size(): " << arrPDGResonant.size();
380+
bool checkResonantDecay(std::array<int, N> arrDaughIndex, std::array<int, N> arrPDGResonant) {
384381
LOG(info) << "Testing: " << arrDaughIndex[0] << ", " << arrDaughIndex[1] << " matching PDG codes: " << arrPDGResonant[0] << ", " << arrPDGResonant[1];
385382
for (int i = 0; i < N; i++) {
386383
LOG(info) << "Checking daughter index: " << arrDaughIndex[i];
@@ -407,13 +404,13 @@ namespace o2::hf_corrbkg
407404
/// \tparam arrDaughIndex index of the particle daughters at resonance level
408405
/// \tparam arrPDGResonant PDG code of the resonant decay
409406
/// \return true if the decay is resonant
410-
template <bool is3Prong = false>
411-
void flagResonantDecay(int motherPdg, int8_t* channel, std::vector<int> arrDaughIndex) {
407+
template <bool is3Prong = false, std::size_t N>
408+
void flagResonantDecay(int motherPdg, int8_t* channel, std::array<int, N> arrDaughIndex) {
412409
if constexpr (is3Prong) {
413410
std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelResonant, std::array<int, 2> > resoStates = getResoChannels3Prong(motherPdg);
414411
for (const auto& [flag, pdgCodes] : resoStates) {
415412
if (abs(motherPdg) == Pdg::kDStar) {
416-
std::cout << "Checking D0 resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughIndex[0] << " " << arrDaughIndex[1] << std::endl;
413+
std::cout << "Checking Dstar resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughIndex[0] << " " << arrDaughIndex[1] << std::endl;
417414
}
418415
if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
419416
*channel = flag;
@@ -441,72 +438,6 @@ namespace o2::hf_corrbkg
441438
}
442439
}
443440
}
444-
445-
// switch (motherPdg) {
446-
// case Pdg::kD0:
447-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_2prong::resoStatesD0) {
448-
// std::cout << "Checking D0 resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughIndex[0] << " " << arrDaughIndex[1] << std::endl;
449-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
450-
// *channel = flag;
451-
// LOG(info) << "D0 resonant decay found with channel: " << static_cast<int>(*channel);
452-
// break;
453-
// }
454-
// }
455-
// break;
456-
// case Pdg::kDPlus:
457-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesDPlus) {
458-
// // std::cout << "Checking DPlus resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
459-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
460-
// *channel = flag;
461-
// LOG(info) << "D+ resonant decay found with channel: " << static_cast<int>(*channel);
462-
// break;
463-
// }
464-
// }
465-
// break;
466-
// case Pdg::kDS:
467-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesDs) {
468-
// // std::cout << "Checking DS resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
469-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
470-
// *channel = flag;
471-
// LOG(info) << "Ds resonant decay found with channel: " << static_cast<int>(*channel);
472-
// break;
473-
// }
474-
// }
475-
// break;
476-
// case Pdg::kDStar:
477-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesDstar) {
478-
// std::cout << "Checking Dstar resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
479-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
480-
// *channel = flag;
481-
// LOG(info) << "Dstar resonant decay found with channel: " << static_cast<int>(*channel);
482-
// break;
483-
// }
484-
// }
485-
// LOG(info) << "Dstar resonant decay not found, checking D0 resonances";
486-
// break;
487-
// case Pdg::kLambdaCPlus:
488-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesLambdaC) {
489-
// // std::cout << "Checking LambdaC resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
490-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
491-
// *channel = flag;
492-
// LOG(info) << "Lc resonant decay found with channel: " << static_cast<int>(*channel);
493-
// break;
494-
// }
495-
// }
496-
// break;
497-
// case Pdg::kXiCPlus:
498-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesXiC) {
499-
// // std::cout << "Checking XiC resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
500-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
501-
// *channel = flag;
502-
// LOG(info) << "Xic resonant decay found with channel: " << static_cast<int>(*channel);
503-
// break;
504-
// }
505-
// }
506-
// break;
507-
// }
508-
// }
509-
510441
} // namespace o2::hf_corrbkg
511442

512443
#endif // PWGHF_CORE_DECAYCHANNELS_H_

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ struct HfCandidateCreator2ProngExpressions {
746746
int8_t origin = 0;
747747
int8_t nKinkedTracks = 0;
748748
int8_t nInteractionsWithMaterial = 0;
749+
constexpr std::size_t NDaughtersResonant{2u};
749750

750751
// Match reconstructed candidates.
751752
// Spawned table can be used directly
@@ -778,17 +779,6 @@ struct HfCandidateCreator2ProngExpressions {
778779
LOG(info) << "--------------------------------------------";
779780
LOG(info) << "Matching correlated bkgs";
780781
indexRec = -1; // Index of the matched reconstructed candidate
781-
std::vector<int> arrResoDaughIndex = {};
782-
// const std::unordered_map<int, std::vector<int>>* finalStates = nullptr;
783-
// switch (pdgMother) {
784-
// case Pdg::kD0:
785-
// finalStates = reinterpret_cast<const std::unordered_map<int, std::vector<int>>*>(&finalStates2Prongs);
786-
// break;
787-
// default:
788-
// finalStates = reinterpret_cast<const std::unordered_map<int, std::vector<int>>*>(&finalStates3Prongs);
789-
// break;
790-
// }
791-
792782
int depth = 2;
793783
for (const auto& [chn, finalState] : finalStates2Prongs) {
794784
std::array<int, 2> finalStateParts2Prong = std::array{finalState[0], finalState[1]};
@@ -805,7 +795,14 @@ struct HfCandidateCreator2ProngExpressions {
805795

806796
if (indexRec != -1) {
807797
auto motherParticle = mcParticles.rawIteratorAt(indexRec);
808-
std::array<int, 3> finalStateParts2ProngAll = std::array{finalState[0], finalState[1], sign*finalState[2]};
798+
std::array<int, 3> finalStateParts2ProngAll = std::array{finalState[0], finalState[1], finalState[2]};
799+
if (sign < 0) {
800+
for (auto& part : finalStateParts2ProngAll) {
801+
if (part == kPi0) {
802+
part = -part; // Ensure all parts are positive for matching
803+
}
804+
}
805+
}
809806
if (!RecoDecay::isMatchedMCGen(mcParticles, motherParticle, Pdg::kD0, finalStateParts2ProngAll, false, &sign, depth)) {
810807
indexRec = -1; // Reset indexRec if the generated decay
811808
}
@@ -830,13 +827,13 @@ struct HfCandidateCreator2ProngExpressions {
830827

831828
// Flag the resonant decay channel
832829
int resoMaxDepth = 1;
833-
int NDaughtersResonant = 2;
830+
std::vector<int> arrResoDaughIndex = {};
834831
RecoDecay::getDaughters(mcParticles.rawIteratorAt(indexRec), &arrResoDaughIndex, std::array{0}, resoMaxDepth);
835-
std::vector<int> arrPDGDaugh = {};
832+
std::array<int, NDaughtersResonant> arrPDGDaugh = {};
836833
if (arrResoDaughIndex.size() == NDaughtersResonant) {
837834
for (auto iProng = 0u; iProng < arrResoDaughIndex.size(); ++iProng) {
838835
auto daughI = mcParticles.rawIteratorAt(arrResoDaughIndex[iProng]);
839-
arrPDGDaugh.push_back(std::abs(daughI.pdgCode()));
836+
arrPDGDaugh[iProng] = daughI.pdgCode();
840837
}
841838
flagResonantDecay(Pdg::kD0, &channel, arrPDGDaugh);
842839
// LOG(info) << "[matchFinalStateCorrBkgs] Matched D0 final state: " << chn << ", flag: " << static_cast<int>(flag) << ", &sign: " << static_cast<int>(sign);
@@ -845,22 +842,7 @@ struct HfCandidateCreator2ProngExpressions {
845842
break; // Exit loop if a match is found
846843
}
847844
}
848-
LOG(info) << "D0 matching ended with flag " << static_cast<int>(flag) << " and indexRec " << static_cast<int>(indexRec) << ", &sign " << static_cast<int>(sign) << ", channel " << static_cast<int>(channel);
849-
850-
// LOG(info) << "--------------------------------------------";
851-
// LOG(info) << "Matching correlated bkgs of " << Pdg::kD0;
852-
// if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
853-
// indexRec = matchFinalStateCorrBkgs<true, true>(Pdg::kD0, mcParticles, arrayDaughters, &flag, &sign, &channel, 1, &nKinkedTracks, &nInteractionsWithMaterial);
854-
// } else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
855-
// indexRec = matchFinalStateCorrBkgs<true, false>(Pdg::kD0, mcParticles, arrayDaughters, &flag, &sign, &channel, 1, &nKinkedTracks, &nInteractionsWithMaterial);
856-
// } else if (!matchKinkedDecayTopology && matchInteractionsWithMaterial) {
857-
// indexRec = matchFinalStateCorrBkgs<false, true>(Pdg::kD0, mcParticles, arrayDaughters, &flag, &sign, &channel, 1, &nKinkedTracks, &nInteractionsWithMaterial);
858-
// } else {
859-
// indexRec = matchFinalStateCorrBkgs<false, false>(Pdg::kD0, mcParticles, arrayDaughters, &flag, &sign, &channel, 1, &nKinkedTracks, &nInteractionsWithMaterial);
860-
// }
861-
// if (indexRec > -1) {
862-
// LOG(info) << "Matched!";
863-
// }
845+
// LOG(info) << "D0 matching ended with flag " << static_cast<int>(flag) << " and indexRec " << static_cast<int>(indexRec) << ", &sign " << static_cast<int>(sign) << ", channel " << static_cast<int>(channel);
864846
} else {
865847
// D0(bar) → π± K∓
866848
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {

0 commit comments

Comments
 (0)