  We present an analytic, Mie theory-based solution for the energy-loss and the
photon-emission probabilities in the interaction of spherical nanoparticles
with electrons passing nearby and through them, in both cathodoluminescence and
electron energy-loss spectroscopies. In particular, we focus on the case of
penetrating electron trajectories, for which the complete fully electrodynamic
and relativistic formalism has not been reported as yet. We exhibit the
efficiency of this method in describing collective excitations in matter
through calculations for a dispersive and lossy system, namely a sphere
described by a Drude permittivity. Subsequently, we use the analytic solution
to corroborate the implementation of electron-beam sources in a
state-of-the-art numerical method for problems in electrodynamics, the
discontinuous Galerkin time-domain (DGTD) method. We show that the two
approaches produce spectra in good mutual agreement, and demonstrate the
versatility of DGTD via simulations of spherical nanoparticles characterized by
surface roughness. The possibility of simultaneously employing both kinds of
calculations (analytic and numerical) facilitates a better understanding of the
rich optical response of nanophotonic architectures excited by fast electron
beams.
