Changeset 7697 for trunk/MagicSoft/Mars/mjtrain
- Timestamp:
- 05/05/06 10:53:03 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/mjtrain
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.cc
r7421 r7697 35 35 #include "MLogManip.h" 36 36 37 #include "MF.h" 38 #include "MParameterCalc.h" 39 37 40 #include "MStatusDisplay.h" 38 39 #include "MF.h"40 41 41 42 ClassImp(MJTrainRanForest); … … 45 46 //------------------------------------------------------------------------ 46 47 // 47 // Add a cut which is used to fill the matrix, eg "MMcEvt.f OartId<1.5"48 // (The rule is applied, n it inverted: The matrix is filled with48 // Add a cut which is used to fill the matrix, eg "MMcEvt.fPartId<1.5" 49 // (The rule is applied, not inverted: The matrix is filled with 49 50 // the events fullfilling the condition) 50 51 // … … 52 53 { 53 54 MFilter *f = new MF(rule); 54 f->SetBit(kCanDelete); 55 Add Cut(l, f);55 f->SetBit(kCanDelete); //FIXME!!!! Why does not any other list delete it??? 56 Add(l, f); 56 57 } 57 58 58 59 //------------------------------------------------------------------------ 59 60 // 60 // Add a cut which is used to fill the matrix. If kCanDelete is set 61 // Add an additional parameter (MParameterCalc), eg "0.5", "MWeight" 62 // The default container name is "MWeight" 63 // 64 void MJTrainRanForest::AddPar(TList &l, const char *rule, const char *pname) 65 { 66 TString tname(pname); 67 tname += "Calc"; 68 69 MParameterCalc *par = new MParameterCalc(rule, tname); 70 par->SetNameParameter(pname); 71 // par->SetBit(kCanDelete); //FIXME!!!! MTaskList is deleting it 72 Add(l, par); 73 } 74 75 //------------------------------------------------------------------------ 76 // 77 // Add a task/cut which is used to fill the matrix. If kCanDelete is set 61 78 // MJOptimize takes the ownership. 62 79 // 63 void MJTrainRanForest::Add Cut(TList &l, MFilter*f)80 void MJTrainRanForest::Add(TList &l, MTask *f) 64 81 { 65 82 l.Add(f); -
trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.h
r7552 r7697 6 6 #endif 7 7 8 class MTask; 8 9 class MFilter; 9 10 … … 12 13 protected: 13 14 Bool_t fDebug; 15 Bool_t fEnableWeights; 14 16 15 17 TList fRules; … … 18 20 TList fTrainCuts; 19 21 TList fTestCuts; 22 TList fPreTasks; 23 TList fPostTasks; 20 24 21 25 UShort_t fNumTrees; … … 26 30 27 31 void AddCut(TList &l, const char *rule); 28 void AddCut(TList &l, MFilter *f); 32 void AddPar(TList &l, const char *rule, const char *name); 33 void Add(TList &l, MTask *f); 29 34 30 35 public: 31 MJTrainRanForest() : fDebug(kFALSE) 36 MJTrainRanForest() : fDebug(kFALSE), fEnableWeights(kFALSE) 32 37 { 33 38 fNumTrees = 100; //100 … … 36 41 } 37 42 38 void SetDebug(Bool_t b=kTRUE) { fDebug = b; } 43 void AddPreTask(MTask *t) { Add(fPreTasks, t); } 44 void AddPreTask(const char *rule, 45 const char *name="MWeight") { AddPar(fPreTasks, rule, name); } 46 47 void AddPostTask(MTask *t) { Add(fPostTasks, t); } 48 void AddPostTask(const char *rule, 49 const char *name="MWeight") { AddPar(fPostTasks, rule, name); } 50 51 void SetDebug(Bool_t b=kTRUE) { fDebug = b; } 52 53 void SetWeights(const char *rule) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); } 54 void SetWeights(MTask *t) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t); } 39 55 40 56 void AddPreCut(const char *rule) { AddCut(fPreCuts, rule); } 41 void AddPreCut(MFilter *f) { Add Cut(fPreCuts, f); }57 void AddPreCut(MFilter *f) { Add(fPreCuts, (MTask*)(f)); } 42 58 43 59 void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); } 44 void AddTrainCut(MFilter *f) { Add Cut(fTrainCuts, f); }60 void AddTrainCut(MFilter *f) { Add(fTrainCuts, (MTask*)(f)); } 45 61 46 62 void AddTestCut(const char *rule) { AddCut(fTestCuts, rule); } 47 void AddTestCut(MFilter *f) { Add Cut(fTestCuts, f); }63 void AddTestCut(MFilter *f) { Add(fTestCuts, (MTask*)(f)); } 48 64 49 void SetNumTrees(UShort_t n=100) { fNumTrees = n; }50 void SetNdSize(UShort_t n=5) { fNdSize = n; }51 void SetNumTry(UShort_t n=0) { fNumTry = n; }65 void SetNumTrees(UShort_t n=100) { fNumTrees = n; } 66 void SetNdSize(UShort_t n=5) { fNdSize = n; } 67 void SetNumTry(UShort_t n=0) { fNumTry = n; } 52 68 53 69 Int_t AddParameter(const char *rule);
Note:
See TracChangeset
for help on using the changeset viewer.