Return the transformation needed to rotate p to the z-axis and boost it to its CMS, then boost it along the z-axis and rotate it so that it ends up with momentum q.
Return the transformation needed to rotate p to the z-axis and boost it to its CMS, then boost it along the z-axis and rotate it so that it ends up with momentum q.