This can be as simple as inspecting the observation line in your analyzer file. For a tutorial please look at:
Gratings Created with VB Script
All you would need in your project is an additional line detector before the input plane to detect and reflections that occur.
Regards
+1