Logo ROOT  
Reference Guide
TTreeViewer.h
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2//Author : Andrei Gheata 16/08/00
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_TTreeViewer
13#define ROOT_TTreeViewer
14
15////////////////////////////////////////////////////
16// //
17// TTreeViewer - A GUI oriented tree viewer //
18// //
19////////////////////////////////////////////////////
20
21#include "TGFrame.h"
22
23#include "TTree.h"
24
25class TTVLVContainer;
26class TTVLVEntry;
27class TTVSession;
28class TGSelectBox;
29class TBranch;
30class TContextMenu;
31class TList;
32class TGPicture;
33class TTimer;
34class TGLayoutHints;
35class TGMenuBar;
36class TGPopupMenu;
37class TGToolBar;
38class TGLabel;
39class TGCheckButton;
40class TGComboBox;
41class TGTextButton;
42class TGTextEntry;
43class TGDoubleVSlider;
44class TGPictureButton;
45class TGStatusBar;
46class TGCanvas;
47class TGListTree;
48class TGListTreeItem;
49class TGListView;
50class TGHProgressBar;
51class TGButton;
52
53
54class TTreeViewer : public TGMainFrame {
55
56friend class TGClient;
57friend class TGButton;
58
59public:
60 /// Item types used as user data
70 kLTCutType = BIT(7)
71 };
72
73private:
74
75///@{
76 TTree *fTree; ///< Selected tree
77 TTVSession *fSession; ///< Current tree-viewer session
78 const char *fFilename; ///< Name of the file containing the tree
79 const char *fSourceFile; ///< Name of the C++ source file - default treeviewer.C
80 TString fLastOption; ///< Last graphic option
81 TTree *fMappedTree; ///< Listed tree
82 TBranch *fMappedBranch; ///< Listed branch
83 Int_t fDimension; ///< Histogram dimension
84 Bool_t fVarDraw; ///< True if an item is double-clicked
85 Bool_t fScanMode; ///< Flag activated when Scan Box is double-clicked
86 TContextMenu *fContextMenu; ///< Context menu for tree viewer
87 TGSelectBox *fDialogBox; ///< Expression editor
88 TList *fTreeList; ///< List of mapped trees
89 Int_t fTreeIndex; ///< Index of current tree in list
90 const TGPicture *fPicX; ///< Pictures for X expressions
91 const TGPicture *fPicY; ///< Pictures for Y expressions
92 const TGPicture *fPicZ; ///< Pictures for Z expressions
93 const TGPicture *fPicDraw; ///< Pictures for Draw buttons
94 const TGPicture *fPicStop; ///< Pictures for Stop buttons
95 const TGPicture *fPicRefr; ///< Pictures for Refresh buttons ///<ia
96 Cursor_t fDefaultCursor; ///< Default cursor
97 Cursor_t fWatchCursor; ///< Watch cursor
98 TTimer *fTimer; ///< Tree viewer timer
99 Bool_t fCounting; ///< True if timer is counting
100 Bool_t fStopMapping; ///< True if branch don't need remapping
101 Bool_t fEnableCut; ///< True if cuts are enabled
102 Int_t fNexpressions; ///< Number of expression widgets
103///@}
104
105///@{
106/// @name Menu bar, menu bar entries and layouts
119///@}
120
121///@{
122/// @name Toolbar and hints
125///@}
126
127///@{
128/// @name Widgets on the toolbar
129 TGLabel *fBarLbl1; ///< Label of command text entry
130 TGLabel *fBarLbl2; ///< Label of option text entry
131 TGLabel *fBarLbl3; ///< Label of histogram name text entry
132 TGCheckButton *fBarH; ///< Checked for drawing current histogram with different graphic option
133 TGCheckButton *fBarScan; ///< Checked for tree scan
134 TGCheckButton *fBarRec; ///< Command recording toggle
135 TGTextEntry *fBarCommand; ///< User command entry
136 TGTextEntry *fBarOption; ///< Histogram drawing option entry
137 TGTextEntry *fBarHist; ///< Histogram name entry
138///@}
139
140///@{
141/// @name Frames
142 TGHorizontalFrame *fHf; ///< Main horizontal frame
143 TGDoubleVSlider *fSlider; ///< Vertical slider to select processed tree entries;
144 TGVerticalFrame *fV1; ///< List tree mother
145 TGVerticalFrame *fV2; ///< List view mother
146 TGCompositeFrame *fTreeHdr; ///< Header for list tree
147 TGCompositeFrame *fListHdr; ///< Header for list view
148 TGLabel *fLbl1; ///< Label for list tree
149 TGLabel *fLbl2; ///< Label for list view
150 TGHorizontalFrame *fBFrame; ///< Button frame
151 TGHorizontalFrame *fHpb; ///< Progress bar frame
152 TGHProgressBar *fProgressBar; ///< Progress bar
153 TGLabel *fBLbl4; ///< Label for input list entry
154 TGLabel *fBLbl5; ///< Label for output list entry
155 TGTextEntry *fBarListIn; ///< Tree input event list name entry
156 TGTextEntry *fBarListOut; ///< Pree output event list name entry
157 TGPictureButton *fDRAW; ///< DRAW button
158 TGTextButton *fSPIDER; ///< SPIDER button
159 TGPictureButton *fSTOP; ///< Interrupt current command (not yet)
160 TGPictureButton *fREFR; ///< REFRESH button ///<ia
161 TGStatusBar *fStatusBar; ///< Status bar
162 TGComboBox *fCombo; ///< Combo box with session records
168 TGTextButton *fReset; ///< clear expression's entries
169///@}
170
171///@{
172/// @name ListTree
173 TGCanvas *fTreeView; ///< ListTree canvas container
174 TGListTree *fLt; ///< ListTree with file and tree items
175///@}
176
177///@{
178/// @name ListView
179 TGListView *fListView; ///< ListView with branches and leaves
180 TTVLVContainer *fLVContainer; ///< Container for listview
181
182 TList *fWidgets; ///< List of widgets to be deleted
183///@}
184
185
186private:
187
189 const char *Cut();
191 const char *EmptyBrackets(const char* name);
192 const char *Ex();
193 const char *Ey();
194 const char *Ez();
195 const char *En(Int_t n);
196 void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
197 void MapOptions(Long_t parm1);
198 void MapTree(TTree *tree, TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
199 void SetFile();
200 const char *ScanList();
202 void DoError(int level, const char *location, const char *fmt, va_list va) const;
203
204public:
205 TTreeViewer(const char* treeName = 0);
207 virtual ~TTreeViewer();
208
211 Bool_t next , Bool_t last);
212 virtual void CloseWindow();
213 virtual void Delete(Option_t *) { } // *MENU*
214 void DoRefresh();
216 void Empty();
217 void EmptyAll(); // *MENU*
218 void ExecuteCommand(const char* command, Bool_t fast = kFALSE); // *MENU*
223 const char *GetGrOpt();
224 TTree *GetTree() {return fTree;}
228 Int_t MakeSelector(const char* selector = 0); // *MENU*
229 void Message(const char* msg);
230 void NewExpression(); // *MENU*
235 void RemoveLastRecord(); // *MENU*
236 void SaveSource(const char* filename="", Option_t *option=""); // *MENU*
237 void SetHistogramTitle(const char *title);
238 void SetCutMode(Bool_t enabled = kTRUE) {fEnableCut = enabled;}
240 void SetGrOpt(const char *option);
242 void SetRecordName(const char *name); // *MENU*
243 void SetScanFileName(const char *name=""); // *MENU*
246 void SetSession(TTVSession *session);
247 void SetUserCode(const char *code, Bool_t autoexec=kTRUE); // *MENU*
249 void SetTreeName(const char* treeName); // *MENU*
252 void UpdateRecord(const char *name="new name"); // *MENU*
253
254 ClassDef(TTreeViewer,0) // A GUI oriented tree viewer
255};
256
257#endif
Handle_t Cursor_t
Cursor handle.
Definition: GuiTypes.h:34
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
long long Long64_t
Definition: RtypesCore.h:80
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:335
#define BIT(n)
Definition: Rtypes.h:85
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char mode
char name[80]
Definition: TGX11.cxx:110
int nentries
Definition: THbookFile.cxx:91
A TTree is a list of TBranches.
Definition: TBranch.h:89
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:44
A button abstract base class.
Definition: TGButton.h:68
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
Selects different options.
Definition: TGButton.h:264
Window client.
Definition: TGClient.h:37
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
Dragging the slider will generate the event:
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:385
This class handles GUI labels.
Definition: TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition: TGListTree.h:195
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition: TGListView.h:115
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:397
The TGMenu.h header contains all different menu classes.
Definition: TGMenu.h:282
Yield an action as soon as it is clicked.
Definition: TGButton.h:228
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
This class creates a popup menu object.
Definition: TGMenu.h:110
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
Provides a StatusBar widget.
Definition: TGStatusBar.h:21
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
A toolbar is a composite frame that contains TGPictureButtons.
Definition: TGToolBar.h:33
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:374
A doubly linked list.
Definition: TList.h:38
Basic string class.
Definition: TString.h:136
This class represent the list view container for the TreeView class.
This class represent entries that goes into the TreeViewer listview container.
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:75
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features.
Definition: TTreeViewer.h:54
TGLabel * fBarLbl2
Label of option text entry.
Definition: TTreeViewer.h:130
void SetUserCode(const char *code, Bool_t autoexec=kTRUE)
TGSelectBox * fDialogBox
Expression editor.
Definition: TTreeViewer.h:87
virtual ~TTreeViewer()
void SetCurrentRecord(Long64_t entry)
TGCheckButton * fBarRec
Command recording toggle.
Definition: TTreeViewer.h:134
TGHProgressBar * fProgressBar
Progress bar.
Definition: TTreeViewer.h:152
void SetHistogramTitle(const char *title)
TTreeViewer(const char *treeName=0)
TTreeViewer default constructor.
const char * Ez()
Bool_t HandleTimer(TTimer *timer)
Execute action in response of a timer timing out.
void UpdateRecord(const char *name="new name")
TGTextEntry * fBarOption
Histogram drawing option entry.
Definition: TTreeViewer.h:136
TGLabel * fBLbl4
Label for input list entry.
Definition: TTreeViewer.h:153
TGTextEntry * fBarCommand
User command entry.
Definition: TTreeViewer.h:135
TGPopupMenu * fOptions2D
Definition: TTreeViewer.h:117
TGListView * fListView
ListView with branches and leaves.
Definition: TTreeViewer.h:179
TGComboBox * fCombo
Combo box with session records.
Definition: TTreeViewer.h:162
void EditExpression()
TGListTree * fLt
ListTree with file and tree items.
Definition: TTreeViewer.h:174
TList * fWidgets
List of widgets to be deleted.
Definition: TTreeViewer.h:182
void SetNexpressions(Int_t expr)
Bool_t fEnableCut
True if cuts are enabled.
Definition: TTreeViewer.h:101
TGCheckButton * fBarH
Checked for drawing current histogram with different graphic option.
Definition: TTreeViewer.h:132
TGPictureButton * fBGFirst
Definition: TTreeViewer.h:163
Cursor_t fDefaultCursor
Default cursor.
Definition: TTreeViewer.h:96
void MapOptions(Long_t parm1)
TGLabel * fBLbl5
Label for output list entry.
Definition: TTreeViewer.h:154
Bool_t IsScanRedirected()
virtual void CloseWindow()
Close and delete main frame.
TGCanvas * fTreeView
ListTree canvas container.
Definition: TTreeViewer.h:173
Int_t fTreeIndex
Index of current tree in list.
Definition: TTreeViewer.h:89
void NewExpression()
TGPictureButton * fSTOP
Interrupt current command (not yet)
Definition: TTreeViewer.h:159
void SaveSource(const char *filename="", Option_t *option="")
Save the GUI main frame widget in a C++ macro file.
void SetSession(TTVSession *session)
void SetParentTree(TGListTreeItem *item)
const char * EmptyBrackets(const char *name)
const TGPicture * fPicStop
Pictures for Stop buttons.
Definition: TTreeViewer.h:94
const TGPicture * fPicY
Pictures for Y expressions.
Definition: TTreeViewer.h:91
TGMenuBar * fMenuBar
Definition: TTreeViewer.h:110
TGLabel * fLbl2
Label for list view.
Definition: TTreeViewer.h:149
TTVLVEntry * ExpressionItem(Int_t index)
Cursor_t fWatchCursor
Watch cursor.
Definition: TTreeViewer.h:97
void AppendTree(TTree *tree)
Bool_t fScanMode
Flag activated when Scan Box is double-clicked.
Definition: TTreeViewer.h:85
TGPopupMenu * fRunMenu
Definition: TTreeViewer.h:113
TGTextEntry * fBarListIn
Tree input event list name entry.
Definition: TTreeViewer.h:155
void SetScanRedirect(Bool_t mode)
TTimer * fTimer
Tree viewer timer.
Definition: TTreeViewer.h:98
Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=TTree::kMaxEntries, Long64_t firstentry=0)
Bool_t SwitchTree(Int_t index)
TGCheckButton * fBarScan
Checked for tree scan.
Definition: TTreeViewer.h:133
void ExecuteDraw()
const TGPicture * fPicRefr
Pictures for Refresh buttons ///<ia.
Definition: TTreeViewer.h:95
const char * fSourceFile
Name of the C++ source file - default treeviewer.C.
Definition: TTreeViewer.h:79
virtual void Delete(Option_t *)
Delete this object.
Definition: TTreeViewer.h:213
TGPopupMenu * fOptions1D
Definition: TTreeViewer.h:116
const TGPicture * fPicX
Pictures for X expressions.
Definition: TTreeViewer.h:90
void SetRecordName(const char *name)
TGPictureButton * fDRAW
DRAW button.
Definition: TTreeViewer.h:157
const char * Cut()
TString fLastOption
Last graphic option.
Definition: TTreeViewer.h:80
TList * fTreeList
List of mapped trees.
Definition: TTreeViewer.h:88
const char * fFilename
Name of the file containing the tree.
Definition: TTreeViewer.h:78
EListItemType
Item types used as user data.
Definition: TTreeViewer.h:61
@ kLTExpressionType
Definition: TTreeViewer.h:69
void RemoveItem()
TGTextEntry * fBarHist
Histogram name entry.
Definition: TTreeViewer.h:137
TGLayoutHints * fBarLayout
Definition: TTreeViewer.h:124
void SetScanMode(Bool_t mode=kTRUE)
Definition: TTreeViewer.h:244
TContextMenu * fContextMenu
Context menu for tree viewer.
Definition: TTreeViewer.h:86
void EmptyAll()
TGHorizontalFrame * fHpb
Progress bar frame.
Definition: TTreeViewer.h:151
TGPopupMenu * fHelpMenu
Definition: TTreeViewer.h:118
TGPictureButton * fBGNext
Definition: TTreeViewer.h:166
Int_t fNexpressions
Number of expression widgets.
Definition: TTreeViewer.h:102
void SetTreeName(const char *treeName)
TGVerticalFrame * fV2
List view mother.
Definition: TTreeViewer.h:145
void Empty()
const char * En(Int_t n)
TGLayoutHints * fMenuBarItemLayout
Definition: TTreeViewer.h:108
Bool_t fStopMapping
True if branch don't need remapping.
Definition: TTreeViewer.h:100
void Message(const char *msg)
void ExecuteCommand(const char *command, Bool_t fast=kFALSE)
void BuildInterface()
void UpdateCombo()
TTree * fTree
Selected tree.
Definition: TTreeViewer.h:76
const char * GetGrOpt()
TGCompositeFrame * fTreeHdr
Header for list tree.
Definition: TTreeViewer.h:146
TGLabel * fBarLbl3
Label of histogram name text entry.
Definition: TTreeViewer.h:131
Int_t Dimension()
Int_t MakeSelector(const char *selector=0)
void SetTree(TTree *tree)
TGDoubleVSlider * fSlider
Vertical slider to select processed tree entries;.
Definition: TTreeViewer.h:143
TTree * fMappedTree
Listed tree.
Definition: TTreeViewer.h:81
TGVerticalFrame * fV1
List tree mother.
Definition: TTreeViewer.h:144
void DoRefresh()
const TGPicture * fPicDraw
Pictures for Draw buttons.
Definition: TTreeViewer.h:93
TGPictureButton * fBGLast
Definition: TTreeViewer.h:167
const char * Ex()
TList * ExpressionList()
void ActivateButtons(Bool_t first, Bool_t previous, Bool_t next, Bool_t last)
void MapTree(TTree *tree, TGListTreeItem *parent=0, Bool_t listIt=kTRUE)
void SetFile()
TGPopupMenu * fOptionsMenu
Definition: TTreeViewer.h:114
void RemoveLastRecord()
TGLayoutHints * fMenuBarHelpLayout
Definition: TTreeViewer.h:109
Bool_t fVarDraw
True if an item is double-clicked.
Definition: TTreeViewer.h:84
TGPictureButton * fBGPrevious
Definition: TTreeViewer.h:164
void PrintEntries()
TTVLVContainer * fLVContainer
Container for listview.
Definition: TTreeViewer.h:180
TGLabel * fLbl1
Label for list tree.
Definition: TTreeViewer.h:148
void SetGrOpt(const char *option)
TGPopupMenu * fOptionsGen
Definition: TTreeViewer.h:115
TGLayoutHints * fMenuBarLayout
Definition: TTreeViewer.h:107
TGLabel * fBarLbl1
Label of command text entry.
Definition: TTreeViewer.h:129
TGPictureButton * fREFR
REFRESH button ///<ia.
Definition: TTreeViewer.h:160
TGHorizontalFrame * fHf
Main horizontal frame.
Definition: TTreeViewer.h:142
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
const TGPicture * fPicZ
Pictures for Z expressions.
Definition: TTreeViewer.h:92
Bool_t fCounting
True if timer is counting.
Definition: TTreeViewer.h:99
TTreeViewer(const TTree *tree)
const char * Ey()
TGToolBar * fToolBar
Definition: TTreeViewer.h:123
TGHorizontalFrame * fBFrame
Button frame.
Definition: TTreeViewer.h:150
const char * ScanList()
void SetCutMode(Bool_t enabled=kTRUE)
Definition: TTreeViewer.h:238
TGPopupMenu * fEditMenu
Definition: TTreeViewer.h:112
TBranch * fMappedBranch
Listed branch.
Definition: TTreeViewer.h:82
TTVSession * fSession
Current tree-viewer session.
Definition: TTreeViewer.h:77
Bool_t IsCutEnabled()
Definition: TTreeViewer.h:226
Int_t fDimension
Histogram dimension.
Definition: TTreeViewer.h:83
TGCompositeFrame * fListHdr
Header for list view.
Definition: TTreeViewer.h:147
TGPopupMenu * fFileMenu
Definition: TTreeViewer.h:111
TGTextEntry * fBarListOut
Pree output event list name entry.
Definition: TTreeViewer.h:156
TGTextButton * fReset
clear expression's entries
Definition: TTreeViewer.h:168
void ExecuteSpider()
TGPictureButton * fBGRecord
Definition: TTreeViewer.h:165
void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent=0, Bool_t listIt=kTRUE)
void SetScanFileName(const char *name="")
TTree * GetTree()
Definition: TTreeViewer.h:224
TGStatusBar * fStatusBar
Status bar.
Definition: TTreeViewer.h:161
TGTextButton * fSPIDER
SPIDER button.
Definition: TTreeViewer.h:158
void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
A TTree represents a columnar dataset.
Definition: TTree.h:79
static constexpr Long64_t kMaxEntries
Definition: TTree.h:226
const Int_t n
Definition: legend1.C:16
Definition: first.py:1
Definition: tree.py:1