TTreeViewer


class description - source file - inheritance tree

class TTreeViewer : public TGMainFrame

    private:
void BuildInterface() const char* Cut() const Int_t Dimension() virtual void DoError(int level, const char* location, const char* fmt, va_list va) const const char* EmptyBrackets(const char* name) const const char* Ex() const const char* Ey() const const char* Ez() const void MapBranch(TBranch* branch, TGListTreeItem* parent = 0, Bool_t listIt = kTRUE) void MapOptions(Long_t parm1) void MapTree(TTree* tree, TGListTreeItem* parent = 0, Bool_t listIt = kTRUE) const char* ScanList() const void SetFile() void SetParentTree(TGListTreeItem* item) public:
TTreeViewer(const char* treeName = "0") TTreeViewer(const TTree* tree) TTreeViewer(const TTreeViewer&) virtual ~TTreeViewer() void ActivateButtons(Bool_t first, Bool_t previous, Bool_t next, Bool_t last) static TClass* Class() virtual void CloseWindow() virtual void Delete(const Option_t*) void EditExpression() void Empty() void EmptyAll() void ExecuteCommand(const char* command, Bool_t fast = kFALSE) void ExecuteDraw() TTVLVEntry* ExpressionItem(Int_t index) TList* ExpressionList() const char* GetGrOpt() const TTree* GetTree() virtual Bool_t HandleTimer(TTimer* timer) virtual TClass* IsA() const Bool_t IsCutEnabled() Bool_t IsScanRedirected() Int_t MakeSelector(const char* selector = "0") virtual void Message(const char* msg) void NewExpression() void PrintEntries() Int_t Process(const char* filename, const Option_t* option, Int_t nentries = 1000000000, Int_t firstentry = 0) virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) void RemoveItem() void RemoveLastRecord() void SaveSource(const char* filename) void SetCurrentRecord(Int_t entry) void SetCutMode(Bool_t enabled = kTRUE) void SetGrOpt(const char* option) void SetHistogramTitle(const char* title) void SetNexpressions(Int_t expr) void SetRecordName(const char* name) void SetScanFileName(const char* name) void SetScanMode(Bool_t mode = kTRUE) void SetScanRedirect(Bool_t mode) void SetSession(TTVSession* session) void SetTreeName(const char* treeName) void SetUserCode(const char* code, Bool_t autoexec = kTRUE) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) Bool_t SwitchTree(Int_t index) void UpdateCombo() void UpdateRecord(const char* name = "new name")

Data Members

    private:
