Skip to content

Conversation

@qunib
Copy link

@qunib qunib commented Oct 28, 2025

Previously, some photons that overlapped with charged tracks were being incorrectly discarded, leading to reduced reconstruction efficiency. This change adjusts the matching logic to retain valid photons without affecting charged particle suppression.

Briefly, what does this PR introduce?

This PR improves the cluster-to-MC association logic in MatchClusters by selecting the best MC particle per cluster based on association weight, instead of taking the first match found. Default behavior is slightly changed for clusters with multiple MC associations; otherwise, results are identical. No API or function signature changes are required for users.

This code change :

  1. Builds a map keyed by cluster object index, storing the best-associated MC id and its weight.
  2. When matching charged tracks, it only removes a cluster if that cluster's best association is to that charged MC particle (and chooses the best cluster for that MC by highest association weight if multiple clusters claim the same MC). Remaining clusters are treated as neutrals.

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (issue #__)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

Does this PR change default behavior?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

@github-actions github-actions bot dismissed their stale review October 28, 2025 06:01

No Clang-Tidy warnings found so I assume my comments were addressed

@wdconinc wdconinc mentioned this pull request Oct 28, 2025
7 tasks
@qunib qunib changed the title Update MatchClusters.cc Fix missing photon reconstruction caused by charged track overlap in MatchClusters.cc Oct 29, 2025
qunib pushed a commit that referenced this pull request Oct 29, 2025
This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18865551002.
Please merge this PR into the branch `qunib-patch-1`
to resolve failures in PR #2154.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@veprbl veprbl requested review from a team and veprbl and removed request for a team October 29, 2025 13:46
qunib and others added 4 commits October 29, 2025 13:03
This PR improves the cluster-to-MC association logic in MatchClusters by selecting the best MC particle per cluster based on association weight, instead of taking the first match found.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/18865551002.
Please merge this PR into the branch `qunib-patch-1`
to resolve failures in PR #2154.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@wdconinc
Copy link
Contributor

I compared this branch before/after with #2163:

Before:
[] [Truthiness] [info] Processed 100 events, average truthiness: 530.444009

After:
[] [Truthiness] [info] Processed 100 events, average truthiness: 546.366942

Not sure why the truthiness goes up (bad direction), since the changes look fine to me.

It is possible (maybe likely) that a penalty of 1 for missing associations is not large enough. Just based on resolution alone, the E, px, py, pz would each contribute 1 in 67% (1 sigma) of the cases, so the effect of better reconstruction leading to better associations may actually lead to an increase in the truthiness since we are now more dominated by the energy and momentum resolution effects...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants