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
24 {
25 fSum++;
26 fSum2++;
27 return *this;
28 }
29
31 {
32 RBinWithError old = *this;
33 operator++();
34 return old;
35 }
36
38 {
39 fSum += w;
40 fSum2 += w * w;
41 return *this;
42 }
43
45 {
46 fSum += rhs.fSum;
47 fSum2 += rhs.fSum2;
48 return *this;
49 }
50
51 RBinWithError &operator*=(double factor)
52 {
53 fSum *= factor;
54 fSum2 *= factor * factor;
55 return *this;
56 }
57
63
64 void AtomicAdd(double w)
65 {
68 }
69
70 /// Add another bin content using atomic instructions.
71 ///
72 /// \param[in] rhs another bin content that must not be modified during the operation
74 {
77 }
78};
79
80} // namespace Experimental
81} // namespace ROOT
82
83#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.