Skip to content

Commit 7e66dec

Browse files
committed
Add break statements in 3prong matching
1 parent efbddc9 commit 7e66dec

File tree

4 files changed

+25
-40
lines changed

4 files changed

+25
-40
lines changed

PWGHF/Core/DecayChannels.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ namespace o2::hf_corrbkg
445445
break;
446446
}
447447
}
448+
LOG(info) << "Leaving function with channel: " << static_cast<int>(*channel);
448449
// if (abs(motherPdg) == Pdg::kDStar) {
449-
// LOG(info) << "Leaving function with channel: " << static_cast<int>(*channel);
450450
// }
451451
} else {
452452
if (motherPdg != Pdg::kD0) {

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -945,25 +945,17 @@ struct HfCandidateCreator3ProngExpressions {
945945
}
946946
}
947947

948-
// LOG(info) << "CIAO REC MATCHING";
949948
if (matchCorrBkgs) {
950-
// LOG(info) << "CIAO 1";
951-
// LOG(info) << "--------------------------------------------";
952-
// LOG(info) << "Matching correlated bkgs";
953949
std::array<int, 5> mothersPdgCodes = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus, Pdg::kXiCPlus};
954950
indexRec = -1; // Index of the matched reconstructed candidate
955-
956-
// LOG(info) << "CIAO 2";
951+
957952
for (const auto& pdg : mothersPdgCodes) {
958953
int depth = 2;
959954
if (pdg == Pdg::kDStar) {
960955
depth = 3; // D0 resonant decays are active
961956
}
962-
// LOG(info) << "CIAO 3";
963957
auto finalStates = getDecayChannel3Prong(pdg);
964-
// LOG(info) << "CIAO 3.0";
965958
for (const auto& [chn, finalState] : finalStates) {
966-
// LOG(info) << "CIAO 3.0.1";
967959
std::array<int, 3> finalStateParts3Prong = std::array{finalState[0], finalState[1], finalState[2]};
968960
if (finalState.size() > 3) { // Partly Reco 3-prong decays
969961
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
@@ -975,8 +967,7 @@ struct HfCandidateCreator3ProngExpressions {
975967
} else {
976968
indexRec = RecoDecay::getMatchedMCRec<false, false, true, false, false>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth);
977969
}
978-
979-
// LOG(info) << "CIAO 3.0.2";
970+
980971
if (indexRec != -1) {
981972
auto motherParticle = mcParticles.rawIteratorAt(indexRec);
982973
if (finalState.size() == 4) { // Check if the final state has 4 particles
@@ -992,30 +983,22 @@ struct HfCandidateCreator3ProngExpressions {
992983
if (!RecoDecay::isMatchedMCGen(mcParticles, motherParticle, pdg, finalStateParts3ProngAll, false, &sign, depth)) {
993984
indexRec = -1; // Reset indexRec if the generated decay does not match the reconstructed one is not matched
994985
}
995-
// LOG(info) << "CIAO 3.0.3";
996986
} else if (finalState.size() == 5) { // Check if the final state has 3 particles
997987
// std::array<int, 5> finalStateParts3ProngAll = std::array{finalState[0], finalState[1], finalState[2], sign*finalState[3], sign*finalState[4]};
998-
// LOG(info) << "CIAO 3.0.4";
999988
std::array<int, 5> finalStateParts3ProngAll = std::array{finalState[0], finalState[1], finalState[2], finalState[3], finalState[4]};
1000989
if (sign < 0) {
1001990
for (auto& part : finalStateParts3ProngAll) {
1002991
if (part == kPi0) {
1003992
part = -part; // The Pi0 pdg code does not change between particle and antiparticle
1004993
}
1005994
}
1006-
// LOG(info) << "CIAO 3.0.5";
1007995
}
1008996
if (!RecoDecay::isMatchedMCGen(mcParticles, motherParticle, pdg, finalStateParts3ProngAll, false, &sign, depth)) {
1009997
indexRec = -1; // Reset indexRec if the generated decay does not match the reconstructed one is not matched
1010-
// LOG(info) << "CIAO 3.0.6";
1011998
}
1012-
// LOG(info) << "CIAO 3.0.7";
1013999
}
1014-
// LOG(info) << "CIAO 3.0.8";
10151000
}
1016-
// LOG(info) << "CIAO 3.0.9";
10171001
} else if (finalState.size() == 3) { // Fully Reco 3-prong decays
1018-
// LOG(info) << "CIAO 3.1";
10191002
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
10201003
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
10211004
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
@@ -1025,19 +1008,18 @@ struct HfCandidateCreator3ProngExpressions {
10251008
} else {
10261009
indexRec = RecoDecay::getMatchedMCRec<false, false, false, false, false>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth);
10271010
}
1028-
// LOG(info) << "CIAO 3.2";
10291011
} else {
10301012
LOG(info) << "Final state size not supported: " << finalState.size();
10311013
continue; // Skip unsupported final states
10321014
}
1033-
// LOG(info) << "CIAO 4";
10341015
if (indexRec > -1) {
10351016
// std::cout << "Matched final state: " << chn << " with PDG code: " << pdg << std::endl;
10361017
flag = sign * chn;
1037-
1018+
10381019
// Flag the resonant decay channel
10391020
int resoMaxDepth = 1;
1040-
if (std::abs(pdg) == Pdg::kDStar) {
1021+
// if (std::abs(pdg) == Pdg::kDStar) {
1022+
if (std::abs(mcParticles.rawIteratorAt(indexRec).pdgCode()) == Pdg::kDStar) {
10411023
resoMaxDepth = 2; // Flag D0 resonances
10421024
}
10431025
std::vector<int> arrResoDaughIndex = {};
@@ -1049,16 +1031,16 @@ struct HfCandidateCreator3ProngExpressions {
10491031
arrPDGDaugh[iProng] = daughI.pdgCode();
10501032
}
10511033
flagResonantDecay<true>(pdg, &channel, arrPDGDaugh);
1052-
// LOG(info) << "CIAO 5";
1053-
// LOG(info) << "[matchFinalStateCorrBkgs] Matched final state: " << chn << " with PDG code: " << static_cast<int>(pdg) << ", flag: " << static_cast<int>(flag) << ", &sign: " << static_cast<int>(sign);
1054-
// LOG(info) << "[matchFinalStateCorrBkgs] Flag set to: " << static_cast<int>(flag) << " sign: " << static_cast<int>(sign) << " for channel: " << static_cast<int>(channel);
1034+
LOG(info) << "[matchFinalStateCorrBkgs] Matched final state: " << chn << " with PDG code: " << static_cast<int>(pdg) << ", flag: " << static_cast<int>(flag) << ", &sign: " << static_cast<int>(sign);
1035+
LOG(info) << "[matchFinalStateCorrBkgs] Flag set to: " << static_cast<int>(flag) << " sign: " << static_cast<int>(sign) << " for channel: " << static_cast<int>(channel);
10551036
}
10561037
break; // Exit loop if a match is found
10571038
}
1058-
// LOG(info) << "CIAO 6";
1039+
}
1040+
if (indexRec > -1) {
1041+
break; // Exit loop if a match is found
10591042
}
10601043
}
1061-
// LOG(info) << "CIAO 7";
10621044
// LOG(info) << "Corr Bkg matching ended with flag " << static_cast<int>(flag) << " and indexRec " << static_cast<int>(indexRec) << ", &sign " << static_cast<int>(sign) << ", channel " << static_cast<int>(channel);
10631045
} else {
10641046
// D± → π± K∓ π±

PWGHF/TableProducer/treeCreatorD0ToKPi.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ struct HfTreeCreatorD0ToKPi {
243243
using MatchedGenCandidatesMc = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand2ProngMcGen>>;
244244

245245
Filter filterSelectCandidates = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1;
246-
Filter filterMcGenMatching = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && (nabs(aod::hf_cand_2prong::flagMcMatchGen) != 0));
246+
Filter filterMcGenMatching = nabs(aod::hf_cand_2prong::flagMcMatchGen) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && (nabs(aod::hf_cand_2prong::flagMcMatchGen) != 0));
247247

