legend-exp / remage

Simulation framework for germanium experiments
https://remage.readthedocs.io
GNU Lesser General Public License v3.0
4 stars 5 forks source link

Pre-compute rough distance to HPGe surface #154

Open gipert opened 3 days ago

gipert commented 3 days ago

We should investigate whether there is a simple way to roughly determine the distance of energy depositions from the HPGe surface. This would be very useful in post-processing to fold the activeness map only with points that are reasonably close to the surface, and therefore speed up computation.

One idea could be to define an additional, nested, sensitive volume, but I think this has several downsides.

EricMEsch commented 2 days ago

My first idea regarding a really simple solution to estimate an upper boundary on the distance: Take the vector between where the particle entered the volume and the energy deposition. You could then calculate the distance to the entrance point. The real distance to the closest surface will always be equal or less.

That would be a simple way to get an upper boundary, but i guess we rather need a lower boundary?

EricMEsch commented 2 days ago

A better option i think would be to use the ComputeStep() function of the G4Navigator and sample a few directions. Although i am not sure about how computational intensive that would be, but certainly better than nested volumes.

ManuelHu commented 2 days ago

There are also some geometry functions from geant directly (on G4VSolid): DistanceToIn, DistanceToOut

https://github.com/Geant4/geant4/blob/e58e650b32b961c8093f3dd6a2c3bc917b2552be/source/geometry/management/include/G4VSolid.hh#L123-L158

I am unsure, DistanceToOut seems right for inside points? edit: but I don't know how well they perform...

The distance can be an underestimate.

this worries me a bit, but it might be okay for our use case?

gipert commented 1 day ago

They sound useful but I don't know what they do, we should have a look at the source code...