Histograming/Sink/Utils.h: Fix calculation of stats for (profile) histograms
Closes #351 (closed)
Based on top of !1685 (closed) so includes the fixes there, to avoid printing empty histograms.
Fixes a number of issues in the calculations of histogram stats :-
- Fix bin values used for profile histograms, that was not taking the correct (weighted) bin values into account.
- Fix a bug in the calculation of the bin central value for profiles, that had an offset of one bin.
- Also adds protection against
sqrt(-ve)
when values are expected to be zero, but due to machine (im)precision could fluctuate below zero.
Edited by Marco Clemencic