Three‐dimensional ray tracing of electrostatic cyclotron harmonic waves and Z mode electromagnetic waves in the magnetosphere