boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
313 stars 74 forks source link

Extend fraction to weighted samples #367

Open HDembinski opened 1 year ago

HDembinski commented 1 year ago

We have a fraction accumulator now, but it does not work correctly for weighted samples. However, we definitely need this in high-energy physics because we often estimate the efficiency of some detector from weighted simulation samples.

There are several ways how this could be implemented 1) New class weighted_fraction<T> 2) Specialization fraction<weighted_sum<T>> 3) Template specialization fraction<T, bool weight_support = False>

Number 3) is my least favored. I like 2), if that's feasible.

Ping @henryiii @gohil-jay @jpivarski

HDembinski commented 1 year ago

For those interest, the math for weighted fractions is discussed here https://arxiv.org/abs/2110.00294