58 double sumWeights = 0;
59 double sumWeightsSquared = 0;
69 sumWeights += rhs.sumWeights;
70 sumWeightsSquared += rhs.sumWeightsSquared;
81 inline void Fill(T x,
double weight=1.0)
84 v.sumWeights += weight;
85 v.sumWeightsSquared += weight*weight;
88 inline long long int Entries()
const {
return entries;}
89 inline size_t size()
const {
return data.size();}
90 std::map<T, Bin>
Result()
const
92 std::map<T, Bin> result;
93 for (
const auto& kv : data)
96 v.value = kv.second.sumWeights;
97 v.error = std::sqrt(kv.second.sumWeightsSquared);
104 typedef typename std::map<T, BinWorking>::iterator
iterator;
105 typedef typename std::map<T, BinWorking>::const_iterator const_iterator;
106 iterator begin() {
return data.begin();}
108 const_iterator begin()
const {
return data.begin();}
109 const_iterator end()
const {
return data.end();}
110 bool empty()
const {
return data.empty();}
112 BinWorking& operator[](
const long long int key) {
return data[key];}
113 const BinWorking& operator[](
const long long int key)
const {
return data.at(key);}
115 bool HasAbscissa(T value)
const {
return data.find(value) != data.end();}
118 std::map<T, BinWorking> data;
119 long long int entries;