Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RBinWithError.hxx
Go to the documentation of this file.
1/// \file
2/// \warning This is part of the %ROOT 7 prototype! It will change without notice. It might trigger earthquakes.
3/// Feedback is welcome!
4
5#ifndef ROOT_RBinWithError
6#define ROOT_RBinWithError
7
8#include "RHistUtils.hxx"
9
10namespace ROOT {
11namespace Experimental {
12
13/**
14A special bin content type to compute the bin error in weighted filling.
15
16\warning This is part of the %ROOT 7 prototype! It will change without notice. It might trigger earthquakes.
17Feedback is welcome!
18*/
20 double fSum = 0;
21 double fSum2 = 0;
22
23 explicit operator float() const { return fSum; }
24 explicit operator double() const { return fSum; }
25
27 {
28 fSum++;
29 fSum2++;
30 return *this;
31 }
32
34 {
35 RBinWithError old = *this;
36 operator++();
37 return old;
38 }
39
41 {
42 fSum += w;
43 fSum2 += w * w;
44 return *this;
45 }
46
48 {
49 fSum += rhs.fSum;
50 fSum2 += rhs.fSum2;
51 return *this;
52 }
53
54 RBinWithError &operator*=(double factor)
55 {
56 fSum *= factor;
57 fSum2 *= factor * factor;
58 return *this;
59 }
60
66
67 void AtomicAdd(double w)
68 {
71 }
72
73 /// Add another bin content using atomic instructions.
74 ///
75 /// \param[in] rhs another bin content that must not be modified during the operation
77 {
80 }
81};
82
83} // namespace Experimental
84} // namespace ROOT
85
86#endif
std::enable_if_t< std::is_arithmetic_v< T > > AtomicInc(T *ptr)
std::enable_if_t< std::is_integral_v< T > > AtomicAdd(T *ptr, T val)
A special bin content type to compute the bin error in weighted filling.
RBinWithError & operator+=(double w)
RBinWithError & operator+=(const RBinWithError &rhs)
RBinWithError & operator*=(double factor)
void AtomicAdd(const RBinWithError &rhs)
Add another bin content using atomic instructions.