Logo ROOT   6.21/01
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 
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:44
long long Long64_t
Definition: RtypesCore.h:69
TSelectorEntries(TTree *tree=0, const char *selection=0)
Default, constructor.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~TSelectorEntries()
Destructor.
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 ...
virtual void Init(TTree *tree)
The Init() function is called when the selector needs to initialize a new tree or chain...
virtual void Begin(TTree *tree)
The Begin() function is called at the start of the query.
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
#define ClassDef(name, id)
Definition: Rtypes.h:326
TString fOption
Option given to TTree::Process.
Definition: TSelector.h:41
virtual TList * GetOutputList() const
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read entry.
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
A doubly linked list.
Definition: TList.h:44
virtual void SetObject(TObject *obj)
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:42
TTreeFormula * fSelect
pointer to the analyzed TTree or TChain
virtual Long64_t GetSelectedRows() const
virtual void SetSelection(const char *selection)
Set the selection expression.
virtual Bool_t Notify()
This function is called at the first entry of a new tree in a chain.
The class is derived from the ROOT class TSelector.
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
virtual void SetOption(const char *option)
Definition: tree.py:1
A TTree represents a columnar dataset.
Definition: TTree.h:72
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:33
virtual Int_t Version() const