Skip to content

Commit 77838d0

Browse files
committed
Remove unused variables
1 parent 5ede46a commit 77838d0

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
@@ -354,9 +353,7 @@ namespace o2::hf_corrbkg
354353
}
355354

356355
template <std::size_t N>
357-
bool checkResonantDecay(std::vector<int> arrDaughIndex, std::array<int, N> arrPDGResonant) {
358-
// LOG(info) << "Entered checkResonantDecay with daughters: " << arrDaughIndex[0] << ", " << arrDaughIndex[1] << " and resonant PDG codes: " << arrPDGResonant[0] << ", " << arrPDGResonant[1];
359-
// LOG(info) << "arrDaughIndex.size(): " << arrDaughIndex.size() << ", arrPDGResonant.size(): " << arrPDGResonant.size();
356+
bool checkResonantDecay(std::array<int, N> arrDaughIndex, std::array<int, N> arrPDGResonant) {
360357
LOG(info) << "Testing: " << arrDaughIndex[0] << ", " << arrDaughIndex[1] << " matching PDG codes: " << arrPDGResonant[0] << ", " << arrPDGResonant[1];
361358
for (int i = 0; i < N; i++) {
362359
LOG(info) << "Checking daughter index: " << arrDaughIndex[i];
@@ -383,13 +380,13 @@ namespace o2::hf_corrbkg
383380
/// \tparam arrDaughIndex index of the particle daughters at resonance level
384381
/// \tparam arrPDGResonant PDG code of the resonant decay
385382
/// \return true if the decay is resonant
386-
template <bool is3Prong = false>
387-
void flagResonantDecay(int motherPdg, int8_t* channel, std::vector<int> arrDaughIndex) {
383+
template <bool is3Prong = false, std::size_t N>
384+
void flagResonantDecay(int motherPdg, int8_t* channel, std::array<int, N> arrDaughIndex) {
388385
if constexpr (is3Prong) {
389386
std::unordered_map<o2::hf_decay::hf_cand_3prong::DecayChannelResonant, std::array<int, 2> > resoStates = getResoChannels3Prong(motherPdg);
390387
for (const auto& [flag, pdgCodes] : resoStates) {
391388
if (abs(motherPdg) == Pdg::kDStar) {
392-
std::cout << "Checking D0 resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughIndex[0] << " " << arrDaughIndex[1] << std::endl;
389+
std::cout << "Checking Dstar resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughIndex[0] << " " << arrDaughIndex[1] << std::endl;
393390
}
394391
if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
395392
*channel = flag;
@@ -417,72 +414,6 @@ namespace o2::hf_corrbkg
417414
}
418415
}
419416
}
420-
421-
// switch (motherPdg) {
422-
// case Pdg::kD0:
423-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_2prong::resoStatesD0) {
424-
// std::cout << "Checking D0 resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << " vs " << arrDaughIndex[0] << " " << arrDaughIndex[1] << std::endl;
425-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
426-
// *channel = flag;
427-
// LOG(info) << "D0 resonant decay found with channel: " << static_cast<int>(*channel);
428-
// break;
429-
// }
430-
// }
431-
// break;
432-
// case Pdg::kDPlus:
433-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesDPlus) {
434-
// // std::cout << "Checking DPlus resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
435-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
436-
// *channel = flag;
437-
// LOG(info) << "D+ resonant decay found with channel: " << static_cast<int>(*channel);
438-
// break;
439-
// }
440-
// }
441-
// break;
442-
// case Pdg::kDS:
443-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesDs) {
444-
// // std::cout << "Checking DS resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
445-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
446-
// *channel = flag;
447-
// LOG(info) << "Ds resonant decay found with channel: " << static_cast<int>(*channel);
448-
// break;
449-
// }
450-
// }
451-
// break;
452-
// case Pdg::kDStar:
453-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesDstar) {
454-
// std::cout << "Checking Dstar resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
455-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
456-
// *channel = flag;
457-
// LOG(info) << "Dstar resonant decay found with channel: " << static_cast<int>(*channel);
458-
// break;
459-
// }
460-
// }
461-
// LOG(info) << "Dstar resonant decay not found, checking D0 resonances";
462-
// break;
463-
// case Pdg::kLambdaCPlus:
464-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesLambdaC) {
465-
// // std::cout << "Checking LambdaC resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
466-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
467-
// *channel = flag;
468-
// LOG(info) << "Lc resonant decay found with channel: " << static_cast<int>(*channel);
469-
// break;
470-
// }
471-
// }
472-
// break;
473-
// case Pdg::kXiCPlus:
474-
// for (const auto& [flag, pdgCodes] : o2::hf_decay::hf_cand_3prong::resoStatesXiC) {
475-
// // std::cout << "Checking XiC resonant decay with flag: " << flag << ", pdgCodes: " << pdgCodes[0] << ", " << pdgCodes[1] << std::endl;
476-
// if (checkResonantDecay(arrDaughIndex, pdgCodes)) {
477-
// *channel = flag;
478-
// LOG(info) << "Xic resonant decay found with channel: " << static_cast<int>(*channel);
479-
// break;
480-
// }
481-
// }
482-
// break;
483-
// }
484-
// }
485-
486417
} // namespace o2::hf_corrbkg
487418

488419
#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)