Problem 1032

Summary: G4Step.IsFirstStepInVolume() always returns false
Product: Geant4 Reporter: Kevin Lynch <krlynch>
Component: trackAssignee: John Apostolakis <John.Apostolakis>
Status: CLOSED FIXED    
Severity: minor CC: kurasige
Priority: P5    
Version: 9.1   
Hardware: All   
OS: All   

Description Kevin Lynch 2008-11-07 18:37:34 CET
Both the G4Step.IsFirstStepInVolume() and G4Step.IsLastStepInVolume() members always return false.

While I just independently discovered this problem using 9.1.p02 and 9.1.p03, there is also a post in the hypernews forum from August 2008:
http://hypernews.slac.stanford.edu/HyperNews/geant4/get/eventtrackmanage/829.html

There is an interaction with G4VParticleChange; it's likely there's a bug in there somewhere.  I can't follow the thread of control well enough to suggest a patch.

In my application, there's a simple user workaround: I check that the physical volumes at the PreStepPoint and PostStepPoint are different in the SensitiveDetector that needs this information.  But it would still be nice if the members worked.
Comment 1 kurasige 2008-11-07 19:54:06 CET
This method is introduced from release 8.1.
G4Step or G4VParticleChange can not know that the step is the first step in the volume by itself. So, This flag is expected set/re-set by G4Transportaion process. But G4Transprotaion and related classes have never set this flag from the method is added.
Comment 2 John Apostolakis 2009-10-21 18:02:24 CEST
Thanks for report.  We will correct this.

John
Comment 3 John Apostolakis 2010-09-13 18:16:42 CEST
A candidate fix has been prepared G4Transportation for the case where a particle does not feel the effect of an EM field (i.e. if it is neutral or is in a location where the EM field is zero.)

The case when a particle must propagate in a field is not yet addressed.
Comment 4 John Apostolakis 2014-12-16 19:51:40 CET
I have identified a number of improvements of G4PropagatorInField and G4Transportation that resolve this issue.

I am creating a tag so that they can be tested. Once they are tested, we can upload a tarball that will work with the most recent Geant4 release(s).
Comment 5 John Apostolakis 2015-01-26 10:41:07 CET
Found that problem persisted in the case that parallel geometries existed.

To correct this, I propagated fixes to G4CoupledTransportation.

Unfortunately a problem persists in this case.  I am investigating it.
Comment 6 John Apostolakis 2015-02-04 18:40:11 CET
I have corrected the problem introduced in the new code.

The fix now works.