Logo ROOT   6.18/05
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 TTreeViewer;
26class TTVLVContainer;
27class TTVLVEntry;
28class TTVSession;
29class TGSelectBox;
30class TTree;
31class TBranch;
32class TContextMenu;
33class TList;
34class TGPicture;
35class TTimer;
36class TGLayoutHints;
37class TGMenuBar;
38class TGPopupMenu;
39class TGToolBar;
40class TGLabel;
41class TGCheckButton;
42class TGComboBox;
43class TGTextButton;
44class TGTextEntry;
45class TGDoubleVSlider;
46class TGPictureButton;
47class TGStatusBar;
48class TGCanvas;
49class TGListTree;
50class TGListTreeItem;
51class TGListView;
52class TGHProgressBar;
53class TGButton;
54
55
56class TTreeViewer : public TGMainFrame {
57
58friend class TGClient;
59friend class TGButton;
60
61public:
62 //---- item types used as user data
72 kLTCutType = BIT(7)
73 };
74
75private:
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, *fPicY, *fPicZ; // pictures for X, Y and Z expressions
91 const TGPicture *fPicDraw, *fPicStop; // pictures for Draw/Stop buttons
92 const TGPicture *fPicRefr; // pictures for Refresh buttons //ia
93 Cursor_t fDefaultCursor; // default cursor
94 Cursor_t fWatchCursor; // watch cursor
95 TTimer *fTimer; // tree viewer timer
96 Bool_t fCounting; // true if timer is counting
97 Bool_t fStopMapping; // true if branch don't need remapping
98 Bool_t fEnableCut; // true if cuts are enabled
99 Int_t fNexpressions; // number of expression widgets
100// menu bar, menu bar entries and layouts
113// toolbar and hints
116// widgets on the toolbar
117 TGLabel *fBarLbl1; // label of command text entry
118 TGLabel *fBarLbl2; // label of option text entry
119 TGLabel *fBarLbl3; // label of histogram name text entry
120 TGCheckButton *fBarH; // checked for drawing current histogram with different graphic option
121 TGCheckButton *fBarScan; // checked for tree scan
122 TGCheckButton *fBarRec; // command recording toggle
123 TGTextEntry *fBarCommand; // user command entry
124 TGTextEntry *fBarOption; // histogram drawing option entry
125 TGTextEntry *fBarHist; // histogram name entry
126// frames
127 TGHorizontalFrame *fHf; // main horizontal frame
128 TGDoubleVSlider *fSlider; // vertical slider to select processed tree entries;
129 TGVerticalFrame *fV1; // list tree mother
130 TGVerticalFrame *fV2; // list view mother
131 TGCompositeFrame *fTreeHdr; // header for list tree
132 TGCompositeFrame *fListHdr; // header for list view
133 TGLabel *fLbl1; // label for list tree
134 TGLabel *fLbl2; // label for list view
135 TGHorizontalFrame *fBFrame; // button frame
136 TGHorizontalFrame *fHpb; // progress bar frame
137 TGHProgressBar *fProgressBar; // progress bar
138 TGLabel *fBLbl4; // label for input list entry
139 TGLabel *fBLbl5; // label for output list entry
140 TGTextEntry *fBarListIn; // tree input event list name entry
141 TGTextEntry *fBarListOut; // tree output event list name entry
142 TGPictureButton *fDRAW; // DRAW button
143 TGTextButton *fSPIDER; // SPIDER button
144 TGPictureButton *fSTOP; // interrupt current command (not yet)
145 TGPictureButton *fREFR; // REFRESH button //ia
146 TGStatusBar *fStatusBar; // status bar
147 TGComboBox *fCombo; // combo box with session records
153 TGTextButton *fReset; // clear expression's entries
154// ListTree
155 TGCanvas *fTreeView; // ListTree canvas container
156 TGListTree *fLt; // ListTree with file and tree items
157// ListView
158 TGListView *fListView; // ListView with branches and leaves
159 TTVLVContainer *fLVContainer; // container for listview
160
161 TList *fWidgets; // list of widgets to be deleted
162
163private:
164// private methods
166 const char *Cut();
168 const char *EmptyBrackets(const char* name);
169 const char *Ex();
170 const char *Ey();
171 const char *Ez();
172 const char *En(Int_t n);
173 void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
174 void MapOptions(Long_t parm1);
175 void MapTree(TTree *tree, TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
176 void SetFile();
177 const char *ScanList();
179 void DoError(int level, const char *location, const char *fmt, va_list va) const;
180
181public:
182 TTreeViewer(const char* treeName = 0);
184 virtual ~TTreeViewer();
185// public methods
188 Bool_t next , Bool_t last);
189 virtual void CloseWindow();
190 virtual void Delete(Option_t *) { } // *MENU*
191 void DoRefresh();
193 void Empty();
194 void EmptyAll(); // *MENU*
195 void ExecuteCommand(const char* command, Bool_t fast = kFALSE); // *MENU*
200 const char *GetGrOpt();
201 TTree *GetTree() {return fTree;}
205 Int_t MakeSelector(const char* selector = 0); // *MENU*
206 void Message(const char* msg);
207 void NewExpression(); // *MENU*
209 Long64_t Process(const char* filename, Option_t *option="", Long64_t nentries=TTree::kMaxEntries, Long64_t firstentry=0); // *MENU*
212 void RemoveLastRecord(); // *MENU*
213 void SaveSource(const char* filename="", Option_t *option=""); // *MENU*
214 void SetHistogramTitle(const char *title);
215 void SetCutMode(Bool_t enabled = kTRUE) {fEnableCut = enabled;}
217 void SetGrOpt(const char *option);
219 void SetRecordName(const char *name); // *MENU*
220 void SetScanFileName(const char *name=""); // *MENU*
221 void SetScanMode(Bool_t mode=kTRUE) {fScanMode = mode;}
223 void SetSession(TTVSession *session);
224 void SetUserCode(const char *code, Bool_t autoexec=kTRUE); // *MENU*
226 void SetTreeName(const char* treeName); // *MENU*
229 void UpdateRecord(const char *name="new name"); // *MENU*
230
231 ClassDef(TTreeViewer,0) // A GUI oriented tree viewer
232};
233
234#endif
Handle_t Cursor_t
Definition: GuiTypes.h:33
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:69
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define BIT(n)
Definition: Rtypes.h:83
char name[80]
Definition: TGX11.cxx:109
int nentries
Definition: THbookFile.cxx:89
A TTree is a list of TBranches.
Definition: TBranch.h:65
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:40
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
A doubly linked list.
Definition: TList.h:44
Basic string class.
Definition: TString.h:131
This class represent the list view container for the.
This class represent entries that goes into the TreeViewer listview container.
I/O classes for TreeViewer session handling.
Definition: TTVSession.h:69
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:56
TGLabel * fBarLbl2
Definition: TTreeViewer.h:118
void SetUserCode(const char *code, Bool_t autoexec=kTRUE)
TGSelectBox * fDialogBox
Definition: TTreeViewer.h:87
virtual ~TTreeViewer()
void SetCurrentRecord(Long64_t entry)
TGCheckButton * fBarRec
Definition: TTreeViewer.h:122
const TGPicture * fPicZ
Definition: TTreeViewer.h:90
TGHProgressBar * fProgressBar
Definition: TTreeViewer.h:137
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
Definition: TTreeViewer.h:124
TGLabel * fBLbl4
Definition: TTreeViewer.h:138
TGTextEntry * fBarCommand
Definition: TTreeViewer.h:123
TGPopupMenu * fOptions2D
Definition: TTreeViewer.h:111
TGListView * fListView
Definition: TTreeViewer.h:158
TGComboBox * fCombo
Definition: TTreeViewer.h:147
void EditExpression()
TGListTree * fLt
Definition: TTreeViewer.h:156
TList * fWidgets
Definition: TTreeViewer.h:161
void SetNexpressions(Int_t expr)
Bool_t fEnableCut
Definition: TTreeViewer.h:98
TGCheckButton * fBarH
Definition: TTreeViewer.h:120
TGPictureButton * fBGFirst
Definition: TTreeViewer.h:148
Cursor_t fDefaultCursor
Definition: TTreeViewer.h:93
void MapOptions(Long_t parm1)
TGLabel * fBLbl5
Definition: TTreeViewer.h:139
Bool_t IsScanRedirected()
virtual void CloseWindow()
Close and delete main frame.
TGCanvas * fTreeView
Definition: TTreeViewer.h:155
Int_t fTreeIndex
Definition: TTreeViewer.h:89
void NewExpression()
TGPictureButton * fSTOP
Definition: TTreeViewer.h:144
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)
TGMenuBar * fMenuBar
Definition: TTreeViewer.h:104
TGLabel * fLbl2
Definition: TTreeViewer.h:134
TTVLVEntry * ExpressionItem(Int_t index)
Cursor_t fWatchCursor
Definition: TTreeViewer.h:94
void AppendTree(TTree *tree)
Bool_t fScanMode
Definition: TTreeViewer.h:85
TGPopupMenu * fRunMenu
Definition: TTreeViewer.h:107
TGTextEntry * fBarListIn
Definition: TTreeViewer.h:140
void SetScanRedirect(Bool_t mode)
TTimer * fTimer
Definition: TTreeViewer.h:95
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
Definition: TTreeViewer.h:121
void ExecuteDraw()
const TGPicture * fPicRefr
Definition: TTreeViewer.h:92
const char * fSourceFile
Definition: TTreeViewer.h:79
virtual void Delete(Option_t *)
Delete this object.
Definition: TTreeViewer.h:190
TGPopupMenu * fOptions1D
Definition: TTreeViewer.h:110
const TGPicture * fPicX
Definition: TTreeViewer.h:90
void SetRecordName(const char *name)
TGPictureButton * fDRAW
Definition: TTreeViewer.h:142
const char * Cut()
TString fLastOption
Definition: TTreeViewer.h:80
TList * fTreeList
Definition: TTreeViewer.h:88
const char * fFilename
Definition: TTreeViewer.h:78
@ kLTExpressionType
Definition: TTreeViewer.h:71
void RemoveItem()
TGTextEntry * fBarHist
Definition: TTreeViewer.h:125
TGLayoutHints * fBarLayout
Definition: TTreeViewer.h:115
void SetScanMode(Bool_t mode=kTRUE)
Definition: TTreeViewer.h:221
TContextMenu * fContextMenu
Definition: TTreeViewer.h:86
void EmptyAll()
TGHorizontalFrame * fHpb
Definition: TTreeViewer.h:136
TGPopupMenu * fHelpMenu
Definition: TTreeViewer.h:112
TGPictureButton * fBGNext
Definition: TTreeViewer.h:151
Int_t fNexpressions
Definition: TTreeViewer.h:99
void SetTreeName(const char *treeName)
TGVerticalFrame * fV2
Definition: TTreeViewer.h:130
void Empty()
const char * En(Int_t n)
TGLayoutHints * fMenuBarItemLayout
Definition: TTreeViewer.h:102
Bool_t fStopMapping
Definition: TTreeViewer.h:97
void Message(const char *msg)
void ExecuteCommand(const char *command, Bool_t fast=kFALSE)
void BuildInterface()
void UpdateCombo()
TTree * fTree
Definition: TTreeViewer.h:76
const char * GetGrOpt()
TGCompositeFrame * fTreeHdr
Definition: TTreeViewer.h:131
TGLabel * fBarLbl3
Definition: TTreeViewer.h:119
Int_t Dimension()
Int_t MakeSelector(const char *selector=0)
void SetTree(TTree *tree)
TGDoubleVSlider * fSlider
Definition: TTreeViewer.h:128
TTree * fMappedTree
Definition: TTreeViewer.h:81
TGVerticalFrame * fV1
Definition: TTreeViewer.h:129
const TGPicture * fPicY
Definition: TTreeViewer.h:90
void DoRefresh()
const TGPicture * fPicDraw
Definition: TTreeViewer.h:91
TGPictureButton * fBGLast
Definition: TTreeViewer.h:152
const char * Ex()
TList * ExpressionList()
const TGPicture * fPicStop
Definition: TTreeViewer.h:91
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:108
void RemoveLastRecord()
TGLayoutHints * fMenuBarHelpLayout
Definition: TTreeViewer.h:103
Bool_t fVarDraw
Definition: TTreeViewer.h:84
TGPictureButton * fBGPrevious
Definition: TTreeViewer.h:149
void PrintEntries()
TTVLVContainer * fLVContainer
Definition: TTreeViewer.h:159
TGLabel * fLbl1
Definition: TTreeViewer.h:133
void SetGrOpt(const char *option)
TGPopupMenu * fOptionsGen
Definition: TTreeViewer.h:109
TGLayoutHints * fMenuBarLayout
Definition: TTreeViewer.h:101
TGLabel * fBarLbl1
Definition: TTreeViewer.h:117
TGPictureButton * fREFR
Definition: TTreeViewer.h:145
TGHorizontalFrame * fHf
Definition: TTreeViewer.h:127
Bool_t fCounting
Definition: TTreeViewer.h:96
TTreeViewer(const TTree *tree)
const char * Ey()
TGToolBar * fToolBar
Definition: TTreeViewer.h:114
TGHorizontalFrame * fBFrame
Definition: TTreeViewer.h:135
const char * ScanList()
void SetCutMode(Bool_t enabled=kTRUE)
Definition: TTreeViewer.h:215
TGPopupMenu * fEditMenu
Definition: TTreeViewer.h:106
TBranch * fMappedBranch
Definition: TTreeViewer.h:82
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
TTVSession * fSession
Definition: TTreeViewer.h:77
Bool_t IsCutEnabled()
Definition: TTreeViewer.h:203
Int_t fDimension
Definition: TTreeViewer.h:83
TGCompositeFrame * fListHdr
Definition: TTreeViewer.h:132
TGPopupMenu * fFileMenu
Definition: TTreeViewer.h:105
TGTextEntry * fBarListOut
Definition: TTreeViewer.h:141
TGTextButton * fReset
Definition: TTreeViewer.h:153
void ExecuteSpider()
TGPictureButton * fBGRecord
Definition: TTreeViewer.h:150
void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent=0, Bool_t listIt=kTRUE)
void SetScanFileName(const char *name="")
TTree * GetTree()
Definition: TTreeViewer.h:201
TGStatusBar * fStatusBar
Definition: TTreeViewer.h:146
TGTextButton * fSPIDER
Definition: TTreeViewer.h:143
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:71
static constexpr Long64_t kMaxEntries
Definition: TTree.h:215
const Int_t n
Definition: legend1.C:16
Definition: first.py:1
Definition: tree.py:1