A Monte Carlo code to simulate the effect of fast secondary electrons on κAB factors and spatial resolution in the TEM