Refactor far-forward neutrals reconstruction - #2736
Conversation
|
Range-based for loops are deterministic, so the motivation doesn't seem to make sense. Indices are prone to abuse (and incorrect typing as |
|
Please fix the merge conflicts first. They will remove the need for us to comment on things that pre-commit will fix. |
47e8383 to
1127c0c
Compare
for more information, see https://pre-commit.ci
|
Sorry, my branch was not up to date with main. I restarted the branch from the current main and reapplied the changes cleanly. @wdconinc yes, the range-based loops themselves are deterministic. The motivation behind index-based loops was to ensure that cluster objects / their paths were not involved in the ST/MT discrepancy. But okay, if there's no benefit to keeping it this way, I stick to '&cluster' loops. |
| best_k = k; | ||
| } | ||
| } | ||
| std::sort(cands.begin(), cands.end(), better); |
There was a problem hiding this comment.
use a ranges version of this algorithm
| std::sort(cands.begin(), cands.end(), better); | |
| std::ranges::sort(cands,, better); |
Summary
This PR refactors neutral and Lambda reconstruction.
1. Factorize
FarForwardNeutralsReconstruction(issue #2689)Following the discussions in PR #2622 followed by issue #2689, the neutral reconstruction has been refactored so that the same algorithm is used for each calorimeter independently instead of processing everything in a single instance.
## 2. Use index-based cluster loopsThe neutral reconstruction now iterates over clusters using index-based loops instead of object-based iteration. This was motivated by the investigation of the Capybara single-threaded / multi-threaded mismatch, as it removes one possible source of non-deterministic behavior.3. Improve Lambda candidate selection
The Lambda selection has been slightly modified to prioritize the candidate with the lowest chi-2. The selection also continues scanning the remaining candidates when appropriate instead of stopping after the first valid one.
@ruse-traveler @veprbl @DraTeots @wdconinc