ROOT  6.06/09
Reference Guide
TTreeTableInterface.h
Go to the documentation of this file.
1 // Author: Roel Aaij 21/07/2007
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TTreeTableInterface
12 #define ROOT_TTreeTableInterface
13 
14 #ifndef ROOT_TVirtualTableInterface
15 #include "TVirtualTableInterface.h"
16 #endif
17 
18 class TTree;
19 class TObjArray;
20 class TTreeFormula;
22 class TSelectorDraw;
23 class TEntryList;
24 class TList;
25 
26 
28 
29 private:
30  TTree *fTree; // Data in a TTree
31  TList *fFormulas; // Array of TTreeFormulas to display values
32  Long64_t fEntry; // Present entry number in fTree.
33  Long64_t fNEntries; // Number of entries in the tree.
34  Long64_t fFirstEntry; // First entry.
35  TTreeFormulaManager *fManager; // Coordinator for the formulas.
36  TTreeFormula *fSelect; // Selection condition
37  TSelectorDraw *fSelector; // Selector
38  TList *fInput; // Used for fSelector.
39  Bool_t fForceDim; // Force dimension.
40  TEntryList *fEntries; // Currently active entries
41  UInt_t fNRows; // Amount of rows in the data
42  UInt_t fNColumns; // Amount of columns in the data
43 
44  void SetVariablesExpression(const char *varexp);
45  void SyncFormulas();
46  void InitEntries();
47 
48 protected:
49 
50 public:
51  TTreeTableInterface(TTree *tree = 0, const char *varexp = 0,
52  const char *selection = 0, Option_t *option = 0,
53  Long64_t nentries = 0, Long64_t firstentry = 0);
54  virtual ~TTreeTableInterface();
55 
56  virtual Double_t GetValue(UInt_t row, UInt_t column);
57  virtual const char *GetValueAsString(UInt_t row, UInt_t column);
58  virtual const char *GetRowHeader(UInt_t row);
59  virtual const char *GetColumnHeader(UInt_t column);
60  virtual UInt_t GetNRows();
61  virtual UInt_t GetNColumns();
62  virtual TEntryList *GetEntryList() { return fEntries; }
63 
64  virtual void AddColumn(const char *expression, UInt_t position);
65  virtual void AddColumn(TTreeFormula *formula, UInt_t position);
66  virtual void RemoveColumn(UInt_t position);
67  virtual void SetFormula(TTreeFormula *formula, UInt_t position);
68  virtual void SetSelection(const char *selection);
69  virtual void SetEntryList(TEntryList *entrylist = 0);
70 
71  ClassDef(TTreeTableInterface, 0) // Interface to data in a TTree
72 };
73 
74 #endif
An array of TObjects.
Definition: TObjArray.h:39
long long Long64_t
Definition: RtypesCore.h:69
virtual void RemoveColumn(UInt_t position)
Remove column at position, TGTable->Update() is needed afterwards to apply the change to the TGTable...
const char Option_t
Definition: RtypesCore.h:62
virtual TEntryList * GetEntryList()
virtual void SetFormula(TTreeFormula *formula, UInt_t position)
Set the TTreeFormula of position to formula.
virtual UInt_t GetNRows()
Return the amount of rows in the Tree.
bool Bool_t
Definition: RtypesCore.h:59
virtual const char * GetValueAsString(UInt_t row, UInt_t column)
Return the content of row,column as string to use in a TGTableCell label.
virtual void AddColumn(const char *expression, UInt_t position)
Add column according ot expression at position, TGTable->Update() is needed afterwards to apply the c...
virtual const char * GetColumnHeader(UInt_t column)
Return a string to use as a label for columnheader at column.
Used to coordinate one or more TTreeFormula objects.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:64
A doubly linked list.
Definition: TList.h:47
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given varexp.
unsigned int UInt_t
Definition: RtypesCore.h:42
TTreeFormulaManager * fManager
TSelectorDraw * fSelector
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
virtual ~TTreeTableInterface()
TTreeTableInterface destructor.
void SyncFormulas()
Sync the formulas using the TTreeFormulaManager.
TTreeTableInterface(TTree *tree=0, const char *varexp=0, const char *selection=0, Option_t *option=0, Long64_t nentries=0, Long64_t firstentry=0)
double Double_t
Definition: RtypesCore.h:55
virtual const char * GetRowHeader(UInt_t row)
Return a string to use as a label for rowheader at column.
int nentries
Definition: THbookFile.cxx:89
virtual Double_t GetValue(UInt_t row, UInt_t column)
Return the value of row,column.
void InitEntries()
Initialise the TEntryList with the entries that match the selection criterium.
TTreeTableInterface is used to interface to data that is stored in a TTree.
A TTree object has a header with a name and a title.
Definition: TTree.h:94
virtual UInt_t GetNColumns()
Return the amount of column available.
virtual void SetEntryList(TEntryList *entrylist=0)
Set the currently active entrylist.
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:27
virtual void SetSelection(const char *selection)
Set the selection expression.