TTree* fTree selected tree TTVSession* fSession current tree-viewer session const char* fFilename name of the file containing the tree const char* fSourceFile name of the C++ source file - default treeviewer.C TString fLastOption last graphic option TTree* fMappedTree listed tree TBranch* fMappedBranch listed branch Int_t fDimension histogram dimension Bool_t fVarDraw true if an item is double-clicked Bool_t fScanMode flag activated when Scan Box is double-clicked TContextMenu* fContextMenu context menu for tree viewer TGSelectBox* fDialogBox expression editor TList* fTreeList list of mapped trees Int_t fTreeIndex index of current tree in list const TGPicture* fPicX const TGPicture* fPicY const TGPicture* fPicZ pictures for X, Y and Z expressions const TGPicture* fPicDraw const TGPicture* fPicStop pictures for Draw/Stop buttons Cursor_t fDefaultCursor default cursor Cursor_t fWatchCursor watch cursor TTimer* fTimer tree viewer timer Bool_t fCounting true if timer is counting Bool_t fStopMapping true if branch don't need remapping Bool_t fEnableCut true if cuts are enabled Int_t fNexpressions number of expression widgets TGLayoutHints* fMenuBarLayout TGLayoutHints* fMenuBarItemLayout TGLayoutHints* fMenuBarHelpLayout TGMenuBar* fMenuBar TGPopupMenu* fFileMenu TGPopupMenu* fEditMenu TGPopupMenu* fRunMenu TGPopupMenu* fOptionsMenu TGPopupMenu* fOptionsGen TGPopupMenu* fOptions1D TGPopupMenu* fOptions2D TGPopupMenu* fHelpMenu TGToolBar* fToolBar TGLayoutHints* fBarLayout TGLabel* fBarLbl1 label of command text entry TGLabel* fBarLbl2 label of option text entry TGLabel* fBarLbl3 label of histogram name text entry TGCheckButton* fBarH checked for drawing current histogram with different graphic option TGCheckButton* fBarScan checked for tree scan TGCheckButton* fBarRec command recording toggle TGTextEntry* fBarCommand user command entry TGTextEntry* fBarOption histogram drawing option entry TGTextEntry* fBarHist histogram name entry TGHorizontalFrame* fHf main horizontal frame TGDoubleVSlider* fSlider vertical slider to select processed tree entries; TGVerticalFrame* fV1 list tree mother TGVerticalFrame* fV2 list view mother TGCompositeFrame* fTreeHdr header for list tree TGCompositeFrame* fListHdr header for list view TGLabel* fLbl1 label for list tree TGLabel* fLbl2 label for list view TGHorizontalFrame* fBFrame button frame TGHorizontalFrame* fHpb progress bar frame TGHProgressBar* fProgressBar progress bar TGLabel* fBLbl4 label for input list entry TGLabel* fBLbl5 label for output list entry TGTextEntry* fBarListIn tree input event list name entry TGTextEntry* fBarListOut tree output event list name entry TGPictureButton* fDRAW DRAW button TGPictureButton* fSTOP interrupt current command (not yet) TGStatusBar* fStatusBar status bar TGComboBox* fCombo combo box with session records TGPictureButton* fBGFirst TGPictureButton* fBGPrevious TGPictureButton* fBGRecord TGPictureButton* fBGNext TGPictureButton* fBGLast TGTextButton* fReset clear expression's entries TGCanvas* fTreeView ListTree canvas container TGListTree* fLt ListTree with file and tree items TGListView* fListView ListView with branches and leaves TTVLVContainer* fLVContainer container for listview TList* fWidgets list of widgets to be deleted public:
static const TTreeViewer::EListItemType kLTNoType static const TTreeViewer::EListItemType kLTPackType static const TTreeViewer::EListItemType kLTTreeType static const TTreeViewer::EListItemType kLTBranchType static const TTreeViewer::EListItemType kLTLeafType static const TTreeViewer::EListItemType kLTActionType static const TTreeViewer::EListItemType kLTDragType static const TTreeViewer::EListItemType kLTExpressionType static const TTreeViewer::EListItemType kLTCutType

