LMM usage selecting factors and pricing

Is there any example of the usage of LMM to price a mortgage or a swaption?
In particular, How does one select the number of factors when using LMM in the OpenGamma platform?

Thanks in advance