Generalizing MCSampler infinite loop break
MCSampler can get stuck in a (practically) infinite loop if there is no contribution to the integral. This can happen either if the prior is zero, or if the actual integrand is zero. A fix was made for the prior case, but not the integrand, which was causing some of our high-SNR jobs to stall. This MR extends this fix to the integrand, and refactors the fix a little bit to minimize repetition.