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