We give a prescription for finding optimized correlation functions for the
extraction of the gap to the first excited state within quantum Monte Carlo
simulations. We demonstrate that optimized correlation functions provide a more
accurate reading of the gap when compared to other `non-optimized' correlation
functions and are generally characterized by considerably larger
signal-to-noise ratios. We also analyze the cost of the procedure and show that
it is not computationally demanding. We illustrate the effectiveness of the
proposed procedure by analyzing several exemplary many-body systems of
interacting spin-1/2 particles.Comment: 11 pages, 5 figure