Thanks for doing these tests. I see what is happening. Usually, when an opticalphoton in volume A is incident on the surface with volume B, if it is reflected, it is reflected back into volume A. However, in this case, the opticalphoton hits the edge of the volume, and is reflected into volume C. You can see this be comparing thePostPV in the output above.
Volume C is expHall, which has no RINDEX defined. The boundary status should be both StepTooSmall and NoRINDEX, but it can only be one. It gets set to NoRINDEX, and the check in LXESteppingAction fails.
This is a literal edge case!
What to do?
- you could verify the above by defining RINDEX for the expHall. Maybe also give expHall a short ABSORPTIONLENGTH so that optical photons are not propagated in it.
- without an RINDEX, the correct behaviour is for the opticalphoton to be killed. I believe this would happen correctly, except the SteppingAction check is failing first. You could
- modify the SteppingAction FatalException to allow NoRINDEX (but I don’t know if there are other cases that should correctly fail)
- change the FatalException to JustWarning (we’ve made this change for future Geant4 versions), and make sure they are few, and/or understood
- the probability of this happening must be pretty low (maybe two floats have to be equal). Don’t shoot photons at the edge
I’d consider this a bug, so you can file a bug report if you like.