Diana Software
QChannelCovariance.hh
Go to the documentation of this file.
1 #ifndef _Q_CHANNELCOVARIANCE_HH_
2 #define _Q_CHANNELCOVARIANCE_HH_
3 
11 #include "QObject.hh"
12 #include "QMatrixC.hh"
13 #include "QMatrix.hh"
14 #include "QVectorC.hh"
15 #include <vector>
16 #include <map>
17 
18 class QChannelCovariance : public Diana::QObject {
19 
20 public:
23 
25  QChannelCovariance(size_t nfreq, const std::vector<int> &channels);
26 
28  void Clear()
29  {
30  // mandatory method: reset members to default
31  fCovariance.clear();
32  fChannels.clear();
33  fNevents.Clear();
34  }
35 
37  void SetNFreq(size_t nfreq);
39  void SetChannels(const std::vector<int> &channels);
41  void SetCovariance(int chI, int chJ,const Diana::QVectorC& cov);
43  void SetNEvents(int chI, int chJ, int nev);
44 
46  inline size_t GetNFreq() const {return fCovariance.size();};
48  std::vector<int> GetChannels() const;
50  inline size_t GetNChan() const {return fChannels.size();};
52  Diana::QVectorC GetCovariance(int chI, int chJ) const;
53  Diana::QVectorC GetCovarianceByIndex(int i, int j) const;
55  int GetNEvents(int chI, int chJ) const;
56 
60  QChannelCovariance GetSubMatrix(const std::vector<int> &channels) const;
62  Diana::QVectorC GetCorrelation(int chI, int chJ) const;
64  double GetMeanCorrelation(int chI,int chJ, int fmin = -1, int fmax = -1) const;
65 
67  std::vector<int> GetChannelsByCorrelation(int chI, int fmin = -1, int fmax = -1) const;
68 
69 
71  void DumpMeanCorrelationMatrix(std::ostream& o,const int fmin =-1, const int fmax = -1) const;
72 
74  void Dump(std::ostream& o) const;
75 
76 
77 private:
78 
80  void Channels2Indices(const int chI, const int chJ, int& i, int& j) const;
81  /* @brief vector of QMatrixC.
82  * The index of the vector is the frequency and the indexes of the
83  * matrix are the channel indices
84  */
85  std::vector<Diana::QMatrixC> fCovariance;
86 
88  std::map<int,int> fChannels;
89 
91  Diana::QMatrix fNevents;
92 
93 
95 
96 };
97 
98 
99 
100 #endif
Complex covariance matrix of an array of bolometers.
std::map< int, int > fChannels
map real channel number into channel index
void SetNEvents(int chI, int chJ, int nev)
set number of events of the couple I,J
void DumpMeanCorrelationMatrix(std::ostream &o, const int fmin=-1, const int fmax=-1) const
dump mean correlation matrix
void Dump(std::ostream &o) const
dump summary of content
double GetMeanCorrelation(int chI, int chJ, int fmin=-1, int fmax=-1) const
get mean correlation between frequency indices fmin and fmax of the couple (chI,chJ)
Diana::QVectorC GetCorrelation(int chI, int chJ) const
get correlation
void SetChannels(const std::vector< int > &channels)
set channels
QChannelCovariance GetSubMatrix(const std::vector< int > &channels) const
Get sub matrix of channels.
std::vector< int > GetChannels() const
get channels
QObjectDef(QChannelCovariance, 2)
void Clear()
clear members
size_t GetNFreq() const
get number of frequencies
QChannelCovariance Inverse() const
get inverse matrix
size_t GetNChan() const
get number of channels
void SetNFreq(size_t nfreq)
set number of frequencies
Diana::QVectorC GetCovarianceByIndex(int i, int j) const
int GetNEvents(int chI, int chJ) const
get number of events of the couple I,J
Diana::QVectorC GetCovariance(int chI, int chJ) const
get covariance between channel I and J
Diana::QMatrix fNevents
number of events used to build each element of fCovariance
void Channels2Indices(const int chI, const int chJ, int &i, int &j) const
convert channel numbers to indices
std::vector< Diana::QMatrixC > fCovariance
std::vector< int > GetChannelsByCorrelation(int chI, int fmin=-1, int fmax=-1) const
get mean correlation between frequency indices fmin and fmax of the couple (chI,chJ)
void SetCovariance(int chI, int chJ, const Diana::QVectorC &cov)
set covariance (size equal to nfreq) of channels I and J