Monte Carlo studies of positrons in matter. Method and application to annihilation spectra in helium gas