Skip to content

Conversation

@ManuelHu
Copy link
Contributor

@ManuelHu ManuelHu commented Sep 8, 2025

for now, this is just meant as a reference for (manual) testing

@ManuelHu ManuelHu marked this pull request as draft September 8, 2025 11:58
@gipert gipert linked an issue Sep 8, 2025 that may be closed by this pull request
@gipert gipert added performance Memory, CPU, storage stacking action labels Sep 8, 2025
@tdixon97
Copy link
Contributor

tdixon97 commented Sep 8, 2025

Wow, nice work Manuel! I think this will have a huge impact on many simulations... not just optics but eg. radiogenic sims of far sources (cryostat?)

@ManuelHu ManuelHu force-pushed the stack-volume branch 2 times, most recently from 70aa66c to 2a87a5b Compare September 10, 2025 08:37
@ManuelHu
Copy link
Contributor Author

the following macro is helful for testing:

/RMG/Output/ActivateOutputScheme VolumeStacker

/run/initialize

/RMG/Output/Germanium/EdepCutLow 10 keV
# note: this does now _not_ just affect the photons, but also the others
/RMG/Output/Germanium/DiscardPhotonsIfNoGermaniumEdep true

/RMG/Output/VolumeStacker/VolumeSafety 0.1 cm
/RMG/Output/VolumeStacker/VolumeName lar

however, the code does not yet work. Apparently, ComputeSafety always return 0...

@EricMEsch
Copy link
Contributor

I just wanted to ask if you can not just use RMGOutputTools::distance_to_surface(pv, position) instead, but seems like you already adjusted that.

@tdixon97
Copy link
Contributor

I did some tests and did not observe a significant speed-up.
I wonder if this can related to the "stages" in the stacking action (this I never understood), in other words.

If we do not stack some e- tracks, for example they are within safety what happens to the optical tracks produced by the e-s, does the usual optical stacking apply?
I am wondering since I found if I set safety quite high I actually get a slow-down of the simulation (factor of 2)

@ManuelHu
Copy link
Contributor Author

If I did not introduce any error in the logic, we should still have a two-stage stack in the end (there is actually no way to stack into higher stages in a sane modular way... This really is a state machine in the end.)

  1. stage = 0 -> everything immediately to track
  2. stage = 1 -> everything not immediately to track (photons until now, also now e-/e+ in bulk)

The important option is /RMG/Output/Germanium/DiscardPhotonsIfNoGermaniumEdep true, because that generally controls whether stage 1 will be transitioned to, depending on the germanium energy.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the optical photon stacking action

4 participants