Optimization of the scanning process in the X-ray-beam-induced current method