source: trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h@ 7692

Last change on this file since 7692 was 7396, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.4 KB
Line 
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
16class MDataArray;
17class MParameterD;
18class MHMatrix;
19
20class MRFEnergyEst : public MTask
21{
22public:
23 enum EstimationMode_t
24 {
25 kMean,
26 kMaximum,
27 kFit
28 };
29
30private:
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
50private:
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
64public:
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
Note: See TracBrowser for help on using the repository browser.