Treatment of weights in YODA
Suggested guiding principles:
- Weight treatment must allow arbitrary partitioning of data: fill1 + fill2 + fill3 == fill1 + (fill2 + fill3) == (fill1 + fill2) + fill3, etc.
- The whole point of weights is that they allow more rapid convergence of distributions, but the errors must be equivalent to filling with a larger number of samples with smaller weights which add up to the same.
- Negative weights must be treated carefully: filling a bin with +w and later with -w should contribute a value of zero, but the errors necessarily scale as the differing negative/positive contributions indicate significant uncertainty/fluctuation in the bin content.
Where bin/histo statistics questions are asked and there have been insufficient fills, a LowStatsError? exception is thrown rather than return a magic number. These conditions are minimised as far as possible. The decision re. whether there is sufficient information in the bin to calculate e.g. the bin mean or its standard error is typically taken based on the effective number of fills/entries, sumW2/sumW2.