]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/TTreeTools.cxx
From Cvetan: new macro to load ITS clusters.
[u/mrichter/AliRoot.git] / EVE / Reve / TTreeTools.cxx
CommitLineData
5a5a1232 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
15ClassImp(TSelectorToEventList)
16
17TSelectorToEventList::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
25Bool_t TSelectorToEventList::Process(Long64_t entry)
26{
9ce3a7e7 27 if(GetSelect()->EvalInstance(0) != 0)
28 fEvList->Enter(entry);
29 return kTRUE;
5a5a1232 30}
31
32/**************************************************************************/
33/**************************************************************************/
34
35ClassImp(TTreeQuery)
36
37Int_t TTreeQuery::Select(TTree* t, const Text_t* selection)
38{
39 TSelectorToEventList sel(this, selection);
40 t->Process(&sel, "goff");
41 return GetN();
42}
9ce3a7e7 43
44/**************************************************************************/
45// TPointSelectorConsumer, TPointSelector
46/**************************************************************************/
47
48ClassImp(TPointSelectorConsumer)
49ClassImp(TPointSelector)
50
51TPointSelector::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
64Long64_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
78Long64_t TPointSelector::Select(TTree* t, const Text_t* selection)
79{
80 fTree = t;
81 return Select(selection);
82}
83
84void 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}