How to use GetMomentumDirection() in the SteppingAction.cc file ?
It depends on where you would like to get your momentum direction. Assuming you need the momentum direction at the pre-step point, you can use the GetMomentumDirection() method of the G4StepPoint class as follow:
G4ThreeVector & prestep_momentum = aStep->GetPreStepPoint()->GetMomentumDirection();
or for track momentum direction:
G4ThreeVector & track_momentum = aStep->GetTrack()->GetMomentumDirection();
or you can get the dynamic particle and then get the momentum direction as follow:
G4ThreeVector & particle_momentum = aStep->GetTrack()->GetDynamicParticle()->GetMomentumDirection();
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.