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 
26 #include <vector>
27 
28 class TTreeFormula;
30 class TH1;
31 class TEntryListArray;
32 
33 class TSelectorDraw : public TSelector {
34 
35 protected:
36  enum EStatusBits { 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
TSelectorDraw::Notify
virtual Bool_t Notify()
This function is called at the first entry of a new tree in a chain.
Definition: TSelectorDraw.cxx:1154
n
const Int_t n
Definition: legend1.C:16
TSelectorDraw::GetV1
virtual Double_t * GetV1() const
Definition: TSelectorDraw.h:102
TSelectorDraw::~TSelectorDraw
virtual ~TSelectorDraw()
Selector destructor.
Definition: TSelectorDraw.cxx:86
TSelector
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:31
TSelectorDraw::GetDrawFlag
virtual Long64_t GetDrawFlag() const
Definition: TSelectorDraw.h:83
tree
Definition: tree.py:1
TEntryListArray
A list of entries and subentries in a TTree or TChain.
Definition: TEntryListArray.h:26
TSelectorDraw::fDraw
Long64_t fDraw
Action type.
Definition: TSelectorDraw.h:46
TSelectorDraw::fSelectedRows
Long64_t fSelectedRows
Definition: TSelectorDraw.h:50
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TSelectorDraw::ClearFormula
virtual void ClearFormula()
Delete internal buffers.
Definition: TSelectorDraw.cxx:941
TSelectorDraw::GetSelect
TTreeFormula * GetSelect() const
Definition: TSelectorDraw.h:88
TSelectorDraw::fCleanElist
Bool_t fCleanElist
Definition: TSelectorDraw.h:62
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TSelectorDraw::GetW
virtual Double_t * GetW() const
Definition: TSelectorDraw.h:109
TSelectorDraw::fVmax
Double_t * fVmax
[fDimension] Minima of varexp columns
Definition: TSelectorDraw.h:55
TSelectorDraw::ProcessFillMultiple
virtual void ProcessFillMultiple(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
Definition: TSelectorDraw.cxx:1204
TSelectorDraw::TSelectorDraw
TSelectorDraw(const TSelectorDraw &)
Int_t
int Int_t
Definition: RtypesCore.h:45
TSelectorDraw::GetVar3
TTreeFormula * GetVar3() const
Definition: TSelectorDraw.h:97
TSelectorDraw::ProcessFillObject
virtual void ProcessFillObject(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
Definition: TSelectorDraw.cxx:1277
TSelectorDraw::GetNfill
virtual Int_t GetNfill() const
Definition: TSelectorDraw.h:86
TSelectorDraw::fW
Double_t * fW
Definition: TSelectorDraw.h:59
TSelectorDraw::TakeEstimate
virtual void TakeEstimate()
Estimate limits for 1-D, 2-D or 3-D objects.
Definition: TSelectorDraw.cxx:1547
TSelectorDraw::kWarn
@ kWarn
Definition: TSelectorDraw.h:36
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TSelectorDraw::fNfill
Int_t fNfill
Last entry loop number when object was drawn.
Definition: TSelectorDraw.h:47
TSelectorDraw::GetAction
virtual Int_t GetAction() const
Definition: TSelectorDraw.h:80
bool
TSelectorDraw::GetVar
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
Definition: TSelectorDraw.cxx:1081
TSelectorDraw::GetOldHistogram
TH1 * GetOldHistogram() const
Definition: TSelectorDraw.h:87
TSelectorDraw::fSelectMultiple
Bool_t fSelectMultiple
[fDimension] true if fVar[i] has a variable index
Definition: TSelectorDraw.h:61
TSelectorDraw::TSelectorDraw
TSelectorDraw()
Default selector constructor.
Definition: TSelectorDraw.cxx:47
TSelectorDraw::fTreeElistArray
TEntryListArray * fTreeElistArray
Definition: TSelectorDraw.h:43
TSelectorDraw::ProcessFill
virtual void ProcessFill(Long64_t entry)
Called in the entry loop for all entries accepted by Select.
Definition: TSelectorDraw.cxx:1169
TTreeFormulaManager
Used to coordinate one or more TTreeFormula objects.
Definition: TTreeFormulaManager.h:30
TSelectorDraw::GetSelectedRows
virtual Long64_t GetSelectedRows() const
Definition: TSelectorDraw.h:89
TSelectorDraw::fOldEstimate
Long64_t fOldEstimate
Definition: TSelectorDraw.h:51
TSelectorDraw::InitArrays
virtual void InitArrays(Int_t newsize)
Initialization of the primitive type arrays if the new size is bigger than the available space.
Definition: TSelectorDraw.cxx:1092
TSelectorDraw::fNbins
Int_t * fNbins
Definition: TSelectorDraw.h:53
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TSelectorDraw::SplitNames
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
Definition: TSelectorDraw.cxx:1125
TTreeFormula
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
TSelectorDraw::GetMultiplicity
Int_t GetMultiplicity() const
Definition: TSelectorDraw.h:85
BIT
#define BIT(n)
Definition: Rtypes.h:85
TSelectorDraw::fObjEval
Bool_t fObjEval
Definition: TSelectorDraw.h:63
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TSelectorDraw::GetCleanElist
virtual Bool_t GetCleanElist() const
Definition: TSelectorDraw.h:81
TSelectorDraw::operator=
TSelectorDraw & operator=(const TSelectorDraw &)
TSelectorDraw::SetEstimate
virtual void SetEstimate(Long64_t n)
Set number of entries to estimate variable limits.
Definition: TSelectorDraw.cxx:1343
TSelectorDraw::fVal
Double_t ** fVal
Definition: TSelectorDraw.h:57
TSelectorDraw::fDimension
Int_t fDimension
Definition: TSelectorDraw.h:49
TSelectorDraw::fAction
Int_t fAction
Pointer to previously used histogram.
Definition: TSelectorDraw.h:45
TSelectorDraw::GetVar4
TTreeFormula * GetVar4() const
Definition: TSelectorDraw.h:99
TSelectorDraw::GetVar1
TTreeFormula * GetVar1() const
Definition: TSelectorDraw.h:93
TSelectorDraw::fManager
TTreeFormulaManager * fManager
Definition: TSelectorDraw.h:41
TSelectorDraw::TakeAction
virtual void TakeAction()
Execute action for object obj fNfill times.
Definition: TSelectorDraw.cxx:1357
TSelectorDraw::Process
virtual Bool_t Process(Long64_t)
Definition: TSelectorDraw.h:111
TSelectorDraw::Terminate
virtual void Terminate()
Called at the end of a loop on a TTree.
Definition: TSelectorDraw.cxx:1819
Double_t
double Double_t
Definition: RtypesCore.h:59
TSelectorDraw::fWeight
Double_t fWeight
[fDimension] Maxima of varexp columns
Definition: TSelectorDraw.h:56
TSelectorDraw::fOldHistogram
TH1 * fOldHistogram
pointer to Tree Event list array
Definition: TSelectorDraw.h:44
TSelectorDraw::GetVal
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 ...
Definition: TSelectorDraw.cxx:1069
TSelectorDraw::fCurrentSubEntry
Long64_t fCurrentSubEntry
Definition: TSelectorDraw.h:64
TSelectorDraw::fSelect
TTreeFormula * fSelect
[fDimension] Array of pointers to variables formula
Definition: TSelectorDraw.h:40
TSelectorDraw::GetV2
virtual Double_t * GetV2() const
Definition: TSelectorDraw.h:104
TSelectorDraw::GetV4
virtual Double_t * GetV4() const
Definition: TSelectorDraw.h:108
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TH1
TH1 is the base class of all histogramm classes in ROOT.
Definition: TH1.h:58
TSelectorDraw::fValSize
Int_t fValSize
[fSelectedRows][fDimension] Local buffer for the variables
Definition: TSelectorDraw.h:58
TSelector::fObject
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:40
TSelectorDraw::fVar
TTreeFormula ** fVar
Definition: TSelectorDraw.h:39
TSelectorDraw::GetV3
virtual Double_t * GetV3() const
Definition: TSelectorDraw.h:106
TSelectorDraw::fTreeElist
TObject * fTreeElist
Definition: TSelectorDraw.h:42
TSelectorDraw::fVarMultiple
Bool_t * fVarMultiple
[fSelectedRows]Local buffer for weights
Definition: TSelectorDraw.h:60
TSelectorDraw::GetObject
TObject * GetObject() const
Definition: TSelectorDraw.h:84
TSelectorDraw::GetVar2
TTreeFormula * GetVar2() const
Definition: TSelectorDraw.h:95
TSelectorDraw::CompileVariables
virtual Bool_t CompileVariables(const char *varexp="", const char *selection="")
Compile input variables and selection expression.
Definition: TSelectorDraw.cxx:976
TSelectorDraw::fTree
TTree * fTree
Definition: TSelectorDraw.h:38
TSelectorDraw::fVmin
Double_t * fVmin
[fDimension] Number of bins per dimension
Definition: TSelectorDraw.h:54
TSelector.h
TSelectorDraw::GetTree
TTree * GetTree() const
Definition: TSelectorDraw.h:90
TObject::EStatusBits
EStatusBits
Definition: TObject.h:57
TSelectorDraw::GetDimension
virtual Int_t GetDimension() const
Definition: TSelectorDraw.h:82
TSelectorDraw
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
TSelectorDraw::fForceRead
Int_t fForceRead
Definition: TSelectorDraw.h:52
TSelectorDraw::fMultiplicity
Int_t fMultiplicity
Total number of histogram fills.
Definition: TSelectorDraw.h:48
int
TSelectorDraw::Begin
virtual void Begin(TTree *tree)
Called every time a loop on the tree(s) starts.
Definition: TSelectorDraw.cxx:105