BristolTopGroup/DailyPythonScripts — pull request #76 by senkin (2014-05-07 15:25:30+00:00)
Title: Fixing the optimal binning procedure

A few fixes have been made to remove inconsistency between two methods of calculating purities and stabilities, used in the optimal binning procedure:
- the first method is based on using the GetBinContent function, the second uses the Integral function;
- the consistency is checked in a new unit test (test/Integral_GetBinContent_consistency.py);
- for all 2D histograms under examination, the overflow bin is moved to the last bin using the fix_overflow function as the ProjectionX/ProjectionY functions in rootpy don't handle them, and that's the way we do it in the unfolding;
- the fix_overflow function has been moved from tools/Unfolding.py to tools/hist_utilities.py as it does not depend on the unfolding.

The corrected binning is a bit different from the one used in the last BAT processing. For example, for MET:
```
bin edges_old = [0.0, 31.0, 58.0, 96.0, 142.0, 1000.0]
bin edges_fixed = [0.0, 28.0, 54.0, 90.0, 134.0, 1000.0]
```
Dropping the statistics requirement in each bin from 400 to 200 events adds an extra bin at 182 GeV.