Skip to content

Conversation

@amandalund
Copy link
Contributor

This addresses the incorrect sampling of Cherenkov and scintillation photons when the track undergoes a collision at the end of the step. Because the distribution data was offloaded at the user-post step point, energy lost in the discrete interaction was incorrectly included in the energy loss used to sample the number of optical photons and photon times.

For Cherenkov the only change needed to fix this was to move the offload action from user_post to pre_post. Scintillation was a bit more complicated because we need the pre-step quantities, the speed following the slowing down but before the discrete interaction, and the energy deposition following the discrete interaction. I've kept the offload action for scintillation as user-post so we can get the post-interaction energy deposition and added a second step gather action to collect the pre-post data (by templating the OffloadGatherAction on StepActionOrder).

I updated the scintillation photon position sampling to use the fraction of energy deposited locally at the collision site to determine whether to generate photons at the endpoint rather than basing it off whether the particle is charged, but reverted it for now since I wasn't sure it was an improvement (6cfab20).

  - Move Cherenkov offload from user-post to pre-post
  - Template OffloadGatherAction on StepActionOrder to support reusing the
    action for pre-post-step gathering
  - Add a pre-post gather action to collect speed and energy deposition for
    scintillation
  - Fix sampling of scintillation photon position if energy was deposited both
    along the step and at the collision site
@amandalund amandalund requested a review from sethrj December 6, 2025 18:48
@amandalund amandalund added bug Something isn't working physics Particles, processes, and stepping algorithms labels Dec 6, 2025
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

Test summary

 5 730 files   9 216 suites   18m 30s ⏱️
 2 078 tests  2 046 ✅  26 💤  6 ❌
32 038 runs  31 848 ✅ 129 💤 61 ❌

For more details on these failures, see this check.

Results for commit f0430fe.

♻️ This comment has been updated with latest results.

…cision:

/home/alund/celeritas_project/celeritas/src/celeritas/alongstep/detail/PropagationApplier.hh:128: error: Propagation of step length 3.945664e-07f due to post-step action 2 leading to distance 3.945664e-07f failed to change position
/home/alund/celeritas_project/celeritas/src/celeritas/phys/detail/TrackingCutExecutor.hh:69: error: Killing track {"geo":{"dir":[-0.311763733625412,0.8268820643424988,-0.4680486023426056],"is_on_boundary":false,"is_outside":false,"pos":[[11.132973670959473,46.96626281738281,-14.058794975280762],"cm"],"volume_id":"sphere"},"mat":"lAr","particle":{"energy":[0.0002947896718978882,"MeV"],"particle_id":"e-"},"sim":{"event_id":0,"num_steps":0,"parent_id":48,"post_step_action":"tracking-cut","status":"errored","step_length":[3.945664275306626e-07,"cm"],"time":[1.9288048935806046e-09,"s"],"track_id":51},"thread_id":2,"track_slot_id":2}: lost 0.00029479 MeV
@codecov
Copy link

codecov bot commented Dec 7, 2025

Codecov Report

❌ Patch coverage is 84.12698% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.13%. Comparing base (d66098c) to head (f0430fe).

Files with missing lines Patch % Lines
...leritas/optical/gen/detail/ScintOffloadExecutor.hh 50.00% 0 Missing and 4 partials ⚠️
...tas/optical/gen/detail/CherenkovOffloadExecutor.hh 50.00% 0 Missing and 2 partials ⚠️
...optical/gen/detail/OffloadPrePostGatherExecutor.hh 66.66% 0 Missing and 2 partials ⚠️
src/celeritas/optical/gen/OffloadGatherAction.cc 88.88% 1 Missing ⚠️
...tas/optical/gen/detail/OffloadPreGatherExecutor.hh 80.00% 0 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (d66098c) and HEAD (f0430fe). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (d66098c) HEAD (f0430fe)
2 1
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2152      +/-   ##
===========================================
- Coverage    84.91%   76.13%   -8.78%     
===========================================
  Files         1273     1198      -75     
  Lines        44667    36536    -8131     
  Branches     16611    14522    -2089     
===========================================
- Hits         37927    27816   -10111     
+ Misses        4756     4302     -454     
- Partials      1984     4418    +2434     
Files with missing lines Coverage Δ
src/celeritas/global/CoreState.hh 34.61% <100.00%> (-34.62%) ⬇️
src/celeritas/optical/OpticalCollector.cc 87.83% <100.00%> (-6.83%) ⬇️
src/celeritas/optical/OpticalCollector.hh 100.00% <ø> (+7.14%) ⬆️
src/celeritas/optical/gen/OffloadAction.cc 80.43% <100.00%> (-7.81%) ⬇️
src/celeritas/optical/gen/OffloadAction.hh 85.71% <100.00%> (ø)
src/celeritas/optical/gen/OffloadData.hh 76.92% <100.00%> (-23.08%) ⬇️
src/celeritas/optical/gen/OffloadGatherAction.hh 100.00% <100.00%> (ø)
src/celeritas/optical/gen/ScintillationOffload.hh 76.31% <100.00%> (-17.44%) ⬇️
src/celeritas/optical/gen/OffloadGatherAction.cc 79.16% <88.88%> (-10.84%) ⬇️
...tas/optical/gen/detail/OffloadPreGatherExecutor.hh 70.00% <80.00%> (ø)
... and 3 more

... and 1085 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

bug Something isn't working physics Particles, processes, and stepping algorithms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant