Changeset 7724 for trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.h
- Timestamp:
- 05/21/06 16:17:05 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.h
r7701 r7724 14 14 class MJTrainSeparation : public MJTrainRanForest 15 15 { 16 public: 17 enum Type_t { kTrainOn, kTrainOff, kTestOn, kTestOff }; 18 16 19 private: 17 20 MDataSet fDataSetTest; 18 21 MDataSet fDataSetTrain; 19 22 20 UInt_t fNumTrainOn; 21 UInt_t fNumTrainOff; 23 UInt_t fNum[4]; 22 24 23 UInt_t fNumTestOn; 24 UInt_t fNumTestOff; 25 26 TList fPreTasksOn; 27 TList fPreTasksOff; 28 TList fPostTasksOn; 29 TList fPostTasksOff; 25 TList fPreTasksSet[4]; 26 TList fPostTasksSet[4]; 30 27 31 28 Bool_t fAutoTrain; 32 29 Bool_t fUseRegression; 33 Bool_t fEnableWeightsOn;34 Bool_t fEnableWeightsOff;35 30 36 Float_t fFlux;31 Bool_t fEnableWeights[4]; 37 32 38 void DisplayResult(MH3 &h31, MH3 &h32); 33 Float_t fFluxTrain; 34 Float_t fFluxTest; 39 35 36 // Result 37 void DisplayResult(MH3 &h31, MH3 &h32, Float_t ontime); 38 39 // Auto training 40 40 Bool_t GetEventsProduced(MDataSet &set, Double_t &num, Double_t &min, Double_t &max) const; 41 41 Double_t GetDataRate(MDataSet &set, Double_t &num) const; 42 42 Double_t GetNumMC(MDataSet &set) const; 43 Bool_t AutoTrain(MDataSet &set, UInt_t &on, UInt_t &off);43 Float_t AutoTrain(MDataSet &set, Type_t typon, Type_t typoff, Float_t flux); 44 44 45 45 public: 46 46 MJTrainSeparation() : 47 fNumTrainOn((UInt_t)-1), fNumTrainOff((UInt_t)-1),48 fNumTestOn((UInt_t)-1), fNumTestOff((UInt_t)-1),49 47 fAutoTrain(kFALSE), fUseRegression(kFALSE), 50 f EnableWeightsOn(kFALSE), fEnableWeightsOff(kFALSE), fFlux(2e-7)51 { }48 fFluxTrain(2e-7), fFluxTest(2e-7) 49 { for (int i=0; i<4; i++) { fEnableWeights[i]=kFALSE; fNum[i] = (UInt_t)-1; } } 52 50 53 51 void SetDataSetTrain(const MDataSet &ds, UInt_t non=(UInt_t)-1, UInt_t noff=(UInt_t)-1) … … 57 55 fDataSetTrain.SetNumAnalysis(1); 58 56 59 fNum TrainOn= non;60 fNum TrainOff= noff;57 fNum[kTrainOn] = non; 58 fNum[kTrainOff] = noff; 61 59 } 62 60 void SetDataSetTest(const MDataSet &ds, UInt_t non=(UInt_t)-1, UInt_t noff=(UInt_t)-1) … … 66 64 fDataSetTest.SetNumAnalysis(1); 67 65 68 fNum TestOn= non;69 fNum TestOff= noff;66 fNum[kTestOn] = non; 67 fNum[kTestOff] = noff; 70 68 } 71 69 72 void AddPreTaskOn(MTask *t) { Add(fPreTasksOn, t); }73 void AddPreTask On(const char *rule,74 const char *name="MWeight") { AddPar(fPreTasksOn, rule, name); }70 // Deprecated, used for test purpose 71 void AddPreTask(Type_t typ, MTask *t) { Add(fPreTasksSet[typ], t); } 72 void AddPreTask(Type_t typ, const char *rule, const char *name="MWeight") { AddPar(fPreTasksSet[typ], rule, name); } 75 73 76 void AddPreTaskOff(MTask *t) { Add(fPreTasksOff, t); } 77 void AddPreTaskOff(const char *rule, 78 const char *name="MWeight") { AddPar(fPreTasksOff, rule, name); } 74 void AddPostTask(Type_t typ, MTask *t) { Add(fPostTasksSet[typ], t); } 75 void AddPostTask(Type_t typ, const char *rule, const char *name="MWeight") { AddPar(fPostTasksSet[typ], rule, name); } 79 76 80 void AddPostTaskOn(MTask *t) { Add(fPostTasksOn, t); } 81 void AddPostTaskOn(const char *rule, 82 const char *name="MWeight") { AddPar(fPostTasksOn, rule, name); } 77 void SetWeights(Type_t typ, const char *rule) { if (fEnableWeights[typ]) return; fEnableWeights[typ]=kTRUE; AddPostTask(typ, rule); } 78 void SetWeights(Type_t typ, MTask *t) { if (fEnableWeights[typ]) return; fEnableWeights[typ]=kTRUE; AddPostTask(typ, t); } 83 79 84 void AddPostTaskOff(MTask *t) { Add(fPostTasksOff, t); } 85 void AddPostTaskOff(const char *rule, 86 const char *name="MWeight") { AddPar(fPostTasksOff, rule, name); } 80 // Standard user interface 81 void AddPreTaskOn(MTask *t) { AddPreTask(kTrainOn, t); AddPreTask(kTestOn, t); } 82 void AddPreTaskOn(const char *rule, const char *name="MWeight") { AddPreTask(kTrainOn, rule, name); AddPreTask(kTestOn, rule, name); } 83 void AddPreTaskOff(MTask *t) { AddPreTask(kTrainOff, t); AddPreTask(kTestOff, t); } 84 void AddPreTaskOff(const char *rule, const char *name="MWeight") { AddPreTask(kTrainOff, rule, name); AddPreTask(kTestOff, rule, name); } 87 85 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); } 86 void AddPostTaskOn(MTask *t) { AddPostTask(kTrainOn, t); AddPostTask(kTestOn, t); } 87 void AddPostTaskOn(const char *rule, const char *name="MWeight") { AddPostTask(kTrainOn, rule, name); AddPostTask(kTestOn, rule, name); } 88 void AddPostTaskOff(MTask *t) { AddPostTask(kTrainOff, t); AddPostTask(kTestOff, t); } 89 void AddPostTaskOff(const char *rule, const char *name="MWeight") { AddPostTask(kTrainOff, rule, name); AddPostTask(kTestOff, rule, name); } 90 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); } 91 void SetWeightsOn(const char *rule) { SetWeights(kTrainOn, rule); SetWeights(kTestOn, rule); } 92 void SetWeightsOn(MTask *t) { SetWeights(kTrainOn, t); SetWeights(kTestOn, t); } 93 void SetWeightsOff(const char *rule) { SetWeights(kTrainOff, rule); SetWeights(kTestOff, rule); } 94 void SetWeightsOff(MTask *t) { SetWeights(kTrainOff, t); SetWeights(kTestOff, t); } 93 95 94 void SetFlux(Float_t f) { fFlux = f; } 96 void SetFluxTrain(Float_t f) { fFluxTrain = f; } 97 void SetFluxTest(Float_t f) { fFluxTest = f; } 98 void SetFlux(Float_t f) { SetFluxTrain(f); SetFluxTest(f); } 95 99 96 100 void EnableAutoTrain(Bool_t b=kTRUE) { fAutoTrain = b; }
Note:
See TracChangeset
for help on using the changeset viewer.