Logo ROOT   6.14/05
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 class TTreeFormula;
28 class TH1;
29 class TEntryListArray;
30 
31 class TSelectorDraw : public TSelector {
32 
33 protected:
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 
64 protected:
65  virtual void ClearFormula();
66  virtual Bool_t CompileVariables(const char *varexp="", const char *selection="");
67  virtual void InitArrays(Int_t newsize);
68 
69 private:
70  TSelectorDraw(const TSelectorDraw&); // not implemented
71  TSelectorDraw& operator=(const TSelectorDraw&); // not implemented
72 
73 public:
74  TSelectorDraw();
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;}
85  TH1 *GetOldHistogram() const {return fOldHistogram;}
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
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:78
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:55
TSelectorDraw & operator=(const TSelectorDraw &)
TTreeFormula ** fVar
Definition: TSelectorDraw.h:37
TEntryListArray * fTreeElistArray
Definition: TSelectorDraw.h:41
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:43
#define BIT(n)
Definition: Rtypes.h:78
Bool_t * fVarMultiple
[fSelectedRows]Local buffer for weights
Definition: TSelectorDraw.h:58
TTreeFormulaManager * fManager
Definition: TSelectorDraw.h:39
virtual void TakeAction()
Execute action for object obj fNfill times.
Basic string class.
Definition: TString.h:131
virtual Bool_t Process(Long64_t)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t * fNbins
Definition: TSelectorDraw.h:51
Long64_t fCurrentSubEntry
Definition: TSelectorDraw.h:62
TH1 * fOldHistogram
pointer to Tree Event list array
Definition: TSelectorDraw.h:42
virtual Int_t GetDimension() const
Definition: TSelectorDraw.h:80
Int_t GetMultiplicity() const
Definition: TSelectorDraw.h:83
virtual Double_t * GetV4() const
Int_t fValSize
[fSelectedRows][fDimension] Local buffer for the variables
Definition: TSelectorDraw.h:56
virtual Double_t * GetV3() const
Used to coordinate one or more TTreeFormula objects.
TTreeFormula * GetVar4() const
Definition: TSelectorDraw.h:97
#define ClassDef(name, id)
Definition: Rtypes.h:320
TTreeFormula * GetVar2() const
Definition: TSelectorDraw.h:93
Double_t fWeight
[fDimension] Maxima of varexp columns
Definition: TSelectorDraw.h:54
TTreeFormula * fSelect
[fDimension] Array of pointers to variables formula
Definition: TSelectorDraw.h:38
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
Int_t fMultiplicity
Total number of histogram fills.
Definition: TSelectorDraw.h:46
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:42
TTreeFormula * GetSelect() const
Definition: TSelectorDraw.h:86
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:40
TObject * GetObject() const
Definition: TSelectorDraw.h:82
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:52
TTree * GetTree() const
Definition: TSelectorDraw.h:88
Long64_t fDraw
Action type.
Definition: TSelectorDraw.h:44
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:31
const Bool_t kFALSE
Definition: RtypesCore.h:88
Long64_t fSelectedRows
Definition: TSelectorDraw.h:48
Bool_t fCleanElist
Definition: TSelectorDraw.h:60
double Double_t
Definition: RtypesCore.h:55
Bool_t fSelectMultiple
[fDimension] true if fVar[i] has a variable index
Definition: TSelectorDraw.h:59
Double_t * fVmax
[fDimension] Minima of varexp columns
Definition: TSelectorDraw.h:53
EStatusBits
Definition: TObject.h:57
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:84
The TH1 histogram class.
Definition: TH1.h:56
TTreeFormula * GetVar3() const
Definition: TSelectorDraw.h:95
Double_t * fW
Definition: TSelectorDraw.h:57
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Long64_t GetDrawFlag() const
Definition: TSelectorDraw.h:81
Long64_t fOldEstimate
Definition: TSelectorDraw.h:49
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:45
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:70
TH1 * GetOldHistogram() const
Definition: TSelectorDraw.h:85
virtual Bool_t GetCleanElist() const
Definition: TSelectorDraw.h:79
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:33
TSelectorDraw()
Default selector constructor.
const Int_t n
Definition: legend1.C:16
virtual Long64_t GetSelectedRows() const
Definition: TSelectorDraw.h:87
TTreeFormula * GetVar1() const
Definition: TSelectorDraw.h:91