Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
35 TSelectorDraw *fSelector; ///< Selector
36 TList *fInput; ///< Used for fSelector.
37 bool 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 = nullptr, const char *varexp = nullptr,
50 const char *selection = nullptr, Option_t *option = nullptr,
51 Long64_t nentries = 0, Long64_t firstentry = 0);
52 ~TTreeTableInterface() override;
53
54 Double_t GetValue(UInt_t row, UInt_t column) override;
55 const char *GetValueAsString(UInt_t row, UInt_t column) override;
56 const char *GetRowHeader(UInt_t row) override;
57 const char *GetColumnHeader(UInt_t column) override;
58 UInt_t GetNRows() override;
59 UInt_t GetNColumns() override;
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 = nullptr);
68
69 ClassDefOverride(TTreeTableInterface, 0) // Interface to data in a TTree
70};
71
72#endif
unsigned int UInt_t
Definition RtypesCore.h:46
long long Long64_t
Definition RtypesCore.h:80
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
int nentries
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
A doubly linked list.
Definition TList.h:38
An array of TObjects.
Definition TObjArray.h:31
A specialized TSelector for TTree::Draw.
Used to coordinate one or more TTreeFormula objects.
Used to pass a selection expression to the Tree drawing routine.
TTreeTableInterface is used to interface to data that is stored in a TTree.
virtual TEntryList * GetEntryList()
const char * GetRowHeader(UInt_t row) override
Return a string to use as a label for rowheader at column.
~TTreeTableInterface() override
TTreeTableInterface destructor.
Long64_t fFirstEntry
First entry.
Long64_t fEntry
Present entry number in fTree.
const char * GetColumnHeader(UInt_t column) override
Return a string to use as a label for columnheader at column.
UInt_t GetNColumns() override
Return the amount of column available.
UInt_t fNRows
Amount of rows in the data.
virtual void SetFormula(TTreeFormula *formula, UInt_t position)
Set the TTreeFormula of position to formula.
const char * GetValueAsString(UInt_t row, UInt_t column) override
Return the content of row,column as string to use in a TGTableCell label.
void SyncFormulas()
Sync the formulas using the TTreeFormulaManager.
UInt_t fNColumns
Amount of columns in the data.
virtual void RemoveColumn(UInt_t position)
Remove column at position, TGTable->Update() is needed afterwards to apply the change to the TGTable.
UInt_t GetNRows() override
Return the amount of rows in the Tree.
TTreeFormula * fSelect
Selection condition.
TTreeFormulaManager * fManager
Coordinator for the formulas.
Double_t GetValue(UInt_t row, UInt_t column) override
Return the value of row,column.
virtual void SetEntryList(TEntryList *entrylist=nullptr)
Set the currently active entrylist.
void InitEntries()
Initialise the TEntryList with the entries that match the selection criterium.
TTree * fTree
Data in a TTree.
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...
TList * fFormulas
Array of TTreeFormulas to display values.
Long64_t fNEntries
Number of entries in the tree.
bool fForceDim
Force dimension.
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given varexp.
TEntryList * fEntries
Currently active entries.
TSelectorDraw * fSelector
Selector.
TList * fInput
Used for fSelector.
A TTree represents a columnar dataset.
Definition TTree.h:79