Analysis of longitudinal field reflection in dielectric gratings