Optimization of the detector-target geometry for in-beam singles and coincidence γ-ray spectroscopy