Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/treeplayer:$Id$
2// Author: Rene Brun 08/01/2003
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 *************************************************************************/
12#ifndef ROOT_TSelectorDraw
13#define ROOT_TSelectorDraw
17// //
18// TSelectorDraw //
19// //
20// A specialized TSelector for TTree::Draw. //
21// //
24#include "TSelector.h"
26#include <vector>
28class TTreeFormula;
30class TH1;
31class TEntryListArray;
33class TSelectorDraw : public TSelector {
36 enum EStatusBits { kWarn = BIT(12) };
38 TTree *fTree; ///< Pointer to current Tree
39 TTreeFormula **fVar; ///<![fDimension] Array of pointers to variables formula
40 TTreeFormula *fSelect; ///< Pointer to selection formula
41 TTreeFormulaManager *fManager; ///< Pointer to the formula manager
42 TObject *fTreeElist; ///< Pointer to Tree Event list
43 TEntryListArray *fTreeElistArray; ///<! Pointer to Tree Event list array
44 TH1 *fOldHistogram; ///<! Pointer to previously used histogram
45 Int_t fAction; ///<! Action type
46 Long64_t fDraw; ///<! Last entry loop number when object was drawn
47 Int_t fNfill; ///<! Total number of histogram fills
48 Int_t fMultiplicity; ///< Indicator of the variability of the size of entries
49 Int_t fDimension; ///< Dimension of the current expression
50 Long64_t fSelectedRows; ///< Number of selected entries
51 Long64_t fOldEstimate; ///< Value of Tree fEstimate when selector is called
52 Int_t fForceRead; ///< Force Read flag
53 Int_t *fNbins; ///<![fDimension] Number of bins per dimension
54 Double_t *fVmin; ///<![fDimension] Minima of varexp columns
55 Double_t *fVmax; ///<![fDimension] Maxima of varexp columns
56 Double_t fWeight; ///< Tree weight (see TTree::SetWeight)
57 Double_t **fVal; ///<![fSelectedRows][fDimension] Local buffer for the variables
59 Double_t *fW; ///<![fSelectedRows]Local buffer for weights
60 Bool_t *fVarMultiple; ///<![fDimension] True if fVar[i] has a variable index
61 Bool_t fSelectMultiple; ///< True if selection has a variable index
62 Bool_t fCleanElist; ///< True if original Tree elist must be saved
63 Bool_t fObjEval; ///< True if fVar1 returns an object (or pointer to).
64 Long64_t fCurrentSubEntry; ///< Current subentry when fSelectMultiple is true. Used to fill TEntryListArray
67 virtual void ClearFormula();
68 virtual Bool_t CompileVariables(const char *varexp="", const char *selection="");
69 virtual void InitArrays(Int_t newsize);
72 TSelectorDraw(const TSelectorDraw&); // not implemented
73 TSelectorDraw& operator=(const TSelectorDraw&); // not implemented
77 virtual ~TSelectorDraw();
79 virtual void Begin(TTree *tree);
80 virtual Int_t GetAction() const {return fAction;}
81 virtual Bool_t GetCleanElist() const {return fCleanElist;}
82 virtual Int_t GetDimension() const {return fDimension;}
83 virtual Long64_t GetDrawFlag() const {return fDraw;}
84 TObject *GetObject() const {return fObject;}
86 virtual Int_t GetNfill() const {return fNfill;}
88 TTreeFormula *GetSelect() const {return fSelect;}
89 virtual Long64_t GetSelectedRows() const {return fSelectedRows;}
90 TTree *GetTree() const {return fTree;}
91 TTreeFormula *GetVar(Int_t i) const;
92 /// See TSelectorDraw::GetVar
93 TTreeFormula *GetVar1() const {return GetVar(0);}
94 /// See TSelectorDraw::GetVar
95 TTreeFormula *GetVar2() const {return GetVar(1);}
96 /// See TSelectorDraw::GetVar
97 TTreeFormula *GetVar3() const {return GetVar(2);}
98 /// See TSelectorDraw::GetVar
99 TTreeFormula *GetVar4() const {return GetVar(3);}
100 virtual Double_t *GetVal(Int_t i) const;
101 /// See TSelectorDraw::GetVal
102 virtual Double_t *GetV1() const {return GetVal(0);}
103 /// See TSelectorDraw::GetVal
104 virtual Double_t *GetV2() const {return GetVal(1);}
105 /// See TSelectorDraw::GetVal
106 virtual Double_t *GetV3() const {return GetVal(2);}
107 /// See TSelectorDraw::GetVal
108 virtual Double_t *GetV4() const {return GetVal(3);}
109 virtual Double_t *GetW() const {return fW;}
110 virtual Bool_t Notify();
111 virtual Bool_t Process(Long64_t /*entry*/) { return kFALSE; }
112 virtual void ProcessFill(Long64_t entry);
113 virtual void ProcessFillMultiple(Long64_t entry);
114 virtual void ProcessFillObject(Long64_t entry);
115 virtual void SetEstimate(Long64_t n);
116 virtual UInt_t SplitNames(const TString &varexp, std::vector<TString> &names);
117 virtual void TakeAction();
118 virtual void TakeEstimate();
119 virtual void Terminate();
121 ClassDef(TSelectorDraw,1); //A specialized TSelector for TTree::Draw
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
unsigned int UInt_t
Definition: RtypesCore.h:46
double Double_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:80
#define ClassDef(name, id)
Definition: Rtypes.h:335
#define BIT(n)
Definition: Rtypes.h:85
A list of entries and subentries in a TTree or TChain.
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
Mother of all ROOT objects.
Definition: TObject.h:41
Definition: TObject.h:61
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
TEntryListArray * fTreeElistArray
! Pointer to Tree Event list array
Definition: TSelectorDraw.h:43
virtual void SetEstimate(Long64_t n)
Set number of entries to estimate variable limits.
virtual void InitArrays(Int_t newsize)
Initialization of the primitive type arrays if the new size is bigger than the available space.
virtual Double_t * GetW() const
Int_t fAction
! Action type
Definition: TSelectorDraw.h:45
Int_t GetMultiplicity() const
Definition: TSelectorDraw.h:85
TTreeFormulaManager * fManager
Pointer to the formula manager.
Definition: TSelectorDraw.h:41
TTreeFormula * GetSelect() const
Definition: TSelectorDraw.h:88
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
Bool_t * fVarMultiple
![fDimension] True if fVar[i] has a variable index
Definition: TSelectorDraw.h:60
virtual Bool_t CompileVariables(const char *varexp="", const char *selection="")
Compile input variables and selection expression.
virtual Double_t * GetV4() const
See TSelectorDraw::GetVal.
TTreeFormula * GetVar3() const
See TSelectorDraw::GetVar.
Definition: TSelectorDraw.h:97
TSelectorDraw & operator=(const TSelectorDraw &)
virtual Long64_t GetDrawFlag() const
Definition: TSelectorDraw.h:83
Default selector constructor.
Double_t * fW
![fSelectedRows]Local buffer for weights
Definition: TSelectorDraw.h:59
virtual void Terminate()
Called at the end of a loop on a TTree.
TH1 * GetOldHistogram() const
Definition: TSelectorDraw.h:87
virtual Long64_t GetSelectedRows() const
Definition: TSelectorDraw.h:89
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
Long64_t fCurrentSubEntry
Current subentry when fSelectMultiple is true. Used to fill TEntryListArray.
Definition: TSelectorDraw.h:64
TTreeFormula * fSelect
Pointer to selection formula.
Definition: TSelectorDraw.h:40
TSelectorDraw(const TSelectorDraw &)
Long64_t fSelectedRows
Number of selected entries.
Definition: TSelectorDraw.h:50
Int_t fForceRead
Force Read flag.
Definition: TSelectorDraw.h:52
virtual void ClearFormula()
Delete internal buffers.
virtual ~TSelectorDraw()
Selector destructor.
virtual void TakeAction()
Execute action for object obj fNfill times.
TObject * GetObject() const
Definition: TSelectorDraw.h:84
virtual Double_t * GetV2() const
See TSelectorDraw::GetVal.
Long64_t fOldEstimate
Value of Tree fEstimate when selector is called.
Definition: TSelectorDraw.h:51
Double_t fWeight
Tree weight (see TTree::SetWeight)
Definition: TSelectorDraw.h:56
Int_t fNfill
! Total number of histogram fills
Definition: TSelectorDraw.h:47
virtual Bool_t GetCleanElist() const
Definition: TSelectorDraw.h:81
virtual void ProcessFill(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
TH1 * fOldHistogram
! Pointer to previously used histogram
Definition: TSelectorDraw.h:44
TTreeFormula * GetVar2() const
See TSelectorDraw::GetVar.
Definition: TSelectorDraw.h:95
virtual Int_t GetAction() const
Definition: TSelectorDraw.h:80
Double_t * fVmax
![fDimension] Maxima of varexp columns
Definition: TSelectorDraw.h:55
TTreeFormula * GetVar1() const
See TSelectorDraw::GetVar.
Definition: TSelectorDraw.h:93
Int_t fMultiplicity
Indicator of the variability of the size of entries.
Definition: TSelectorDraw.h:48
TTreeFormula ** fVar
![fDimension] Array of pointers to variables formula
Definition: TSelectorDraw.h:39
virtual void ProcessFillMultiple(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
TTree * fTree
Pointer to current Tree.
Definition: TSelectorDraw.h:38
TTreeFormula * GetVar4() const
See TSelectorDraw::GetVar.
Definition: TSelectorDraw.h:99
virtual Double_t * GetV1() const
See TSelectorDraw::GetVal.
virtual Bool_t Process(Long64_t)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
Int_t fDimension
Dimension of the current expression.
Definition: TSelectorDraw.h:49
Bool_t fObjEval
True if fVar1 returns an object (or pointer to).
Definition: TSelectorDraw.h:63
virtual Int_t GetDimension() const
Definition: TSelectorDraw.h:82
TObject * fTreeElist
Pointer to Tree Event list.
Definition: TSelectorDraw.h:42
virtual Double_t * GetVal(Int_t i) const
Return the last values corresponding to the i-th component of the formula being processed (where the ...
Int_t * fNbins
![fDimension] Number of bins per dimension
Definition: TSelectorDraw.h:53
virtual Double_t * GetV3() const
See TSelectorDraw::GetVal.
Double_t ** fVal
![fSelectedRows][fDimension] Local buffer for the variables
Definition: TSelectorDraw.h:57
Long64_t fDraw
! Last entry loop number when object was drawn
Definition: TSelectorDraw.h:46
Bool_t fSelectMultiple
True if selection has a variable index.
Definition: TSelectorDraw.h:61
TTree * GetTree() const
Definition: TSelectorDraw.h:90
virtual void TakeEstimate()
Estimate limits for 1-D, 2-D or 3-D objects.
Bool_t fCleanElist
True if original Tree elist must be saved.
Definition: TSelectorDraw.h:62
virtual Int_t GetNfill() const
Definition: TSelectorDraw.h:86
virtual void ProcessFillObject(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
Double_t * fVmin
![fDimension] Minima of varexp columns
Definition: TSelectorDraw.h:54
virtual void Begin(TTree *tree)
Called every time a loop on the tree(s) starts.
virtual Bool_t Notify()
This function is called at the first entry of a new tree in a chain.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:31
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:40
Basic string class.
Definition: TString.h:136
Used to coordinate one or more TTreeFormula objects.
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
A TTree represents a columnar dataset.
Definition: TTree.h:79
const Int_t n
Definition: legend1.C:16
Definition: tree.py:1