Step Limits Forgotten?

Hello,
I am attempting to enable user step limits in a specific volume (“boundaryPV”; spans 150x150x5000mm) via the G4UserLimits class. The volume boundaryPV holds a daughter volume (“daughterPV”) which does not share edges with boundaryPV. The simulation obeys my limits while inside boundaryPV, but seems to occasionally fail when entering boundaryPV.

For example of a successful entrance, see:

*** G4Navigator::ComputeStep: ***
Volume = World - Proposed step length = 91.1478
----- Upon exiting :
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,0) Exiting = 0 Entering = 1 BlockedPhysicalVolume= boundaryPV
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (-16.773248,3.6383308,-2565.7303)
PreviousSftOrigin = (-16.773248,3.6383308,-2565.7303)
PreviousSafety = 65.726752
Returned step= 65.7303 Safety = 65.7268
*** G4Navigator::LocateGlobalPointAndSetup: ***
Called with arguments:
Globalpoint = (-16.779452,3.6378361,-2500)
RelativeSearch = 1
----- Upon entering:
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,0) Exiting = 0 Entering = 1 BlockedPhysicalVolume= boundaryPV
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (-16.773248,3.6383308,-2565.7303)
PreviousSftOrigin = (-16.773248,3.6383308,-2565.7303)
PreviousSafety = 65.726752
Return value = new volume = boundaryPV
----- Upon exiting:
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,0) Exiting = 0 Entering = 0 BlockedPhysicalVolume= None
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (-16.779452,3.6378361,-2500)
PreviousSftOrigin = (-16.773248,3.6383308,-2565.7303)
PreviousSafety = 65.726752
*** G4Navigator::ComputeStep: ***
Volume = boundaryPV - Proposed step length = 1
----- Upon exiting :
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,0) Exiting = 0 Entering = 0 BlockedPhysicalVolume= None
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (-16.779452,3.6378361,-2500)
PreviousSftOrigin = (-16.779452,3.6378361,-2500)
PreviousSafety = 0
Returned step= 9e+99 Requested step= 1 Safety = 0

However, the step limits are occasionally disobeyed when entering boundaryPV:

*** G4Navigator::ComputeStep: ***
Volume = boundaryPV - Proposed step length = 166318
----- Upon exiting :
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,-1) Exiting = 0 Entering = 1 BlockedPhysicalVolume= daughterPV
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (7.2337165,0.21567678,2500)
PreviousSftOrigin = (7.2337165,0.21567678,2500)
PreviousSafety = 0
Returned step= 1.1 Safety = 0
*** G4Navigator::LocateGlobalPointAndSetup: ***
Called with arguments:
Globalpoint = (7.3085994,0.04244853,2498.9163)
RelativeSearch = 1
----- Upon entering:
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,-1) Exiting = 0 Entering = 1 BlockedPhysicalVolume= daughterPV
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (7.2337165,0.21567678,2500)
PreviousSftOrigin = (7.2337165,0.21567678,2500)
PreviousSafety = 0
Return value = new volume = daughterPV
----- Upon exiting:
The current state of G4Navigator is:
ValidExitNormal= 0 ExitNormal = (0,0,-1) Exiting = 0 Entering = 0 BlockedPhysicalVolume= None
BlockedReplicaNo = -1 LastStepWasZero = 0
Current Localpoint = (7.3085994,0.04244853,2498.9163)
PreviousSftOrigin = (7.2337165,0.21567678,2500)
PreviousSafety = 0

While looking for the cause, I have noted that in the successful case, the “Entering” flag is set to 0 when the particle is on the surface of boundaryPV while, in the failed case, this flag is 1. Additionally, the successful case has “BlockedPhysicalVolume” set to boundaryPV while the failed case has it set to daughterPV.

Any suggestions as to why this failure occurs and how I can fix it?

Thank you!

As an update, investigation into the current physics processes seems to suggest that the step limiting is forgotten for photons. For example, see the following processes and proposed step lengths for an electron (bolding added by me):

Process UserSpecialCut proposes limit=1.79769e+308
Process StepLimiter proposes limit=1
Process electronNuclear proposes limit=1.79769e+308
Process CoulombScat proposes limit=1.79769e+308
Process eBrem proposes limit=493300
Process eIoni proposes limit=1.79769e+308
Process CoupledTransportation proposes limit=1.79769e+308

While those for a photon are:

Process UserSpecialCut proposes limit=1.79769e+308
Process photonNuclear proposes limit=1.79769e+308
Process Rayl proposes limit=5306.93
Process conv proposes limit=1.79769e+308
Process compt proposes limit=202041
Process phot proposes limit=11.6296
Process CoupledTransportation proposes limit=1.79769e+308

This was confirmed by changing the primary to a photon and noticing the error immediately.

The issue seemed to be caused by a local DistanceToIn function returning the wrong value

Hello,

something is problematic in your Physics List: for electrons you have both G4UserSpecialCuts and StepLimiter. StepLimiter should never return a limit “1”, it should be “0” or DBL_MAX. Photon transport seems to be correct.

VI

Hello,
Yes - I think you are correct. We did also find a bug in a geometry class that we were working on. With these fixed, the problem no longer appears.

Thank you for the help!