248248
Partition<SelectedCandidatesMc> reconstructedCandSig = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
249249
Partition<SelectedCandidatesMc> reconstructedCandBkg = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
250250
Partition<SelectedCandidatesMcKf> reconstructedCandSigKF = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
251251
Partition<SelectedCandidatesMcKf> reconstructedCandBkgKF = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
252252

253-
Partition<SelectedCandidatesMcMl> reconstructedCandSigMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
253+
Partition<SelectedCandidatesMcMl> reconstructedCandSigMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
254254
Partition<SelectedCandidatesMcMl> reconstructedCandBkgMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
255255
Partition<SelectedCandidatesMcKfMl> reconstructedCandSigKFMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
256256
Partition<SelectedCandidatesMcKfMl> reconstructedCandBkgKFMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));

PWGHF/Utils/utilsMcGen.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
203203
if (matched) {
204204
flag = sign * chn;
205205
if (motherPdgCode == Pdg::kDStar) {
206-
std::cout << "Matched final state: " << chn << " with PDG code: " << motherPdgCode << std::endl;
206+
// std::cout << "Found D*: " << static_cast<int>(flag) << " with PDG code: " << motherPdgCode << std::endl;
207207
}
208208
// Flag the resonant decay channel
209209
int resoMaxDepth = 1;
@@ -213,7 +213,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
213213
RecoDecay::getDaughters(particle, &arrResoDaughIndexDStar, std::array{0}, resoMaxDepth);
214214
for (size_t iDaug = 0; iDaug < arrResoDaughIndexDStar.size(); iDaug++) {
215215
if (std::abs(mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]).pdgCode()) == Pdg::kD0) {
216-
LOG(info) << "[matchFinalStateCorrBkgsGen] D* Daughter with PDG code: " << mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]).pdgCode() << " recognized as D0.";
216+
// LOG(info) << "[matchFinalStateCorrBkgsGen] D* Daughter with PDG code: " << mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]).pdgCode() << " recognized as D0.";
217217
auto daughDstarD0 = mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]);
218218
RecoDecay::getDaughters(daughDstarD0, &arrResoDaughIndex, std::array{0}, resoMaxDepth);
219219
break;
@@ -223,38 +223,41 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
223223
RecoDecay::getDaughters(daughDstarDplus, &arrResoDaughIndex, std::array{0}, resoMaxDepth);
224224
break;
225225
} else {
226-
LOG(info) << "[matchFinalStateCorrBkgsGen] D* Daughter with PDG code: " << mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]).pdgCode() << " not recognized.";
226+
// LOG(info) << "[matchFinalStateCorrBkgsGen] D* Daughter with PDG code: " << mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]).pdgCode() << " not recognized.";
227227
}
228228

