I suggest adding a rotation matrix to the root of a particle dump. This will serve to transform position and momentum coordinates between the local and global frames. In Bmad and MAD this is called the 'W matrix' or Wmat. The rule is then for 3d position vectors: R_local (local coordinates), R_global (global coordinates), R_frame (offset of local frame relative to the global coordinates). The transformations are then:
I suggest adding a rotation matrix to the root of a particle dump. This will serve to transform position and momentum coordinates between the local and global frames. In Bmad and MAD this is called the 'W matrix' or Wmat. The rule is then for 3d position vectors: R_local (local coordinates), R_global (global coordinates), R_frame (offset of local frame relative to the global coordinates). The transformations are then:
R_global = WmatR_local + R_frame and therefore: R_local = Wmat^T (R_global - R_frame)
Momenta are transformed as: P_global = Wmat P_local P_local = Wmat^T P_global