source: trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.h@ 7701

Last change on this file since 7701 was 7701, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 3.4 KB
Line 
1#ifndef MARS_MJTrainSeparation
2#define MARS_MJTrainSeparation
3
4#ifndef MARS_MJTrainRanForest
5#include "MJTrainRanForest.h"
6#endif
7
8#ifndef MARS_MDataSet
9#include "MDataSet.h"
10#endif
11
12class MH3;
13
14class MJTrainSeparation : public MJTrainRanForest
15{
16private:
17 MDataSet fDataSetTest;
18 MDataSet fDataSetTrain;
19
20 UInt_t fNumTrainOn;
21 UInt_t fNumTrainOff;
22
23 UInt_t fNumTestOn;
24 UInt_t fNumTestOff;
25
26 TList fPreTasksOn;
27 TList fPreTasksOff;
28 TList fPostTasksOn;
29 TList fPostTasksOff;
30
31 Bool_t fAutoTrain;
32 Bool_t fUseRegression;
33 Bool_t fEnableWeightsOn;
34 Bool_t fEnableWeightsOff;
35
36 Float_t fFlux;
37
38 void DisplayResult(MH3 &h31, MH3 &h32);
39
40 Bool_t GetEventsProduced(MDataSet &set, Double_t &num, Double_t &min, Double_t &max) const;
41 Double_t GetDataRate(MDataSet &set, Double_t &num) const;
42 Double_t GetNumMC(MDataSet &set) const;
43 Bool_t AutoTrain(MDataSet &set, UInt_t &on, UInt_t &off);
44
45public:
46 MJTrainSeparation() :
47 fNumTrainOn((UInt_t)-1), fNumTrainOff((UInt_t)-1),
48 fNumTestOn((UInt_t)-1), fNumTestOff((UInt_t)-1),
49 fAutoTrain(kFALSE), fUseRegression(kFALSE),
50 fEnableWeightsOn(kFALSE), fEnableWeightsOff(kFALSE), fFlux(2e-7)
51 { }
52
53 void SetDataSetTrain(const MDataSet &ds, UInt_t non=(UInt_t)-1, UInt_t noff=(UInt_t)-1)
54 {
55 ds.Copy(fDataSetTrain);
56
57 fDataSetTrain.SetNumAnalysis(1);
58
59 fNumTrainOn = non;
60 fNumTrainOff = noff;
61 }
62 void SetDataSetTest(const MDataSet &ds, UInt_t non=(UInt_t)-1, UInt_t noff=(UInt_t)-1)
63 {
64 ds.Copy(fDataSetTest);
65
66 fDataSetTest.SetNumAnalysis(1);
67
68 fNumTestOn = non;
69 fNumTestOff = noff;
70 }
71
72 void AddPreTaskOn(MTask *t) { Add(fPreTasksOn, t); }
73 void AddPreTaskOn(const char *rule,
74 const char *name="MWeight") { AddPar(fPreTasksOn, rule, name); }
75
76 void AddPreTaskOff(MTask *t) { Add(fPreTasksOff, t); }
77 void AddPreTaskOff(const char *rule,
78 const char *name="MWeight") { AddPar(fPreTasksOff, rule, name); }
79
80 void AddPostTaskOn(MTask *t) { Add(fPostTasksOn, t); }
81 void AddPostTaskOn(const char *rule,
82 const char *name="MWeight") { AddPar(fPostTasksOn, rule, name); }
83
84 void AddPostTaskOff(MTask *t) { Add(fPostTasksOff, t); }
85 void AddPostTaskOff(const char *rule,
86 const char *name="MWeight") { AddPar(fPostTasksOff, rule, name); }
87
88 void SetWeightsOn(const char *rule) { if (fEnableWeightsOn) return; fEnableWeightsOn=kTRUE; AddPostTaskOn(rule); }
89 void SetWeightsOn(MTask *t) { if (fEnableWeightsOn) return; fEnableWeightsOn=kTRUE; AddPostTaskOn(t); }
90
91 void SetWeightsOff(const char *rule) { if (fEnableWeightsOff) return; fEnableWeightsOff=kTRUE; AddPostTaskOff(rule); }
92 void SetWeightsOff(MTask *t) { if (fEnableWeightsOff) return; fEnableWeightsOff=kTRUE; AddPostTaskOff(t); }
93
94 void SetFlux(Float_t f) { fFlux = f; }
95
96 void EnableAutoTrain(Bool_t b=kTRUE) { fAutoTrain = b; }
97 void EnableRegression(Bool_t b=kTRUE) { fUseRegression = b; }
98 void EnableClassification(Bool_t b=kTRUE) { fUseRegression = !b; }
99
100 Bool_t Train(const char *out);
101
102 ClassDef(MJTrainSeparation, 0)//Class to train Random Forest gamma-/background-separation
103};
104
105#endif
Note: See TracBrowser for help on using the repository browser.