Theory of ion beam induced charge collection in detectors based on the extended Shockley–Ramo theorem