]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/TTreeTools.h
a44f56f2d8f2cf920edcdbb1beb6268ef103b53f
[u/mrichter/AliRoot.git] / EVE / Reve / TTreeTools.h
1 // $Header
2
3 #ifndef REVE_TTreeTools_H
4 #define REVE_TTreeTools_H
5
6 #include <TSelectorDraw.h>
7 #include <TEventList.h>
8
9 /**************************************************************************/
10 // TSelectorToEventList
11 /**************************************************************************/
12
13 class TSelectorToEventList : public TSelectorDraw
14 {
15   TSelectorToEventList(const TSelectorToEventList&);            // Not implemented
16   TSelectorToEventList& operator=(const TSelectorToEventList&); // Not implemented
17
18 protected:
19   TEventList* fEvList;
20   TList       fInput;
21 public:
22   TSelectorToEventList(TEventList* evl, const Text_t* sel);
23
24   virtual Int_t  Version() const { return 1; }
25   virtual Bool_t Process(Long64_t entry);
26
27   ClassDef(TSelectorToEventList, 1)
28 };
29
30 /**************************************************************************/
31 // TTreeQuery
32 /**************************************************************************/
33
34 class TTreeQuery : public TEventList
35 {
36 public:
37   TTreeQuery() : TEventList() {}
38
39   Int_t Select(TTree* t, const Text_t* selection);
40
41   ClassDef(TTreeQuery, 1)
42 };
43
44 /**************************************************************************/
45 // TPointSelectorConsumer, TPointSelector
46 /**************************************************************************/
47
48 class TPointSelector;
49
50 class TPointSelectorConsumer
51 {
52 public:
53   enum TreeVarType_e { TVT_XYZ, TVT_RPhiZ };
54
55 protected:
56   TreeVarType_e fSourceCS; // Coordinate-System of the source tree variables
57
58 public:
59   TPointSelectorConsumer(TreeVarType_e cs=TVT_XYZ) :fSourceCS(cs) {}
60   virtual ~TPointSelectorConsumer() {}
61
62   virtual void InitFill(Int_t /*subIdNum*/) {}
63   virtual void TakeAction(TPointSelector*) = 0;
64
65   TreeVarType_e GetSourceCS() const  { return fSourceCS; }
66   void SetSourceCS(TreeVarType_e cs) { fSourceCS = cs; }
67
68   ClassDef(TPointSelectorConsumer, 1);
69 };
70
71 class TPointSelector : public TSelectorDraw
72 {
73   TPointSelector(const TPointSelector&);            // Not implemented
74   TPointSelector& operator=(const TPointSelector&); // Not implemented
75
76 protected:
77   TTree                  *fTree;
78   TPointSelectorConsumer *fConsumer;
79
80   TString                 fVarexp;
81   TString                 fSelection;
82
83   TString                 fSubIdExp;
84   Int_t                   fSubIdNum;
85
86   TList                   fInput;
87
88 public:
89   TPointSelector(TTree* t=0, TPointSelectorConsumer* c=0,
90                  const Text_t* vexp="", const Text_t* sel="");
91   virtual ~TPointSelector() {}
92
93   virtual Long64_t Select(const Text_t* selection=0);
94   virtual Long64_t Select(TTree* t, const Text_t* selection=0);
95   virtual void  TakeAction();
96
97
98   TTree* GetTree() const   { return fTree; }
99   void   SetTree(TTree* t) { fTree = t; }
100
101   TPointSelectorConsumer* GetConsumer() const { return fConsumer; }
102   void SetConsumer(TPointSelectorConsumer* c) { fConsumer = c; }
103
104   const Text_t* GetVarexp() const { return fVarexp; }
105   void SetVarexp(const Text_t* v) { fVarexp = v; }
106
107   const Text_t* GetSelection() const { return fSelection; }
108   void SetSelection(const Text_t* s) { fSelection = s; }
109
110   const Text_t* GetSubIdExp() const { return fSubIdExp; }
111   void SetSubIdExp(const Text_t* s) { fSubIdExp = s; }
112
113   Int_t GetSubIdNum() const { return fSubIdNum; }
114
115   ClassDef(TPointSelector, 1);
116 };
117
118 /**************************************************************************/
119 /**************************************************************************/
120
121 #endif