Logo ROOT  
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
15
16class TTree;
17class TObjArray;
18class TTreeFormula;
20class TSelectorDraw;
21class TEntryList;
22class TList;
23
24
26
27private:
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
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
46protected:
47
48public:
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
unsigned int UInt_t
Definition: RtypesCore.h:44
double Double_t
Definition: RtypesCore.h:57
long long Long64_t
Definition: RtypesCore.h:71
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
int nentries
Definition: THbookFile.cxx:89
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:26
A doubly linked list.
Definition: TList.h:44
An array of TObjects.
Definition: TObjArray.h:37
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:31
Used to coordinate one or more TTreeFormula objects.
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
TTreeTableInterface is used to interface to data that is stored in a TTree.
virtual TEntryList * GetEntryList()
virtual Double_t GetValue(UInt_t row, UInt_t column)
Return the value of row,column.
virtual ~TTreeTableInterface()
TTreeTableInterface destructor.
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 SetFormula(TTreeFormula *formula, UInt_t position)
Set the TTreeFormula of position to formula.
void SyncFormulas()
Sync the formulas using the TTreeFormulaManager.
virtual void RemoveColumn(UInt_t position)
Remove column at position, TGTable->Update() is needed afterwards to apply the change to the TGTable.
virtual const char * GetColumnHeader(UInt_t column)
Return a string to use as a label for columnheader at column.
virtual UInt_t GetNRows()
Return the amount of rows in the Tree.
TTreeFormulaManager * fManager
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.
void InitEntries()
Initialise the TEntryList with the entries that match the selection criterium.
virtual void SetEntryList(TEntryList *entrylist=0)
Set the currently active entrylist.
virtual void SetSelection(const char *selection)
Set the selection expression.
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...
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given varexp.
virtual const char * GetRowHeader(UInt_t row)
Return a string to use as a label for rowheader at column.
virtual UInt_t GetNColumns()
Return the amount of column available.
TSelectorDraw * fSelector
A TTree represents a columnar dataset.
Definition: TTree.h:78
Definition: tree.py:1