1 | #ifndef MARS_MHMatrix
|
---|
2 | #define MARS_MHMatrix
|
---|
3 |
|
---|
4 | #ifdef MARS_MLogManip
|
---|
5 | #error Please make ensure that MLogManip.h are included _after_ MHMatrix.h
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef ROOT_TMatrix
|
---|
9 | #include <TMatrix.h>
|
---|
10 | #endif
|
---|
11 | #ifndef MARS_MH
|
---|
12 | #include "MH.h"
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | #include <TArrayF.h>
|
---|
16 |
|
---|
17 | class TArrayI;
|
---|
18 | class TArrayF;
|
---|
19 |
|
---|
20 | class TH1F;
|
---|
21 | class MTask;
|
---|
22 | class MParList;
|
---|
23 | class MDataArray;
|
---|
24 | class MF;
|
---|
25 |
|
---|
26 | class MHMatrix : public MH
|
---|
27 | {
|
---|
28 | private:
|
---|
29 | static const TString gsDefName; //! Default Name
|
---|
30 | static const TString gsDefTitle; //! Default Title
|
---|
31 |
|
---|
32 | Int_t fNumRow; //! Number of dimensions of histogram
|
---|
33 | Int_t fRow; //! Present row
|
---|
34 | TMatrix fM; // Matrix to be filled
|
---|
35 |
|
---|
36 | TMatrix fM2; //! Covariance Matrix
|
---|
37 |
|
---|
38 | MDataArray *fData; // List of data members (columns)
|
---|
39 |
|
---|
40 |
|
---|
41 | enum {
|
---|
42 | kIsOwner = BIT(14),
|
---|
43 | kIsLocked = BIT(16)
|
---|
44 | };
|
---|
45 |
|
---|
46 | void AddRow();
|
---|
47 |
|
---|
48 | Bool_t SetupFill(const MParList *pList);
|
---|
49 |
|
---|
50 | Bool_t Fill(const MParContainer *par);
|
---|
51 | Bool_t Finalize();
|
---|
52 |
|
---|
53 | void StreamPrimitive(ofstream &out) const;
|
---|
54 |
|
---|
55 | public:
|
---|
56 | MHMatrix(const char *name=NULL, const char *title=NULL);
|
---|
57 | MHMatrix(MDataArray *mat, const char *name=NULL, const char *title=NULL);
|
---|
58 | MHMatrix(const TMatrix &m, const char *name=NULL, const char *title=NULL);
|
---|
59 | ~MHMatrix();
|
---|
60 |
|
---|
61 | void Lock() { SetBit(kIsLocked); }
|
---|
62 | void Unlock() { ResetBit(kIsLocked); }
|
---|
63 |
|
---|
64 | Int_t AddColumn(const char *name);
|
---|
65 | void AddColumns(MDataArray *mat);
|
---|
66 |
|
---|
67 | MDataArray *GetColumns() { return fData; }
|
---|
68 |
|
---|
69 | const TMatrix &GetM() const { return fM; }
|
---|
70 |
|
---|
71 | Bool_t IsValid() const { return fM.IsValid(); }
|
---|
72 | Int_t GetNumRows() const { return fNumRow; }
|
---|
73 |
|
---|
74 | //void Draw(Option_t *opt=NULL);
|
---|
75 | //TObject *DrawClone(Option_t *opt=NULL) const;
|
---|
76 |
|
---|
77 | void Print(Option_t *) const;
|
---|
78 |
|
---|
79 | const TMatrix *InvertPosDef();
|
---|
80 |
|
---|
81 | Double_t CalcDist(const TMatrix &m, const TVector &v, Int_t num = 25) const;
|
---|
82 | Double_t CalcDist(const TVector &v, Int_t num = 25);
|
---|
83 |
|
---|
84 | void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); }
|
---|
85 |
|
---|
86 | void Reassign();
|
---|
87 |
|
---|
88 | const TArrayI GetIndexOfSortedColumn(Int_t ncol=0, Bool_t desc=kTRUE) const;
|
---|
89 | void SortMatrixByColumn(Int_t ncol=0, Bool_t desc=kTRUE);
|
---|
90 |
|
---|
91 | Bool_t SetNumRow(Int_t row) { if (row>=fNumRow || row<0) return kFALSE; fRow = row; return kTRUE; }
|
---|
92 | Int_t GetNumRow() const { return fRow; };
|
---|
93 | Double_t operator[](Int_t col) { return fM(fRow, col); }
|
---|
94 |
|
---|
95 | Bool_t Fill(MParList *plist, MTask *read, MF *filter=NULL);
|
---|
96 |
|
---|
97 | TString GetDataMember() const;
|
---|
98 |
|
---|
99 | void ReduceNumberOfRows(UInt_t numrows, const TString opt);
|
---|
100 |
|
---|
101 | Int_t Read(const char *name);
|
---|
102 |
|
---|
103 | Bool_t DefRefMatrix(const UInt_t refcolumn, const TH1F &thsh,
|
---|
104 | Int_t nmaxevts=0, TMatrix *mrest=NULL);
|
---|
105 | Bool_t DefRefMatrix(Int_t nmaxevts=0, TMatrix *mrest=NULL);
|
---|
106 |
|
---|
107 | ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events
|
---|
108 | };
|
---|
109 |
|
---|
110 | #endif
|
---|
111 |
|
---|
112 |
|
---|