source: branches/MarsMoreSimulationTruth/mtools/MTFillMatrix.h@ 20099

Last change on this file since 20099 was 9041, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.7 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 Int_t fNumMaxEvents;
30
31 MTask *fWriteFile1;
32 MTask *fWriteFile2;
33
34 TList fPreCuts;
35 TList fPreTasks;
36 TList fPostTasks;
37
38 void Init(const char *name, const char *title);
39
40 void Add(const TList &src, const TClass *cls, TList &dest);
41
42 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
43
44 Bool_t CheckResult(MHMatrix *m, Int_t num) const;
45 Bool_t WriteMatrix(MHMatrix *m, const TString &fname, Int_t i) const;
46
47public:
48 MTFillMatrix(const char *name=0, const char *title=0);
49 MTFillMatrix(const MH3 *ref, const char *name=0, const char *title=0);
50 ~MTFillMatrix();
51
52 void SetDestMatrix1(MHMatrix *matrix, UInt_t num=0)
53 {
54 fDestMatrix1 = matrix;
55 if (num>0)
56 SetNumDestEvents1(num);
57 }
58 void SetWriteFile1(MTask *write, UInt_t num=0)
59 {
60 fWriteFile1 = write;
61 if (num>0)
62 SetNumDestEvents1(num);
63 }
64 void SetDestMatrix2(MHMatrix *matrix, UInt_t num=0)
65 {
66 fDestMatrix2 = matrix;
67 if (num>0)
68 SetNumDestEvents2(num);
69 }
70 void SetWriteFile2(MTask *write, UInt_t num=0)
71 {
72 fWriteFile2 = write;
73 if (num>0)
74 SetNumDestEvents2(num);
75 }
76 void SetNumDestEvents1(UInt_t num) { fNumDestEvents1 = num; }
77 void SetNumDestEvents2(UInt_t num) { fNumDestEvents2 = num; }
78 void SetMaxEvents(UInt_t num) { fNumMaxEvents = num; }
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.