Class Description

 TreeViewer is a graphic user interface designed to handle ROOT trees and to
 take advantage of TTree class features.

 It uses ROOT native GUI widgets adapted for 'drag and drop' functionality.
 in the same session.
 The following capabilities are making the viewer a helpful tool for analysis:
  - several trees may be opened in the same session;
  - branches and leaves can be easily browsed or scanned;
  - fast drawing of branch expressions by double-clicking;
  - new variables/selections easy to compose with the built-in editor;
  - histograms can be composed by dragging leaves or user-defined expressions
  to X, Y and Z axis items;
  - the tree entries to be processed can be selected with a double slider;
  - selections can be defined and activated by dragging them to the 'Cut' item;
  - all expressions can be aliased and aliases can be used in composing others;
  - input/output event lists easy to handle;
  - menu with histogram drawing options;
  - user commands may be executed within the viewer and the current command
  can be echoed;
  - current 'Draw' event loop is reflected by a progress bar and may be
  interrupted by the user;
  - all widgets have self-explaining tool tips and/or context menus;
  - expressions/leaves can be dragged to a 'scan box' and scanned by
  double-clicking this item. The result can be redirected to an ASCII file;

 The layout has the following items:

  - a menu bar with entries : File, Edit, Run, Options and Help;
  - a toolbar in the upper part where you can issue user commands, change
  the drawing option and the histogram name, three check buttons Hist, Rec
  and Scan.HIST toggles histogram drawing mode, REC enables recording of the
  last command issued and SCAN enables redirecting of TTree::Scan command in
  an ASCII file (see -Scanning expressions-);
  - a button bar in the lower part with : buttons DRAW/STOP that issue histogram
  drawing and stop the current command respectively, two text widgets where
  input and output event lists can be specified, a message box and a RESET
  button on the right that clear edited expression content (see Editing...)
  - a tree-type list on the main left panel where you can select among trees or
  branches. The tree/branch will be detailed in the right panel.
  Mapped trees are provided with context menus, activated by right-clicking;
  - a view-type list on the right panel. The first column contain X, Y and
  Z expression items, an optional cut and ten optional editable expressions.
  Expressions and leaf-type items can be dragged or deleted. A right click on
  the list-box or item activates context menus.

 Opening a new tree and saving a session :

   To open a new tree in the viewer use <File/Open tree file> menu
 The content of the file (keys) will be listed. Use <SetTreeName> function
 from the context menu of the right panel, entering a tree name among those
 listed.
   To save the current session, use <File/Save> menu or the <SaveSource>
 function from the context menu of the right panel (to specify the name of the
 file - name.C)
   To open a previously saved session for the tree MyTree, first open MyTree
 in the browser, then use <File/Open session> menu.

 Dragging items:

 Items that can be dragged from the list in the right : expressions and
 leaves. Dragging an item and dropping to another will copy the content of first
 to the last (leaf->expression, expression->expression). Items far to the right
 side of the list can be easily dragged to the left (where expressions are
 placed) by dragging them to the left at least 10 pixels.

 Editing expressions

   Any editable expression from the right panel has two components : a
 true name (that will be used when TTree::Draw() commands are issued) and an
 alias. The visible name is the alias. Aliases of user defined expressions have
 a leading ~ and may be used in new expressions. Expressions containing boolean
 operators have a specific icon and may be dragged to the active cut (scissors
 item) position.
    The expression editor can be activated by double-clicking empty expression,
 using <EditExpression> from the selected expression context menu or using
 <Edit/Expression> menu.
    The editor will pop-up in the left part, but it can be moved.
 The editor usage is the following :
   - you can write C expressions made of leaf names by hand or you can insert
   any item from the right panel by clicking on it (recommandable);
   - you can click on other expressions/leaves to paste them in the editor;
   - you should write the item alias by hand since it not only make the expression
  meaningfull, but it also highly improve the layout for big expressions
   - you may redefine an old alias - the other expressions depending on it will
   be modified accordingly. An alias must not be the leading string of other aliases.
  When Draw commands are issued, the name of the corresponding histogram axes
  will become the aliases of the expressions.

 User commands can be issued directly from the textbox labeled "Command"
 from the upper-left toolbar by typing and pressing Enter at the end.
   An other way is from the right panel context menu : ExecuteCommand.
 All commands can be interrupted at any time by pressing the STOP button
 from the bottom-left
 You can toggle recording of the current command in the history file by
 checking the Rec button from the top-right

 Context menus

   You can activate context menus by right-clicking on items or inside the
 right panel.
 Context menus for mapped items from the left tree-type list :
   The items from the left that are provided with context menus are tree and
 branch items. You can directly activate the *MENU* marked methods of TTree
 from this menu.
 Context menu for the right panel :
   A general context menu is acivated if the user right-clicks the right panel.
   Commands are :
   - EmptyAll        : clears the content of all expressions;
   - ExecuteCommand  : execute a ROOT command;
   - MakeSelector    : equivalent of TTree::MakeSelector();
   - NewExpression   : add an expression item in the right panel;
   - Process         : equivalent of TTree::Process();
   - SaveSource      : save the current session as a C++ macro;
   - SetScanFileName : define a name for the file where TTree::Scan command
   is redirected when the <Scan> button is checked;
   - SetTreeName     : open a new tree whith this name in the viewer;
   A specific context menu is activated if expressions/leaves are right-clicked.
   Commands are :
   - Draw            : draw a histogram for this item;
   - EditExpression  : pops-up the expression editor;
   - Empty           : empty the name and alias of this item;
   - RemoveItem      : removes clicked item from the list;
   - Scan            : scan this expression;
   - SetExpression   : edit name and alias for this item by hand;

 Starting the viewer

   1) From the TBrowser :
  Select a tree in the TBrowser, then call the StartViewer() method from its
 context menu (right-click on the tree).
   2) From the command line :
  Start a ROOT session in the directory where you have your tree.
 You will need first to load the library for TTreeViewer and optionally other
 libraries for user defined classes (you can do this later in the session) :
    root [0] gSystem->Load("TTreeViewer");
 Supposing you have the tree MyTree in the file MyFile, you can do :
    root [1] TFile file("Myfile");
    root [2] new TTreeViewer("Mytree");
 or :
    root [2] TreeViewer *tv = new TTreeViewer();
    root [3] tv->SetTreeName("Mytree");