229-
std::cout << "[matchFinalStateCorrBkgsGen] D* Daughter index: " << arrResoDaughIndexDStar[iDaug] << std::endl;
229+
// std::cout << "[matchFinalStateCorrBkgsGen] D* Daughter index: " << arrResoDaughIndexDStar[iDaug] << std::endl;
230230
}
231231
} else {
232232
RecoDecay::getDaughters(particle, &arrResoDaughIndex, std::array{0}, resoMaxDepth);
233233
}
234234
std::array<int, NDaughtersResonant> arrPDGDaugh = {};
235235
if (std::abs(motherPdgCode) == Pdg::kDStar) {
236-
LOG(info) << "[matchFinalStateCorrBkgsGen] D* decay detected, arrResoDaughIndex size: " << arrResoDaughIndex.size();
236+
// LOG(info) << "[matchFinalStateCorrBkgsGen] D* decay detected, arrResoDaughIndex size: " << arrResoDaughIndex.size();
237237
}
238238
if (arrResoDaughIndex.size() == NDaughtersResonant) {
239239
if (std::abs(motherPdgCode) == Pdg::kDStar) {
240-
LOG(info) << "[matchFinalStateCorrBkgsGen] Flagging resonant decay ... ";
240+
// LOG(info) << "[matchFinalStateCorrBkgsGen] Flagging resonant decay ... ";
241241
}
242242
for (auto iProng = 0u; iProng < NDaughtersResonant; ++iProng) {
243243
auto daughI = mcParticles.rawIteratorAt(arrResoDaughIndex[iProng]);
244244
if (std::abs(motherPdgCode) == Pdg::kDStar) {
245-
std::cout << "Adding daughter PDG: " << daughI.pdgCode() << std::endl;
245+
// std::cout << "Adding daughter PDG: " << daughI.pdgCode() << std::endl;
246246
}
247247
arrPDGDaugh[iProng] = daughI.pdgCode();
248248
}
249249
flagResonantDecay<true>(motherPdgCode, &channel, arrPDGDaugh);
250250
if (std::abs(motherPdgCode) == Pdg::kDStar) {
251-
LOG(info) << "[matchFinalStateCorrBkgsGen] Matched final state: " << chn << " with PDG code: " << motherPdgCode << ", flag: " << static_cast<int>(flag) << ", sign: " << static_cast<int>(sign);
252-
LOG(info) << "[matchFinalStateCorrBkgsGen] Flag set to: " << static_cast<int>(flag) << " sign: " << static_cast<int>(sign) << " for channel: " << static_cast<int>(channel);
251+
// LOG(info) << "[matchFinalStateCorrBkgsGen] Matched final state: " << chn << " with PDG code: " << motherPdgCode << ", flag: " << static_cast<int>(flag) << ", sign: " << static_cast<int>(sign);
252+
// LOG(info) << "[matchFinalStateCorrBkgsGen] Flag set to: " << static_cast<int>(flag) << " sign: " << static_cast<int>(sign) << " for channel: " << static_cast<int>(channel);
253253
}
254254
}
255255
break; // Exit loop if a match is found
256256
}
257257
}
258+
if (matched) {
259+
break; // Exit loop if a match is found
260+
}
258261
}
259262
} else {
260263

0 commit comments

Comments
 (0)