Skip to content

Commit ab9677f

Browse files
committed
[WIP] Generated matching
1 parent 004acaa commit ab9677f

File tree

9 files changed

+245
-101
lines changed

9 files changed

+245
-101
lines changed

Common/Core/RecoDecay.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ struct RecoDecay {
642642
}
643643

644644
bool isFinal = false; // Flag to indicate the end of recursion
645-
std::cout << "[getDaughters] Stage: " << static_cast<int>(stage) << ", Particle PDG: " << particle.pdgCode() << ", Index: " << particle.globalIndex() << ", depthMax: " << static_cast<int>(depthMax) << std::endl;
645+
// std::cout << "[getDaughters] Stage: " << static_cast<int>(stage) << ", Particle PDG: " << particle.pdgCode() << ", Index: " << particle.globalIndex() << ", depthMax: " << static_cast<int>(depthMax) << std::endl;
646646
if (depthMax > -1 && stage >= depthMax) { // Maximum depth has been reached (or exceeded).
647647
isFinal = true;
648648
}
@@ -799,14 +799,14 @@ struct RecoDecay {
799799
indexMother = getMother(particlesMC, particleI, pdgMother, acceptAntiParticles, &sgn, depthMax);
800800
// Check whether mother was found.
801801
if (indexMother <= -1) {
802-
std::cout << "MC Rec: Rejected: bad mother index or PDG" << std::endl;
802+
// std::cout << "MC Rec: Rejected: bad mother index or PDG" << std::endl;
803803
return -1;
804804
}
805805
std::cout << "MC Rec: Good mother: " << indexMother << std::endl;
806806
auto particleMother = particlesMC.rawIteratorAt(indexMother - particlesMC.offset());
807807
// Check the daughter indices.
808808
if (!particleMother.has_daughters()) {
809-
std::cout << "MC Rec: Rejected: bad daughter index range: " << particleMother.daughtersIds().front() << "-" << particleMother.daughtersIds().back() << std::endl;
809+
// std::cout << "MC Rec: Rejected: bad daughter index range: " << particleMother.daughtersIds().front() << "-" << particleMother.daughtersIds().back() << std::endl;
810810
return -1;
811811
}
812812
// Check that the number of direct daughters is not larger than the number of expected final daughters.
@@ -851,7 +851,7 @@ struct RecoDecay {
851851
}
852852
}
853853
if (!isDaughterFound) {
854-
std::cout << "MC Rec: Rejected: bad daughter index: " << arrDaughtersIndex[iProng] << " not in the list of final daughters" << std::endl;
854+
// std::cout << "MC Rec: Rejected: bad daughter index: " << arrDaughtersIndex[iProng] << " not in the list of final daughters" << std::endl;
855855
return -1;
856856
}
857857
// Check daughter's PDG code.
@@ -866,7 +866,7 @@ struct RecoDecay {
866866
}
867867
}
868868
if (!isPdgFound) {
869-
std::cout << "MC Rec: Rejected: bad daughter PDG: " << pdgParticleI << std::endl;
869+
// std::cout << "MC Rec: Rejected: bad daughter PDG: " << pdgParticleI << std::endl;
870870
return -1;
871871
}
872872
}
@@ -939,11 +939,13 @@ struct RecoDecay {
939939
// Check the PDG code of the particle.
940940
auto pdgCandidate = candidate.pdgCode();
941941
// Printf("MC Gen: Candidate PDG: %d", pdgCandidate);
942+
// std::cout << "MC Gen: Candidate PDG: " << pdgCandidate << std::endl;
942943
if (pdgCandidate == pdgParticle) { // exact PDG match
943944
sgn = 1;
944945
} else if (acceptAntiParticles && pdgCandidate == -pdgParticle) { // antiparticle PDG match
945946
sgn = -1;
946947
} else {
948+
// std::cout << "MC Gen: Rejected: bad particle PDG: " << (acceptAntiParticles ? "abs " : "") << pdgCandidate << " != " << pdgParticle << std::endl;
947949
// Printf("MC Gen: Rejected: bad particle PDG: %s%d != %d", acceptAntiParticles ? "abs " : "", pdgCandidate, std::abs(pdgParticle));
948950
return false;
949951
}
@@ -965,13 +967,17 @@ struct RecoDecay {
965967
}
966968
// Get the list of actual final daughters.
967969
getDaughters<checkProcess>(candidate, &arrAllDaughtersIndex, arrPdgDaughters, depthMax);
970+
968971
// printf("MC Gen: Mother %ld has %ld final states", candidate.globalIndex(), arrAllDaughtersIndex.size());
969-
// for (auto i : arrAllDaughtersIndex) {
970-
// printf(" %d", i);
971-
// }
972+
// std::cout << "MC Gen: Mother " << candidate.globalIndex() << " has " << arrAllDaughtersIndex.size() << " final states" << std::endl;
973+
for (auto i : arrAllDaughtersIndex) {
974+
// std::cout << " (" << i << " , pdg: " << particlesMC.rawIteratorAt(i - particlesMC.offset()).pdgCode() << ") , ";
975+
}
976+
std::cout << " " << std::endl;
972977
// printf("\n");
973978
// Check whether the number of final daughters is equal to the required number.
974979
if (arrAllDaughtersIndex.size() != N) {
980+
// std::cout << "MC Gen: Rejected: incorrect number of final states " << arrAllDaughtersIndex.size() << " (expected " << N << ")" << std::endl;
975981
// Printf("MC Gen: Rejected: incorrect number of final states %ld (expected %ld)", arrAllDaughtersIndex.size(), N);
976982
return false;
977983
}
@@ -989,6 +995,7 @@ struct RecoDecay {
989995
for (auto indexDaughterI : arrAllDaughtersIndex) { // o2-linter: disable=const-ref-in-for-loop (int elements)
990996
auto candidateDaughterI = particlesMC.rawIteratorAt(indexDaughterI - particlesMC.offset()); // ith daughter particle
991997
auto pdgCandidateDaughterI = candidateDaughterI.pdgCode(); // PDG code of the ith daughter
998+
// std::cout << "MC Gen: Daughter " << indexDaughterI << " PDG: " << pdgCandidateDaughterI << std::endl;
992999
// Printf("MC Gen: Daughter %d PDG: %d", indexDaughterI, pdgCandidateDaughterI);
9931000
bool isPdgFound = false; // Is the PDG code of this daughter among the remaining expected PDG codes?
9941001
for (std::size_t iProngCp = 0; iProngCp < N; ++iProngCp) {
@@ -999,6 +1006,7 @@ struct RecoDecay {
9991006
}
10001007
}
10011008
if (!isPdgFound) {
1009+
// std::cout << "MC Gen: Rejected: bad daughter PDG: " << pdgCandidateDaughterI << std::endl;
10021010
// Printf("MC Gen: Rejected: bad daughter PDG: %d", pdgCandidateDaughterI);
10031011
return false;
10041012
}
@@ -1007,6 +1015,7 @@ struct RecoDecay {
10071015
*listIndexDaughters = arrAllDaughtersIndex;
10081016
}
10091017
}
1018+
std::cout << "MC Gen: Accepted: m: " << candidate.globalIndex() << std::endl;
10101019
// Printf("MC Gen: Accepted: m: %d", candidate.globalIndex());
10111020
if (sign) {
10121021
*sign = sgn;

0 commit comments

Comments
 (0)