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

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