CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Accumulator.h
Go to the documentation of this file.
1 #ifndef Statistics_Accumulator_h
2 #define Statistics_Accumulator_h
3 
9 #include <iosfwd>
10 #include<cmath>
11 
13 {
14 public:
15  Accumulator();
16 
17  void addEntry(double value, double weight=1.);
18 
19  double mean() const;
20 
21  double variance() const;
22 
23  double sigma() const {return std::sqrt(variance());}
24 
25  double weightedMean() const;
26 
27  unsigned long nEntries() const {return n_;}
28 
29 private:
30  double sum_;
31  double sumOfSquares_;
32  double weightedSum_;
33  double sumOfWeights_;
34  unsigned long n_;
35 };
36 
37 std::ostream & operator<<(std::ostream & os, const Accumulator & stat);
38 
39 #endif
40 
void addEntry(double value, double weight=1.)
Definition: Accumulator.cc:14
double mean() const
Definition: Accumulator.cc:23
double weightedSum_
Definition: Accumulator.h:32
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
unsigned long n_
Definition: Accumulator.h:34
unsigned long nEntries() const
Definition: Accumulator.h:27
double sigma() const
Definition: Accumulator.h:23
double sum_
Definition: Accumulator.h:30
T sqrt(T t)
Definition: SSEVec.h:18
double weightedMean() const
Definition: Accumulator.cc:35
double variance() const
Definition: Accumulator.cc:28
double sumOfSquares_
Definition: Accumulator.h:31
double sumOfWeights_
Definition: Accumulator.h:33