Geant4 simulation of the PSI LEM beam line: energy loss and muonium formation in thin foils and the impact of unmoderated muons on the μSR spectrometer. (16th October 2015)