BNLNPPS / esi-g4ox

0 stars 0 forks source link

Understand how does "stepping" work together with Ray Tracing in Opticks #25

Closed ggalgoczi closed 1 month ago

ggalgoczi commented 1 month ago

In ray-tracing the code just checks what is the next boundary. Then it retrieves the potential physical processes that can happen on the boundary. However Rayleigh scattering and other processes happen along the step.

Essentially how is Optix combined with MC?

ggalgoczi commented 1 month ago

The magic happens here: https://github.com/BNLNPPS/esi-opticks/blob/esi/optixrap/cu/propagate.h#L134

Essentially a path -- calculated from the mean free path with random number to simulate stochasticity -- for all physical processes are calculated together with the distance to the next boundary.

Then they are compared and the process with the shortest length happens. Will reopen this issue when we get to the implementation and something will not be clear.

plexoos commented 1 month ago

The optixrap module isn't used in g4cx/tests/G4CXTest.cc or g4cx/tests/G4CXApp.h, which is why it hasn't been on my radar until now.

ggalgoczi commented 1 month ago

It is likely that those examples do not do proper optical photon propagation on GPU, right?

By the way CaTS uses G4CXOpticks.

ggalgoczi commented 1 month ago

As you mentioned optixrap is not used anymore, it was replaced by qudarap that takes care of "generation and propagation".

ggalgoczi commented 1 month ago

Can I close this one @plexoos ?

plexoos commented 1 month ago

I don't really have anything to add here. Again, I hope our simple simulation based on Opticks runs the photons on both the CPU (Geant4) and GPU, but we'll confirm this as we go.