ATLAS Offline Software
Loading...
Searching...
No Matches
Averager.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#ifndef LArSamples_Averager_H
11#define LArSamples_Averager_H
12
14#include "TMatrixD.h"
15#include "TVectorD.h"
16#include "TMath.h"
17
19
20namespace LArSamples {
21
22 class Averager : public IndexRange
23 {
24
25 public:
26
28 Averager(unsigned int n = 0);
29 Averager(unsigned int lwb, unsigned int upb);
30 Averager(const Averager&) = default;
31
32 virtual ~Averager() { }
33
34 bool add(double xMin = -DBL_MAX, double xMax = DBL_MAX);
35 bool fill(const TVectorD& values, double w = 1);
36 bool append(const Averager& other);
37
38 double mean(unsigned int i) const;
39 double meanError(unsigned int i) const;
40
41 double rms(unsigned int i) const;
42 double covariance(unsigned int i, unsigned j) const;
43 double covarianceError(unsigned int i, unsigned j) const;
44
45 TVectorD means() const;
46 TVectorD meanErrors() const;
47
49
52
53 unsigned int nVariables() const { return m_xMin.size(); }
54 int lwb() const { return m_lwb; }
55 int upb() const { return m_lwb + nVariables() - 1; }
56
57 unsigned int nEntries() const { return m_n; }
58 double totalWeight() const { return m_wTot; }
59
60 const TVectorD& sum1() const { return m_sum1; }
61 const TVectorD& sum2() const { return m_sum2; }
62 const TMatrixD& sum11Matrix() const { return m_sum11Matrix; }
63 const TMatrixD& sum21Matrix() const { return m_sum21Matrix; }
64 const TMatrixD& sum22Matrix() const { return m_sum22Matrix; }
65
66 Averager& operator=(const Averager& other);
67 static double safeSqrt(double x);
68
69 private:
70
71 bool prepare();
72
73 unsigned int m_n;
74 double m_wTot;
75 int m_lwb;
76
77 std::vector<double> m_xMin, m_xMax;
78 TVectorD m_sum1, m_sum2;
80 };
81}
82
83#endif
#define x
storage of the time histories of all the cells
Definition Averager.h:23
Averager(const Averager &)=default
Averager & operator=(const Averager &other)
Definition Averager.cxx:29
bool fill(const TVectorD &values, double w=1)
Definition Averager.cxx:69
bool append(const Averager &other)
Definition Averager.cxx:94
double covariance(unsigned int i, unsigned j) const
Definition Averager.cxx:221
const TMatrixD & sum22Matrix() const
Definition Averager.h:64
const TVectorD & sum1() const
Definition Averager.h:60
double mean(unsigned int i) const
Definition Averager.cxx:191
const TMatrixD & sum21Matrix() const
Definition Averager.h:63
bool add(double xMin=-DBL_MAX, double xMax=DBL_MAX)
Definition Averager.cxx:46
CovMatrix meanErrorMatrix() const
Definition Averager.cxx:138
Averager(unsigned int n=0)
Constructor.
Definition Averager.cxx:15
double covarianceError(unsigned int i, unsigned j) const
Definition Averager.cxx:231
const TMatrixD & sum11Matrix() const
Definition Averager.h:62
TVectorD means() const
Definition Averager.cxx:112
std::vector< double > m_xMax
Definition Averager.h:77
TMatrixD m_sum21Matrix
Definition Averager.h:79
double meanError(unsigned int i) const
Definition Averager.cxx:201
unsigned int nEntries() const
Definition Averager.h:57
double rms(unsigned int i) const
Definition Averager.cxx:211
double totalWeight() const
Definition Averager.h:58
int lwb() const
Definition Averager.h:54
CovMatrix covarianceMatrix() const
Definition Averager.cxx:153
int upb() const
Definition Averager.h:55
CovMatrix covarianceMatrixErrors() const
Definition Averager.cxx:167
unsigned int nVariables() const
Definition Averager.h:53
TMatrixD m_sum11Matrix
Definition Averager.h:79
const TVectorD & sum2() const
Definition Averager.h:61
static double safeSqrt(double x)
Definition Averager.cxx:241
TVectorD meanErrors() const
Definition Averager.cxx:124
std::vector< double > m_xMin
Definition Averager.h:77
virtual ~Averager()
Definition Averager.h:32
TMatrixD m_sum22Matrix
Definition Averager.h:79
unsigned int m_n
Definition Averager.h:73
storage of the time histories of all the cells
Definition IndexRange.h:19