source: trunk/MagicSoft/Mars/mhist/MHMatrix.h@ 1765

Last change on this file since 1765 was 1762, checked in by wittek, 22 years ago
*** empty log message ***
File size: 2.6 KB
Line 
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
17class TArrayI;
18class TArrayF;
19
20class TH1F;
21class MTask;
22class MParList;
23class MDataArray;
24
25class MHMatrix : public MH
26{
27private:
28 static const TString gsDefName; //! Default Name
29 static const TString gsDefTitle; //! Default Title
30
31 Int_t fNumRow; //! Number of dimensions of histogram
32 Int_t fRow; //! Present row
33 TMatrix fM; // Matrix to be filled
34
35 TMatrix fM2; //! Covariance Matrix
36
37 MDataArray *fData; // List of data members (columns)
38
39
40 enum {
41 kIsOwner = BIT(14),
42 kIsLocked = BIT(16)
43 };
44
45 void AddRow();
46
47 Bool_t SetupFill(const MParList *pList);
48
49 Bool_t Fill(const MParContainer *par);
50 Bool_t Finalize();
51
52 void StreamPrimitive(ofstream &out) const;
53
54public:
55 MHMatrix(const char *name=NULL, const char *title=NULL);
56 MHMatrix(MDataArray *mat, const char *name=NULL, const char *title=NULL);
57 ~MHMatrix();
58
59 void Lock() { SetBit(kIsLocked); }
60 void Unlock() { ResetBit(kIsLocked); }
61
62 Int_t AddColumn(const char *name);
63 void AddColumns(MDataArray *mat);
64
65 MDataArray *GetColumns() { return fData; }
66
67 const TMatrix &GetM() const { return fM; }
68
69 Bool_t IsValid() const { return fM.IsValid(); }
70 Int_t GetNumRows() const { return fNumRow; }
71
72 //void Draw(Option_t *opt=NULL);
73 //TObject *DrawClone(Option_t *opt=NULL) const;
74
75 void Print(Option_t *) const;
76
77 const TMatrix *InvertPosDef();
78
79 Double_t CalcDist(const TMatrix &m, const TVector &v, Int_t num = 25) const;
80 Double_t CalcDist(const TVector &v, Int_t num = 25);
81
82 void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); }
83
84 void Reassign();
85
86 const TArrayI GetIndexOfSortedColumn(Int_t ncol=0, Bool_t desc=kTRUE) const;
87 void SortMatrixByColumn(Int_t ncol=0, Bool_t desc=kTRUE);
88
89 Bool_t SetNumRow(Int_t row) { if (row>=fNumRow || row<0) return kFALSE; fRow = row; return kTRUE; }
90 Int_t GetNumRow() const { return fRow; };
91 Double_t operator[](Int_t col) { return fM(fRow, col); }
92
93 Bool_t Fill(MParList *plist, MTask *read);
94
95 TString GetDataMember() const;
96
97 void ReduceNumberOfRows(UInt_t numrows, const TString opt);
98
99 Int_t Read(const char *name);
100
101 Bool_t DefRefMatrix (const Int_t refcolumn=-1, const TH1F *thsh=NULL,
102 const Int_t nmaxevts=0);
103
104 ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events
105};
106
107#endif
108
109
Note: See TracBrowser for help on using the repository browser.