Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTreeViewer.cxx
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id: c8e226dde2f9b6f39946bfe90cabcb778d63dc4f $
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/** \class TTreeViewer
13A graphic user interface designed to handle ROOT trees and to take advantage of
14TTree class features.
15
16It uses ROOT native GUI widgets adapted for "drag and drop" functionality.
17in the same session.
18
19### The following capabilities are making the viewer a helpful tool for analysis:
20
21 - several trees may be opened in the same session;
22 - branches and leaves can be easily browsed or scanned;
23 - fast drawing of branch expressions by double-clicking;
24 - new variables/selections easy to compose with the built-in editor;
25 - histograms can be composed by dragging leaves or user-defined expressions
26 to X, Y and Z axis items;
27 - the tree entries to be processed can be selected with a double slider;
28 - selections can be defined and activated by dragging them to the 'Cut' item;
29 - all expressions can be aliased and aliases can be used in composing others;
30 - input/output event lists easy to handle;
31 - menu with histogram drawing options;
32 - user commands may be executed within the viewer and the current command
33 can be echoed;
34 - current 'Draw' event loop is reflected by a progress bar and may be
35 interrupted by the user;
36 - all widgets have self-explaining tool tips and/or context menus;
37 - expressions/leaves can be dragged to a 'scan box' and scanned by
38 double-clicking this item. The result can be redirected to an ASCII file;
39
40### The layout has the following items:
41
42 - a menu bar with entries : File, Edit, Run, Options and Help;
43 - a toolbar in the upper part where you can issue user commands, change
44 the drawing option and the histogram name, three check buttons Hist, Rec
45 and Scan.HIST toggles histogram drawing mode, REC enables recording of the
46 last command issued and SCAN enables redirecting of TTree::Scan command in
47 an ASCII file (see -Scanning expressions-);
48 - a button bar in the lower part with : buttons DRAW/STOP that issue histogram
49 drawing and stop the current command respectively, two text widgets where
50 input and output event lists can be specified, a message box and a RESET
51 button on the right that clear edited expression content (see Editing...)
52 - a tree-type list on the main left panel where you can select among trees or
53 branches. The tree/branch will be detailed in the right panel.
54 Mapped trees are provided with context menus, activated by right-clicking;
55 - a view-type list on the right panel. The first column contain X, Y and
56 Z expression items, an optional cut and ten optional editable expressions.
57 Expressions and leaf-type items can be dragged or deleted. A right click on
58 the list-box or item activates context menus.
59
60### Opening a new tree and saving a session :
61
62 To open a new tree in the viewer use `<File/Open tree file>` menu
63The content of the file (keys) will be listed. Use `<SetTreeName>` function
64from the context menu of the right panel, entering a tree name among those
65listed.
66
67 To save the current session, use `<File/Save>` menu or the `<SaveSource>`
68function from the context menu of the right panel (to specify the name of the
69file - name.C)
70
71 To open a previously saved session for the tree MyTree, first open MyTree
72in the browser, then use `<File/Open session>` menu.
73
74### Dragging items:
75
76Items that can be dragged from the list in the right : expressions and
77leaves. Dragging an item and dropping to another will copy the content of first
78to the last (leaf->expression, expression->expression). Items far to the right
79side of the list can be easily dragged to the left (where expressions are
80placed) by dragging them to the left at least 10 pixels.
81
82### Editing expressions:
83
84 Any editable expression from the right panel has two components : a
85true name (that will be used when TTree::Draw() commands are issued) and an
86alias. The visible name is the alias. Aliases of user defined expressions have
87a leading ~ and may be used in new expressions. Expressions containing boolean
88operators have a specific icon and may be dragged to the active cut (scissors
89item) position.
90
91 The expression editor can be activated by double-clicking empty expression,
92using `<EditExpression>` from the selected expression context menu or using
93`<Edit/Expression>` menu.
94
95 The editor will pop-up in the left part, but it can be moved.
96The editor usage is the following :
97
98 - you can write C expressions made of leaf names by hand or you can insert
99 any item from the right panel by clicking on it (recommandable);
100 - you can click on other expressions/leaves to paste them in the editor;
101 - you should write the item alias by hand since it not only make the
102 expression meaningful, but it also highly improve the layout for big
103 expressions
104 - you may redefine an old alias - the other expressions depending on it will
105 be modified accordingly. An alias must not be the leading string of other
106 aliases. When Draw commands are issued, the name of the corresponding
107 histogram axes will become the aliases of the expressions.
108
109User commands can be issued directly from the textbox labeled "Command"
110from the upper-left toolbar by typing and pressing Enter at the end.
111
112 Another way is from the right panel context menu : ExecuteCommand.
113All commands can be interrupted at any time by pressing the STOP button
114from the bottom-left
115You can toggle recording of the current command in the history file by
116checking the Rec button from the top-right
117
118### Context menus
119
120 You can activate context menus by right-clicking on items or inside the
121right panel.
122
123Context menus for mapped items from the left tree-type list :
124 The items from the left that are provided with context menus are tree and
125branch items. You can directly activate the *MENU* marked methods of TTree
126from this menu.
127
128Context menu for the right panel:
129
130 A general context menu is activated if the user right-clicks the right panel.
131
132 Commands are :
133 - EmptyAll : clears the content of all expressions;
134 - ExecuteCommand : execute a ROOT command;
135 - MakeSelector : equivalent of TTree::MakeSelector();
136 - NewExpression : add an expression item in the right panel;
137 - Process : equivalent of TTree::Process();
138 - SaveSource : save the current session as a C++ macro;
139 - SetScanFileName : define a name for the file where TTree::Scan command
140 is redirected when the `<Scan>` button is checked;
141 - SetTreeName : open a new tree with this name in the viewer;
142
143 A specific context menu is activated if expressions/leaves are right-clicked.
144
145 Commands are :
146 - Draw : draw a histogram for this item;
147 - EditExpression : pops-up the expression editor;
148 - Empty : empty the name and alias of this item;
149 - RemoveItem : removes clicked item from the list;
150 - Scan : scan this expression;
151 - SetExpression : edit name and alias for this item by hand;
152
153Starting the viewer
154
155 1. From the TBrowser: Select a tree in the TBrowser, then call the
156 StartViewer() method from its context menu (right-click on the tree).
157 2. From the command line: Start a ROOT session in the directory where you have
158 your tree. You will need first to load the library for TTreeViewer and
159 optionally other libraries for user defined classes (you can do this later in
160 the session) :
161~~~ {.cpp}
162 root [0] gSystem->Load(\"TTreeViewer\");
163~~~
164Supposing you have the tree MyTree in the file MyFile, you can do :
165~~~ {.cpp}
166 root [1] TFile file("Myfile");
167 root [2] new TTreeViewer("Mytree");
168~~~
169or :
170~~~ {.cpp}
171 root [2] TTreeViewer *tv = new TTreeViewer();
172 root [3] tv->SetTreeName("Mytree");
173~~~
174
175### The HISTOGRAM and OPTION boxes
176
177As explained before, in the top bar, there is the "Histogram" box, prepopulated with the string "htemp",
178which will be the variable name where the drawn histogram will be stored. You can modify it to specify
179e.g. a specific 2D binning "htemp(100,0,10, 20,0,5)", in the same way that you would do it when calling
180TTree::Draw ( "x >> htemp(...)" ).
181Likewise, there is the "Option" box, where you can specify drawing options such as "SAME", "COLZ", etc.
182In fact, once you click on the Draw icon, the resulting behind-the-scenes executed command will be added
183to the ROOT history. You can go back to the command line and press arrow-up, to be able to edit it further
184if you prefer the command line rather than the GUI.
185
186### Comparing different cuts
187
188It's a common use case to define different cuts on your data and compare them in the same canvas. To do so,
189define an expression e1 and e2 by double clicking on the empty "E<>" icons. Drag-and-drop e1 into the scissors
190icon, click then on the Draw icon. Then, add the "same" to the "Option" box, and change "htemp" to "htemp2",
191finally drag-and-drop e2 to the scissors, and click on the Draw icon again. Finally, right click on the resulting
192histogram (htemp2), choose "DrawPanel" and change the color to make it distinguishable.
193You can also define, directly by double-clicking on the scissors icons, or by generating a third expression e3,
194more complex cuts such as (~e1) && (~e2), or (~e1) || !(~e2). Parentheses are important.
195
196\image html ttree_treeview.png
197*/
198
199#include "RConfigure.h"
200
201#include <iostream>
202#include <fstream>
203#include "TTreeViewer.h"
204#include "HelpText.h"
205#include "HelpTextTV.h"
206#include "TTVLVContainer.h"
207#include "TTVSession.h"
208
209#include "TROOT.h"
210#include "TError.h"
211#include "TGMsgBox.h"
212#include "TTreePlayer.h"
213#include "TContextMenu.h"
214#include "TInterpreter.h"
215#include "TLeaf.h"
216#include "TBranch.h"
217#include "TRootHelpDialog.h"
218#include "TSystem.h"
219#include "TApplication.h"
220#include "TVirtualX.h"
221#include "TGClient.h"
222#include "TKey.h"
223#include "TFile.h"
224#include "TGMenu.h"
225#include "TVirtualPad.h"
226#include "TH1.h"
227#include "TFriendElement.h"
228#include "TObjArray.h"
229#include "TObjString.h"
230#include "TGButton.h"
231#include "TGButtonGroup.h"
232#include "TGTextEntry.h"
233#include "TGComboBox.h"
234#include "TGLabel.h"
235#include "TGListView.h"
236#include "TGListTree.h"
237#include "TGMimeTypes.h"
238#include "TGSplitter.h"
239#include "TGDoubleSlider.h"
240#include "TGToolBar.h"
241#include "TGStatusBar.h"
242#include "Getline.h"
243#include "TTimer.h"
244#include "TG3DLine.h"
245#include "TGFileDialog.h"
246#include "TGProgressBar.h"
247#include "TSpider.h"
248#include "strlcpy.h"
249#include "snprintf.h"
250
251#include <filesystem>
252
253#ifdef WIN32
254#include "TWin32SplashThread.h"
255#endif
256
257// drawing options
258static const char* gOptgen[16] =
259{
260 "","AXIS","HIST","SAME","CYL","POL","SPH","PSR","LEGO","LEGO1","LEGO2",
261 "SURF","SURF1","SURF2","SURF3","SURF4"
262};
263static const char* gOpt1D[12] =
264{
265 "","AH","B","C","E","E1","E2","E3","E4","L","P","*H"
266};
267static const char* gOpt2D[14] =
268{
269 "","ARR","BOX","COL","COL2","CONT","CONT0","CONT1","CONT2","CONT3",
270 "FB","BB","SCAT","PROF"
271};
272
273static const char* gOpenTypes[] = {"Root files", "*.root",
274 nullptr, nullptr };
275
276static const char* gMacroTypes[] = {"C++ macros", "*.C",
277 nullptr, nullptr };
278
279// Menu command id's
321
322// button Id's
335
337
338////////////////////////////////////////////////////////////////////////////////
339/// TTreeViewer default constructor
340
342 TGMainFrame(nullptr,10,10,kVerticalFrame),
343 fDimension(0), fVarDraw(false), fScanMode(false),
344 fTreeIndex(0), fDefaultCursor(0), fWatchCursor(0),
345 fCounting(false), fStopMapping(false), fEnableCut(false),fNexpressions(0)
346{
347 fTree = nullptr;
348 if (!gClient) return;
349 char command[128];
350 gROOT->ProcessLine("#ifndef GTV_DEFINED\n\
351 TTreeViewer *gTV = 0;\n\
352 TTree *tv__tree = 0;\n\
353 TList *tv__tree_list = 0;\n\
354 TFile *tv__tree_file = 0;\n\
355 #define GTV_DEFINED\n\
356 #endif");
357 snprintf(command,128, "gTV = (TTreeViewer*)0x%zx", (size_t)this);
358 gROOT->ProcessLine(command);
359 fTreeList = new TList;
360 gROOT->ProcessLine("tv__tree_list = new TList;");
361 fFilename = "";
362 gInterpreter->SaveContext();
365}
366
367////////////////////////////////////////////////////////////////////////////////
368
369TTreeViewer::TTreeViewer(const TTree *tree) :
370 TGMainFrame(nullptr, 10, 10, kVerticalFrame),
371 fDimension(0), fVarDraw(false), fScanMode(false),
372 fTreeIndex(0), fDefaultCursor(0), fWatchCursor(0),
373 fCounting(false), fStopMapping(false), fEnableCut(false),fNexpressions(0)
374
375{
376 // TTreeViewer constructor with a pointer to a Tree
377
378 fTree = nullptr;
379 char command[128];
380 gROOT->ProcessLine("#ifndef GTV_DEFINED\n\
381 TTreeViewer *gTV = 0;\n\
382 TTree *tv__tree = 0;\n\
383 TList *tv__tree_list = 0;\n\
384 TFile *tv__tree_file = 0;\n\
385 #define GTV_DEFINED\n\
386 #endif");
387 snprintf(command,128, "gTV = (TTreeViewer*)0x%zx", (size_t)this);
388 gROOT->ProcessLine(command);
389 if (!tree) return;
390 fTreeList = new TList;
391 gROOT->ProcessLine("tv__tree_list = new TList;");
392 fFilename = "";
393 gInterpreter->SaveContext();
396 TDirectory *cdir = tree->GetDirectory();
397 if (cdir) cdir->cd();
398
399 SetTree((TTree *)tree);
400 // If the tree is a chain, the tree directory will be changed by SwitchTree
401 // (called by SetTreeName)
402 cdir = tree->GetDirectory();
403 if (cdir) {
404 if (cdir->GetFile()) fFilename = cdir->GetFile()->GetName();
405 }
406 if (dirsav) dirsav->cd();
407}
408////////////////////////////////////////////////////////////////////////////////
409/// Allow geting the tree from the context menu.
410
412{
413 if (!tree) return;
414 TTree *ftree;
415 if (fTreeList) {
416 if (fTreeList->FindObject(tree)) {
417 printf("Tree found\n");
418 TIter next(fTreeList);
419 Int_t index = 0;
420 while ((ftree = (TTree*)next())) {
421 if (ftree==tree) {printf("found at index %i\n", index);break;}
422 index++;
423 }
425 if (fTree != fMappedTree) {
426 // switch also the global "tree" variable
428 // map it on the right panel
429 MapTree(fTree);
430 fListView->Layout();
431 TGListTreeItem *base = nullptr;
432 TGListTreeItem *parent = fLt->FindChildByName(base, "TreeList");
433 TGListTreeItem *item = fLt->FindChildByName(parent, fTree->GetName());
435 fLt->HighlightItem(item);
437 }
438 return;
439 }
440 }
441 if (fTree != tree) {
443 // load the tree via the interpreter
444 char command[100];
445 command[0] = 0;
446 // define a global "tree" variable for the same tree
447 snprintf(command,100, "tv__tree = (TTree *)0x%zx;", (size_t)tree);
449 }
450 //--- add the tree to the list if it is not already in
452 ExecuteCommand("tv__tree_list->Add(tv__tree);");
453 //--- map this tree
454 TGListTreeItem *base = nullptr;
455 TGListTreeItem *parent = fLt->FindChildByName(base, "TreeList");
456 if (!parent) parent = fLt->AddItem(base, "TreeList", new ULong_t(kLTNoType));
458 fTreeIndex++;
460 gClient->GetPicture("tree_t.xpm"), gClient->GetPicture("tree_t.xpm"));
461 MapTree(fTree, lTreeItem, false);
462 fLt->OpenItem(parent);
465
466 //--- map slider and list view
469 MapTree(fTree);
470 fListView->Layout();
471 SetFile();
472}
473////////////////////////////////////////////////////////////////////////////////
474/// Change the number of expression widgets.
475
477{
479 if (diff <= 0) return;
480 if (!fLVContainer) return;
481 for (Int_t i=0; i<TMath::Abs(diff); i++) NewExpression();
482}
483////////////////////////////////////////////////////////////////////////////////
484/// Set the name of the file where to redirect `<Scan>` output.
485
486void TTreeViewer::SetScanFileName(const char *name)
487{
489}
490////////////////////////////////////////////////////////////////////////////////
491/// Set the state of Scan check button.
492
494{
495 if (mode)
497 else
499}
500////////////////////////////////////////////////////////////////////////////////
501/// Assign the fTree member from existing tree, e.g. when calling
502/// tree->StartViewer() from the browser, or even from the command line.
503
504void TTreeViewer::SetTree(TTree *tree)
505{
506 if (!tree) return;
507 if (fTree != tree) {
509 // load the tree via the interpreter
510 // define a global "tree" variable for the same tree
511 TString command = TString::Format("tv__tree = (TTree *)0x%zx;", (size_t)tree);
512 ExecuteCommand(command.Data());
513 }
514 //--- add the tree to the list if it is not already in
516 ExecuteCommand("tv__tree_list->Add(tv__tree);");
517 //--- map this tree
518 TGListTreeItem *base = nullptr;
519 TGListTreeItem *parent = fLt->FindChildByName(base, "TreeList");
520 if (!parent) parent = fLt->AddItem(base, "TreeList", new ULong_t(kLTNoType));
522 fTreeIndex++;
524 gClient->GetPicture("tree_t.xpm"), gClient->GetPicture("tree_t.xpm"));
525 MapTree(fTree, lTreeItem, false);
526 fLt->OpenItem(parent);
529
530 //--- map slider and list view
533 MapTree(fTree);
534 fListView->Layout();
535 SetFile();
536}
537////////////////////////////////////////////////////////////////////////////////
538/// Allow geting the tree from the context menu.
539
540void TTreeViewer::SetTreeName(const char* treeName)
541{
542 if (!treeName) return;
544 if (fTreeList) {
546 printf("Tree found\n");
547 TIter next(fTreeList);
548 Int_t index = 0;
549 while ((tree = (TTree*)next())) {
551 index++;
552 }
554 if (fTree != fMappedTree) {
555 // switch also the global "tree" variable
557 // map it on the right panel
558 MapTree(fTree);
559 fListView->Layout();
560 TGListTreeItem *base = nullptr;
561 TGListTreeItem *parent = fLt->FindChildByName(base, "TreeList");
562 TGListTreeItem *item = fLt->FindChildByName(parent, fTree->GetName());
564 fLt->HighlightItem(item);
566 }
567 return;
568 }
569 }
570 if (!tree) return;
571// ((TTreePlayer *)tree->GetPlayer())->SetViewer(this);
572 if (fTree != tree) {
574 // load the tree via the interpreter
575 // define a global "tree" variable for the same tree
576 TString command = TString::Format("tv__tree = (TTree *) gROOT->FindObject(\"%s\");", treeName);
577 ExecuteCommand(command.Data());
578 }
579 //--- add the tree to the list if it is not already in
581 ExecuteCommand("tv__tree_list->Add(tv__tree);");
582 //--- map this tree
583 TGListTreeItem *base = nullptr;
584 TGListTreeItem *parent = fLt->FindChildByName(base, "TreeList");
585 if (!parent) parent = fLt->AddItem(base, "TreeList", new ULong_t(kLTNoType));
587 fTreeIndex++;
589 gClient->GetPicture("tree_t.xpm"), gClient->GetPicture("tree_t.xpm"));
590 MapTree(fTree, lTreeItem, false);
591 fLt->OpenItem(parent);
594
595 //--- map slider and list view
598 MapTree(fTree);
599 fListView->Layout();
600 SetFile();
601}
602////////////////////////////////////////////////////////////////////////////////
603/// Set file name containing the tree.
604
606{
607 if (!fTree) return;
608 TSeqCollection *list = gROOT->GetListOfFiles();
610 TIter next(list);
611 TObject *obj;
612 TFile *file;
613 while ((obj=next())) {
614 file = (TFile*)obj;
615 if (file) {
617 if (tree) {
618 fFilename = file->GetName();
619 std::cout << "File name : "<< fFilename << std::endl;
620 return;
621 } else {
622 fFilename = "";
623 }
624 }
625 }
626 fFilename = "";
627}
628////////////////////////////////////////////////////////////////////////////////
629/// Create all viewer widgets.
630
632{
633 //--- timer & misc
634 fCounting = false;
635 fScanMode = false;
636 fEnableCut = true;
637 fTimer = new TTimer(this, 20, true);
638 fLastOption = "";
639 fSession = new TTVSession(this);
640 //--- cursors
641 fDefaultCursor = gVirtualX->CreateCursor(kPointer);
642 fWatchCursor = gVirtualX->CreateCursor(kWatch);
643 //--- colours
644 ULong_t color;
645 gClient->GetColorByName("blue",color);
646 //--- pictures for X, Y and Z expression items
647 fPicX = gClient->GetPicture("x_pic.xpm");
648 fPicY = gClient->GetPicture("y_pic.xpm");
649 fPicZ = gClient->GetPicture("z_pic.xpm");
650
651 //--- general context menu
652 fContextMenu = new TContextMenu("TreeViewer context menu","");
653 fMappedTree = nullptr;
654 fMappedBranch = nullptr;
655 fDialogBox = nullptr;
656 fDimension = 0;
657 fVarDraw = false;
658 fStopMapping = false;
659// fFilename = "";
660 fSourceFile = "treeviewer.C";
661 //--- lists : trees and widgets to be removed
662// fTreeList = 0;
663 fTreeIndex = 0;
664 fWidgets = new TList();
665 //--- create menus --------------------------------------------------------
666 //--- File menu
668 fFileMenu->AddEntry("&New canvas", kFileCanvas);
669 fFileMenu->AddEntry("Open &tree file...", kFileBrowse);
670 fFileMenu->AddEntry("&Load Library...", kFileLoadLibrary);
671 fFileMenu->AddEntry("&Open session", kFileOpenSession);
672 fFileMenu->AddEntry("&Save source...", kFileSaveMacro);
674 fFileMenu->AddEntry("&Print", kFilePrint);
675 fFileMenu->AddEntry("&Close", kFileClose);
677 fFileMenu->AddEntry("&Quit ROOT", kFileQuit);
678
680
681 //--- Edit menu
682 fEditMenu = new TGPopupMenu(gClient->GetRoot());
683 fEditMenu->AddEntry("&Expression...", kEditExpression);
684 fEditMenu->AddEntry("&Cut...", kEditCut);
685 fEditMenu->AddEntry("&Macro...", kEditMacro);
686 fEditMenu->AddEntry("E&Vent...", kEditEvent);
687
690 //---Run menu
691 fRunMenu = new TGPopupMenu(gClient->GetRoot());
692 fRunMenu->AddEntry("&Macro...", kRunMacro);
694 //--- Options menu
695 //--- General options
696 fOptionsGen = new TGPopupMenu(gClient->GetRoot());
699 fOptionsGen->AddEntry("Axis only", kOptionsGeneral+1); // "AXIS"
700 fOptionsGen->AddEntry("Contour only", kOptionsGeneral+2); // "HIST"
701 fOptionsGen->AddEntry("Superimpose", kOptionsGeneral+3); //"SAME"
702 fOptionsGen->AddEntry("Cylindrical", kOptionsGeneral+4); //"CYL"
703 fOptionsGen->AddEntry("Polar", kOptionsGeneral+5); //"POL"
704 fOptionsGen->AddEntry("Spherical", kOptionsGeneral+6); //"SPH"
705 fOptionsGen->AddEntry("PsRap/Phi", kOptionsGeneral+7); //"PSR"
706 fOptionsGen->AddEntry("Lego HLR", kOptionsGeneral+8); //"LEGO"
707 fOptionsGen->AddEntry("Lego HSR", kOptionsGeneral+9); //"LEGO1"
708 fOptionsGen->AddEntry("Lego Color", kOptionsGeneral+10); //"LEGO2"
709 fOptionsGen->AddEntry("Surface HLR", kOptionsGeneral+11); //"SURF"
710 fOptionsGen->AddEntry("Surface HSR", kOptionsGeneral+12); //"SURF1"
711 fOptionsGen->AddEntry("Surface Col", kOptionsGeneral+13); //"SURF2"
712 fOptionsGen->AddEntry("Surf+Cont", kOptionsGeneral+14); //"SURF3"
713 fOptionsGen->AddEntry("Gouraud", kOptionsGeneral+15); //"SURF4"
714 fOptionsGen->Associate(this);
715 //--- 1D options
716 fOptions1D = new TGPopupMenu(gClient->GetRoot());
717 fOptions1D->AddEntry("Default", kOptions1D);
719 fOptions1D->AddEntry("No labels/ticks", kOptions1D+1); // "AH"
720 fOptions1D->AddEntry("Bar chart", kOptions1D+2); // "B"
721 fOptions1D->AddEntry("Smooth curve", kOptions1D+3); // "C"
722 fOptions1D->AddEntry("Errors", kOptions1D+4); // "E"
723 fOptions1D->AddEntry("Errors 1", kOptions1D+5); // "E1"
724 fOptions1D->AddEntry("Errors 2", kOptions1D+6); // "E2"
725 fOptions1D->AddEntry("Errors 3", kOptions1D+7); // "E3"
726 fOptions1D->AddEntry("Errors 4", kOptions1D+8); // "E4"
727 fOptions1D->AddEntry("Line", kOptions1D+9); // "L"
728 fOptions1D->AddEntry("Markers", kOptions1D+10); // "P"
729 fOptions1D->AddEntry("Stars", kOptions1D+11); // "*H"
730 fOptions1D->Associate(this);
731 //--- 2D options
732 fOptions2D = new TGPopupMenu(gClient->GetRoot());
733 fOptions2D->AddEntry("Default", kOptions2D);
735 fOptions2D->AddEntry("Arrows", kOptions2D+1); // "ARR"
736 fOptions2D->AddEntry("Box/Surf", kOptions2D+2); // "BOX"
737 fOptions2D->AddEntry("Box/Color", kOptions2D+3); // "COL"
738 fOptions2D->AddEntry("Box/ColMap", kOptions2D+4); // "COLZ"
739 fOptions2D->AddEntry("Contour", kOptions2D+5); // "CONT"
740 fOptions2D->AddEntry("Contour 0", kOptions2D+6); // "CONT0"
741 fOptions2D->AddEntry("Contour 1", kOptions2D+7); // "CONT1"
742 fOptions2D->AddEntry("Contour 2", kOptions2D+8); // "CONT2"
743 fOptions2D->AddEntry("Contour 3", kOptions2D+9); // "CONT3"
744 fOptions2D->AddEntry("No front-box", kOptions2D+10); // "FB"
745 fOptions2D->AddEntry("No back-box", kOptions2D+11); // "BB"
746 fOptions2D->AddEntry("Scatter", kOptions2D+12); // "SCAT"
747 fOptions2D->AddEntry("Profile", kOptions2D+13); // "SCAT"
748 fOptions2D->Associate(this);
749
750 fOptionsMenu = new TGPopupMenu(gClient->GetRoot());
751 fOptionsMenu->AddPopup("&General Options...", fOptionsGen);
752 fOptionsMenu->AddPopup("&1D Options", fOptions1D);
753 fOptionsMenu->AddPopup("&2D Options", fOptions2D);
755 fOptionsMenu->AddEntry("&Reset options", kOptionsReset);
756 //--- Help menu
757 fHelpMenu = new TGPopupMenu(gClient->GetRoot());
758 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
759 fHelpMenu->AddEntry("&About TreeViewer...", kHelpAboutTV);
761 fHelpMenu->AddEntry("&Starting...", kHelpStart);
762 fHelpMenu->AddEntry("&Layout...", kHelpLayout);
763 fHelpMenu->AddEntry("&Open/Save", kHelpOpenSave);
764 fHelpMenu->AddEntry("&Dragging...", kHelpDragging);
765 fHelpMenu->AddEntry("&Editing expressions...",kHelpEditing);
766 fHelpMenu->AddEntry("&Session...", kHelpSession);
767 fHelpMenu->AddEntry("&User commands...", kHelpCommands);
768 fHelpMenu->AddEntry("&Context menus...", kHelpContext);
769 fHelpMenu->AddEntry("D&rawing...", kHelpDrawing);
770 fHelpMenu->AddEntry("&Macros...", kHelpMacros);
771
772 fFileMenu->Associate(this);
773 fEditMenu->Associate(this);
774 fRunMenu->Associate(this);
775 fOptionsMenu->Associate(this);
776 fHelpMenu->Associate(this);
777
778 //--- menubar layout hints
782 //--- create menubar and add popup menus
783 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
784
790
792 //--- toolbar ----------------------------------------------------------------
793 fToolBar = new TGToolBar(this, 10, 10, kHorizontalFrame);
795
796 TGLayoutHints *lo;
797 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4,4,0,0);
798 fWidgets->Add(lo);
799 //--- label for Command text entry
800 fBarLbl1 = new TGLabel(fToolBar,"Command");
802 //--- command text entry
804 fBarCommand->SetWidth(120);
805 fBarCommand->Associate(this);
806 fBarCommand->SetToolTipText("User commands executed via interpreter. Type <ENTER> to execute");
808 //--- first vertical separator
810 lo = new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 4,4,0,0);
811 fWidgets->Add(lo);
814
815 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4,4,0,0);
816 fWidgets->Add(lo);
817 //--- label for Option text entry
818 fBarLbl2 = new TGLabel(fToolBar,"Option");
820 //--- drawing option text entry
822 fBarOption->SetWidth(100);
823 fBarOption->Associate(this);
824 fBarOption->SetToolTipText("Histogram graphics option. Type option here and click <Draw> (or <ENTER> to update current histogram).");
826 //--- second vertical separator
828 lo = new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 4,4,0,0);
829 fWidgets->Add(lo);
832
833 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4,4,0,0);
834 fWidgets->Add(lo);
835 //--- label for Histogram text entry
836 fBarLbl3 = new TGLabel(fToolBar,"Histogram");
838
839 //--- histogram name text entry
840 lo = new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 4,4,0,0);
841 fWidgets->Add(lo);
842 fBarHist = new TGTextEntry(fToolBar, new TGTextBuffer(100));
845 fBarHist->SetText("htemp");
847
848 //--- Hist check button
849 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4,4,0,0);
850 fWidgets->Add(lo);
851 fBarH = new TGCheckButton(fToolBar, "Hist");
852 fBarH->SetToolTipText("Checked : redraw only current histogram");
854 fToolBar->AddFrame(fBarH, lo);
855 //--- Scan check button
856 fBarScan = new TGCheckButton(fToolBar, "Scan");
858 fBarScan->SetToolTipText("Check to redirect TTree::Scan command in a file");
860 //--- Rec check button
861 fBarRec = new TGCheckButton(fToolBar, "Rec");
863 fBarRec->SetToolTipText("Check to record commands in history file and be verbose");
865 //--- 1'st horizontal tool bar separator ----------------------------------------
870 //--- 2'nd horizontal tool bar separator ----------------------------------------
871 toolBarSep = new TGHorizontal3DLine(this);
874
875 //--- Horizontal mother frame ---------------------------------------------------
876 fHf = new TGHorizontalFrame(this, 10, 10);
877 //--- Vertical frames
879// fSlider->SetBackgroundColor(color);
880 fSlider->Associate(this);
881
882 //--- fV1 -----------------------------------------------------------------------
883 fV1 = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
885
886 fLbl1 = new TGLabel(fTreeHdr, "Current Folder");
887 lo = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY, 3, 0, 0, 0);
888 fWidgets->Add(lo);
889 fTreeHdr->AddFrame(fLbl1, lo);
890
891 lo = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 1, 0);
892 fWidgets->Add(lo);
893 fV1->AddFrame(fTreeHdr, lo);
894
895 //--- tree view canvas on the left
897 //--- container frame
899 GetWhitePixel());
900 fLt->Associate(this);
902
903 lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2,0,0,0);
904 fWidgets->Add(lo);
905 fV1->AddFrame(fTreeView, lo);
906
907 //--- button horizontal frame
909
910 //--- DRAW button
911 fPicDraw = gClient->GetPicture("draw_t.xpm");
913 fDRAW->SetToolTipText("Draw current selection");
914 fDRAW->Associate(this);
915
916 lo = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2,2,4,2);
917 fWidgets->Add(lo);
918 fHpb->AddFrame(fDRAW, lo);
919
920 //--- SPIDER button
921 fSPIDER = new TGTextButton(fHpb,"SPIDER");
922 fSPIDER->SetToolTipText("Scan current selection using a spider plot");
923 fSPIDER->Associate(this);
924
925 lo = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2,2,4,2);
926 fWidgets->Add(lo);
927 fHpb->AddFrame(fSPIDER,lo);
928 //---connect SPIDER button to ExecuteScan() method
929 fSPIDER->Connect("Clicked()","TTreeViewer",this,"ExecuteSpider()");
930
931 //--- STOP button (breaks current operation)
932// fPicStop = gClient->GetPicture("mb_stop_s.xpm");
933 fPicStop = gClient->GetPicture("stop_t.xpm");
935 fSTOP->SetToolTipText("Abort current operation");
936 fSTOP->Associate(this);
937
938 lo = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2,2,4,2);
939 fWidgets->Add(lo);
940 fHpb->AddFrame(fSTOP, lo);
941
942 //--- REFR button (breaks current operation)
943 fPicRefr = gClient->GetPicture("refresh2.xpm");
945 fREFR->SetToolTipText("Update the tree viewer");
946 lo = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2,2,4,2);
947 fWidgets->Add(lo);
948 fHpb->AddFrame(fREFR, lo);
949 //---connect REFR button to DoRefresh() method
950 fREFR->Connect("Clicked()", "TTreeViewer", this, "DoRefresh()");
951
952 lo = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2,2,2,2);
953 fWidgets->Add(lo);
954 fV1->AddFrame(fHpb, lo);
955
956 //--- fV2
957 fV2 = new TGVerticalFrame(fHf, 10, 10);
959 fLbl2 = new TGLabel(fListHdr, "Current Tree: ");
960 lo = new TGLayoutHints(kLHintsTop | kLHintsLeft, 3, 0, 0, 0);
961 fWidgets->Add(lo);
962 fListHdr->AddFrame(fLbl2, lo);
963
964 //--- progress bar
968 lo = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 2,2,4,2);
969 fWidgets->Add(lo);
972 fWidgets->Add(lo);
973 fV2->AddFrame(fListHdr, lo);
974
977 fWidgets->Add(lo);
978 fHf->AddFrame(fSlider, lo);
980 fWidgets->Add(lo);
981 fHf->AddFrame(fV1, lo);
982
983 //--- vertical splitter
985 splitter->SetFrame(fV1,true);
988 fWidgets->Add(lo);
989 fHf->AddFrame(splitter,lo);
990
991
992
993 //-- listview for the content of the tree/branch -----------------------------
994 fListView = new TGListView(fListHdr,400,300);
995 //--- container frame
997 fLVContainer->Associate(this);
999 fLVContainer->SetViewer(this);
1005 fWidgets->Add(lo);
1006
1008
1010 fWidgets->Add(lo);
1011 fHf->AddFrame(fV2,lo);
1012
1013 AddFrame(fHf, lo);
1014 //--- 3rd horizontal tool bar separator ----------------------------------------
1015 toolBarSep = new TGHorizontal3DLine(this);
1018
1019 //--- label for IList text entry
1020 fBFrame = new TGHorizontalFrame(this,10,10);
1021 fBLbl4 = new TGLabel(fBFrame,"IList");
1022 lo = new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2,2,2,2);
1023 fWidgets->Add(lo);
1024 fBFrame->AddFrame(fBLbl4, lo);
1025 //--- IList text entry
1026 fBarListIn = new TGTextEntry(fBFrame, new TGTextBuffer(100));
1027 fBarListIn->SetWidth(60);
1028 fBarListIn->SetToolTipText("Name of a previously created event list");
1030 //--- label for OList text entry
1031 fBLbl5 = new TGLabel(fBFrame,"OList");
1032 fBFrame->AddFrame(fBLbl5, lo);
1033 //--- OList text entry
1035 fBarListOut->SetWidth(60);
1036 fBarListOut->SetToolTipText("Output event list. Use <Draw> to generate it.");
1038 //--- Status bar
1039 fStatusBar = new TGStatusBar(fBFrame, 10, 10);
1040 fStatusBar->SetWidth(200);
1041 fStatusBar->Draw3DCorner(false);
1043 fWidgets->Add(lo);
1045 //--- RESET button
1046 fReset = new TGTextButton(fBFrame,"RESET",kRESET);
1047 fReset->SetToolTipText("Reset variable's fields and drawing options");
1048 fReset->Associate(this);
1049 lo = new TGLayoutHints(kLHintsTop | kLHintsRight, 2,2,2,2);
1050 fWidgets->Add(lo);
1051 fBFrame->AddFrame(fReset,lo);
1052 //--- group of buttons for session handling
1054 gClient->GetPicture("first_t.xpm"), kBGFirst);
1055 fBGFirst->SetToolTipText("First record");
1056 fBGFirst->Associate(this);
1058 gClient->GetPicture("previous_t.xpm"), kBGPrevious);
1059 fBGPrevious->SetToolTipText("Previous record");
1060 fBGPrevious->Associate(this);
1062 gClient->GetPicture("record_t.xpm"), kBGRecord);
1063 fBGRecord->SetToolTipText("Record");
1064 fBGRecord->Associate(this);
1066 gClient->GetPicture("next_t.xpm"), kBGNext);
1067 fBGNext->SetToolTipText("Next record");
1068 fBGNext->Associate(this);
1070 gClient->GetPicture("last_t.xpm"), kBGLast);
1071 fBGLast->SetToolTipText("Last record");
1072 fBGLast->Associate(this);
1073
1074 fCombo = new TGComboBox(fBFrame, 0);
1076 fCombo->SetWidth(100);
1077 fCombo->Associate(this);
1078
1079 lo = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 0,0,2,0);
1080 fWidgets->Add(lo);
1081 fBFrame->AddFrame(fCombo, lo);
1082 fBFrame->AddFrame(fBGLast, lo);
1083 fBFrame->AddFrame(fBGNext, lo);
1087 lo = new TGLayoutHints(kLHintsExpandX,2,2,2,0);
1088 fWidgets->Add(lo);
1089 AddFrame(fBFrame,lo);
1090
1091 // map the window
1092 SetWindowName("TreeViewer");
1093 MapSubwindows();
1095 MapWindow();
1096
1097 // put default items in the listview on the right
1098 const TGPicture *pic, *spic;
1099
1102 Char_t symbol;
1104 symbol = 'X';
1105 entry->SetUserData(new ULong_t((symbol << 8) | kLTExpressionType | kLTTreeType));
1106 entry->SetToolTipText("X expression. Drag and drop expressions here");
1107 //--- X item
1109 entry->Empty();
1110 entry->MapWindow();
1111
1113 symbol = 'Y';
1114 entry->SetUserData(new ULong_t((symbol << 8) | kLTExpressionType | kLTTreeType));
1115 entry->SetToolTipText("Y expression. Drag and drop expressions here");
1116 //--- Y item
1118 entry->Empty();
1119 entry->MapWindow();
1120
1122 symbol = 'Z';
1123 entry->SetUserData(new ULong_t((symbol << 8) | kLTExpressionType | kLTTreeType));
1124 entry->SetToolTipText("Z expression. Drag and drop expressions here");
1125 //--- Z item
1127 entry->Empty();
1128 entry->MapWindow();
1129
1130 pic = gClient->GetPicture("cut_t.xpm");
1131 spic = gClient->GetPicture("cut_t.xpm");
1133 entry->SetUserData(new ULong_t(kLTExpressionType | kLTCutType));
1134 entry->SetToolTipText("Active cut. Double-click to enable/disable");
1135 //--- Cut item (scissors icon)
1137 entry->Empty();
1138 entry->MapWindow();
1139
1140 pic = gClient->GetPicture("pack_t.xpm");
1141 spic = gClient->GetPicture("pack-empty_t.xpm");
1142 entry = new TTVLVEntry(fLVContainer,pic,spic,new TGString("Scan box"),nullptr,kLVSmallIcons);
1143 entry->SetUserData(new ULong_t(kLTExpressionType | kLTPackType));
1144 entry->SetToolTipText("Drag and drop expressions/leaves here. Double-click to scan. Check <Scan> to redirect on file.");
1145 //--- Scan Box
1147 entry->MapWindow();
1148 entry->SetTrueName("");
1149
1150 //--- 10 expression items
1151 fNexpressions = 10;
1152 for (Int_t i=0; i<fNexpressions; i++) {
1153 pic = gClient->GetPicture("expression_t.xpm");
1154 spic = gClient->GetPicture("expression_t.xpm");
1156 entry->SetUserData(new ULong_t(kLTExpressionType | kLTDragType));
1157 entry->SetToolTipText("User defined expression/cut. Double-click to edit");
1159 entry->Empty();
1160 entry->MapWindow();
1161 }
1162
1163 fListView->Layout();
1164 fListView->Resize();
1165// EmptyAll();
1166 // map the tree if it was supplied in the constructor
1167
1168 if (!fTree) {
1169 fSlider->SetRange(0LL,1000000LL);
1170 fSlider->SetPosition(0LL,1000000LL);
1171 } else {
1174 }
1175 PrintEntries();
1178 ActivateButtons(false, false, false, false);
1179
1180 // map the window
1181 ///SetWindowName("TreeViewer");
1182 MapSubwindows();
1184 MapWindow();
1185}
1186
1187////////////////////////////////////////////////////////////////////////////////
1188/// TTreeViewer destructor.
1189
1191{
1192 if (!gClient) return;
1193 gClient->FreePicture(fPicX);
1194 gClient->FreePicture(fPicY);
1195 gClient->FreePicture(fPicZ);
1196 gClient->FreePicture(fPicDraw);
1197 gClient->FreePicture(fPicStop);
1198 gClient->FreePicture(fPicRefr);
1199
1201 if (fDialogBox) delete fDialogBox;
1202
1203 delete fContextMenu;
1204
1205 delete fBarLbl1;
1206 delete fBarLbl2;
1207 delete fBarLbl3;
1208 delete fBLbl4;
1209 delete fBLbl5;
1210 delete fBarCommand;
1211 delete fBarOption;
1212 delete fBarHist;
1213 delete fBarListIn;
1214 delete fBarListOut;
1215
1216 delete fBarH;
1217 delete fBarScan;
1218 delete fBarRec;
1219
1220 delete fToolBar;
1221
1222 delete fSlider;
1223 delete fV1;
1224 delete fV2;
1225 delete fLbl1;
1226 delete fLbl2;
1227 delete fHf;
1228 delete fTreeHdr;
1229 delete fListHdr;
1230 delete fLt;
1231 delete fTreeView;
1232 delete fLVContainer;
1233 delete fListView;
1234
1235 delete fProgressBar;
1236 delete fHpb;
1237
1238 delete fDRAW;
1239 delete fSPIDER;
1240 delete fSTOP;
1241 delete fReset;
1242 delete fBGFirst;
1243 delete fBGPrevious;
1244 delete fBGRecord;
1245 delete fBGNext;
1246 delete fBGLast;
1247 delete fCombo;
1248 delete fBFrame;
1249
1250 delete fMenuBar;
1251 delete fFileMenu;
1252 delete fEditMenu;
1253
1254 delete fOptionsGen;
1255 delete fOptions1D;
1256 delete fOptions2D;
1257 delete fOptionsMenu;
1258 delete fHelpMenu;
1259 delete fMenuBarLayout;
1260 delete fMenuBarItemLayout;
1261 delete fMenuBarHelpLayout;
1262 delete fBarLayout;
1263
1264 fWidgets->Delete();
1265 delete fWidgets;
1266 if (fTreeList) {
1267 delete fTreeList;
1268 }
1269 delete fTimer;
1270 delete fSession;
1271}
1272
1273////////////////////////////////////////////////////////////////////////////////
1274/// Enable/disable session buttons.
1275
1276void TTreeViewer::ActivateButtons(bool first, bool previous,
1277 bool next, bool last)
1278{
1279 if (first) fBGFirst->SetState(kButtonUp);
1283 if (next) fBGNext->SetState(kButtonUp);
1285 if (last) fBGLast->SetState(kButtonUp);
1287}
1288
1289////////////////////////////////////////////////////////////////////////////////
1290/// Apply Cut
1291
1292const char* TTreeViewer::Cut()
1293{
1294 return fLVContainer->Cut();
1295}
1296
1297////////////////////////////////////////////////////////////////////////////////
1298/// returns scanlist
1299
1300const char* TTreeViewer::ScanList()
1301{
1302 return fLVContainer->ScanList();
1303}
1304
1305////////////////////////////////////////////////////////////////////////////////
1306/// Set current session
1307
1309{
1310 if (session) {
1311 delete fSession;
1312 fSession = session;
1313 }
1314}
1315
1316////////////////////////////////////////////////////////////////////////////////
1317/// Empty the bracket content of a string.
1318
1319const char* TTreeViewer::EmptyBrackets(const char* name)
1320{
1322 if (!stripped.Contains("[")) return name;
1325 Int_t index = 0;
1326 while (stripped.Index("[", index) != kNPOS) {
1329 if (end == kNPOS) {
1330 objstr = new TObjString(retstr.Data());
1332 return (objstr->String()).Data();
1333 }
1335 retstr = stripped.Remove(start+1, end-start-1);
1336 stripped = retstr;
1337 }
1338 objstr = new TObjString(retstr.Data());
1340 return (objstr->String()).Data();
1341}
1342
1343////////////////////////////////////////////////////////////////////////////////
1344/// Clear the content of all items in the list view.
1345
1347{
1349}
1350
1351////////////////////////////////////////////////////////////////////////////////
1352/// Empty the content of the selected expression.
1353
1354void TTreeViewer::Empty()
1355{
1356 void *p = nullptr;
1357 TTVLVEntry *item = nullptr;
1358 if ((item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p)) == nullptr) {
1359 Warning("Empty", "No item selected.");
1360 return;
1361 }
1362 ULong_t *itemType = (ULong_t *) item->GetUserData();
1363 if (!(*itemType & kLTExpressionType)) {
1364 Warning("Empty", "Not expression type.");
1365 return;
1366 }
1367 if (*itemType & kLTPackType) {
1368 item->SetSmallPic(fClient->GetPicture("pack-empty_t.xpm"));
1369 item->SetTrueName("");
1370 return;
1371 }
1372 item->Empty();
1373}
1374
1375////////////////////////////////////////////////////////////////////////////////
1376/// Get the item from a specific position.
1377
1379{
1381}
1382
1383////////////////////////////////////////////////////////////////////////////////
1384/// Get the list of expression items.
1385
1387{
1388 return fLVContainer->ExpressionList();
1389}
1390
1391////////////////////////////////////////////////////////////////////////////////
1392/// Compute dimension of the histogram.
1393
1395{
1396 fDimension = 0;
1397 if (Ex() && strlen(Ex())) fDimension++;
1398 if (Ey() && strlen(Ey())) fDimension++;
1399 if (Ez() && strlen(Ez())) fDimension++;
1400 return fDimension;
1401}
1402
1403////////////////////////////////////////////////////////////////////////////////
1404/// Called when the DRAW button is executed.
1405
1407{
1410 Int_t dimension = 0;
1411 TString alias[3];
1412 TTVLVEntry *item;
1413 Int_t i;
1414 // fill in expressions
1415 if (fVarDraw) {
1416 void *p = nullptr;
1417 dimension = 1;
1418 if (!(item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p))) return;
1419 alias[0] = item->GetAlias();
1420 if (alias[0].BeginsWith("~")) alias[0].Remove(0, 1);
1421 varexp = item->ConvertAliases();
1422 } else {
1423 if (Ez() && strlen(Ez())) {
1424 dimension++;
1425 varexp = Ez();
1426 item = ExpressionItem(2);
1427 alias[2] = item->GetAlias();
1428 if (alias[2].BeginsWith("~")) alias[2].Remove(0, 1);
1429 }
1430 if ((Ez() && strlen(Ez())) && ((Ex() &&strlen(Ex())) || (Ey() && strlen(Ey())))) varexp += ":";
1431 if (Ey() && strlen(Ey())) {
1432 dimension++;
1433 varexp += Ey();
1434 item = ExpressionItem(1);
1435 alias[1] = item->GetAlias();
1436 if (alias[1].BeginsWith("~")) alias[1].Remove(0, 1);
1437 }
1438 if (Ey() && strlen(Ey()) && Ex() && strlen(Ex())) varexp += ":";
1439 if (Ex () && strlen(Ex())) {
1440 dimension++;
1441 varexp += Ex();
1442 item = ExpressionItem(0);
1443 alias[0] = item->GetAlias();
1444 if (alias[0].BeginsWith("~")) alias[0].Remove(0, 1);
1445 }
1446 }
1447 if (!dimension && !fScanMode) {
1448 Warning("ExecuteDraw", "Nothing to draw on X,Y,Z.");
1449 return;
1450 }
1451 // find ListIn
1452 fTree->SetEventList(nullptr);
1453 TEventList *elist = nullptr;
1454 if (strlen(fBarListIn->GetText())) {
1455 elist = (TEventList *) gROOT->FindObject(fBarListIn->GetText());
1456 if (elist) fTree->SetEventList(elist);
1457 }
1458 // find ListOut
1460 // find histogram name
1461 if (strcmp("htemp", fBarHist->GetText())) {
1462 varexp += ">>";
1463 varexp += fBarHist->GetText();
1464 }
1465 // find canvas/pad where to draw
1466 auto pad = gROOT->GetSelectedPad();
1467 if (pad) pad->cd();
1468 // find graphics option
1469 const char* gopt = fBarOption->GetText();
1470 // just in case a previous interrupt was posted
1471 gROOT->SetInterrupt(false);
1472 // check if cut is enabled
1473 const char *cut = "";
1474 if (fEnableCut) cut = Cut();
1475
1476 // get entries to be processed
1478 fSlider->GetMinPositionD() + 1);
1480//printf("firstentry=%lld, nentries=%lld\n",firstentry,nentries);
1481 // check if Scan is checked and if there is something in the box
1482 if (fScanMode) {
1483// fBarScan->SetState(kButtonUp);
1484 fScanMode = false;
1485 if (ScanList() && strlen(ScanList())) varexp = ScanList();
1486 command = TString::Format("tv__tree->Scan(\"%s\",\"%s\",\"%s\", %lld, %lld);",
1487 varexp.Data(), cut, gopt, nentries, firstentry);
1488 if (fBarScan->GetState() == kButtonDown) {
1490 } else {
1492 }
1493 ExecuteCommand(command.Data(), true);
1494 return;
1495 }
1496 // check if only histogram has to be updated
1497 if (fBarH->GetState() == kButtonDown) {
1498 // reset 'Hist' mode
1500 TH1 *hist = fTree->GetHistogram();
1501 if (hist && gPad) {
1502 //hist = (TH1*)gPad->GetListOfPrimitives()->FindObject(fBarHist->GetText());
1503 if (hist) {
1504 // check if graphic option was modified
1505 TString last(fLastOption);
1506 TString current(gopt);
1507 current.ToUpper();
1508 last.ToUpper();
1509 if (current == last) {
1510 gPad->Update();
1511 return;
1512 }
1513 if (dimension == 3 && strlen(gopt)) {
1514 std::cout << "Graphics option " << gopt << " not valid for 3D histograms" << std::endl;
1515 return;
1516 }
1517 std::cout << " Graphics option for current histogram changed to " << gopt << std::endl;
1518 hist->Draw(gopt);
1520 gPad->Update();
1521 return;
1522 }
1523 }
1524 }
1525 // send draw command
1527 //if (!gopt[0] && dimension!=3) {
1528 // gopt = "hist";
1529 // fLastOption = "hist";
1530 //}
1531 if (dimension == 3 && strlen(gopt)) {
1532 std::cout << "Graphics option " << gopt << " not valid for 3D histograms" << std::endl;
1533 gopt = "";
1534 fLastOption = "";
1535 }
1536 command = TString::Format("tv__tree->Draw(\"%s\",\"%s\",\"%s\", %lld, %lld);",
1537 varexp.Data(), cut, gopt, nentries, firstentry);
1538 if (fCounting) return;
1539 fCounting = true;
1540 fTree->SetTimerInterval(200);
1541 fTimer->TurnOn();
1542 ExecuteCommand(command.Data());
1544 fTimer->TurnOff();
1546 fCounting = false;
1549 TH1 *hist = fTree->GetHistogram();
1550 if (hist) {
1551 // put expressions aliases on axes
1552 Int_t current = 0;
1553 for (i=0; i<3; i++) {
1554 if (alias[i].Length()) {
1555 if (i != current) {
1556 alias[current] = alias[i];
1557 alias[i] = "";
1558 }
1559 current++;
1560 }
1561 }
1562 //hist = (TH1*)gPad->GetListOfPrimitives()->FindObject(fBarHist->GetText());
1563 TAxis *axis[3];
1564 axis[0] = hist->GetXaxis();
1565 axis[1] = hist->GetYaxis();
1566 axis[2] = hist->GetZaxis();
1567 for (Int_t ind=0; ind<3; ind++) axis[ind]->SetTitle(alias[ind].Data());
1568 }
1569 if (gPad) gPad->Update();
1570}
1571
1572////////////////////////////////////////////////////////////////////////////////
1573/// Draw a spider plot for the selected entries.
1574
1576{
1578 Int_t dimension = 0;
1579 TString alias[3];
1580 TTVLVEntry *item;
1581 bool previousexp = false;
1582 // fill in expressions
1583 if (Ez() && strlen(Ez())) {
1584 previousexp = true;
1585 dimension++;
1586 varexp = Ez();
1587 item = ExpressionItem(2);
1588 alias[2] = item->GetAlias();
1589 if (alias[2].BeginsWith("~")) alias[2].Remove(0, 1);
1590 }
1591 if ((Ez() && strlen(Ez())) && ((Ex() && strlen(Ex())) || (Ey() && strlen(Ey())))) varexp += ":";
1592 if (Ey() && strlen(Ey())) {
1593 previousexp = true;
1594 dimension++;
1595 varexp += Ey();
1596 item = ExpressionItem(1);
1597 alias[1] = item->GetAlias();
1598 if (alias[1].BeginsWith("~")) alias[1].Remove(0, 1);
1599 }
1600 if (Ey() && strlen(Ey()) && Ex() && strlen(Ex())) varexp += ":";
1601 if (Ex() && strlen(Ex())) {
1602 previousexp = true;
1603 dimension++;
1604 varexp += Ex();
1605 item = ExpressionItem(0);
1606 alias[0] = item->GetAlias();
1607 if (alias[0].BeginsWith("~")) alias[0].Remove(0, 1);
1608 }
1609 for(Int_t i=0;i<10;++i){
1610 if(En(i+5) && strlen(En(i+5))){
1611 ++dimension;
1612 if(previousexp){
1613 varexp += ":";
1614 varexp += En(i+5);
1615 } else varexp = En(i+5);
1616 previousexp = true;
1617 }
1618 }
1619 if (dimension<3) {
1620 Warning("ExecuteSpider", "Need at least 3 variables");
1621 return;
1622 }
1623 // find ListIn
1624 fTree->SetEventList(nullptr);
1625 TEventList *elist = nullptr;
1626 if (strlen(fBarListIn->GetText())) {
1627 elist = (TEventList *) gROOT->FindObject(fBarListIn->GetText());
1628 if (elist) fTree->SetEventList(elist);
1629 }
1630 // find ListOut
1632 // find canvas/pad where to draw
1633 auto pad = gROOT->GetSelectedPad();
1634 if (pad) pad->cd();
1635 // find graphics option
1636 const char* gopt = fBarOption->GetText();
1637 // just in case a previous interrupt was posted
1638 gROOT->SetInterrupt(false);
1639 // check if cut is enabled
1640 const char *cut = "";
1641 if (fEnableCut) cut = Cut();
1642
1643 // get entries to be processed
1645 fSlider->GetMinPositionD() + 1);
1647
1648 // create the spider plot
1649
1650 TSpider* spider = new TSpider(fTree,varexp.Data(),cut,Form("%s spider average",gopt),nentries,firstentry);
1651 spider->Draw();
1652
1653 if (gPad) gPad->Update();
1654}
1655
1656////////////////////////////////////////////////////////////////////////////////
1657/// Get the expression to be drawn on X axis.
1658
1659const char* TTreeViewer::Ex()
1660{
1661 return fLVContainer->Ex();
1662}
1663
1664////////////////////////////////////////////////////////////////////////////////
1665/// Get the expression to be drawn on Y axis.
1666
1667const char* TTreeViewer::Ey()
1668{
1669 return fLVContainer->Ey();
1670}
1671
1672////////////////////////////////////////////////////////////////////////////////
1673/// Get the expression to be drawn on Z axis.
1674
1675const char* TTreeViewer::Ez()
1676{
1677 return fLVContainer->Ez();
1678}
1679
1680////////////////////////////////////////////////////////////////////////////////
1681/// Get the n'th expression
1682
1683const char* TTreeViewer::En(Int_t n)
1684{
1686 if(e) return e->ConvertAliases();
1687 return "";
1688}
1689
1690////////////////////////////////////////////////////////////////////////////////
1691/// Start the expression editor.
1692
1694{
1695 void *p = nullptr;
1696 // get the selected item
1697 TTVLVEntry *item = nullptr;
1698 if ((item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p)) == nullptr) {
1699 Warning("EditExpression", "No item selected.");
1700 return;
1701 }
1702 // check if it is an expression
1703 ULong_t *itemType = (ULong_t *) item->GetUserData();
1704 if (!(*itemType & kLTExpressionType)) {
1705 Warning("EditExpression", "Not expression type.");
1706 return;
1707 }
1708 // check if the editor is already active
1710 if (!fDialogBox) {
1711 fDialogBox = new TGSelectBox(fClient->GetRoot(), this, fV1->GetWidth() - 10);
1712 }
1713 // copy current item data into editor boxes
1714 fDialogBox->SetEntry(item);
1715 fDialogBox->SetWindowName("Expression editor");
1716 // check if you are editing the cut expression
1717 if (*itemType & kLTCutType || item->IsCut()) {
1718 fDialogBox->SetLabel("Selection");
1719 } else {
1720 fDialogBox->SetLabel("Expression");
1721 }
1722}
1723
1724////////////////////////////////////////////////////////////////////////////////
1725/// Get use of TTree::MakeSelector() via the context menu.
1726
1727Int_t TTreeViewer::MakeSelector(const char* selector)
1728{
1729 if (!fTree) return 0;
1730 return fTree->MakeSelector(selector);
1731}
1732
1733////////////////////////////////////////////////////////////////////////////////
1734/// Get use of TTree::Process() via the context menu.
1735
1737{
1738 if (!fTree) return 0;
1740}
1741
1742////////////////////////////////////////////////////////////////////////////////
1743/// Get graph option
1744
1745const char *TTreeViewer::GetGrOpt()
1746{
1747 return fBarOption->GetText();
1748}
1749
1750////////////////////////////////////////////////////////////////////////////////
1751/// Set graph option
1752
1753void TTreeViewer::SetGrOpt(const char *option)
1754{
1756}
1757
1758////////////////////////////////////////////////////////////////////////////////
1759/// Return true if scan is redirected
1760
1762{
1763 return (fBarScan->GetState()==kButtonDown);
1764}
1765
1766////////////////////////////////////////////////////////////////////////////////
1767/// Remove the selected item from the list.
1768
1770{
1771 void *p = nullptr;
1772 TTVLVEntry *item = nullptr;
1773 // get the selected item
1774 if ((item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p)) == nullptr) {
1775 Warning("RemoveItem", "No item selected.");
1776 return;
1777 }
1778 // check if it is removable
1779 ULong_t *itemType = (ULong_t *) item->GetUserData();
1780 if (!(*itemType & kLTDragType)) {
1781 Warning("RemoveItem", "Not removable type.");
1782 return;
1783 }
1784 fLVContainer->RemoveItem(item);
1785 fListView->Layout();
1786}
1787
1788////////////////////////////////////////////////////////////////////////////////
1789/// Remove the current record.
1790
1792{
1794}
1795
1796////////////////////////////////////////////////////////////////////////////////
1797/// This function is called by the fTimer object.
1798
1800{
1801 if (fCounting) {
1802 Double_t first = fSlider->GetMinPositionD();
1804 Double_t current = (Double_t)fTree->GetReadEntry();
1805 Double_t percent = (current-first+1)/(last-first+1);
1808 }
1809 timer->Reset();
1810 return false;
1811}
1812
1813////////////////////////////////////////////////////////////////////////////////
1814/// Handle menu and other commands generated.
1815
1817{
1820
1821 switch (GET_MSG(msg)) {
1822 case kC_VSLIDER :
1823 // handle slider messages
1824 PrintEntries();
1825 break;
1826 case kC_TEXTENTRY:
1827 switch (GET_SUBMSG(msg)) {
1828 // handle enter posted by the Command text entry
1829 case kTE_ENTER:
1832 fBarCommand->Clear();
1833 }
1835 fVarDraw = false;
1837 ExecuteDraw();
1839 }
1840 break;
1841 default:
1842 break;
1843 }
1844 break;
1845 case kC_LISTTREE:
1846 switch (GET_SUBMSG(msg)) {
1847 // handle mouse messages in the list-tree (left panel)
1848 case kCT_ITEMCLICK :
1849 // tell coverity that parm1 is a Long_t, and not an enum (even
1850 // if we compare it with an enum value) and the meaning of
1851 // parm1 depends on GET_MSG(msg) and GET_SUBMSG(msg)
1852 // coverity[mixed_enums]
1853 if (((EMouseButton)parm1==kButton1) ||
1855 TGListTreeItem *ltItem = nullptr;
1856 // get item that sent this
1857 if ((ltItem = fLt->GetSelected()) != nullptr) {
1858 // get item type
1859 ULong_t *itemType = (ULong_t *)ltItem->GetUserData();
1860 if (!itemType)
1861 break;
1862 if (*itemType & kLTTreeType) {
1863 // already mapped tree item clicked
1864 Int_t index = (Int_t)(*itemType >> 8);
1866 if (fTree != fMappedTree) {
1867 // switch also the global "tree" variable
1869 // map it on the right panel
1870 MapTree(fTree);
1871 fListView->Layout();
1872 }
1873 // activate context menu for this tree
1874 if (parm1 == kButton3) {
1875 Int_t x = (Int_t)(parm2 &0xffff);
1876 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1878 }
1879 }
1880
1881 if (*itemType & kLTBranchType) {
1882 // branch item clicked
1884 if (!fTree) break; // really needed ?
1885 TBranch *branch = fTree->GetBranch(ltItem->GetText());
1886 if (!branch) break;
1887 // check if it is mapped on the right panel
1888 if (branch != fMappedBranch) {
1891 fStopMapping = false;
1892 fListView->Layout();
1893 }
1894 // activate context menu for this branch (no *MENU* methods ):)
1895 if (parm1 == kButton3) {
1896 Int_t x = (Int_t)(parm2 &0xffff);
1897 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1899 }
1900 }
1901
1902 if (*itemType & kLTLeafType) {
1903 // leaf item clicked
1905 if (!fTree) break;
1906 // find parent branch
1907 TBranch *branch = fTree->GetBranch(ltItem->GetParent()->GetText());
1908 if (!branch) {
1909 if (fTree != fMappedTree) {
1911 MapTree(fTree);
1912 fListView->Layout();
1913 }
1914 } else {
1915 // check if it is already mapped
1916 if (branch!=fMappedBranch) {
1919 fStopMapping = false;
1920 fListView->Layout();
1921 }
1922 }
1923 // select corresponding leaf on the right panel
1924 fLVContainer->SelectItem(ltItem->GetText());
1925 if (parm1 == kButton3) {
1926 // activate context menu for this leaf
1928 }
1929 }
1930 }
1931 }
1932 break;
1933 case kCT_ITEMDBLCLICK :
1935 if (parm1 == kButton1) {
1936 // execute double-click action for corresponding item in the right panel
1938 }
1939 break;
1940 default:
1941 break;
1942 }
1943 break;
1944 case kC_COMMAND:
1945 switch (GET_SUBMSG(msg)) {
1946 case kCM_COMBOBOX:
1947 if ((record = fSession->GetRecord((Int_t)parm2)))
1949 break;
1950 case kCM_BUTTON:
1951 switch (parm1) {
1952 // handle button messages
1953 case kRESET:
1954 EmptyAll();
1955 break;
1956 case kDRAW:
1957 fVarDraw = false;
1958 ExecuteDraw();
1959 break;
1960 case kSTOP:
1961 if (fCounting)
1962 gROOT->SetInterrupt(true);
1963 break;
1964 case kCLOSE:
1966 break;
1967 case kBGFirst:
1968 if ((record = fSession->First()))
1970 break;
1971 case kBGPrevious:
1972 if ((record = fSession->Previous()))
1974 break;
1975 case kBGRecord:
1977 break;
1978 case kBGNext:
1979 if ((record = fSession->Next()))
1981 break;
1982 case kBGLast:
1983 if ((record = fSession->Last()))
1985 break;
1986 default:
1987 break;
1988 }
1989 break;
1990 case kCM_MENU:
1991 // handle menu messages
1992 // check if sent by Options menu
1993 if ((parm1>=kOptionsReset) && (parm1<kHelpAbout)) {
1994 Dimension();
1995 if ((fDimension==0) && (parm1>=kOptions1D)) {
1996 Warning("ProcessMessage", "Edit expressions first.");
1997 break;
1998 }
1999 if ((fDimension==1) && (parm1>=kOptions2D)) {
2000 Warning("ProcessMessage", "You have only one expression active.");
2001 break;
2002 }
2003 if ((fDimension==2) && (parm1>=kOptions1D) &&(parm1<kOptions2D)) {
2004 Warning("ProcessMessage", "1D drawing options not apply to 2D histograms.");
2005 break;
2006 }
2007 // make composed option
2009 break;
2010 }
2011 switch (parm1) {
2012 case kFileCanvas:
2013 gROOT->MakeDefCanvas();
2014 break;
2015 case kFileBrowse:
2016 if (true) {
2017 static TString dir(".");
2019 info.fFileTypes = gOpenTypes;
2020 info.SetIniDir(dir);
2021 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &info);
2022 if (!info.fFilename) return true;
2023 dir = info.fIniDir;
2024 TString command = TString::Format("tv__tree_file = new TFile(\"%s\");",
2025 gSystem->UnixPathName(info.fFilename));
2026 ExecuteCommand(command.Data());
2027 ExecuteCommand("tv__tree_file->ls();");
2028 std::cout << "Use SetTreeName() from context menu and supply a tree name" << std::endl;
2029 std::cout << "The context menu is activated by right-clicking the panel from right" << std::endl;
2030 }
2031 break;
2032 case kFileLoadLibrary:
2033 fBarCommand->SetText("gSystem->Load(\"\");");
2034 if (true) {
2035 Event_t event;
2036 event.fType = kButtonPress;
2037 event.fCode = kButton1;
2038 event.fX = event.fY = 1;
2039 fBarCommand->HandleButton(&event);
2040 }
2042 break;
2043 case kFileOpenSession:
2044 if (true) {
2045 static TString dir(".");
2047 info.fFileTypes = gMacroTypes;
2048 info.SetIniDir(dir);
2049 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &info);
2050 if (!info.fFilename) return true;
2051 dir = info.fIniDir;
2052 gInterpreter->Reset();
2053 if (!gInterpreter->IsLoaded(info.fFilename)) gInterpreter->LoadMacro(info.fFilename);
2054 char command[1024];
2055 command[0] = 0;
2056 snprintf(command,1024,"open_session((void*)0x%zx);", (size_t)this);
2058 }
2059 break;
2060 case kFileSaveMacro:
2061 fContextMenu->Action(this,(TMethod*)IsA()->GetListOfMethods()->FindObject("SaveSource"));
2062 break;
2063 case kFilePrint:
2064 break;
2065 case kFileClose:
2067 break;
2068 case kFileQuit:
2070 break;
2071 case kEditExpression:
2073 break;
2074 case kEditCut:
2076 break;
2077 case kEditMacro:
2078 break;
2079 case kEditEvent:
2080 break;
2081 case kRunMacro:
2082 break;
2083 case kHelpAbout:
2084 {
2085#ifdef WIN32
2086 new TWin32SplashThread(true);
2087#else
2088 char str[32];
2089 snprintf(str,32, "About ROOT %s...", gROOT->GetVersion());
2090 hd = new TRootHelpDialog(this, str, 600, 400);
2091 hd->SetText(gHelpAbout);
2092 hd->Popup();
2093#endif
2094 }
2095 break;
2096 case kHelpAboutTV:
2097 hd = new TRootHelpDialog(this, "About TreeViewer...", 600, 400);
2098 hd->SetText(gTVHelpAbout);
2099 hd->Resize(hd->GetDefaultSize());
2100 hd->Popup();
2101 break;
2102 case kHelpStart:
2103 hd = new TRootHelpDialog(this, "Quick start...", 600, 400);
2104 hd->SetText(gTVHelpStart);
2105 hd->Popup();
2106 break;
2107 case kHelpLayout:
2108 hd = new TRootHelpDialog(this, "Layout...", 600, 400);
2109 hd->SetText(gTVHelpLayout);
2110 hd->Popup();
2111 break;
2112 case kHelpOpenSave:
2113 hd = new TRootHelpDialog(this, "Open/Save...", 600, 400);
2114 hd->SetText(gTVHelpOpenSave);
2115 hd->Popup();
2116 break;
2117 case kHelpDragging:
2118 hd = new TRootHelpDialog(this, "Dragging items...", 600, 400);
2119 hd->SetText(gTVHelpDraggingItems);
2120 hd->Popup();
2121 break;
2122 case kHelpEditing:
2123 hd = new TRootHelpDialog(this, "Editing expressions...", 600, 400);
2124 hd->SetText(gTVHelpEditExpressions);
2125 hd->Popup();
2126 break;
2127 case kHelpSession:
2128 hd = new TRootHelpDialog(this, "Session...", 600, 400);
2129 hd->SetText(gTVHelpSession);
2130 hd->Popup();
2131 break;
2132 case kHelpCommands:
2133 hd = new TRootHelpDialog(this, "Executing user commands...", 600, 400);
2134 hd->SetText(gTVHelpUserCommands);
2135 hd->Popup();
2136 break;
2137 case kHelpContext:
2138 hd = new TRootHelpDialog(this, "Context menus...", 600, 400);
2139 hd->SetText(gTVHelpContext);
2140 hd->Popup();
2141 break;
2142 case kHelpDrawing:
2143 hd = new TRootHelpDialog(this, "Drawing histograms...", 600, 400);
2144 hd->SetText(gTVHelpDrawing);
2145 hd->Popup();
2146 break;
2147 case kHelpMacros:
2148 hd = new TRootHelpDialog(this, "Using macros...", 600, 400);
2149 hd->SetText(gTVHelpMacros);
2150 hd->Popup();
2151 break;
2152 default:
2153 break;
2154 }
2155 break;
2156 default:
2157 break;
2158 }
2159 break;
2160 case kC_CONTAINER:
2161 switch (GET_SUBMSG(msg)) {
2162 // handle messages sent from the listview (right panel)
2163 case kCT_SELCHANGED:
2164 break;
2165 case kCT_ITEMCLICK:
2166 // handle mouse messages
2167 switch (parm1) {
2168 case kButton1:
2169 if (fLVContainer->NumSelected()) {
2170 // get item that sent this
2171 void *p = nullptr;
2172 TTVLVEntry *item;
2173 if ((item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p)) != nullptr) {
2174 const char* vname = item->GetTrueName();
2176 if (trueName.Contains("[]")) {
2177 TIter next(fTree->GetListOfLeaves());
2178 TLeaf *leaf;
2179 while((leaf=(TLeaf*)next())) {
2180 if (!strcmp(vname, EmptyBrackets(leaf->GetName())))
2181 vname = leaf->GetName();
2182 }
2183 }
2184 char* msg2 = new char[2000];
2185 // get item type
2186 ULong_t *itemType = (ULong_t *) item->GetUserData();
2187 if (*itemType & kLTTreeType) {
2188 // X, Y or Z clicked
2189 char symbol = (char)((*itemType) >> 8);
2190 snprintf(msg2,2000, "%c expression : %s", symbol, vname);
2191 } else {
2192 if (*itemType & kLTCutType) {
2193 // scissors clicked
2194 snprintf(msg2,2000, "Cut : %s", vname);
2195 } else {
2196 if (*itemType & kLTPackType) {
2197 snprintf(msg2,2000, "Box : %s", vname);
2198 } else {
2199 if (*itemType & kLTExpressionType) {
2200 // expression clicked
2201 snprintf(msg2,2000, "Expression : %s", vname);
2202 } else {
2203 if (*itemType & kLTBranchType) {
2204 snprintf(msg2,2000, "Branch : %s", vname);
2205 } else {
2206 snprintf(msg2,2000, "Leaf : %s", vname);
2207 }
2208 }
2209 }
2210 }
2211 }
2212 // write who is responsable for this
2213 TString message = msg2;
2214 message = message(0,150);
2215 Message(msg2);
2216 delete[] msg2;
2217 // check if this should be pasted into the expression editor
2218 if ((*itemType & kLTBranchType) || (*itemType & kLTCutType)) break;
2220 if (!fDialogBox || !vname[0]) break;
2221 if (item == fDialogBox->EditedEntry()) break;
2222 // paste it
2223// char first = (char) vname[0];
2224 TString insert(item->GetAlias());
2225// if (first != '(') insert += "(";
2226// insert += item->GetAlias();
2227// if (first != '(') insert += ")";
2228
2230 fDialogBox->InsertText(insert.Data());
2231 // put the cursor at the right position
2232 }
2233 }
2234 break;
2235 case kButton2:
2236 break;
2237 case kButton3:
2238 // activate general context menu
2239 if (fLVContainer->NumSelected()) {
2240 void *p = nullptr;
2241 Int_t x = (Int_t)(parm2 &0xffff);
2242 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2243 TTVLVEntry *item = nullptr;
2244 if ((item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p)) != nullptr) {
2245 fContextMenu->Popup(x, y, item->GetContext());
2246 }
2247 } else { // empty click
2248 Int_t x = (Int_t)(parm2 &0xffff);
2249 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2250 fContextMenu->Popup(x, y, this);
2251 }
2252 break;
2253 default:
2254 break;
2255 }
2256 break;
2257 case kCT_ITEMDBLCLICK:
2258 switch (parm1) {
2259 case kButton1:
2260 if (fLVContainer->NumSelected()) {
2261 // get item that sent this
2262 void *p = nullptr;
2263 TTVLVEntry *item;
2264 if ((item = (TTVLVEntry *) fLVContainer->GetNextSelected(&p)) != nullptr) {
2265 // get item type
2266 ULong_t *itemType = (ULong_t *) item->GetUserData();
2267 if (!(*itemType & kLTCutType) && !(*itemType & kLTBranchType)
2268 && !(*itemType & kLTPackType)) {
2269 if (strlen(item->GetTrueName())) {
2270 fVarDraw = true;
2271 // draw on double-click
2272 ExecuteDraw();
2273 break;
2274 } else {
2275 // open expression in editor
2277 }
2278 }
2279 if (*itemType & kLTCutType) {
2281 if (fEnableCut) {
2282 item->SetSmallPic(gClient->GetPicture("cut_t.xpm"));
2283 } else {
2284 item->SetSmallPic(gClient->GetPicture("cut-disable_t.xpm"));
2285 }
2286 }
2287 if (*itemType & kLTPackType) {
2288 fScanMode = true;
2289 ExecuteDraw();
2290 }
2291 }
2292 }
2293 break;
2294 case kButton2:
2295 break;
2296 case kButton3:
2297 break;
2298 default:
2299 break;
2300 }
2301 break;
2302 case 4:
2303// std::cout << "Dragging Item" << std::endl;
2304 default:
2305 break;
2306 }
2307 break;
2308 default:
2309 break;
2310 }
2311 return true;
2312}
2313
2314////////////////////////////////////////////////////////////////////////////////
2315/// Close the viewer.
2316
2318{
2319 DeleteWindow();
2320}
2321
2322////////////////////////////////////////////////////////////////////////////////
2323/// Execute all user commands.
2324
2325void TTreeViewer::ExecuteCommand(const char* command, bool fast)
2326{
2327 // Execute the command, write it to history file and echo it to output
2328 if (fBarRec->GetState() == kButtonDown) {
2329 // show the command on the command line
2330 //printf("%s\n", command);
2331 char comm[2000];
2332 comm[0] = 0;
2333 if (strlen(command) > 1999) {
2334 Warning("ExecuteCommand", "Command too long: aborting.");
2335 return;
2336 }
2337 snprintf(comm,2000, "%s", command);
2338 // print the command to history file
2340 }
2341 // execute it
2342 if (fast) {
2343 gROOT->ProcessLineFast(command);
2344 } else {
2345 gROOT->ProcessLine(command);
2346 }
2347 // make sure that 'draw on double-click' flag is reset
2348 fVarDraw = false;
2349}
2350
2351////////////////////////////////////////////////////////////////////////////////
2352/// Scan the selected options from option menu.
2353
2355{
2356 Int_t ind;
2357 if (parm1 == kOptionsReset) {
2360 for (ind=kOptions1D; ind<kOptions1D+12; ind++)
2362 for (ind=kOptions2D; ind<kOptions2D+14; ind++)
2364 }
2365 if ((parm1 < kOptions1D) && (parm1 != kOptionsReset)) {
2368 } else {
2371 }
2373 // uncheck all in this menu
2374 for (ind=kOptionsGeneral+1; ind<kOptionsGeneral+16; ind++) {
2376 }
2377 }
2378 }
2379
2380 if ((parm1 < kOptions2D) && (parm1 >= kOptions1D)) {
2383 } else {
2386 }
2388 // uncheck all in this menu
2389 for (ind=kOptions1D+1; ind<kOptions1D+12; ind++) {
2391 }
2392 }
2393 }
2394
2395 if (parm1 >= kOptions2D) {
2398 } else {
2401 }
2403 // uncheck all in this menu
2404 for (ind=kOptions2D+1; ind<kOptions2D+14; ind++) {
2406 }
2407 }
2408 }
2409 // concatenate options
2410 fBarOption->SetText("");
2414 }
2415 if (Dimension() == 1) {
2416 for (ind=kOptions1D; ind<kOptions1D+12; ind++) {
2419 }
2420 }
2421 if (Dimension() == 2) {
2422 for (ind=kOptions2D; ind<kOptions2D+14; ind++) {
2425 }
2426 }
2427}
2428
2429////////////////////////////////////////////////////////////////////////////////
2430/// Map current tree and expand its content (including friends) in the lists.
2431
2432void TTreeViewer::MapTree(TTree *tree, TGListTreeItem *parent, bool listIt)
2433{
2434 if (!tree) return;
2436 if (!branches) return; // A Chain with no underlying trees.
2437 TBranch *branch;
2438 // loop on branches
2439 Int_t id;
2440 for (id=0; id<branches->GetEntries(); id++) {
2441 branch = (TBranch *)branches->At(id);
2442 if (branch->TestBit(kDoNotProcess)) continue;
2443 TString name = branch->GetName();
2444 if (name.Contains("fBits") || name.Contains("fUniqueID")) continue;
2445 // now map sub-branches
2446 MapBranch(branch, "", parent, listIt);
2447 fStopMapping = false;
2448 }
2449 //Map branches of friend Trees (if any)
2450 //Look at tree->GetTree() to insure we see both the friends of a chain
2451 //and the friends of the chain members
2453 TFriendElement *fr;
2454 while ((fr = (TFriendElement*)nextf())) {
2455 TTree * t = fr->GetTree();
2457 for (id=0; id<branches->GetEntries(); id++) {
2458 branch = (TBranch *)branches->At(id);
2459 if (branch->TestBit(kDoNotProcess)) continue;
2460 TString name = branch->GetName();
2461 if (name.Contains("fBits") || name.Contains("fUniqueID")) continue;
2462 // now map sub-branches
2463 MapBranch(branch, fr->GetName(), parent, listIt);
2464 fStopMapping = false;
2465 }
2466 }
2467
2468 // tell who was last mapped
2469 if (listIt) {
2471 fMappedBranch = nullptr;
2472 }
2473}
2474
2475////////////////////////////////////////////////////////////////////////////////
2476/// Map current branch and expand its content in the list view.
2477
2478void TTreeViewer::MapBranch(TBranch *branch, const char *prefix, TGListTreeItem *parent, bool listIt)
2479{
2480 if (!branch) return;
2481 TString name;
2482 if (prefix && strlen(prefix) > 0) {
2483 name = prefix;
2484 if (!name.EndsWith(".")) name += ".";
2485 name += branch->GetName();
2486 }
2487 else name = branch->GetName();
2488 Int_t ind;
2489 TGListTreeItem *branchItem = nullptr;
2491 // map this branch
2492 if (name.Contains("fBits") || name.Contains("fUniqueID")) return;
2493 if (parent) {
2494 // make list tree items for each branch according to the type
2495 const TGPicture *pic, *spic;
2496 if ((branch->GetListOfBranches()->GetEntries()) ||
2497 (branch->GetNleaves())) {
2498 if (branch->GetListOfBranches()->GetEntries()) {
2500 if (branch->InheritsFrom("TBranchObject")) {
2501 pic = gClient->GetPicture("branch-ob_t.xpm");
2502 spic = gClient->GetPicture("branch-ob_t.xpm");
2503 } else {
2504 if (branch->InheritsFrom("TBranchClones")) {
2505 pic = gClient->GetPicture("branch-cl_t.xpm");
2506 spic = gClient->GetPicture("branch-cl_t.xpm");
2507 } else {
2508 pic = gClient->GetPicture("branch_t.xpm");
2509 spic = gClient->GetPicture("branch_t.xpm");
2510 }
2511 }
2513 } else {
2514 if (branch->GetNleaves() > 1) {
2516 pic = gClient->GetPicture("branch_t.xpm");
2517 spic = gClient->GetPicture("branch_t.xpm");
2519 TObjArray *leaves = branch->GetListOfLeaves();
2520 TLeaf *leaf = nullptr;
2522 for (Int_t lf=0; lf<leaves->GetEntries(); lf++) {
2523 leaf = (TLeaf *)leaves->At(lf);
2524 leafName = name;
2525 if (!leafName.EndsWith(".")) leafName.Append(".");
2526 leafName.Append(EmptyBrackets(leaf->GetName()));
2528 pic = gClient->GetPicture("leaf_t.xpm");
2529 spic = gClient->GetPicture("leaf_t.xpm");
2531 }
2532 } else {
2534 pic = gClient->GetPicture("leaf_t.xpm");
2535 spic = gClient->GetPicture("leaf_t.xpm");
2537 }
2538 }
2539 }
2540 }
2541 // list branch in list view if necessary
2542 if (listIt) {
2543 TGString *textEntry = nullptr;
2544 const TGPicture *pic, *spic;
2546 // make list view items in the right frame
2547 if (!fStopMapping) {
2549 fMappedTree = nullptr;
2550 fStopMapping = true;
2551 }
2552 if ((branch->GetListOfBranches()->GetEntries()) ||
2553 (branch->GetNleaves())) {
2554 textEntry = new TGString(EmptyBrackets(name.Data()));
2555 if (branch->GetListOfBranches()->GetEntries()) {
2556 if (branch->InheritsFrom("TBranchObject")) {
2557 pic = gClient->GetPicture("branch-ob_t.xpm");
2558 spic = gClient->GetPicture("branch-ob_t.xpm");
2559 } else {
2560 if (branch->InheritsFrom("TBranchClones")) {
2561 pic = gClient->GetPicture("branch-cl_t.xpm");
2562 spic = gClient->GetPicture("branch-cl_t.xpm");
2563 } else {
2564 pic = gClient->GetPicture("branch_t.xpm");
2565 spic = gClient->GetPicture("branch_t.xpm");
2566 }
2567 }
2569 entry->SetUserData(new UInt_t(kLTBranchType));
2570 entry->SetToolTipText("Branch with sub-branches. Can not be dragged");
2572 entry->MapWindow();
2573 entry->SetAlias(textEntry->GetString());
2574 } else {
2575 if (branch->GetNleaves() > 1) {
2576 if (textEntry) delete textEntry;
2577 textEntry = new TGString(EmptyBrackets(name.Data()));
2578 pic = gClient->GetPicture("branch_t.xpm");
2579 spic = gClient->GetPicture("branch_t.xpm");
2581 entry->SetUserData(new UInt_t(kLTBranchType));
2582 entry->SetToolTipText("Branch with more than one leaf. Can not be dragged");
2584 entry->MapWindow();
2585 entry->SetAlias(textEntry->GetString());
2586
2587 TObjArray *leaves = branch->GetListOfLeaves();
2588 TLeaf *leaf = nullptr;
2590 for (Int_t lf=0; lf<leaves->GetEntries(); lf++) {
2591 leaf = (TLeaf *)leaves->At(lf);
2592 leafName = name;
2593 if (!leafName.EndsWith(".")) leafName.Append(".");
2594 leafName.Append(EmptyBrackets(leaf->GetName()));
2595 textEntry = new TGString(leafName.Data());
2596 pic = gClient->GetPicture("leaf_t.xpm");
2597 spic = gClient->GetPicture("leaf_t.xpm");
2599 entry->SetUserData(new UInt_t(kLTDragType | kLTLeafType));
2600 entry->SetToolTipText("Double-click to draw. Drag to X, Y, Z or scan box.");
2602 entry->MapWindow();
2603 entry->SetAlias(textEntry->GetString());
2604 }
2605 } else {
2606 pic = (gClient->GetMimeTypeList())->GetIcon("TLeaf",false);
2607 if (!pic) pic = gClient->GetPicture("leaf_t.xpm");
2608 spic = gClient->GetMimeTypeList()->GetIcon("TLeaf",true);
2609 if (!spic) spic = gClient->GetPicture("leaf_t.xpm");
2611 entry->SetUserData(new UInt_t(kLTDragType | kLTLeafType));
2612 entry->SetToolTipText("Double-click to draw. Drag to X, Y, Z or scan box.");
2614 entry->MapWindow();
2615 entry->SetAlias(textEntry->GetString());
2616 }
2617 }
2618 }
2619 }
2620
2621 TObjArray *branches = branch->GetListOfBranches();
2622 TBranch *branchDaughter = nullptr;
2623
2624 // loop all sub-branches
2625 for (ind=0; ind<branches->GetEntries(); ind++) {
2626 branchDaughter = (TBranch *)branches->UncheckedAt(ind);
2627 // map also all sub-branches
2629 }
2630}
2631
2632////////////////////////////////////////////////////////////////////////////////
2633/// Create new expression
2634
2636{
2638 const TGPicture *pic = gClient->GetPicture("expression_t.xpm");
2639 const TGPicture *spic = gClient->GetPicture("expression_t.xpm");
2640
2642 new TGString(),nullptr,kLVSmallIcons);
2643 entry->SetUserData(new ULong_t(kLTExpressionType | kLTDragType));
2645 entry->MapWindow();
2646 entry->Empty();
2649 fListView->Layout();
2650 fNexpressions++;
2651}
2652
2653////////////////////////////////////////////////////////////////////////////////
2654/// Find parent tree of a clicked item.
2655
2657{
2658 if (!item) return;
2659 ULong_t *itemType = (ULong_t *)item->GetUserData();
2660 if (!itemType) return;
2661 TGListTreeItem *parent = nullptr;
2662 Int_t index;
2663 if (!(*itemType & kLTTreeType)) {
2664 parent = item->GetParent();
2665 SetParentTree(parent);
2666 } else {
2667 index = (Int_t)(*itemType >> 8);
2669 }
2670}
2671
2672////////////////////////////////////////////////////////////////////////////////
2673/// Send a message on the status bar.
2674
2675void TTreeViewer::Message(const char* msg)
2676{
2678}
2679
2680////////////////////////////////////////////////////////////////////////////////
2681/// Put error/warning into TMsgBox and also forward to console.
2682
2683void TTreeViewer::DoError(int level, const char *location, const char *fmt, va_list va) const
2684{
2685 TObject::DoError(level, location, fmt, va);
2686
2687 // in case level will abort we will not come here...
2688
2689 static const int buf_size = 2048;
2690 char buf[buf_size], *bp;
2691
2692 int n = vsnprintf(buf, buf_size, fmt, va);
2693 // old vsnprintf's return -1 if string is truncated new ones return
2694 // total number of characters that would have been written
2695 if (n == -1 || n >= buf_size) {
2696 TObject::Warning("DoError", "Error message string truncated...");
2697 }
2698 if (level >= kSysError && level < kFatal)
2699 bp = Form("%s (%s)", buf, gSystem->GetError());
2700 else
2701 bp = buf;
2702
2703 const char *title = "";
2704 if (level == kInfo)
2705 title = "Info";
2706 if (level == kWarning)
2707 title = "Warning";
2708 if (level == kError)
2709 title = "Error";
2710 if (level == kSysError)
2711 title = "System Error";
2712
2713 new TGMsgBox(fClient->GetRoot(), this, title, bp, kMBIconExclamation);
2714}
2715
2716////////////////////////////////////////////////////////////////////////////////
2717/// Print the number of selected entries on status-bar.
2718
2720{
2721 if (!fTree) return;
2722 char * msg = new char[100];
2723 snprintf(msg,100, "First entry : %lld Last entry : %lld",
2725 Message(msg);
2726 delete[] msg;
2727}
2728
2729////////////////////////////////////////////////////////////////////////////////
2730/// Save current session as a C++ macro file.
2731
2732void TTreeViewer::SaveSource(const char* filename, Option_t *)
2733{
2734 if (!fTree) return;
2735 char quote = '"';
2738 char * fname;
2739 if (!lenfile) {
2740 fname = (char*)fSourceFile;
2741 lenfile = strlen(fname);
2742 } else {
2743 fname = (char*)filename;
2745 }
2746 // if filename is given, open this file, otherwise create a file
2747 // with a name : treeviewer.C
2748 if (lenfile) {
2750 } else {
2751 fname = new char[13];
2752 strlcpy(fname, "treeviewer.C",13);
2754 }
2756 printf("SaveSource cannot open file : %s\n", fname);
2757 fSourceFile = "treeviewer.C";
2758 if (!lenfile) delete [] fname;
2759 return;
2760 }
2761 // Write macro header and date/time stamp
2762 TDatime t;
2787 // get expressions
2788 TTVLVEntry *item;
2791 for (Int_t i=0; i<4; i++) {
2792 switch (i) {
2793 case 0:
2795 break;
2796 case 1:
2798 break;
2799 case 2:
2801 break;
2802 case 3:
2804 break;
2805 default:
2806 break;
2807 }
2808 item = ExpressionItem(i);
2811 <<", "<<quote<<item->GetAlias()<<quote<<");"<<std::endl;
2812 }
2814 item = ExpressionItem(4);
2817 <<", "<<quote<<"Scan box"<<quote<<");"<<std::endl;
2820 for (Int_t crt=5; crt<fNexpressions+5; crt++) {
2821 item = ExpressionItem(crt);
2822 if (item->IsCut())
2823 itemType = "true";
2824 else
2825 itemType = "false";
2828 <<", "<<quote<<item->GetAlias()<<quote<<", "<<itemType.Data()<<");"<<std::endl;
2829 }
2830 fSession->SaveSource(out);
2833 printf("C++ Macro file: %s has been generated\n", fname);
2834 if (!lenfile) delete [] fname;
2835}
2836
2837////////////////////////////////////////////////////////////////////////////////
2838/// Makes current the tree at a given index in the list.
2839
2841{
2843 if (!tree) {
2844 Warning("SwitchTree", "No tree found.");
2845 return false;
2846 }
2847 if ((tree == fTree) && (tree == fMappedTree)) return false; // nothing to switch
2848 std::string command;
2849 if (tree != fTree) {
2850 command = "tv__tree = (TTree *) tv__tree_list->At";
2851 command += Form("(%i)",index);
2852 ExecuteCommand(command.c_str());
2853 }
2854
2858 command = "Current Tree : ";
2859 command += fTree->GetName();
2860 fLbl2->SetText(new TGString(command.c_str()));
2861 fTreeHdr->Layout();
2862 MapSubwindows();
2864 MapWindow();
2865 ///Resize(); //ia
2866 PrintEntries();
2867 return true;
2868}
2869
2870////////////////////////////////////////////////////////////////////////////////
2871/// Set record name
2872
2873void TTreeViewer::SetRecordName(const char *name)
2874{
2876}
2877
2878////////////////////////////////////////////////////////////////////////////////
2879/// Set current record
2880
2882{
2884}
2885
2886////////////////////////////////////////////////////////////////////////////////
2887/// Set title of Histogram
2888
2889void TTreeViewer::SetHistogramTitle(const char *title)
2890{
2891 if (!gPad) return;
2892 TH1 *hist = (TH1*)gPad->GetListOfPrimitives()->FindObject(fBarHist->GetText());
2893 if (hist) {
2894 hist->SetTitle(title);
2895 gPad->Update();
2896 }
2897}
2898
2899////////////////////////////////////////////////////////////////////////////////
2900/// user defined command for current record
2901
2902void TTreeViewer::SetUserCode(const char *code, bool autoexec)
2903{
2906}
2907
2908////////////////////////////////////////////////////////////////////////////////
2909/// Updates combo box to current session entries.
2910
2912{
2914 fCombo->RemoveEntries(0, 1000);
2915 for (Long64_t entry=0; entry<fSession->GetEntries(); entry++) {
2916 if ((record = fSession->GetRecord(entry)))
2917 fCombo->AddEntry(record->GetName(), entry);
2918 }
2919}
2920
2921////////////////////////////////////////////////////////////////////////////////
2922/// Updates current record to new X, Y, Z items.
2923
2924void TTreeViewer::UpdateRecord(const char *name)
2925{
2927}
2928
2929////////////////////////////////////////////////////////////////////////////////
2930/// This slot is called when button REFR is clicked
2931
2933{
2934 fTree->Refresh();
2936 Double_t max = (Double_t)fTree->GetEntries()-1;
2937 fSlider->SetRange(min,max);
2938 fSlider->SetPosition(min,max);
2939 ExecuteDraw();
2940}
@ kButtonPress
Definition GuiTypes.h:60
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
@ kFitHeight
Definition GuiTypes.h:388
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
EMouseButton
Button names.
Definition GuiTypes.h:214
@ kButton2
Definition GuiTypes.h:214
@ kButton3
Definition GuiTypes.h:214
@ kButton1
Definition GuiTypes.h:214
R__EXTERN const char gTVHelpLayout[]
Definition HelpTextTV.h:19
R__EXTERN const char gTVHelpStart[]
Definition HelpTextTV.h:18
R__EXTERN const char gTVHelpDrawing[]
Definition HelpTextTV.h:26
R__EXTERN const char gTVHelpOpenSave[]
Definition HelpTextTV.h:20
R__EXTERN const char gTVHelpMacros[]
Definition HelpTextTV.h:27
R__EXTERN const char gTVHelpEditExpressions[]
Definition HelpTextTV.h:22
R__EXTERN const char gTVHelpAbout[]
Definition HelpTextTV.h:17
R__EXTERN const char gTVHelpDraggingItems[]
Definition HelpTextTV.h:21
R__EXTERN const char gTVHelpUserCommands[]
Definition HelpTextTV.h:24
R__EXTERN const char gTVHelpSession[]
Definition HelpTextTV.h:23
R__EXTERN const char gTVHelpContext[]
Definition HelpTextTV.h:25
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
@ kCLOSE
Definition Match.cxx:47
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:75
char Char_t
Definition RtypesCore.h:37
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
double Double_t
Definition RtypesCore.h:59
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:117
long long Long64_t
Definition RtypesCore.h:69
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:374
R__EXTERN TApplication * gApplication
const Int_t kDoNotProcess
Definition TBranch.h:56
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gDirectory
Definition TDirectory.h:384
constexpr Int_t kError
Definition TError.h:47
constexpr Int_t kFatal
Definition TError.h:50
constexpr Int_t kWarning
Definition TError.h:46
constexpr Int_t kInfo
Definition TError.h:45
constexpr Int_t kSysError
Definition TError.h:49
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:157
@ kDoubleScaleBoth
@ kFDOpen
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kLVSmallIcons
Definition TGListView.h:23
@ kLVList
Definition TGListView.h:24
@ kMBIconExclamation
Definition TGMsgBox.h:24
winID h TVirtualViewer3D TVirtualGLPainter p
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint percent
char name[80]
Definition TGX11.cxx:110
int nentries
#define gInterpreter
#define gROOT
Definition TROOT.h:406
@ kFilePrint
@ kFileQuit
@ kHelpAbout
static const char * gOpenTypes[]
@ kEditCut
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
static const char * gOpt2D[14]
EButtonIdentifiers
@ kBGFirst
@ kSLIDER
@ kSTOP
@ kBGLast
@ kRESET
@ kBGRecord
@ kCLOSE
@ kDRAW
@ kBGNext
@ kBGPrevious
static const char * gOptgen[16]
static const char * gOpenTypes[]
static const char * gOpt1D[12]
static const char * gMacroTypes[]
ERootTreeViewerCommands
@ kBarCommand
@ kHelpDragging
@ kFilePrint
@ kOptionsGeneral
@ kHelpContext
@ kFileClose
@ kHelpStart
@ kHelpCommands
@ kHelpMacros
@ kOptions2D
@ kFileQuit
@ kEditMacro
@ kHelpDrawing
@ kFileCanvas
@ kFileLoadLibrary
@ kFileSaveMacro
@ kFileBrowse
@ kFileOpenSession
@ kOptionsReset
@ kBarOption
@ kRunMacro
@ kAxis
@ kHelpEditing
@ kBarCut
@ kRunCommand
@ kHelpOpenSave
@ kHelpSession
@ kEditCut
@ kHelpAboutTV
@ kOptions1D
@ kEditEvent
@ kHelpLayout
@ kHelpAbout
@ kEditExpression
#define gPad
#define gVirtualX
Definition TVirtualX.h:337
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kCT_SELCHANGED
@ kCM_COMBOBOX
@ kCM_MENU
@ kTE_ENTER
@ kCT_ITEMCLICK
@ kC_COMMAND
@ kCM_BUTTON
@ kC_TEXTENTRY
@ kC_LISTTREE
@ kC_VSLIDER
@ kCT_ITEMDBLCLICK
@ kC_CONTAINER
Int_t GET_SUBMSG(Long_t val)
#define snprintf
Definition civetweb.c:1540
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
Class to manage histogram axis.
Definition TAxis.h:32
A TTree is a list of TBranches.
Definition TBranch.h:93
This class provides an interface to context sensitive popup menus.
virtual void Action(TObject *object, TMethod *method)
Action to be performed when this menu item is selected.
virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=nullptr, TVirtualPad *p=nullptr)
Popup context menu at given location in canvas c and pad p for selected object.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
const char * AsString() const
Return the date & time as a string (ctime() format).
Definition TDatime.cxx:102
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
Definition TDirectory.h:45
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
Definition TEventList.h:31
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:131
A TFriendElement TF describes a TTree object TF in a file.
virtual TTree * GetTree()
Return pointer to friend TTree.
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
virtual void SetContainer(TGFrame *f)
Definition TGCanvas.h:222
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
Selects different options.
Definition TGButton.h:264
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:381
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
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Definition TGComboBox.h:105
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
UInt_t GetDefaultWidth() const override
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:314
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void Associate(const TGWindow *w)
Definition TGCanvas.h:89
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition TGCanvas.cxx:660
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition TGCanvas.cxx:681
virtual Int_t NumSelected() const
Definition TGCanvas.h:104
void RemoveAll() override
Remove all items from the container.
Definition TGCanvas.cxx:641
virtual Double_t GetMaxPositionD() const
virtual Long64_t GetMinPositionL() const
virtual Double_t GetMinPositionD() const
virtual void SetRange(Float_t min, Float_t max)
virtual Long64_t GetMaxPositionL() const
virtual void SetPosition(Float_t min, Float_t max)
Dragging the slider will generate the event:
This class creates a file selection dialog.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
void MapWindow() override
map window
Definition TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
virtual void SetWidth(UInt_t w)
Definition TGFrame.h:246
UInt_t GetWidth() const
Definition TGFrame.h:224
virtual void SetHeight(UInt_t h)
Definition TGFrame.h:247
void ShowPosition(Bool_t set=kTRUE, Bool_t percent=kTRUE, const char *format="%.2f")
Show postion text, either in percent or formatted according format.
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
void * GetUserData() const
Definition TGListView.h:95
This class handles GUI labels.
Definition TGLabel.h:24
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:180
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGListTreeItem * GetParent() const
Definition TGListTree.h:58
virtual void * GetUserData() const =0
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:195
void ClearHighlighted()
Un highlight items.
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
TGListTreeItem * GetSelected() const
Definition TGListTree.h:382
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
void HighlightItem(TGListTreeItem *item)
Highlight item.
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition TGListView.h:115
void Layout() override
Layout list view components (container and contents of container).
void SetContainer(TGFrame *f) override
Set list view container.
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode.
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1744
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup menu to menu bar.
Definition TGMenu.cxx:418
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
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
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1845
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
Add a (cascading) popup menu to a popup menu.
Definition TGMenu.cxx:1152
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1782
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1724
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1807
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1060
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:990
void SetPosition(Float_t pos)
Set progress position between [min,max].
void SetFillType(EFillType type)
Set fill type.
virtual void SetBarColor(Pixel_t color)
Set progress bar color.
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
TTVLVEntry * EditedEntry()
void InsertText(const char *text)
Insert text in text entry.
void GrabPointer()
Just focus the cursor inside.
void SetLabel(const char *title)
Set label of selection box.
void SetEntry(TTVLVEntry *entry)
Connect one entry.
static TGSelectBox * GetInstance()
Return the pointer to the instantiated singleton.
Provides a StatusBar widget.
Definition TGStatusBar.h:21
void Draw3DCorner(Bool_t corner)
Definition TGStatusBar.h:59
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
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
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
void Clear(Option_t *option="") override
Clears up the text entry.
const char * GetText() const
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
virtual void AppendText(const char *text)
Appends text to the end of text entry, clears the selection and moves the cursor to the end of the li...
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in text entry widget.
A toolbar is a composite frame that contains TGPictureButtons.
Definition TGToolBar.h:33
A vertical 3D line is a line that can be used to separate groups of widgets.
Definition TG3DLine.h:33
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
TAxis * GetZaxis()
Definition TH1.h:342
void SetTitle(const char *title) override
Change/set the title.
Definition TH1.cxx:6716
TAxis * GetXaxis()
Definition TH1.h:340
TObject * FindObject(const char *name) const override
Search object named name in the list of functions.
Definition TH1.cxx:3834
TAxis * GetYaxis()
Definition TH1.h:341
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3037
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition TLeaf.h:57
A doubly linked list.
Definition TList.h:38
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:576
void Add(TObject *obj) override
Definition TList.h:81
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:468
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:355
Each ROOT class (see TClass) has a linked list of methods.
Definition TMethod.h:38
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
An array of TObjects.
Definition TObjArray.h:31
Collectable string class.
Definition TObjString.h:28
Mother of all ROOT objects.
Definition TObject.h:41
virtual void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
Definition TObject.cxx:981
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1006
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:420
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
A TRootHelpDialog is used to display help text (or any text in a dialog window).
Sequenceable collection abstract base class.
Spider class.
Definition TSpider.h:40
Basic string class.
Definition TString.h:139
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1063
virtual const char * GetError()
Return system error string.
Definition TSystem.cxx:254
This class represent the list view container for the TreeView class.
void SelectItem(const char *name)
Select an item.
void SetViewer(TTreeViewer *viewer)
TList * ExpressionList()
Return the list of user-defined expressions.
const char * Cut()
Return the cut entry.
const char * Ez()
Return the expression on Z.
const char * Ey()
Return the expression on Y.
const char * ScanList()
Return the cut entry.
virtual void AddThisItem(TTVLVEntry *item)
TTVLVEntry * ExpressionItem(Int_t index)
Return the expression item at specific position.
void SetListView(TGListView *lv) override
const char * Ex()
Return the expression on X.
void EmptyAll()
Clear all names and aliases for expression type items.
void RemoveNonStatic()
Remove all non-static items from the list view, except expressions.
This class represent entries that goes into the TreeViewer listview container.
TGItemContext * GetContext()
void SetSmallPic(const TGPicture *spic)
Set small picture.
void SetTrueName(const char *name)
const char * ConvertAliases()
Convert all aliases into true names.
const char * GetAlias()
void Empty()
Clear all names and alias.
const char * GetTrueName()
I/O classes for TreeViewer session handling.
Definition TTVSession.h:29
I/O classes for TreeViewer session handling.
Definition TTVSession.h:75
TTVRecord * Last()
Definition TTVSession.h:95
void SaveSource(std::ofstream &out)
Save the TTVSession in a C++ macro file.
TTVRecord * GetRecord(Int_t i)
Return record at index i.
void SetRecordName(const char *name)
Set record name.
void Show(TTVRecord *rec)
Display record rec.
TTVRecord * GetCurrent()
Definition TTVSession.h:92
TTVRecord * AddRecord(bool fromFile=false)
Add a record.
TTVRecord * Previous()
Definition TTVSession.h:97
Int_t GetEntries()
Definition TTVSession.h:91
TTVRecord * First()
Definition TTVSession.h:94
void RemoveLastRecord()
Remove current record from list.
TTVRecord * Next()
Definition TTVSession.h:96
void UpdateRecord(const char *name)
Updates current record according to new X, Y, Z settings.
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
virtual void TurnOff()
Remove timer from system timer list.
Definition TTimer.cxx:231
virtual void TurnOn()
Add the timer to the system timer list.
Definition TTimer.cxx:243
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition TTreePlayer.h:37
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)
TTreeViewer(const char *treeName=nullptr)
TTreeViewer default constructor.
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
void RemoveItem()
TGTextEntry * fBarHist
Histogram name entry.
TGLayoutHints * fBarLayout
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()
TClass * IsA() const override
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;.
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)
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
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="")
TGStatusBar * fStatusBar
Status bar.
TGTextButton * fSPIDER
SPIDER button.
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual void SetTimerInterval(Int_t msec=333)
Definition TTree.h:693
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition TTree.cxx:5287
virtual TObjArray * GetListOfLeaves()
Definition TTree.h:529
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
Definition TTree.cxx:6298
virtual Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Process this tree executing the TSelector code in the specified filename.
Definition TTree.cxx:7520
virtual void SetEventList(TEventList *list)
This function transfroms the given TEventList into a TEntryList The new TEntryList is owned by the TT...
Definition TTree.cxx:9139
virtual Long64_t GetEntries() const
Definition TTree.h:463
virtual Int_t MakeSelector(const char *selector=nullptr, Option_t *option="")
Generate skeleton selector class for this tree.
Definition TTree.cxx:6815
virtual Long64_t GetReadEntry() const
Definition TTree.h:549
virtual TObjArray * GetListOfBranches()
Definition TTree.h:528
TH1 * GetHistogram()
Definition TTree.h:519
virtual void Refresh()
Refresh contents of this tree and its branches from the current status on disk.
Definition TTree.cxx:7986
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=nullptr)
Definition tmvaglob.cxx:590
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175