| 1 | #ifndef MARS_MJOptimizeBase | 
|---|
| 2 | #define MARS_MJOptimizeBase | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef MARS_MJob | 
|---|
| 5 | #include "MJob.h" | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | class MTask; | 
|---|
| 9 | class MFilter; | 
|---|
| 10 |  | 
|---|
| 11 | class MJOptimizeBase : public MJob | 
|---|
| 12 | { | 
|---|
| 13 | protected: | 
|---|
| 14 | Int_t  fDebug; | 
|---|
| 15 | Bool_t fEnableWeights; | 
|---|
| 16 |  | 
|---|
| 17 | TList fRules; | 
|---|
| 18 |  | 
|---|
| 19 | TList fPreCuts; | 
|---|
| 20 | TList fTrainCuts; | 
|---|
| 21 | TList fTestCuts; | 
|---|
| 22 | TList fPreTasks; | 
|---|
| 23 | TList fPostTasks; | 
|---|
| 24 |  | 
|---|
| 25 | void AddCut(TList &l, const char *rule); | 
|---|
| 26 | void AddPar(TList &l, const char *rule, const char *name); | 
|---|
| 27 | void Add(TList &l, MTask *f); | 
|---|
| 28 |  | 
|---|
| 29 | public: | 
|---|
| 30 | MJOptimizeBase() : fDebug(-1), fEnableWeights(kFALSE) | 
|---|
| 31 | { | 
|---|
| 32 | } | 
|---|
| 33 |  | 
|---|
| 34 | void AddPreTask(MTask *t)                    { Add(fPreTasks,  t); } | 
|---|
| 35 | void AddPreTask(const char *rule, | 
|---|
| 36 | const char *name="MWeight")  { AddPar(fPreTasks, rule, name); } | 
|---|
| 37 |  | 
|---|
| 38 | void AddPostTask(MTask *t)                   { Add(fPostTasks, t); } | 
|---|
| 39 | void AddPostTask(const char *rule, | 
|---|
| 40 | const char *name="MWeight") { AddPar(fPostTasks, rule, name); } | 
|---|
| 41 |  | 
|---|
| 42 | void SetDebug(Bool_t b=kTRUE)      { fDebug = b; } | 
|---|
| 43 |  | 
|---|
| 44 | void SetWeights(const char *rule)  { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); } | 
|---|
| 45 | void SetWeights(MTask *t)          { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t);    } | 
|---|
| 46 |  | 
|---|
| 47 | void AddPreCut(const char *rule)   { AddCut(fPreCuts, rule); } | 
|---|
| 48 | void AddPreCut(MFilter *f)         { Add(fPreCuts, (MTask*)(f)); } | 
|---|
| 49 |  | 
|---|
| 50 | void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); } | 
|---|
| 51 | void AddTrainCut(MFilter *f)       { Add(fTrainCuts, (MTask*)(f)); } | 
|---|
| 52 |  | 
|---|
| 53 | void AddTestCut(const char *rule)  { AddCut(fTestCuts, rule); } | 
|---|
| 54 | void AddTestCut(MFilter *f)        { Add(fTestCuts, (MTask*)(f)); } | 
|---|
| 55 |  | 
|---|
| 56 | Int_t AddParameter(const char *rule); | 
|---|
| 57 |  | 
|---|
| 58 | ClassDef(MJOptimizeBase, 0)//Base class for all optimizations and trainings | 
|---|
| 59 | }; | 
|---|
| 60 |  | 
|---|
| 61 | #endif | 
|---|