Optimization of lamellar gratings in Ledatron and Orotron tubes