Skip to content

Commit 092b533

Browse files
committed
[WIP] Generated matching
1 parent 6c9b313 commit 092b533

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
@@ -628,7 +628,7 @@ struct RecoDecay {
628628
}
629629

630630
bool isFinal = false; // Flag to indicate the end of recursion
631-
std::cout << "[getDaughters] Stage: " << static_cast<int>(stage) << ", Particle PDG: " << particle.pdgCode() << ", Index: " << particle.globalIndex() << ", depthMax: " << static_cast<int>(depthMax) << std::endl;
631+
// std::cout << "[getDaughters] Stage: " << static_cast<int>(stage) << ", Particle PDG: " << particle.pdgCode() << ", Index: " << particle.globalIndex() << ", depthMax: " << static_cast<int>(depthMax) << std::endl;
632632
if (depthMax > -1 && stage >= depthMax) { // Maximum depth has been reached (or exceeded).
633633
isFinal = true;
634634
}
@@ -785,14 +785,14 @@ struct RecoDecay {
785785
indexMother = getMother(particlesMC, particleI, pdgMother, acceptAntiParticles, &sgn, depthMax);
786786
// Check whether mother was found.
787787
if (indexMother <= -1) {
788-
std::cout << "MC Rec: Rejected: bad mother index or PDG" << std::endl;
788+
// std::cout << "MC Rec: Rejected: bad mother index or PDG" << std::endl;
789789
return -1;
790790
}
791791
std::cout << "MC Rec: Good mother: " << indexMother << std::endl;
792792
auto particleMother = particlesMC.rawIteratorAt(indexMother - particlesMC.offset());
793793
// Check the daughter indices.
794794
if (!particleMother.has_daughters()) {
795-
std::cout << "MC Rec: Rejected: bad daughter index range: " << particleMother.daughtersIds().front() << "-" << particleMother.daughtersIds().back() << std::endl;
795+
// std::cout << "MC Rec: Rejected: bad daughter index range: " << particleMother.daughtersIds().front() << "-" << particleMother.daughtersIds().back() << std::endl;
796796
return -1;
797797
}
798798
// Check that the number of direct daughters is not larger than the number of expected final daughters.
@@ -837,7 +837,7 @@ struct RecoDecay {
837837
}
838838
}
839839
if (!isDaughterFound) {
840-
std::cout << "MC Rec: Rejected: bad daughter index: " << arrDaughtersIndex[iProng] << " not in the list of final daughters" << std::endl;
840+
// std::cout << "MC Rec: Rejected: bad daughter index: " << arrDaughtersIndex[iProng] << " not in the list of final daughters" << std::endl;
841841
return -1;
842842
}
843843
// Check daughter's PDG code.
@@ -852,7 +852,7 @@ struct RecoDecay {
852852
}
853853
}
854854
if (!isPdgFound) {
855-
std::cout << "MC Rec: Rejected: bad daughter PDG: " << pdgParticleI << std::endl;
855+
// std::cout << "MC Rec: Rejected: bad daughter PDG: " << pdgParticleI << std::endl;
856856
return -1;
857857
}
858858
}
@@ -925,11 +925,13 @@ struct RecoDecay {
925925
// Check the PDG code of the particle.
926926
auto pdgCandidate = candidate.pdgCode();
927927
// Printf("MC Gen: Candidate PDG: %d", pdgCandidate);
928+
// std::cout << "MC Gen: Candidate PDG: " << pdgCandidate << std::endl;
928929
if (pdgCandidate == pdgParticle) { // exact PDG match
929930
sgn = 1;
930931
} else if (acceptAntiParticles && pdgCandidate == -pdgParticle) { // antiparticle PDG match
931932
sgn = -1;
932933
} else {
934+
// std::cout << "MC Gen: Rejected: bad particle PDG: " << (acceptAntiParticles ? "abs " : "") << pdgCandidate << " != " << pdgParticle << std::endl;
933935
// Printf("MC Gen: Rejected: bad particle PDG: %s%d != %d", acceptAntiParticles ? "abs " : "", pdgCandidate, std::abs(pdgParticle));
934936
return false;
935937
}
@@ -951,13 +953,17 @@ struct RecoDecay {
951953
}
952954
// Get the list of actual final daughters.
953955
getDaughters<checkProcess>(candidate, &arrAllDaughtersIndex, arrPdgDaughters, depthMax);
956+
954957
// printf("MC Gen: Mother %ld has %ld final states", candidate.globalIndex(), arrAllDaughtersIndex.size());
955-
// for (auto i : arrAllDaughtersIndex) {
956-
// printf(" %d", i);
957-
// }
958+
// std::cout << "MC Gen: Mother " << candidate.globalIndex() << " has " << arrAllDaughtersIndex.size() << " final states" << std::endl;
959+
for (auto i : arrAllDaughtersIndex) {
960+
// std::cout << " (" << i << " , pdg: " << particlesMC.rawIteratorAt(i - particlesMC.offset()).pdgCode() << ") , ";
961+
}
962+
std::cout << " " << std::endl;
958963
// printf("\n");
959964
// Check whether the number of final daughters is equal to the required number.
960965
if (arrAllDaughtersIndex.size() != N) {
966+
// std::cout << "MC Gen: Rejected: incorrect number of final states " << arrAllDaughtersIndex.size() << " (expected " << N << ")" << std::endl;
961967
// Printf("MC Gen: Rejected: incorrect number of final states %ld (expected %ld)", arrAllDaughtersIndex.size(), N);
962968
return false;
963969
}
@@ -975,6 +981,7 @@ struct RecoDecay {
975981
for (auto indexDaughterI : arrAllDaughtersIndex) { // o2-linter: disable=const-ref-in-for-loop (int elements)
976982
auto candidateDaughterI = particlesMC.rawIteratorAt(indexDaughterI - particlesMC.offset()); // ith daughter particle
977983
auto pdgCandidateDaughterI = candidateDaughterI.pdgCode(); // PDG code of the ith daughter
984+
// std::cout << "MC Gen: Daughter " << indexDaughterI << " PDG: " << pdgCandidateDaughterI << std::endl;
978985
// Printf("MC Gen: Daughter %d PDG: %d", indexDaughterI, pdgCandidateDaughterI);
979986
bool isPdgFound = false; // Is the PDG code of this daughter among the remaining expected PDG codes?
980987
for (std::size_t iProngCp = 0; iProngCp < N; ++iProngCp) {
@@ -985,6 +992,7 @@ struct RecoDecay {
985992
}
986993
}
987994
if (!isPdgFound) {
995+
// std::cout << "MC Gen: Rejected: bad daughter PDG: " << pdgCandidateDaughterI << std::endl;
988996
// Printf("MC Gen: Rejected: bad daughter PDG: %d", pdgCandidateDaughterI);
989997
return false;
990998
}
@@ -993,6 +1001,7 @@ struct RecoDecay {
9931001
*listIndexDaughters = arrAllDaughtersIndex;
9941002
}
9951003
}
1004+
std::cout << "MC Gen: Accepted: m: " << candidate.globalIndex() << std::endl;
9961005
// Printf("MC Gen: Accepted: m: %d", candidate.globalIndex());
9971006
if (sign) {
9981007
*sign = sgn;

0 commit comments

Comments
 (0)