marcguetg / h5particle

1 stars 0 forks source link

Add rotation matrix #5

Closed ChristopherMayes closed 6 years ago

ChristopherMayes commented 6 years ago

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

DavidSagan commented 6 years ago

This should be made optional in case the particles are not all at the same longitudinal position.

marcguetg commented 6 years ago

Fine with me.

DavidSagan commented 6 years ago

I have put this in the draft standard