-
Notifications
You must be signed in to change notification settings - Fork 34
Stop looking for primaries for simple radiative photon-like geometries #2178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sly2j
wants to merge
7
commits into
main
Choose a base branch
from
feat-calo-no-merge-radiative-etc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+46
−56
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c131e85
Stop looking for calorimeter hit primaries if we enounter geometries …
sly2j 6eda068
Add extra condition to avoid storing first pair of early showers
sly2j 5f19d59
unified and deduplicated get_primary/lookup_primary
sly2j fe5a3b3
Merge branch 'main' into feat-calo-no-merge-radiative-etc
sly2j afe1132
fixed typo in comment
sly2j 06c617a
Merge branch 'main' into feat-calo-no-merge-radiative-etc
sly2j 1a0ee98
remove spurious word in comment
sly2j File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // SPDX-License-Identifier: LGPL-3.0-or-later | ||
| // Copyright (C) 2025 Minho Kim, Sylvester Joosten, Derek Anderson, Wouter Deconinck | ||
| #pragma once | ||
|
|
||
| // | ||
| // @TODO should be migrated to a shared utiliy function in edm4xxx | ||
| // | ||
|
|
||
| #include <edm4hep/MCParticleCollection.h> | ||
| #include <edm4hep/CaloHitContributionCollection.h> | ||
|
|
||
| namespace eicrecon::MCTools { | ||
|
|
||
| // Lookup primary MCParticle | ||
| // we stop looking if we find the parent has status 1 | ||
| // so we don't merge e.g. radiative photons with the primary electron as this prevents us | ||
| // from properly linking the clusters back to the event geometry. Note that we also | ||
| // enforce for this case that no steps back towards the primary were taken to avoid | ||
| // storing the first pair of calorimetric showers that start inside the tracking volume. | ||
| // Hence, this algorithm will return: | ||
| // - Contribution came from primary: primary | ||
| // - Contribution came from immediate daughter of primary and has no childern -> daughter | ||
| // - All other cases (i.e. early showers, multi-radiation): primary | ||
| // libraries | ||
| inline edm4hep::MCParticle lookup_primary(const edm4hep::CaloHitContribution& contrib) { | ||
| const auto contributor = contrib.getParticle(); | ||
|
|
||
| edm4hep::MCParticle primary = contributor; | ||
| size_t steps_taken = 0; // The number of steps taken looking for the primary | ||
| while (primary.parents_size() > 0) { | ||
| auto parent = primary.getParents(0); | ||
| if (primary.getGeneratorStatus() != 0 || | ||
| (parent.getGeneratorStatus() != 0 && steps_taken == 0)) { | ||
| break; | ||
| } | ||
| primary = parent; | ||
| steps_taken += 1; | ||
| } | ||
| return primary; | ||
| } | ||
| } // namespace eicrecon::MCTools | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.