1 | #ifndef MARS_MTFillMatrix
|
---|
2 | #define MARS_MTFillMatrix
|
---|
3 |
|
---|
4 | #ifndef MARS_MParList
|
---|
5 | #include "MParList.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef MARS_MH3
|
---|
9 | #include "MH3.h"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | class MRead;
|
---|
13 | class MTask;
|
---|
14 | class MHMatrix;
|
---|
15 | class MFilter;
|
---|
16 |
|
---|
17 | class MTFillMatrix : public MParContainer
|
---|
18 | {
|
---|
19 | private:
|
---|
20 | MH3 *fReference;
|
---|
21 | MRead *fReader;
|
---|
22 |
|
---|
23 | MHMatrix *fDestMatrix1;
|
---|
24 | MHMatrix *fDestMatrix2;
|
---|
25 |
|
---|
26 | Int_t fNumDestEvents1;
|
---|
27 | Int_t fNumDestEvents2;
|
---|
28 |
|
---|
29 | MTask *fWriteFile1;
|
---|
30 | MTask *fWriteFile2;
|
---|
31 |
|
---|
32 | TList fPreCuts;
|
---|
33 | TList fPreTasks;
|
---|
34 | TList fPostTasks;
|
---|
35 |
|
---|
36 | void Init(const char *name, const char *title);
|
---|
37 |
|
---|
38 | void Add(const TList &src, const TClass *cls, TList &dest);
|
---|
39 |
|
---|
40 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
41 |
|
---|
42 | Bool_t CheckResult(MHMatrix *m, Int_t num) const;
|
---|
43 | Bool_t WriteMatrix(MHMatrix *m, const TString &fname, Int_t i) const;
|
---|
44 |
|
---|
45 | public:
|
---|
46 | MTFillMatrix(const char *name=0, const char *title=0);
|
---|
47 | MTFillMatrix(const MH3 *ref, const char *name=0, const char *title=0);
|
---|
48 | ~MTFillMatrix();
|
---|
49 |
|
---|
50 | void SetDestMatrix1(MHMatrix *matrix, UInt_t num=0)
|
---|
51 | {
|
---|
52 | fDestMatrix1 = matrix;
|
---|
53 | if (num>0)
|
---|
54 | fNumDestEvents1 = num;
|
---|
55 | }
|
---|
56 | void SetWriteFile1(MTask *write, UInt_t num=0)
|
---|
57 | {
|
---|
58 | fWriteFile1 = write;
|
---|
59 | if (num>0)
|
---|
60 | fNumDestEvents1 = num;
|
---|
61 | }
|
---|
62 | void SetNumDestEvents1(UInt_t num)
|
---|
63 | {
|
---|
64 | fNumDestEvents1 = num;
|
---|
65 | }
|
---|
66 | void SetDestMatrix2(MHMatrix *matrix, UInt_t num=0)
|
---|
67 | {
|
---|
68 | fDestMatrix2 = matrix;
|
---|
69 | if (num>0)
|
---|
70 | fNumDestEvents2 = num;
|
---|
71 | }
|
---|
72 | void SetWriteFile2(MTask *write, UInt_t num=0)
|
---|
73 | {
|
---|
74 | fWriteFile2 = write;
|
---|
75 | if (num>0)
|
---|
76 | fNumDestEvents2 = num;
|
---|
77 | }
|
---|
78 | void SetNumDestEvents2(UInt_t num)
|
---|
79 | {
|
---|
80 | fNumDestEvents2 = num;
|
---|
81 | }
|
---|
82 |
|
---|
83 | void SetReader(MRead *task) { fReader = task; }
|
---|
84 |
|
---|
85 | void AddPreCut(const char *rule);
|
---|
86 | void AddPreCut(MFilter *f);
|
---|
87 | void AddPreCuts(const TList &list);
|
---|
88 |
|
---|
89 | void ClearPreCuts() { fPreCuts.Clear(); }
|
---|
90 | void ClearPreTasks() { fPreTasks.Clear(); }
|
---|
91 | void ClearPostTasks() { fPostTasks.Clear(); }
|
---|
92 |
|
---|
93 | void AddPreTask(MTask *t);
|
---|
94 | void AddPreTasks(const TList &list);
|
---|
95 |
|
---|
96 | void AddPostTask(MTask *t);
|
---|
97 | void AddPostTasks(const TList &list);
|
---|
98 |
|
---|
99 | Bool_t Process(const MParList &plist=MParList());
|
---|
100 |
|
---|
101 | Bool_t WriteMatrix1(const TString &fname) const { return WriteMatrix(fDestMatrix1, fname, 1); }
|
---|
102 | Bool_t WriteMatrix2(const TString &fname) const { return WriteMatrix(fDestMatrix2, fname, 2); }
|
---|
103 | Bool_t WriteMatrices(const TString &fname) const;
|
---|
104 |
|
---|
105 | ClassDef(MTFillMatrix, 0) // Tool to fill matrices (eg. trainings- and test-matrices)
|
---|
106 | };
|
---|
107 |
|
---|
108 | #endif
|
---|