A self comparison method to measure distortions of fine gratings and to characterize electron beam systems