FairRoot/PandaRoot
RunningStats.h
Go to the documentation of this file.
1 /*
2  * this header file and its implementation are provided by John D. Cook
3  * please visit: http://www.johndcook.com/blog/skewness_kurtosis/ for more information.
4  * unfortunately, he does not provide any copyright information, just this code.
5  */
6 
7 
8 #ifndef RUNNINGSTATS_H
9 #define RUNNINGSTATS_H
10 
12 {
13 public:
14  RunningStats();
15  void Clear();
16  void Push(double x);
17  long long NumDataValues() const;
18  double Mean() const;
19  double Variance() const;
20  double StandardDeviation() const;
21  double Skewness() const;
22  double Kurtosis() const;
23 
24  friend RunningStats operator+(const RunningStats a, const RunningStats b);
26 
27 private:
28  long long n;
29  double M1, M2, M3, M4;
30 };
31 
32 #endif
33 
RunningStats & operator+=(const RunningStats &rhs)
TTree * b
double Kurtosis() const
void Push(double x)
Int_t a
Definition: anaLmdDigi.C:126
double StandardDeviation() const
friend RunningStats operator+(const RunningStats a, const RunningStats b)
double Variance() const
double Skewness() const
Double_t x
double Mean() const
long long n
Definition: RunningStats.h:28
long long NumDataValues() const