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