Belle II Software  release-08-01-10
DisplayUI Class Reference

Control TEve browser user interface. More...

#include <DisplayUI.h>

Inheritance diagram for DisplayUI:
Collaboration diagram for DisplayUI:

Classes

struct  Parameter
 Wraps a module parameter that can be toggled from the UI. More...
 

Public Member Functions

 DisplayUI (bool automatic=false, bool advance=false)
 Constructor. More...
 
 ~DisplayUI ()
 Destructor.
 
void addParameter (const std::string &label, ModuleParam< bool > &param, int level)
 Generate UI elements so the given module parameter can be changed at run time. More...
 
void next ()
 Go to next event.
 
void prev ()
 Go to previous event.
 
void goToEvent (Long_t id)
 Go to event with index id.
 
void goToEvent (Long_t event, Long_t run, Long_t experiment)
 Go to the event specified, using the input file's index.
 
void goToEventWidget ()
 go to the event given by m_eventNumberWidget.
 
void autoAdvanceDelayChanged ()
 m_autoAdvanceDelay was changed, update m_timer if enabled.
 
void togglePlayPause ()
 Handle Play/Pause button clicks.
 
void showJumpToEventDialog ()
 Show a dialog to to enter exp, run, event numbers.
 
void clearEvent ()
 remove all event data in current event.
 
void startAutomaticRun ()
 switch to automatic mode, where visualisations are saved for each event, with no interactive control.
 
void automaticEvent ()
 The actual per-event functionality for automatic saving.
 
bool startDisplay ()
 Start interactive display for current event. More...
 
void setTitle (const std::string &fileName="")
 Set title of Eve window. More...
 
void allowFlaggingEvents (const std::string &description="")
 Show control for flagging events (to set module return value). More...
 
bool getReturnValue () const
 Return value for current event, only makes sense if allowFlaggingEvents(true) was called. More...
 
void hideObjects (const std::vector< std::string > &names)
 hide objects with the given names.
 
void toggleColorScheme ()
 Toggle between light and dark color scheme for viewers.
 
void toggleUndock ()
 dock/undock active viewer.
 
void handleParameterChange (int id)
 Called when one of the module parameters is changed via UI.
 
void savePicture (bool highres=false)
 Save the current view to a user-defined filename. More...
 
void saveHiResPicture ()
 alias for savePicture(true).
 
SplitGLViewgetViewPane ()
 return right-side pane with viewers.
 
void pollNewEvents ()
 Check if new events are available, and go to next event. More...
 
void closeAndExit ()
 Close window and exit immediately.
 
void showUserData (const DisplayData &displayData)
 Add user-defined data (histograms, etc.).
 
bool cumulativeIsOn () const
 If true, DisplayModule shouldn't clear previous data (i.e. More...
 
void toggleCumulative ()
 toggle cumulative mode.
 
void selectionHandler (TEveElement *eveObj)
 Handle special actions when objects are selected.
 
void handleEvent (Event_t *event)
 Handles keyboard shortcuts.
 

Private Member Functions

void makeGui ()
 Build the buttons for event navigation.
 
void updateUI ()
 Update UI after a new event was loaded, as well as m_currentEntry.
 

Private Attributes

long m_currentEntry {0}
 Current entry id.
 
bool m_guiInitialized {false}
 Was GUI already built?
 
bool m_reshowCurrentEvent {false}
 Show current event again after startDisplay() returns?
 
bool m_automatic {false}
 If true, disable interactive control and call automaticEvent() instead.
 
bool m_advance {false}
 If true, start advancing through the events on startup.
 
bool m_cumulative {false}
 If true, DisplayModule shouldn't clear previous data (i.e. More...
 
std::vector< Parameterm_paramList
 List of run time configurable module parameters.
 
TGButton * m_prevButton {nullptr}
 Button to switch to previous event.
 
TGButton * m_nextButton {nullptr}
 Button to switch to next event.
 
TGNumberEntry * m_eventNumberWidget {nullptr}
 Event switcher with numeric entry.
 
TGNumberEntry * m_autoAdvanceDelay {nullptr}
 Delay for automatic advance, in seconds.
 
TGPictureButton * m_playPauseButton {nullptr}
 Play / Pause button.
 
TGCheckButton * m_flagEvent {nullptr}
 Show control for flagging events (to set module return value).
 
TGLabel * m_eventLabel {nullptr}
 show event/run/exp number for current event.
 
TGTextEntry * m_autoFileNamePrefix {nullptr}
 File name prefix (prefix + event number + "_" + projection + ".png").
 
TGNumberEntry * m_autoPictureWidth {nullptr}
 width of saved PNGs.
 
TEveElementList * m_eventData {nullptr}
 List of event data, including projections.
 
SplitGLViewm_viewPane {nullptr}
 pointer to right-side pane with viewers.
 
