source: trunk/MagicSoft/Mars/mtools/MTFillMatrix.h@ 8350

Last change on this file since 8350 was 7714, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 2.5 KB
Line 
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
12class MRead;
13class MTask;
14class MHMatrix;
15class MFilter;
16
17class MTFillMatrix : public MParContainer
18{
19private:
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 Add(const TList &src, const TClass *cls, TList &dest);
37
38 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
39
40 Bool_t CheckResult(MHMatrix *m, Int_t num) const;
41 Bool_t WriteMatrix(MHMatrix *m, const TString &fname, Int_t i) const;
42
43public:
44 MTFillMatrix(const MH3 *ref=NULL);
45 ~MTFillMatrix();
46
47 void SetDestMatrix1(MHMatrix *matrix, UInt_t num=0)
48 {
49 fDestMatrix1 = matrix;
50 if (num>0)
51 fNumDestEvents1 = num;
52 }
53 void SetWriteFile1(MTask *write, UInt_t num=0)
54 {
55 fWriteFile1 = write;
56 if (num>0)
57 fNumDestEvents1 = num;
58 }
59 void SetNumDestEvents1(UInt_t num)
60 {
61 fNumDestEvents1 = num;
62 }
63 void SetDestMatrix2(MHMatrix *matrix, UInt_t num=0)
64 {
65 fDestMatrix2 = matrix;
66 if (num>0)
67 fNumDestEvents2 = num;
68 }
69 void SetWriteFile2(MTask *write, UInt_t num=0)
70 {
71 fWriteFile2 = write;
72 if (num>0)
73 fNumDestEvents2 = num;
74 }
75 void SetNumDestEvents2(UInt_t num)
76 {
77 fNumDestEvents2 = num;
78 }
79
80 void SetReader(MRead *task) { fReader = task; }
81
82 void AddPreCut(const char *rule);
83 void AddPreCut(MFilter *f);
84 void AddPreCuts(const TList &list);
85
86 void ClearPreCuts() { fPreCuts.Clear(); }
87 void ClearPreTasks() { fPreTasks.Clear(); }
88 void ClearPostTasks() { fPostTasks.Clear(); }
89
90 void AddPreTask(MTask *t);
91 void AddPreTasks(const TList &list);
92
93 void AddPostTask(MTask *t);
94 void AddPostTasks(const TList &list);
95
96 Bool_t Process(const MParList &plist=MParList());
97
98 Bool_t WriteMatrix1(const TString &fname) const { return WriteMatrix(fDestMatrix1, fname, 1); }
99 Bool_t WriteMatrix2(const TString &fname) const { return WriteMatrix(fDestMatrix2, fname, 2); }
100 Bool_t WriteMatrices(const TString &fname) const;
101
102 ClassDef(MTFillMatrix, 0) // Tool to fill matrices (eg. trainings- and test-matrices)
103};
104
105#endif
Note: See TracBrowser for help on using the repository browser.