CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AutocorrelationAnalyzer.h
Go to the documentation of this file.
1 #ifndef Statistics_AutocorrelationAnalyzer_h
2 #define Statistics_AutocorrelationAnalyzer_h
3 
4 #include "CLHEP/Matrix/Vector.h"
5 #include "CLHEP/Matrix/SymMatrix.h"
6 #include "CLHEP/Matrix/Matrix.h"
7 #include <iosfwd>
8 
16 {
17 public:
18  explicit AutocorrelationAnalyzer(int size);
19 
21  double mean(int i);
22  double covariance(int i, int j);
23  double correlation(int i, int j);
24 
25  template<class T>
26  void analyze(const T & t)
27  {
28  for (int ii = 0; ii < theSize; ii++) {
29  theMeans[ii] += t[ii];
30  for (int ij = ii; ij < theSize; ij++) {
31  theCovariances[ii][ij] += t[ii] * t[ij];
32  }
33  }
34  ++theNTotal;
35  }
36 
37  friend std::ostream & operator<<(std::ostream & os, AutocorrelationAnalyzer & aa);
38 
39 private:
40  void calculate();
41 
42  int theSize;
43  int theNTotal;
44  CLHEP::HepVector theMeans;
45  CLHEP::HepSymMatrix theCovariances;
46  CLHEP::HepSymMatrix theCorrelations;
48 };
49 
50 #endif
51 
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int j
Definition: DBlmapReader.cc:9
double mean(int i)
indexing starts from 0
CLHEP::HepSymMatrix theCorrelations
double covariance(int i, int j)
double correlation(int i, int j)
friend std::ostream & operator<<(std::ostream &os, AutocorrelationAnalyzer &aa)
long double T
CLHEP::HepSymMatrix theCovariances
tuple size
Write out results.