Dear everyon:
I want to change the momentum direction of particle after the particle hit a specific volume. I use the function: SetMomentumDirection(newMomentumDirection) in UserSteppingAction(). But this can only change the momentum direction for one step. How to change the momentum direction and make the particle maintain this momentum direction in the after step?
if (volumename == "physicdirectionchanger")
{
G4Track* theTrack = const_cast<G4Track*>(track);
G4ThreeVector newMomentumDirection = G4ThreeVector(0,1,1);
theTrack->SetMomentumDirection(newMomentumDirection);
}
This is the code i used.
1 Like