Grating-Based Beam Shaping and Inelastic Interferometry with Free Electrons