TTimer * m_timer {nullptr}
 Polling/auto-advance timer.
 
std::vector< std::string > m_hideObjects
 objects which are to be hidden (can be manually re-enabled in tree view). More...
 

Detailed Description

Control TEve browser user interface.

Mostly responsible for interactive elements like buttons etc.

See also
DisplayModule

Definition at line 41 of file DisplayUI.h.

Constructor & Destructor Documentation

◆ DisplayUI()

DisplayUI ( bool  automatic = false,
bool  advance = false 
)
explicit

Constructor.

Parameters
automaticif true, hide window and save events using automaticEvent()
advanceif true, start advancing through the events on startup.

Definition at line 58 of file DisplayUI.cc.

58  :
59  m_automatic(automatic), m_advance(advance)
60 {
61  //ensure GUI thread goes away when parent dies. (root UI loves deadlocks)
62  prctl(PR_SET_PDEATHSIG, SIGHUP);
63 
64  if (!gEve) {
65  B2INFO("Creating TEve window.");
66  TEveManager::Create(!m_automatic, "I"); //show window in interactive mode, hide file browser
67  }
68 
69  setTitle(); //set default window title
70  TEveBrowser* browser = gEve->GetBrowser();
71  browser->HideBottomTab();
72  browser->StartEmbedding(TRootBrowser::kRight);
73  m_viewPane = new SplitGLView();
74  browser->StopEmbedding();
75 
76  //Without this, our own menu bar entries are not drawn (might appear later)
77  browser->Resize(TGDimension(1200, 1000));
78 
79  m_eventData = new TEveElementList();
80 }
bool m_automatic
If true, disable interactive control and call automaticEvent() instead.
Definition: DisplayUI.h:186
void setTitle(const std::string &fileName="")
Set title of Eve window.
Definition: DisplayUI.cc:113
TEveElementList * m_eventData
List of event data, including projections.
Definition: DisplayUI.h:225
bool m_advance
If true, start advancing through the events on startup.
Definition: DisplayUI.h:189
SplitGLView * m_viewPane
pointer to right-side pane with viewers.
Definition: DisplayUI.h:228
Responsible for arranging the GL viewers and providing related functionality.
Definition: SplitGLView.h:30

Member Function Documentation

◆ addParameter()

void addParameter ( const std::string &  label,
ModuleParam< bool > &  param,
int  level 
)

Generate UI elements so the given module parameter can be changed at run time.

Will result in a checkbox with given label indented by the amount in level (0 being leftmost). Clicking the checkbox will toggle the parameter and reload the event.

Definition at line 87 of file DisplayUI.cc.

◆ allowFlaggingEvents()

void allowFlaggingEvents ( const std::string &  description = "")

Show control for flagging events (to set module return value).

Needs to be called in initialize().

Definition at line 124 of file DisplayUI.cc.

◆ cumulativeIsOn()

bool cumulativeIsOn ( ) const
inline

If true, DisplayModule shouldn't clear previous data (i.e.

we want to show multiple events)

Definition at line 148 of file DisplayUI.h.

148 { return m_cumulative; }
bool m_cumulative
If true, DisplayModule shouldn't clear previous data (i.e.
Definition: DisplayUI.h:192

◆ getReturnValue()

bool getReturnValue ( ) const

Return value for current event, only makes sense if allowFlaggingEvents(true) was called.

Return value for current event, only makes sense if allowFlaggingEvents() was called.

Definition at line 134 of file DisplayUI.cc.

◆ pollNewEvents()

void pollNewEvents ( )

Check if new events are available, and go to next event.

Only useful for AsyncDisplay.

Definition at line 789 of file DisplayUI.cc.

◆ savePicture()

void savePicture ( bool  highres = false)

Save the current view to a user-defined filename.

Parameters
highressave picture with 4000px width instead of screen size

Definition at line 703 of file DisplayUI.cc.

◆ setTitle()

void setTitle ( const std::string &  fileName = "")

Set title of Eve window.

Add fileName, if given.

Definition at line 113 of file DisplayUI.cc.

◆ startDisplay()

bool startDisplay ( )

Start interactive display for current event.

Returns only after user presses prev/next, or closes the window.

Returns
wether to reprocess the current event, e.g. when visualisation options changed

Definition at line 337 of file DisplayUI.cc.

Member Data Documentation

◆ m_cumulative

bool m_cumulative {false}
private

If true, DisplayModule shouldn't clear previous data (i.e.

we want to show multiple events)

Definition at line 192 of file DisplayUI.h.

◆ m_hideObjects

std::vector<std::string> m_hideObjects
private

objects which are to be hidden (can be manually re-enabled in tree view).

Names correspond to the object names in the 'Event Scene'.

Definition at line 234 of file DisplayUI.h.


The documentation for this class was generated from the following files: