ZEMAX Users' Knowledge Base - http://www.zemax.com/kb
How is Ln Different to Hn?
http://www.zemax.com/kb/articles/284/1/How-is-Ln-Different-to-Hn/Page1.html
By Mark Nicholson
Published on 25 September 2009
 
Question; ZEMAX supports both the Hn and Ln filter strings. How are these different, and when should I use one over the other? 

Hn and Ln

Question; ZEMAX supports both the Hn and Ln filter strings. How are these different, and when should I use one over the other? 

The filter string Hn returns TRUE if the ray hits object n, and Ln returns TRUE if the last object hit was object n.

Imagine you are doing a stray light analysis, with rays bouncing around the system. Ultimately some are detected on a detector object. These are the stray rays you want to save. Let's also imagine that the average stray ray takes 200 reflections/refractions/splittings etc to arrive at the detector.

The average ray history is therefore 200 segments long. If you use Hn to find those rays that hit object n, ZEMAX will start with the first ray segment, test it, and if the segment did not hit object n it will go on the next. Ultimately after an average of 200 tests it will find the TRUE condition.

When you test with Ln, ZEMAX goes straight to the last segment and tests only that. This is clearly faster than testing all the segments. This can be substantially faster than using Hn.

Usually you would set the material of object n to ABSORB to ensure that any ray that hits it terminates and is therefore the last segment.