Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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*
232 Long64_t Process(const char* filename, Option_t *option="", Long64_t nentries=TTree::kMaxEntries, Long64_t firstentry=0); // *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*
244 void SetScanMode(Bool_t mode=kTRUE) {fScanMode = mode;}
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:325
#define BIT(n)
Definition Rtypes.h:85
char name[80]
Definition TGX11.cxx:110
int nentries
A TTree is a list of TBranches.
Definition TBranch.h:89
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:386
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:398
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:375
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.
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.
TGHProgressBar * fProgressBar
Progress bar.
void SetHistogramTitle(const char *title)
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.
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.
void SetNexpressions(Int_t expr)
Bool_t fEnableCut
True if cuts are enabled.
TGCheckButton * fBarH
Checked for drawing current histogram with different graphic option.
TGPictureButton * fBGFirst
Cursor_t fDefaultCursor
Default cursor.
Definition TTreeViewer.h:96
void MapOptions(Long_t parm1)
TGLabel * fBLbl5
Label for output list entry.
Bool_t IsScanRedirected()
virtual void CloseWindow()
Close and delete main frame.
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 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
TGLabel * fLbl2
Label for list view.
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
TGTextEntry * fBarListIn
Tree input event list name entry.
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.
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.
TGPopupMenu * fOptions1D
const TGPicture * fPicX
Pictures for X expressions.
Definition TTreeViewer.h:90
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
EListItemType
Item types used as user data.
Definition TTreeViewer.h:61
void RemoveItem()
TGTextEntry * fBarHist
Histogram name entry.
TGLayoutHints * fBarLayout
void SetScanMode(Bool_t mode=kTRUE)
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)
TGLayoutHints * fMenuBarItemLayout
Bool_t fStopMapping
True if branch don't need remapping.
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.
TGLabel * fBarLbl3
Label of histogram name text entry.
Int_t Dimension()
Int_t MakeSelector(const char *selector=0)
void SetTree(TTree *tree)
TGDoubleVSlider * fSlider
Vertical slider to select processed tree entries;.
TTree * fMappedTree
Listed tree.
Definition TTreeViewer.h:81
TGVerticalFrame * fV1
List tree mother.
void DoRefresh()
const TGPicture * fPicDraw
Pictures for Draw buttons.
Definition TTreeViewer.h:93
TGPictureButton * fBGLast
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
void RemoveLastRecord()
TGLayoutHints * fMenuBarHelpLayout
Bool_t fVarDraw
True if an item is double-clicked.
Definition TTreeViewer.h:84
TGPictureButton * fBGPrevious
void PrintEntries()
TTVLVContainer * fLVContainer
Container for listview.
TGLabel * fLbl1
Label for list tree.
void SetGrOpt(const char *option)
TGPopupMenu * fOptionsGen
TGLayoutHints * fMenuBarLayout
TGLabel * fBarLbl1
Label of command text entry.
TGPictureButton * fREFR
REFRESH button ///<ia.
TGHorizontalFrame * fHf
Main horizontal frame.
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
TGHorizontalFrame * fBFrame
Button frame.
const char * ScanList()
void SetCutMode(Bool_t enabled=kTRUE)
TGPopupMenu * fEditMenu
TBranch * fMappedBranch
Listed branch.
Definition TTreeViewer.h:82
TTVSession * fSession
Current tree-viewer session.
Definition TTreeViewer.h:77
Bool_t IsCutEnabled()
Int_t fDimension
Histogram dimension.
Definition TTreeViewer.h:83
TGCompositeFrame * fListHdr
Header for list view.
TGPopupMenu * fFileMenu
TGTextEntry * fBarListOut
Pree output event list name entry.
TGTextButton * fReset
clear expression's entries
void ExecuteSpider()
TGPictureButton * fBGRecord
void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent=0, Bool_t listIt=kTRUE)
void SetScanFileName(const char *name="")
TTree * GetTree()
TGStatusBar * fStatusBar
Status bar.
TGTextButton * fSPIDER
SPIDER button.
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