/*

*/



TTreeViewer(const char* treeName) :TGMainFrame(0,10,10,kVerticalFrame)
 TTreeViewer default constructor

TTreeViewer(const TTree *tree) :TGMainFrame(gClient->GetRoot(),10,10,kVerticalFrame)
 TTreeViewer constructor with a pointer to a Tree

void SetNexpressions(Int_t expr)
 Change the number of expression widgets.

void SetScanFileName(const char *name)
 Set the name of the file where to redirect <Scan> output.

void SetScanRedirect(Bool_t mode)
 Set the state of Scan check button.

void SetTreeName(const char* treeName)
 Allow geting the tree from the context menu.

void SetFile()
 Set file name containing the tree.

void BuildInterface()
 Create all viewer widgets.

~TTreeViewer()
 TTreeViewer destructor.

void ActivateButtons(Bool_t first, Bool_t previous, Bool_t next, Bool_t last)
 Enable/disable session buttons.

const char* Cut()

const char* ScanList()

void SetSession(TTVSession *session)

const char* EmptyBrackets(const char* name)
 Empty the bracket content of a string.

void EmptyAll()
 Clear the content of all items in the list view.

void Empty()
 Empty the content of the selected expression.

TTVLVEntry* ExpressionItem(Int_t index)
 Get the item from a specific position.

TList* ExpressionList()
 Get the list of expression items.

Int_t Dimension()
 Compute dimension of the histogram.

void ExecuteDraw()
 Called when the DRAW button is executed.

const char* Ex()
 Get the expression to be drawn on X axis.

const char* Ey()
 Get the expression to be drawn on Y axis.

const char* Ez()
 Get the expression to be drawn on Z axis.

void EditExpression()
 Start the expression editor.

Int_t MakeSelector(const char* selector)
 Get use of TTree::MakeSelector() via the context menu.

Int_t Process(const char* filename, Option_t *option, Int_t nentries, Int_t firstentry)
 Get use of TTree::Process() via the context menu.

const char* GetGrOpt()

void SetGrOpt(const char *option)

Bool_t IsScanRedirected()

void RemoveItem()
 Remove the selected item from the list.

void RemoveLastRecord()
 Remove the current record.

Bool_t HandleTimer(TTimer *timer)
 This function is called by the fTimer object.

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
 Handle menu and other commands generated.

void CloseWindow()
 Close the viewer.

void ExecuteCommand(const char* command, Bool_t fast)
 Execute all user commands.

void MapOptions(Long_t parm1)
 Scan the selected options from option menu.

void MapTree(TTree *tree, TGListTreeItem *parent, Bool_t listIt)
 Map current tree and expand its content in the lists.

void MapBranch(TBranch *branch, TGListTreeItem *parent, Bool_t listIt)
 Map current branch and expand its content in the list view.

void NewExpression()

void SetParentTree(TGListTreeItem *item)
 Find parent tree of a clicked item.

void Message(const char* msg)
 Send a message on the status bar.

void DoError(int level, const char *location, const char *fmt, va_list va) const
 Put error/warning into TMsgBox and also forward to console.

void PrintEntries()
 Print the number of selected entries on status-bar.

void SaveSource(const char* filename)
 Save current session as a C++ macro file.

Bool_t SwitchTree(Int_t index)
 Makes current the tree at a given index in the list.

void SetRecordName(const char *name)

void SetCurrentRecord(Int_t entry)

void SetHistogramTitle(const char *title)

void SetUserCode(const char *code, Bool_t autoexec)
 user defined command for current record

void UpdateCombo()
 Updates combo box to current session entries.

void UpdateRecord(const char *name)
 Updates current record to new X, Y, Z items.



Inline Functions


               void Delete(const Option_t*)
             TTree* GetTree()
             Bool_t IsCutEnabled()
               void SetCutMode(Bool_t enabled = kTRUE)
               void SetScanMode(Bool_t mode = kTRUE)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)
        TTreeViewer TTreeViewer(const TTreeViewer&)


Last update: root/treeviewer:$Name: $:$Id: TTreeViewer.cxx,v 1.31 2003/05/16 07:32:04 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.