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.
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.
Thanks for report. We will correct this. John
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.
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).
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.
I have corrected the problem introduced in the new code. The fix now works.