]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/TTreeTools.cxx
This commit was generated by cvs2svn to compensate for changes in r13732,
[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(ProcessCut(entry)) { ProcessFill(entry); return true; }
28   return false;
29 }
30
31 Bool_t TSelectorToEventList::ProcessCut(Long64_t )
32 {
33   return GetSelect()->EvalInstance(0) != 0;
34 }
35
36 /**************************************************************************/
37 /**************************************************************************/
38
39 ClassImp(TTreeQuery)
40
41 Int_t TTreeQuery::Select(TTree* t, const Text_t* selection)
42 {
43   TSelectorToEventList sel(this, selection);
44   t->Process(&sel, "goff");
45   return GetN();
46 }