Optimization of toroidal electrostatic analyzers for measurements of low energy particles in space