Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-14 10:31:08

0001 /// \file
0002 /// \warning This is part of the %ROOT 7 prototype! It will change without notice. It might trigger earthquakes.
0003 /// Feedback is welcome!
0004 
0005 #ifndef ROOT_RBinWithError
0006 #define ROOT_RBinWithError
0007 
0008 namespace ROOT {
0009 namespace Experimental {
0010 
0011 /**
0012 A special bin content type to compute the bin error in weighted filling.
0013 
0014 \warning This is part of the %ROOT 7 prototype! It will change without notice. It might trigger earthquakes.
0015 Feedback is welcome!
0016 */
0017 struct RBinWithError final {
0018    double fSum = 0;
0019    double fSum2 = 0;
0020 
0021    RBinWithError &operator++()
0022    {
0023       fSum++;
0024       fSum2++;
0025       return *this;
0026    }
0027 
0028    RBinWithError operator++(int)
0029    {
0030       RBinWithError old = *this;
0031       operator++();
0032       return old;
0033    }
0034 
0035    RBinWithError &operator+=(double w)
0036    {
0037       fSum += w;
0038       fSum2 += w * w;
0039       return *this;
0040    }
0041 
0042    RBinWithError &operator+=(const RBinWithError &rhs)
0043    {
0044       fSum += rhs.fSum;
0045       fSum2 += rhs.fSum2;
0046       return *this;
0047    }
0048 };
0049 
0050 } // namespace Experimental
0051 } // namespace ROOT
0052 
0053 #endif