ATLAS Offline Software
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 
10 #ifndef LArSamples_Averager_H
11 #define LArSamples_Averager_H
12 
14 #include "TMatrixD.h"
15 #include "TVectorD.h"
16 #include "TMath.h"
17 
18 #include "LArCafJobs/Definitions.h"
19 
20 namespace 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 
48  CovMatrix meanErrorMatrix() const;
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 
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
LArSamples::Averager::lwb
int lwb() const
Definition: Averager.h:54
LArSamples::Averager::meanError
double meanError(unsigned int i) const
Definition: Averager.cxx:201
IndexRange.h
LArSamples::Averager::sum21Matrix
const TMatrixD & sum21Matrix() const
Definition: Averager.h:63
LArSamples::CovMatrix
TMatrixTSym< double > CovMatrix
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:11
LArSamples::Averager::~Averager
virtual ~Averager()
Definition: Averager.h:32
LArSamples::Averager::sum22Matrix
const TMatrixD & sum22Matrix() const
Definition: Averager.h:64
LArSamples::Averager::Averager
Averager(const Averager &)=default
LArSamples::Averager::append
bool append(const Averager &other)
Definition: Averager.cxx:94
LArSamples::Averager::meanErrors
TVectorD meanErrors() const
Definition: Averager.cxx:124
LArSamples::Averager::fill
bool fill(const TVectorD &values, double w=1)
Definition: Averager.cxx:69
LArSamples::Averager::mean
double mean(unsigned int i) const
Definition: Averager.cxx:191
LArSamples::Averager::operator=
Averager & operator=(const Averager &other)
Definition: Averager.cxx:29
LArSamples
Definition: AbsShape.h:24
LArSamples::Averager::m_sum11Matrix
TMatrixD m_sum11Matrix
Definition: Averager.h:79
LArSamples::Averager::covarianceError
double covarianceError(unsigned int i, unsigned j) const
Definition: Averager.cxx:231
LArSamples::Averager
storage of the time histories of all the cells
Definition: Averager.h:23
LArSamples::Averager::covariance
double covariance(unsigned int i, unsigned j) const
Definition: Averager.cxx:221
x
#define x
LArSamples::Averager::totalWeight
double totalWeight() const
Definition: Averager.h:58
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
LArSamples::Averager::means
TVectorD means() const
Definition: Averager.cxx:112
LArSamples::Averager::m_sum21Matrix
TMatrixD m_sum21Matrix
Definition: Averager.h:79
LArSamples::Averager::sum2
const TVectorD & sum2() const
Definition: Averager.h:61
LArSamples::Averager::meanErrorMatrix
CovMatrix meanErrorMatrix() const
Definition: Averager.cxx:138
LArSamples::Averager::upb
int upb() const
Definition: Averager.h:55
LArSamples::Averager::covarianceMatrixErrors
CovMatrix covarianceMatrixErrors() const
Definition: Averager.cxx:167
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
LArSamples::Averager::covarianceMatrix
CovMatrix covarianceMatrix() const
Definition: Averager.cxx:153
LArSamples::Averager::safeSqrt
static double safeSqrt(double x)
Definition: Averager.cxx:241
LArSamples::Averager::nEntries
unsigned int nEntries() const
Definition: Averager.h:57
LArSamples::Averager::m_xMin
std::vector< double > m_xMin
Definition: Averager.h:77
LArSamples::Averager::m_sum22Matrix
TMatrixD m_sum22Matrix
Definition: Averager.h:79
LArSamples::Averager::sum11Matrix
const TMatrixD & sum11Matrix() const
Definition: Averager.h:62
LArSamples::Averager::sum1
const TVectorD & sum1() const
Definition: Averager.h:60
LArSamples::Averager::m_sum2
TVectorD m_sum2
Definition: Averager.h:78
LArSamples::Averager::prepare
bool prepare()
Definition: Averager.cxx:58
LArSamples::Averager::m_wTot
double m_wTot
Definition: Averager.h:74
LArSamples::Averager::nVariables
unsigned int nVariables() const
Definition: Averager.h:53
LArSamples::Averager::m_n
unsigned int m_n
Definition: Averager.h:73
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
LArSamples::IndexRange
storage of the time histories of all the cells
Definition: IndexRange.h:19
Definitions.h
LArSamples::Averager::m_sum1
TVectorD m_sum1
Definition: Averager.h:78
LArSamples::Averager::add
bool add(double xMin=-DBL_MAX, double xMax=DBL_MAX)
Definition: Averager.cxx:46
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
LArSamples::Averager::m_xMax
std::vector< double > m_xMax
Definition: Averager.h:77
LArSamples::Averager::m_lwb
int m_lwb
Definition: Averager.h:75
LArSamples::Averager::Averager
Averager(unsigned int n=0)
Constructor
Definition: Averager.cxx:15
LArSamples::Averager::rms
double rms(unsigned int i) const
Definition: Averager.cxx:211