Secondary particles emittance

Hello, is there a function in Geant4 to study the secondary particle emittance? I mean that I store the secondary particles in a ROOT files, and I would like to store information to get graphs like in this presentation

I mean the plots x-x’ @z=value

I think that for the x I can use step->GetTrack()->GetPosition().x(); but

  1. what about the angle x’ ? Is there a function in Geant?
  2. How can I store at a fixed z value?

Thank you

I solved myself the first point in this way

double Secxprime=acos((step->GetTrack()->GetDynamicParticle()->GetMomentum().x())/(step->GetTrack()->GetDynamicParticle()->GetTotalMomentum()));

but…what about the second point?