Electron beams and magnetic fields