Delay full simulation until deposited energy is known#273
Merged
kvjmistry merged 6 commits intonext-exp:masterfrom Jan 21, 2026
Merged
Delay full simulation until deposited energy is known#273kvjmistry merged 6 commits intonext-exp:masterfrom
kvjmistry merged 6 commits intonext-exp:masterfrom
Conversation
Push also ionization electrons to the waiting stack
The event energy is determined when the primary particle interacts in the active volume. This is the metric used to determined if the event needs to be fully simulated or not. Once this is determined, optical photons and ionization electrons don't need to be delayed any further and all particles are simulated eagerly.
kvjmistry
approved these changes
Jan 19, 2026
Collaborator
kvjmistry
left a comment
There was a problem hiding this comment.
This is a really nice upgrade to the nexus simulation!
Code has been tested and runs as expected.
Excellent job @gonzaponte!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Full simulation is computationally very expensive. The main reason is light tracking, as a large number of optical photons can be produced per event. Moreover, nexus is capable of disregarding (not saving) events depending on their energy. However, this is criterion is only checked at the end of the full event simulation, which includes the propagation of photons. This can result in a long simulation that ends up being thrown away.
In this PR we introduce a stacking action that delays the propagation of photons (and ionization electrons, which turn will only produce more optical photons) until all particles that can deposit energy are tracked. The result is a two-stage simulation similar to what we have in what we call fast-sim:
with the second stage performed only when the event meets the deposited energy criterion.
Footnotes
S1 photons are actually produced in the first stage, but not tracked immediately. S2 photons are generated during the second stage, when the ionization electrons delayed from the first stage are tracked. ↩