Step length differs from the magnitude of step DeltaPosition

Dear experts,

In my simulations, I want to get a random point along the current step under analysis in SteppingAction. So I thought that I could employ either G4UniformRand()(step->GetStepLength())(step->GetDeltaPosition()).unit() or G4UniformRand()*(step->GetDeltaPosition()).

However, I notice that the results aren’t always the same, and ((step->GetDeltaPosition()).mag())/(step->GetStepLength()) is not always equal to 1.

I suspect it should be due to the AlongStepDoIt modifications on the step. My question is two fold:

  1. whether my understanding of the problem source is correct?
  2. whether G4UniformRand()*(step->GetDeltaPosition()) is the proper way to get a random point along the step? And if so, should one be extra careful in using step->GetStepLength() as the true step length?

Many thanks!

1 Like