Logo ROOT   6.08/07
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 #ifndef ROOT_TSelector
25 #include "TSelector.h"
26 #endif
27 
28 class TTreeFormula;
30 class TH1;
31 class TEntryListArray;
32 
33 class TSelectorDraw : public TSelector {
34 
35 protected:
36  enum { kWarn = BIT(12) };
37 
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
65 
66 protected:
67  virtual void ClearFormula();
68  virtual Bool_t CompileVariables(const char *varexp="", const char *selection="");
69  virtual void InitArrays(Int_t newsize);
70 
71 private:
72  TSelectorDraw(const TSelectorDraw&); // not implemented
73  TSelectorDraw& operator=(const TSelectorDraw&); // not implemented
74 
75 public:
76  TSelectorDraw();
77  virtual ~TSelectorDraw();
78 
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;}
87  TH1 *GetOldHistogram() const {return fOldHistogram;}
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();
120 
121  ClassDef(TSelectorDraw,1); //A specialized TSelector for TTree::Draw
122 };
123 
124 #endif
virtual void InitArrays(Int_t newsize)
Initialization of the primitive type arrays if the new size is bigger than the available space...
virtual void Terminate()
Called at the end of a loop on a TTree.
virtual Int_t GetAction() const
Definition: TSelectorDraw.h:80
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
long long Long64_t
Definition: RtypesCore.h:69
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 ...
virtual Double_t * GetV2() const
A list of entries and subentries in a TTree or TChain.
virtual void SetEstimate(Long64_t n)
Set number of entries to estimate variable limits.
Double_t ** fVal
Definition: TSelectorDraw.h:57
TSelectorDraw & operator=(const TSelectorDraw &)
TTreeFormula ** fVar
Definition: TSelectorDraw.h:39
TEntryListArray * fTreeElistArray
Definition: TSelectorDraw.h:43
virtual void ProcessFill(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
Int_t fAction
Pointer to previously used histogram.
Definition: TSelectorDraw.h:45
#define BIT(n)
Definition: Rtypes.h:120
Bool_t * fVarMultiple
[fSelectedRows]Local buffer for weights
Definition: TSelectorDraw.h:60
TTreeFormulaManager * fManager
Definition: TSelectorDraw.h:41
virtual void TakeAction()
Execute action for object obj fNfill times.
Basic string class.
Definition: TString.h:137
virtual Bool_t Process(Long64_t)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Int_t * fNbins
Definition: TSelectorDraw.h:53
Long64_t fCurrentSubEntry
Definition: TSelectorDraw.h:64
TH1 * fOldHistogram
pointer to Tree Event list array
Definition: TSelectorDraw.h:44
virtual Int_t GetDimension() const
Definition: TSelectorDraw.h:82
Int_t GetMultiplicity() const
Definition: TSelectorDraw.h:85
virtual Double_t * GetV4() const
Int_t fValSize
[fSelectedRows][fDimension] Local buffer for the variables
Definition: TSelectorDraw.h:58
virtual Double_t * GetV3() const
Used to coordinate one or more TTreeFormula objects.
TTreeFormula * GetVar4() const
Definition: TSelectorDraw.h:99
#define ClassDef(name, id)
Definition: Rtypes.h:254
TTreeFormula * GetVar2() const
Definition: TSelectorDraw.h:95
Double_t fWeight
[fDimension] Maxima of varexp columns
Definition: TSelectorDraw.h:56
TTreeFormula * fSelect
[fDimension] Array of pointers to variables formula
Definition: TSelectorDraw.h:40
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:64
Int_t fMultiplicity
Total number of histogram fills.
Definition: TSelectorDraw.h:48
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:48
TTreeFormula * GetSelect() const
Definition: TSelectorDraw.h:88
virtual void Begin(TTree *tree)
Called every time a loop on the tree(s) starts.
virtual Double_t * GetW() const
virtual Bool_t Notify()
This function is called at the first entry of a new tree in a chain.
virtual Double_t * GetV1() const
TObject * fTreeElist
Definition: TSelectorDraw.h:42
TObject * GetObject() const
Definition: TSelectorDraw.h:84
virtual ~TSelectorDraw()
Selector destructor.
virtual Bool_t CompileVariables(const char *varexp="", const char *selection="")
Compile input variables and selection expression.
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t * fVmin
[fDimension] Number of bins per dimension
Definition: TSelectorDraw.h:54
TTree * GetTree() const
Definition: TSelectorDraw.h:90
Long64_t fDraw
Action type.
Definition: TSelectorDraw.h:46
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
Long64_t fSelectedRows
Definition: TSelectorDraw.h:50
Bool_t fCleanElist
Definition: TSelectorDraw.h:62
double Double_t
Definition: RtypesCore.h:55
Bool_t fSelectMultiple
[fDimension] true if fVar[i] has a variable index
Definition: TSelectorDraw.h:61
Double_t * fVmax
[fDimension] Minima of varexp columns
Definition: TSelectorDraw.h:55
virtual void ProcessFillMultiple(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
virtual void ProcessFillObject(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
virtual Int_t GetNfill() const
Definition: TSelectorDraw.h:86
The TH1 histogram class.
Definition: TH1.h:80
TTreeFormula * GetVar3() const
Definition: TSelectorDraw.h:97
Double_t * fW
Definition: TSelectorDraw.h:59
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Long64_t GetDrawFlag() const
Definition: TSelectorDraw.h:83
Long64_t fOldEstimate
Definition: TSelectorDraw.h:51
virtual void TakeEstimate()
Estimate limits for 1-D, 2-D or 3-D objects.
Int_t fNfill
Last entry loop number when object was drawn.
Definition: TSelectorDraw.h:47
virtual void ClearFormula()
Delete internal buffers.
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:98
TH1 * GetOldHistogram() const
Definition: TSelectorDraw.h:87
virtual Bool_t GetCleanElist() const
Definition: TSelectorDraw.h:81
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:39
TSelectorDraw()
Default selector constructor.
const Int_t n
Definition: legend1.C:16
virtual Long64_t GetSelectedRows() const
Definition: TSelectorDraw.h:89
TTreeFormula * GetVar1() const
Definition: TSelectorDraw.h:93