Theory and Design of Electron Beams