Skip to content

Delay full simulation until deposited energy is known#273

Merged
kvjmistry merged 6 commits intonext-exp:masterfrom
gonzaponte:delay-photon-prop
Jan 21, 2026
Merged

Delay full simulation until deposited energy is known#273
kvjmistry merged 6 commits intonext-exp:masterfrom
gonzaponte:delay-photon-prop

Conversation

@gonzaponte
Copy link
Collaborator

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:

  • a (fast) first stage in which the "main" particles are tracked, which allows to compute the deposited energy
  • a (slow) second stage in which optical photons are produced1 and tracked

with the second stage performed only when the event meets the deposited energy criterion.

Footnotes

  1. 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.

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.
@gonzaponte gonzaponte requested a review from kvjmistry January 19, 2026 16:20
Copy link
Collaborator

@kvjmistry kvjmistry left a comment

Choose a reason for hiding this comment

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

This is a really nice upgrade to the nexus simulation!
Code has been tested and runs as expected.
Excellent job @gonzaponte!

@kvjmistry kvjmistry merged commit 251379a into next-exp:master Jan 21, 2026
1 check passed
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.

2 participants