]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/TTreeTools.cxx
Setup check-box pictures when inserting in a list-tree.
[u/mrichter/AliRoot.git] / EVE / Reve / TTreeTools.cxx
1 // $Header$
2
3 //__________________________________________________________________________
4 // TTreeTools
5 //
6 // Collection of classes for TTree interaction.
7
8 #include "TTreeTools.h"
9 #include <TTree.h>
10 #include <TTreeFormula.h>
11
12 /**************************************************************************/
13 /**************************************************************************/
14
15 ClassImp(TSelectorToEventList)
16
17 TSelectorToEventList::TSelectorToEventList(TEventList* evl, const Text_t* sel) :
18   TSelectorDraw(), fEvList(evl)
19 {
20   fInput.Add(new TNamed("varexp", ""));
21   fInput.Add(new TNamed("selection", sel));
22   SetInputList(&fInput);
23 }
24
25 Bool_t TSelectorToEventList::Process(Long64_t entry)
26 {
27   if(GetSelect()->EvalInstance(0) != 0)
28     fEvList->Enter(entry);
29   return kTRUE;
30 }
31
32 /**************************************************************************/
33 /**************************************************************************/
34
35 ClassImp(TTreeQuery)
36
37 Int_t TTreeQuery::Select(TTree* t, const Text_t* selection)
38 {
39   TSelectorToEventList sel(this, selection);
40   t->Process(&sel, "goff");
41   return GetN();
42 }
43
44 /**************************************************************************/
45 // TPointSelectorConsumer, TPointSelector
46 /**************************************************************************/
47
48 ClassImp(TPointSelectorConsumer)
49 ClassImp(TPointSelector)
50
51 TPointSelector::TPointSelector(TTree* t,
52                                TPointSelectorConsumer* c,
53                                const Text_t* vexp, const Text_t* sel) :
54   TSelectorDraw(),
55
56   fTree      (t),
57   fConsumer  (c),
58   fVarexp    (vexp),
59   fSelection (sel)
60 {
61   SetInputList(&fInput);
62 }
63
64 Long64_t TPointSelector::Select(const Text_t* selection)
65 {
66   if(selection != 0)
67     fSelection = selection;
68
69   fInput.Delete();
70   fInput.Add(new TNamed("varexp",    fVarexp.Data()));
71   fInput.Add(new TNamed("selection", fSelection.Data()));
72
73   if(fTree)
74     fTree->Process(this, "goff");
75   return fSelectedRows;
76 }
77
78 Long64_t TPointSelector::Select(TTree* t, const Text_t* selection)
79 {
80   fTree = t;
81   return Select(selection);
82 }
83
84 void TPointSelector::TakeAction()
85 {
86   fSelectedRows += fNfill;
87   // printf("TPointSelector::TakeAction nfill=%d, nall=%lld\n", fNfill, fSelectedRows);
88   if(fConsumer) {
89     fConsumer->TakeAction(this);
90   }
91 }