Problem 2222

Summary: OpBoundaryProcess triggers InvokeSD unexpectedly
Product: Geant4 Reporter: Daren Sawkey <daren.sawkey>
Component: processes/opticalAssignee: Daren Sawkey <daren.sawkey>
Status: RESOLVED WORKSFORME    
Severity: minor    
Priority: P4    
Version: 10.6   
Hardware: All   
OS: All   

Description Daren Sawkey 2020-01-30 15:30:26 CET
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
Comment 1 Daren Sawkey 2021-09-14 13:34:56 CEST
The wls example has been updated for release 11. The example now uses G4OpBoundaryProcess::InvokeSD() and it appears to work well.