1 | #ifndef MARS_MRFEnergyEst
|
---|
2 | #define MARS_MRFEnergyEst
|
---|
3 |
|
---|
4 | #ifndef MARS_MTask
|
---|
5 | #include "MTask.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef ROOT_TObjArray
|
---|
9 | #include <TObjArray.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #ifndef ROOT_TArrayD
|
---|
13 | #include <TArrayD.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | class MDataArray;
|
---|
17 | class MParameterD;
|
---|
18 | class MHMatrix;
|
---|
19 |
|
---|
20 | class MRFEnergyEst : public MTask
|
---|
21 | {
|
---|
22 | public:
|
---|
23 | enum EstimationMode_t
|
---|
24 | {
|
---|
25 | kMean,
|
---|
26 | kMaximum,
|
---|
27 | kFit
|
---|
28 | };
|
---|
29 |
|
---|
30 | private:
|
---|
31 | static const TString gsDefName; //! Default Name
|
---|
32 | static const TString gsDefTitle; //! Default Title
|
---|
33 |
|
---|
34 | Bool_t fDebug; // Debugging of eventloop while training on/off
|
---|
35 |
|
---|
36 | TString fFileName; // File name to forest
|
---|
37 | TObjArray fEForests; // List of forests
|
---|
38 |
|
---|
39 | MDataArray *fData; //! Used to store the MDataChains to get the event values
|
---|
40 | MParameterD *fEnergyEst; //! Used to storeestimated energy
|
---|
41 |
|
---|
42 | Int_t fNumTrees; //! Training parameters
|
---|
43 | Int_t fNumTry; //! Training parameters
|
---|
44 | Int_t fNdSize; //! Training parameters
|
---|
45 |
|
---|
46 | MHMatrix *fTestMatrix; //! Test Matrix used in Process (together with MMatrixLoop)
|
---|
47 |
|
---|
48 | EstimationMode_t fEstimationMode;
|
---|
49 |
|
---|
50 | private:
|
---|
51 | // MTask
|
---|
52 | Int_t PreProcess(MParList *plist);
|
---|
53 | Int_t Process();
|
---|
54 |
|
---|
55 | // MRFEnergyEst
|
---|
56 | Int_t ReadForests(MParList &plist);
|
---|
57 |
|
---|
58 | // MParContainer
|
---|
59 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
60 |
|
---|
61 | // Train Interface
|
---|
62 | Int_t Train(const MHMatrix &n, const TArrayD &grid, Int_t ver=2);
|
---|
63 |
|
---|
64 | public:
|
---|
65 | MRFEnergyEst(const char *name=NULL, const char *title=NULL);
|
---|
66 | ~MRFEnergyEst();
|
---|
67 |
|
---|
68 | // Setter for estimation
|
---|
69 | void SetFileName(TString filename) { fFileName = filename; }
|
---|
70 | void SetEstimationMode(EstimationMode_t op) { fEstimationMode = op; }
|
---|
71 |
|
---|
72 | // Setter for training
|
---|
73 | void SetNumTrees(UShort_t n=100) { fNumTrees = n; }
|
---|
74 | void SetNdSize(UShort_t n=5) { fNdSize = n; }
|
---|
75 | void SetNumTry(UShort_t n=0) { fNumTry = n; }
|
---|
76 | void SetDebug(Bool_t b=kTRUE) { fDebug = b; }
|
---|
77 |
|
---|
78 | // Train Interface
|
---|
79 | Int_t TrainMultiRF(const MHMatrix &n, const TArrayD &grid)
|
---|
80 | {
|
---|
81 | return Train(n, grid, 0);
|
---|
82 | }
|
---|
83 | Int_t TrainSingleRF(const MHMatrix &n, const TArrayD &grid=TArrayD())
|
---|
84 | {
|
---|
85 | return Train(n, grid, grid.GetSize()==0 ? 2 : 1);
|
---|
86 | }
|
---|
87 |
|
---|
88 | // Test Interface
|
---|
89 | void SetTestMatrix(MHMatrix *m=0) { fTestMatrix=m; }
|
---|
90 | void InitMapping(MHMatrix *m=0) { fTestMatrix=m; }
|
---|
91 |
|
---|
92 | ClassDef(MRFEnergyEst, 0) // Task
|
---|
93 | };
|
---|
94 |
|
---|
95 | #endif
|
---|