G4OpBoundaryProcess may be used to trigger the sensitive detector ProcessHits() method, via /process/optical/boundary/setInvokeSD true (the default) It is only expected to be triggered if the boundary status is Detection [1]. However G4OpBoundaryProcess::PostStepDoIt can call the base G4VDiscreteProcess::PostStepDotIt [2] for other boundary statuses, e.g. StepTooSmall. In this case the sensitive detector ProcessHits() is called without the checks on boundary status and whether setInvokeSD is true. For example, if the setInvokeSD functionality is used with the LXe extended example, by renaming LXePMTSD::ProcessHits_constStep to ProcessHits and removing the code from LXeSteppingAction, we see unwanted calls to ProcessHits. Set /process/optical/boundary/verbose 1 This bug report is based on the investigation into another report [3]. [1] https://geant4.kek.jp/lxr/source/processes/optical/src/G4OpBoundaryProcess.cc#L480 [2] https://geant4.kek.jp/lxr/source/processes/optical/src/G4OpBoundaryProcess.cc#L185 [3] https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2131
The wls example has been updated for release 11. The example now uses G4OpBoundaryProcess::InvokeSD() and it appears to work well.