source: trunk/Mars/mjoptim/MJOptimizeBase.h@ 9876

Last change on this file since 9876 was 9874, checked in by tbretz, 14 years ago
MJOptimizeBase now prints a warning if TRandom is used.
File size: 2.9 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 pre cut execution
25 TList fTestTasks; // Tasks executed at the end of the testing tasklist
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();
33
34 // MJOptimizeBase
35 void SetDebug(Bool_t b=kTRUE) { fDebug = b; }
36
37 // Add a parameter to the list of parameters
38 Int_t AddParameter(const char *rule);
39
40 // Tasks which are executed after reading (training and testing if available)
41 void AddPreTask(MTask *t) { Add(fPreTasks, t); }
42 void AddPreTask(const char *rule,
43 const char *name="MWeight") { AddPar(fPreTasks, rule, name); }
44
45 // Cuts which are executed after the pre-tasks (training and testing if available)
46 void AddPreCut(const char *rule) { AddCut(fPreCuts, rule); }
47 void AddPreCut(MFilter *f) { Add(fPreCuts, (MTask*)(f)); }
48
49 // Same as pre-cuts but only executed in taining or testing
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 // Tasks which are excuted after event selection (training and testing if available)
57 void AddPostTask(MTask *t) { Add(fPostTasks, t); }
58 void AddPostTask(const char *rule,
59 const char *name="MWeight") { AddPar(fPostTasks, rule, name); }
60
61 // Tasks executed at the end of the testing tasklist
62 void AddTestTask(MTask *t) { Add(fTestTasks, t); }
63 void AddTestTask(const char *rule,
64 const char *name="MWeight") { AddPar(fTestTasks, rule, name); }
65
66 // Add calculation of weights to list of post tasks. Set fEnableWeights
67 void SetWeights(const char *rule) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); }
68 void SetWeights(MTask *t) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t); }
69
70 ClassDef(MJOptimizeBase, 0)//Base class for all optimizations and trainings
71};
72
73#endif
Note: See TracBrowser for help on using the repository browser.