Logo ROOT  
Reference Guide
TSelectorEntries.h
Go to the documentation of this file.
1 // @(#)root/treeplayer:$Id$
2 // Author: Philippe Canal 09/06/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT__TSelectorEntries
13 #define ROOT__TSelectorEntries
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TSelectorEntries //
18 // //
19 // A specialized TSelector for TTree::GetEntries(selection) //
20 // The selection is passed either via the constructor or via //
21 // SetSelection. The number of entries passing the selection (or //
22 // at least one element of the arrays or collections used in the //
23 // selection is passing the slection) is stored in fSeletedRwos //
24 // which can be retrieved via GetSelectedRows. //
25 // See a usage example in TTreePlayer::GetEntries. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #include <TSelector.h>
30 
31 class TTree;
32 class TTreeFormula;
33 
34 class TSelectorEntries : public TSelector {
35  Bool_t fOwnInput; // true if we created the input list.
36 public :
37  TTree *fChain; //! pointer to the analyzed TTree or TChain
38  TTreeFormula *fSelect; // Pointer to selection formula
39  Long64_t fSelectedRows; // Number of selected entries
40  Bool_t fSelectMultiple; // true if selection has a variable index
41 
42  TSelectorEntries(TTree *tree = 0, const char *selection = 0);
43  TSelectorEntries(const char *selection);
44  virtual ~TSelectorEntries();
45  virtual Int_t Version() const { return 2; }
46  virtual void Begin(TTree *tree);
47  virtual void SlaveBegin(TTree *tree);
48  virtual void Init(TTree *tree);
49  virtual Bool_t Notify();
50  virtual Bool_t Process(Long64_t entry);
51  virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0);
52  virtual Long64_t GetSelectedRows() const { return fSelectedRows; }
53  virtual void SetOption(const char *option) { fOption = option; }
54  virtual void SetObject(TObject *obj) { fObject = obj; }
55  virtual void SetSelection(const char *selection);
56  virtual TList *GetOutputList() const { return fOutput; }
57  virtual void SlaveTerminate();
58  virtual void Terminate();
59 
60  ClassDef(TSelectorEntries,1); //A specialized TSelector for TTree::GetEntries(selection)
61 };
62 
63 #endif
64 
TSelectorEntries::Begin
virtual void Begin(TTree *tree)
The Begin() function is called at the start of the query.
Definition: TSelectorEntries.cxx:81
TSelectorEntries::TSelectorEntries
TSelectorEntries(TTree *tree=0, const char *selection=0)
Default, constructor.
Definition: TSelectorEntries.cxx:46
TSelectorEntries::GetOutputList
virtual TList * GetOutputList() const
Definition: TSelectorEntries.h:56
TSelectorEntries::SlaveBegin
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
Definition: TSelectorEntries.cxx:92
TSelector
Definition: TSelector.h:31
TSelectorEntries::Version
virtual Int_t Version() const
Definition: TSelectorEntries.h:45
tree
Definition: tree.py:1
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TTree
Definition: TTree.h:79
TSelectorEntries::fOwnInput
Bool_t fOwnInput
Definition: TSelectorEntries.h:35
TSelectorEntries::Process
virtual Bool_t Process(Long64_t entry)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
Definition: TSelectorEntries.cxx:161
Int_t
int Int_t
Definition: RtypesCore.h:45
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
bool
TSelectorEntries
Definition: TSelectorEntries.h:34
TSelectorEntries::GetEntry
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read entry.
Definition: TSelectorEntries.cxx:115
TSelectorEntries::SetObject
virtual void SetObject(TObject *obj)
Definition: TSelectorEntries.h:54
TSelectorEntries::Notify
virtual Bool_t Notify()
This function is called at the first entry of a new tree in a chain.
Definition: TSelectorEntries.cxx:136
TSelectorEntries::Init
virtual void Init(TTree *tree)
The Init() function is called when the selector needs to initialize a new tree or chain.
Definition: TSelectorEntries.cxx:129
TSelector::fOption
TString fOption
Option given to TTree::Process.
Definition: TSelector.h:39
TTreeFormula
Definition: TTreeFormula.h:58
TSelectorEntries::fSelectedRows
Long64_t fSelectedRows
Definition: TSelectorEntries.h:39
TSelectorEntries::SlaveTerminate
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
Definition: TSelectorEntries.cxx:217
TSelectorEntries::GetSelectedRows
virtual Long64_t GetSelectedRows() const
Definition: TSelectorEntries.h:52
TSelectorEntries::fChain
TTree * fChain
Definition: TSelectorEntries.h:37
TSelector::fOutput
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:42
TSelectorEntries::fSelectMultiple
Bool_t fSelectMultiple
Definition: TSelectorEntries.h:40
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TSelectorEntries::fSelect
TTreeFormula * fSelect
pointer to the analyzed TTree or TChain
Definition: TSelectorEntries.h:38
TSelector::fObject
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:40
TSelectorEntries::SetOption
virtual void SetOption(const char *option)
Definition: TSelectorEntries.h:53
TSelectorEntries::SetSelection
virtual void SetSelection(const char *selection)
Set the selection expression.
Definition: TSelectorEntries.cxx:198
TSelectorEntries::Terminate
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
Definition: TSelectorEntries.cxx:227
TSelector.h
TList
Definition: TList.h:44
TSelectorEntries::~TSelectorEntries
virtual ~TSelectorEntries()
Destructor.
Definition: TSelectorEntries.cxx:66
int