source: trunk/MagicSoft/Mars/mjoptim/MJOptimizeBase.h@ 9366

Last change on this file since 9366 was 8698, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 2.4 KB
Line 
1#ifndef MARS_MJOptimizeBase
2#define MARS_MJOptimizeBase
3
4#ifndef MARS_MJob
5#include "MJob.h"
6#endif
7
8class MTask;
9class MFilter;
10
11class MJOptimizeBase : public MJob
12{
13protected:
14 Int_t fDebug;
15 Bool_t fEnableWeights; // Enable using weights
16
17 TList fRules; // Contains the parameters which can be accessed by matrix column
18 TList fTrainParameters; // Parameters in the last columns
19
20 TList fPreCuts; // Cuts executed for training and testing
21 TList fTrainCuts; // Cuts executed only in training
22 TList fTestCuts; // Cuts executed only in testing
23 TList fPreTasks; // Tasks executed before cut execution
24 TList fPostTasks; // Tasks executed after cut execution
25 TList fTestTasks; // Tasks executed after cut execution for testing
26
27 void AddCut(TList &l, const char *rule);
28 void AddPar(TList &l, const char *rule, const char *name);
29 void Add(TList &l, MTask *f);
30
31public:
32 MJOptimizeBase() : fDebug(-1), fEnableWeights(kFALSE)
33 {
34 }
35
36 void AddPreTask(MTask *t) { Add(fPreTasks, t); }
37 void AddPreTask(const char *rule,
38 const char *name="MWeight") { AddPar(fPreTasks, rule, name); }
39
40 void AddPostTask(MTask *t) { Add(fPostTasks, t); }
41 void AddPostTask(const char *rule,
42 const char *name="MWeight") { AddPar(fPostTasks, rule, name); }
43
44 void AddTestTask(MTask *t) { Add(fTestTasks, t); }
45 void AddTestTask(const char *rule,
46 const char *name="MWeight") { AddPar(fTestTasks, rule, name); }
47
48 void SetDebug(Bool_t b=kTRUE) { fDebug = b; }
49
50 void SetWeights(const char *rule) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); }
51 void SetWeights(MTask *t) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t); }
52
53 void AddPreCut(const char *rule) { AddCut(fPreCuts, rule); }
54 void AddPreCut(MFilter *f) { Add(fPreCuts, (MTask*)(f)); }
55
56 void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); }
57 void AddTrainCut(MFilter *f) { Add(fTrainCuts, (MTask*)(f)); }
58
59 void AddTestCut(const char *rule) { AddCut(fTestCuts, rule); }
60 void AddTestCut(MFilter *f) { Add(fTestCuts, (MTask*)(f)); }
61
62 Int_t AddParameter(const char *rule);
63
64 ClassDef(MJOptimizeBase, 0)//Base class for all optimizations and trainings
65};
66
67#endif
Note: See TracBrowser for help on using the repository browser.