Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2//Author : Andrei Gheata 16/08/00
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 *************************************************************************/
12#ifndef ROOT_TTreeViewer
13#define ROOT_TTreeViewer
16// //
17// TTreeViewer - A GUI oriented tree viewer //
18// //
21#include "TGFrame.h"
23#include "TTree.h"
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;
54class TTreeViewer : public TGMainFrame {
56friend class TGClient;
57friend class TGButton;
60 /// Item types used as user data
70 kLTCutType = BIT(7)
71 };
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 fVarDraw; ///< True if an item is double-clicked
85 bool 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 fCounting; ///< True if timer is counting
100 bool fStopMapping; ///< True if branch don't need remapping
101 bool fEnableCut; ///< True if cuts are enabled
102 Int_t fNexpressions; ///< Number of expression widgets
106/// @name Menu bar, menu bar entries and layouts
122/// @name Toolbar and hints
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
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
172/// @name ListTree
173 TGCanvas *fTreeView; ///< ListTree canvas container
174 TGListTree *fLt; ///< ListTree with file and tree items
178/// @name ListView
179 TGListView *fListView; ///< ListView with branches and leaves
180 TTVLVContainer *fLVContainer; ///< Container for listview
182 TList *fWidgets; ///< List of widgets to be deleted
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 = nullptr, bool listIt = true);
197 void MapOptions(Long_t parm1);
198 void MapTree(TTree *tree, TGListTreeItem *parent = nullptr, bool listIt = true);
199 void SetFile();
200 const char *ScanList();
202 void DoError(int level, const char *location, const char *fmt, va_list va) const override;
205 TTreeViewer(const char* treeName = nullptr);
206 TTreeViewer(const TTree *tree);
207 ~TTreeViewer() override;
209 void AppendTree(TTree *tree);
210 void ActivateButtons(bool first, bool previous,
211 bool next , bool last);
212 void CloseWindow() override;
213 void Delete(Option_t *) override { } // *MENU*
214 void DoRefresh();
216 void Empty();
217 void EmptyAll(); // *MENU*
218 void ExecuteCommand(const char* command, bool fast = false); // *MENU*
223 const char *GetGrOpt();
224 TTree *GetTree() {return fTree;}
225 bool HandleTimer(TTimer *timer) override;
226 bool IsCutEnabled() {return fEnableCut;}
228 Int_t MakeSelector(const char* selector = nullptr); // *MENU*
229 void Message(const char* msg) override;
230 void NewExpression(); // *MENU*
233 bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
235 void RemoveLastRecord(); // *MENU*
236 void SaveSource(const char* filename="", Option_t *option="") override; // *MENU*
237 void SetHistogramTitle(const char *title);
238 void SetCutMode(bool enabled = true) {fEnableCut = enabled;}
240 void SetGrOpt(const char *option);
242 void SetRecordName(const char *name); // *MENU*
243 void SetScanFileName(const char *name=""); // *MENU*
244 void SetScanMode(bool mode=true) {fScanMode = mode;}
246 void SetSession(TTVSession *session);
247 void SetUserCode(const char *code, bool autoexec=true); // *MENU*
248 void SetTree(TTree* tree);
249 void SetTreeName(const char* treeName); // *MENU*
252 void UpdateRecord(const char *name="new name"); // *MENU*
254 ClassDefOverride(TTreeViewer,0) // A GUI oriented tree viewer
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
long Longptr_t
Definition RtypesCore.h:82
long Long_t
Definition RtypesCore.h:54
long long Long64_t
Definition RtypesCore.h:80
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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
A TTree is a list of TBranches.
Definition TBranch.h:93
This class provides an interface to context sensitive popup menus.
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:139
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
void SetScanRedirect(bool mode)
TGLabel * fBarLbl2
Label of option text entry.
TGSelectBox * fDialogBox
Expression editor.
Definition TTreeViewer.h:87
void SetCurrentRecord(Long64_t entry)
TGCheckButton * fBarRec
Command recording toggle.
TGHProgressBar * fProgressBar
Progress bar.
bool HandleTimer(TTimer *timer) override
Execute action in response of a timer timing out.
void SetHistogramTitle(const char *title)
const char * Ez()
void UpdateRecord(const char *name="new name")
TGTextEntry * fBarOption
Histogram drawing option entry.
TGLabel * fBLbl4
Label for input list entry.
TGTextEntry * fBarCommand
User command entry.
TGPopupMenu * fOptions2D
TGListView * fListView
ListView with branches and leaves.
TGComboBox * fCombo
Combo box with session records.
void EditExpression()
TGListTree * fLt
ListTree with file and tree items.
TList * fWidgets
List of widgets to be deleted.
~TTreeViewer() override
void SetNexpressions(Int_t expr)
void SetCutMode(bool enabled=true)
TGCheckButton * fBarH
Checked for drawing current histogram with different graphic option.
TGPictureButton * fBGFirst
void SetUserCode(const char *code, bool autoexec=true)
Cursor_t fDefaultCursor
Default cursor.
Definition TTreeViewer.h:96
void MapOptions(Long_t parm1)
TGLabel * fBLbl5
Label for output list entry.
TGCanvas * fTreeView
ListTree canvas container.
Int_t fTreeIndex
Index of current tree in list.
Definition TTreeViewer.h:89
void NewExpression()
TGPictureButton * fSTOP
Interrupt current command (not yet)
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
void CloseWindow() override
Close and delete main frame.
const TGPicture * fPicY
Pictures for Y expressions.
Definition TTreeViewer.h:91
TGMenuBar * fMenuBar
TGLabel * fLbl2
Label for list view.
TTVLVEntry * ExpressionItem(Int_t index)
Cursor_t fWatchCursor
Watch cursor.
Definition TTreeViewer.h:97
void AppendTree(TTree *tree)
TGPopupMenu * fRunMenu
TGTextEntry * fBarListIn
Tree input event list name entry.
void ActivateButtons(bool first, bool previous, bool next, bool last)
TTimer * fTimer
Tree viewer timer.
Definition TTreeViewer.h:98
void MapTree(TTree *tree, TGListTreeItem *parent=nullptr, bool listIt=true)
Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=TTree::kMaxEntries, Long64_t firstentry=0)
TGCheckButton * fBarScan
Checked for tree scan.
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
Int_t MakeSelector(const char *selector=nullptr)
TGPopupMenu * fOptions1D
bool fCounting
True if timer is counting.
Definition TTreeViewer.h:99
const TGPicture * fPicX
Pictures for X expressions.
Definition TTreeViewer.h:90
bool fScanMode
Flag activated when Scan Box is double-clicked.
Definition TTreeViewer.h:85
void DoError(int level, const char *location, const char *fmt, va_list va) const override
Interface to ErrorHandler (protected).
void SetRecordName(const char *name)
TGPictureButton * fDRAW
DRAW button.
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
Item types used as user data.
Definition TTreeViewer.h:61
void RemoveItem()
TGTextEntry * fBarHist
Histogram name entry.
TGLayoutHints * fBarLayout
void Delete(Option_t *) override
Delete this object.
TContextMenu * fContextMenu
Context menu for tree viewer.
Definition TTreeViewer.h:86
void EmptyAll()
TGHorizontalFrame * fHpb
Progress bar frame.
TGPopupMenu * fHelpMenu
TGPictureButton * fBGNext
Int_t fNexpressions
Number of expression widgets.
void SetTreeName(const char *treeName)
TGVerticalFrame * fV2
List view mother.
void Empty()
const char * En(Int_t n)
void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent=nullptr, bool listIt=true)
TGLayoutHints * fMenuBarItemLayout
void SaveSource(const char *filename="", Option_t *option="") override
Save the GUI main frame widget in a C++ macro file.
void BuildInterface()
void UpdateCombo()
TTree * fTree
Selected tree.
Definition TTreeViewer.h:76
const char * GetGrOpt()
TGCompositeFrame * fTreeHdr
Header for list tree.
TGLabel * fBarLbl3
Label of histogram name text entry.
Int_t Dimension()
bool fEnableCut
True if cuts are enabled.
bool SwitchTree(Int_t index)
void SetTree(TTree *tree)
bool fVarDraw
True if an item is double-clicked.
Definition TTreeViewer.h:84
TGDoubleVSlider * fSlider
Vertical slider to select processed tree entries;.
void SetScanMode(bool mode=true)
TTree * fMappedTree
Listed tree.
Definition TTreeViewer.h:81
TGVerticalFrame * fV1
List tree mother.
void DoRefresh()
void Message(const char *msg) override
void ExecuteCommand(const char *command, bool fast=false)
const TGPicture * fPicDraw
Pictures for Draw buttons.
Definition TTreeViewer.h:93
TGPictureButton * fBGLast
const char * Ex()
TList * ExpressionList()
void SetFile()
TGPopupMenu * fOptionsMenu
void RemoveLastRecord()
TGLayoutHints * fMenuBarHelpLayout
TGPictureButton * fBGPrevious
void PrintEntries()
TTVLVContainer * fLVContainer
Container for listview.
TGLabel * fLbl1
Label for list tree.
void SetGrOpt(const char *option)
bool IsCutEnabled()
TGPopupMenu * fOptionsGen
TGLayoutHints * fMenuBarLayout
TGLabel * fBarLbl1
Label of command text entry.
TGPictureButton * fREFR
REFRESH button ///<ia.
TGHorizontalFrame * fHf
Main horizontal frame.
const TGPicture * fPicZ
Pictures for Z expressions.
Definition TTreeViewer.h:92
TTreeViewer(const TTree *tree)
const char * Ey()
TGToolBar * fToolBar
TGHorizontalFrame * fBFrame
Button frame.
const char * ScanList()
TGPopupMenu * fEditMenu
TBranch * fMappedBranch
Listed branch.
Definition TTreeViewer.h:82
TTVSession * fSession
Current tree-viewer session.
Definition TTreeViewer.h:77
Int_t fDimension
Histogram dimension.
Definition TTreeViewer.h:83
TGCompositeFrame * fListHdr
Header for list view.
bool fStopMapping
True if branch don't need remapping.
TGPopupMenu * fFileMenu
TGTextEntry * fBarListOut
Pree output event list name entry.
TGTextButton * fReset
clear expression's entries
bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
void ExecuteSpider()
bool IsScanRedirected()
TGPictureButton * fBGRecord
void SetScanFileName(const char *name="")
TTree * GetTree()
TGStatusBar * fStatusBar
Status bar.
TGTextButton * fSPIDER
SPIDER button.
A TTree represents a columnar dataset.
Definition TTree.h:79
static constexpr Long64_t kMaxEntries
Definition TTree.h:229
const Int_t n
Definition legend1.C:16