Logo ROOT   6.12/07
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 #include "TVirtualTableInterface.h"
15 
16 class TTree;
17 class TObjArray;
18 class TTreeFormula;
20 class TSelectorDraw;
21 class TEntryList;
22 class TList;
23 
24 
26 
27 private:
28  TTree *fTree; // Data in a TTree
29  TList *fFormulas; // Array of TTreeFormulas to display values
30  Long64_t fEntry; // Present entry number in fTree.
31  Long64_t fNEntries; // Number of entries in the tree.
32  Long64_t fFirstEntry; // First entry.
33  TTreeFormulaManager *fManager; // Coordinator for the formulas.
34  TTreeFormula *fSelect; // Selection condition
35  TSelectorDraw *fSelector; // Selector
36  TList *fInput; // Used for fSelector.
37  Bool_t fForceDim; // Force dimension.
38  TEntryList *fEntries; // Currently active entries
39  UInt_t fNRows; // Amount of rows in the data
40  UInt_t fNColumns; // Amount of columns in the data
41 
42  void SetVariablesExpression(const char *varexp);
43  void SyncFormulas();
44  void InitEntries();
45 
46 protected:
47 
48 public:
49  TTreeTableInterface(TTree *tree = 0, const char *varexp = 0,
50  const char *selection = 0, Option_t *option = 0,
51  Long64_t nentries = 0, Long64_t firstentry = 0);
52  virtual ~TTreeTableInterface();
53 
54  virtual Double_t GetValue(UInt_t row, UInt_t column);
55  virtual const char *GetValueAsString(UInt_t row, UInt_t column);
56  virtual const char *GetRowHeader(UInt_t row);
57  virtual const char *GetColumnHeader(UInt_t column);
58  virtual UInt_t GetNRows();
59  virtual UInt_t GetNColumns();
60  virtual TEntryList *GetEntryList() { return fEntries; }
61 
62  virtual void AddColumn(const char *expression, UInt_t position);
63  virtual void AddColumn(TTreeFormula *formula, UInt_t position);
64  virtual void RemoveColumn(UInt_t position);
65  virtual void SetFormula(TTreeFormula *formula, UInt_t position);
66  virtual void SetSelection(const char *selection);
67  virtual void SetEntryList(TEntryList *entrylist = 0);
68 
69  ClassDef(TTreeTableInterface, 0) // Interface to data in a TTree
70 };
71 
72 #endif
An array of TObjects.
Definition: TObjArray.h:37
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:320
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
A doubly linked list.
Definition: TList.h:44
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:31
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)
TTreeTableInterface constructor.
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.
Definition: tree.py:1
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:70
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:25
virtual void SetSelection(const char *selection)
Set the selection expression.