10#include <framework/core/ModuleParam.h>
12#include <framework/dataobjects/DisplayData.h>
13#include <display/DisplayUI.h>
14#include <display/VisualRepMap.h>
15#include <display/BrowsableWrapper.h>
16#include <display/SplitGLView.h>
17#include <display/InfoWidget.h>
19#include <framework/core/InputController.h>
20#include <framework/datastore/StoreObjPtr.h>
21#include <framework/datastore/StoreArray.h>
22#include <framework/dataobjects/EventMetaData.h>
23#include <framework/logging/Logger.h>
24#include <framework/pcore/AsyncWrapper.h>
26#include <TApplication.h>
28#include <TEveBrowser.h>
29#include <TEveManager.h>
30#include <TEveEventManager.h>
31#include <TEveSelection.h>
33#include <TEveViewer.h>
35#include <TGFileBrowser.h>
38#include <TGNumberEntry.h>
40#include <TGFileDialog.h>
41#include <TGInputDialog.h>
42#include <TGTextEntry.h>
59 m_automatic(automatic), m_advance(advance)
62 prctl(PR_SET_PDEATHSIG, SIGHUP);
65 B2INFO(
"Creating TEve window.");
70 TEveBrowser* browser = gEve->GetBrowser();
71 browser->HideBottomTab();
72 browser->StartEmbedding(TRootBrowser::kRight);
74 browser->StopEmbedding();
77 browser->Resize(TGDimension(1200, 1000));
116 std::string title(
"Belle II Event Display");
117 if (!fileName.empty())
118 title +=
" - " + fileName;
120 TEveBrowser* browser = gEve->GetBrowser();
121 browser->SetWindowName(title.c_str());
126 std::string label =
"Flag this Event";
127 if (!description.empty())
128 label +=
" for " + description;
130 m_flagEvent =
new TGCheckButton(
nullptr, label.c_str());
162 if (!eventMetaData) {
163 m_eventLabel->SetText(
"No EventMetaData object available.");
165 time_t secondsSinceEpoch = eventMetaData->getTime() / 1e9;
167 char date[30] =
"<Invalid time>";
168 if (secondsSinceEpoch == 0)
170 else if (
auto gmt = gmtime(&secondsSinceEpoch))
171 strftime(date, 30,
"<%Y-%m-%d %H:%M:%S UTC>", gmt);
172 m_eventLabel->SetText(TString::Format(
"Event: \t\t%u\nRun: \t\t%d\nExperiment: \t%d\n\n%s",
173 eventMetaData->getEvent(),
174 eventMetaData->getRun(), eventMetaData->getExperiment(),
179 gVirtualX->SetCursor(gEve->GetBrowser()->GetId(), gVirtualX->CreateCursor(kPointer));
187 if (numEntries > 0 and
id >= numEntries)
193 B2ERROR(
"Cannot switch to event " <<
id <<
", only works in conjunction with RootInput.");
197 B2DEBUG(100,
"Switching to event " <<
id);
202 gVirtualX->SetCursor(gEve->GetBrowser()->GetId(), gVirtualX->CreateCursor(kWatch));
209 gSystem->ProcessEvents();
211 B2DEBUG(100,
"exiting event loop now.");
220 B2DEBUG(100,
"Switching to event " << event <<
" in run " << run <<
", experiment " << experiment);
221 gVirtualX->SetCursor(gEve->GetBrowser()->GetId(), gVirtualX->CreateCursor(kWatch));
224 B2DEBUG(100,
"exiting event loop now.");
243 const TString icondir(Form(
"%s/icons/", gSystem->Getenv(
"ROOTSYS")));
253 m_timer->Connect(
"Timeout()",
"Belle2::DisplayUI",
this,
"next()");
254 m_timer->Start(pollIntervalMs);
255 m_playPauseButton->SetPicture(gClient->GetPicture(icondir +
"ed_interrupt.png"));
265 char returnString[256];
266 new TGInputDialog(gEve->GetBrowser()->GetClient()->GetDefaultRoot(), gEve->GetBrowser(),
267 "Jump to event '#evt/#run/#exp':",
268 TString::Format(
"%u/%d/%d", eventMetaData->getEvent(), eventMetaData->getRun(), eventMetaData->getExperiment()),
270 if (returnString[0] ==
'\0')
273 unsigned int event, run, exp;
274 returnString[255] =
'\0';
275 if (sscanf(returnString,
"%u/%u/%u", &event, &run, &exp) != 3) {
276 B2WARNING(
"Wrong format!");
287 gEve->AddEvent(
new TEveEventManager());
289 if (gEve->GetCurrentEvent())
290 gEve->GetCurrentEvent()->DestroyElements();
305 if (representedObject)
314 if (event->fType == kGKeyPress) {
316 switch (event->fCode) {
330 if (event->fState & kKeyControlMask)
343 TTimer* t =
new TTimer();
344 const int pollIntervalMs = 300;
345 t->Connect(
"Timeout()",
"Belle2::DisplayUI",
this,
"pollNewEvents()");
346 t->Start(pollIntervalMs);
354 TEveScene* gs = gEve->GetGlobalScene();
357 rphiManager->ImportElements(gs);
361 rhozManager->ImportElements(gs);
365 gEve->GetSelection()->Connect(
"SelectionAdded(TEveElement*)",
"Belle2::DisplayUI",
this,
"selectionHandler(TEveElement*)");
366 gEve->GetSelection()->Connect(
"SelectionRepeated(TEveElement*)",
"Belle2::DisplayUI",
this,
"selectionHandler(TEveElement*)");
377 TGListTreeItem* eventItem = gEve->GetListTree()->FindItemByPathname(
"Event");
378 TGListTreeItem* item = gEve->GetListTree()->FindChildByName(eventItem, name.c_str());
380 B2INFO(
"hiding object '" << name <<
"'.");
381 TEveElement* eveItem =
static_cast<TEveElement*
>(item->GetUserData());
382 eveItem->SetRnrSelfChildren(
false,
false);
384 B2ERROR(
"hideObjects: '" << name <<
"' not found.");
390 gEve->Redraw3D(
false);
397 gApplication->Run(
true);
409 TEveBrowser* browser = gEve->GetBrowser();
410 const int margin = 3;
412 browser->Connect(
"CloseWindow()",
"Belle2::DisplayUI",
this,
"closeAndExit()");
415 browser->Connect(
"ProcessedEvent(Event_t*)",
"Belle2::DisplayUI",
this,
"handleEvent(Event_t*)");
416 TEveViewerList* viewers = gEve->GetViewers();
417 TEveElement::List_ci end_it = viewers->EndChildren();
418 for (TEveElement::List_i it = viewers->BeginChildren(); it != end_it; ++it) {
419 TEveViewer* v =
static_cast<TEveViewer*
>(*it);
420 TGLViewer* glv = v->GetGLViewer();
421 glv->GetGLWidget()->Connect(
"ProcessedEvent(Event_t*)",
"Belle2::DisplayUI",
this,
"handleEvent(Event_t*)");
425 browser->StartEmbedding(TRootBrowser::kLeft);
427 TGMainFrame* frmMain =
new TGMainFrame(gClient->GetRoot(), 240, 600);
428 frmMain->SetWindowName(
"Event control main frame");
429 frmMain->SetCleanup(kDeepCleanup);
431 const TString icondir(Form(
"%s/icons/", gSystem->Getenv(
"ROOTSYS")));
433 TGGroupFrame* event_frame =
new TGGroupFrame(frmMain);
434 event_frame->SetTitle(
"Event");
436 TGHorizontalFrame* hf =
new TGHorizontalFrame(event_frame);
438 m_prevButton =
new TGPictureButton(hf, gClient->GetPicture(icondir +
"GoBack.gif"));
439 m_prevButton->SetToolTipText(
"Go to previous event (Page Up)");
440 hf->AddFrame(
m_prevButton,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
441 m_prevButton->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"prev()");
445 TGNumberFormat::kNEANonNegative,
446 TGNumberFormat::kNELLimitMinMax,
449 hf->AddFrame(
m_eventNumberWidget,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
451 m_eventNumberWidget->Connect(
"ValueSet(Long_t)",
"Belle2::DisplayUI",
this,
"goToEventWidget()");
452 m_eventNumberWidget->GetNumberEntry()->Connect(
"ReturnPressed()",
"Belle2::DisplayUI",
this,
"goToEventWidget()");
455 if (numEntries > 0) {
456 TGLabel* maxEvents =
new TGLabel(hf, TString::Format(
"/%ld", numEntries - 1));
457 hf->AddFrame(maxEvents,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
460 m_nextButton =
new TGPictureButton(hf, gClient->GetPicture(icondir +
"GoForward.gif"));
461 m_nextButton->SetToolTipText(
"Go to next event (Page Down)");
462 hf->AddFrame(
m_nextButton,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
463 m_nextButton->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"next()");
465 event_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
467 hf =
new TGHorizontalFrame(event_frame);
472 TGLabel* delayLabel =
new TGLabel(hf,
"Delay (s):");
473 hf->AddFrame(delayLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
475 const double valueSeconds = async ? 0.5 : 3.5;
476 m_autoAdvanceDelay =
new TGNumberEntry(hf, valueSeconds, 3, 999, TGNumberFormat::kNESRealOne,
477 TGNumberFormat::kNEAPositive,
478 TGNumberFormat::kNELLimitMin,
481 hf->AddFrame(
m_autoAdvanceDelay,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
483 m_autoAdvanceDelay->Connect(
"ValueSet(Long_t)",
"Belle2::DisplayUI",
this,
"autoAdvanceDelayChanged()");
484 m_autoAdvanceDelay->GetNumberEntry()->Connect(
"ReturnPressed()",
"Belle2::DisplayUI",
this,
"autoAdvanceDelayChanged()");
486 m_playPauseButton =
new TGPictureButton(hf, gClient->GetPicture(icondir +
"ed_execute.png"));
488 m_playPauseButton->SetToolTipText(
"Advance automatically to next event after the given delay.");
489 hf->AddFrame(
m_playPauseButton,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
490 m_playPauseButton->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"togglePlayPause()");
492 event_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
494 TGButton* jumpToEventButton =
new TGTextButton(event_frame,
"Jump to event/run/exp...");
496 jumpToEventButton->SetToolTipText(
"Find a given entry identified by an event / run / experiment triplet in the current file");
497 event_frame->AddFrame(jumpToEventButton,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
498 jumpToEventButton->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"showJumpToEventDialog()");
501 event_frame->AddFrame(
m_eventLabel,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
506 m_flagEvent =
new TGCheckButton(event_frame, descr);
507 m_flagEvent->SetToolTipText(
"Set return value to true for this event");
509 event_frame->AddFrame(
m_flagEvent,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
512 frmMain->AddFrame(event_frame,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
514 TGGroupFrame* param_frame =
new TGGroupFrame(frmMain);
515 param_frame->SetTitle(
"Options");
518 for (
int i = 0; i < nParams; i++) {
519 TGCheckButton* b =
new TGCheckButton(param_frame,
m_paramList[i].m_label.c_str(), i);
520 b->SetToolTipText(
m_paramList[i].m_param->getDescription().c_str());
521 b->SetState(
m_paramList[i].m_param->getValue() ? kButtonDown : kButtonUp);
522 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this, TString::Format(
"handleParameterChange(=%d)", i));
524 param_frame->AddFrame(b,
new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, indentation, margin, margin, margin));
528 frmMain->AddFrame(param_frame,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
530 TGGroupFrame* viewer_frame =
new TGGroupFrame(frmMain);
531 viewer_frame->SetTitle(
"Current Viewer");
533 TGHorizontalFrame* hf =
new TGHorizontalFrame(viewer_frame);
536 b =
new TGTextButton(hf,
"Save As...");
537 b->SetToolTipText(
"Save a bitmap graphic for the current viewer");
538 hf->AddFrame(b,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin + 1, margin, margin, margin));
539 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"savePicture()");
541 b =
new TGTextButton(hf,
"Save As (High-Res)... ");
542 b->SetToolTipText(
"Save a bitmap graphic for the current viewer with user-specified size");
543 hf->AddFrame(b,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
544 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"saveHiResPicture()");
547 viewer_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
549 hf =
new TGHorizontalFrame(viewer_frame);
551 b =
new TGTextButton(hf,
"Dock/Undock Viewer");
552 b->SetToolTipText(
"Move current viewer into it's own window, or back to its original position");
553 hf->AddFrame(b,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
554 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"toggleUndock()");
556 viewer_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
558 frmMain->AddFrame(viewer_frame,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
561 TGGroupFrame* visOptionsFrame =
new TGGroupFrame(frmMain);
562 visOptionsFrame->SetTitle(
"Visualisation Options");
564 TGHorizontalFrame* hf =
new TGHorizontalFrame(visOptionsFrame);
566 TGButton* b =
new TGTextButton(hf,
"Dark/light colors");
567 b->SetToolTipText(
"Toggle background color");
568 hf->AddFrame(b,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
569 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"toggleColorScheme()");
571 visOptionsFrame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
574 TGCheckButton* c =
new TGCheckButton(visOptionsFrame,
"Cumulative mode (experimental)");
575 c->SetToolTipText(
"Do not erase previous event, i.e. show data from multiple events. This is quite unstable and will crash sooner or later.");
577 c->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"toggleCumulative()");
578 visOptionsFrame->AddFrame(c,
new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 0, margin, margin, margin));
581 frmMain->AddFrame(visOptionsFrame,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
583 TGGroupFrame* automatisation_frame =
new TGGroupFrame(frmMain);
584 automatisation_frame->SetTitle(
"Automatic Saving (experimental)");
586 TGHorizontalFrame* hf =
new TGHorizontalFrame(automatisation_frame);
588 TGLabel* prefixLabel =
new TGLabel(hf,
"Prefix:");
589 hf->AddFrame(prefixLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
592 hf->AddFrame(
m_autoFileNamePrefix,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
594 automatisation_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
596 hf =
new TGHorizontalFrame(automatisation_frame);
598 TGLabel* widthLabel =
new TGLabel(hf,
"Width (px):");
599 hf->AddFrame(widthLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
602 TGNumberFormat::kNEANonNegative,
603 TGNumberFormat::kNELLimitMinMax,
605 hf->AddFrame(
m_autoPictureWidth,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
607 TGButton* b =
new TGTextButton(hf,
"Save PNGs");
608 b->SetToolTipText(
"Save bitmap graphics for all further events. Cannot be aborted. (EXPERIMENTAL)");
609 hf->AddFrame(b,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, margin, margin, margin, margin));
610 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"startAutomaticRun()");
612 automatisation_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
615 frmMain->AddFrame(automatisation_frame,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
618 TGGroupFrame* exit_frame =
new TGGroupFrame(frmMain);
619 exit_frame->SetTitle(
"Closing");
621 TGHorizontalFrame* hf =
new TGHorizontalFrame(exit_frame);
623 TGButton* b =
new TGTextButton(hf,
" Exit ");
624 b->SetToolTipText(
"Close the display and stop basf2 after this event.");
625 hf->AddFrame(b,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, margin, margin, margin, margin));
626 b->Connect(
"Clicked()",
"Belle2::DisplayUI",
this,
"closeAndExit()");
629 exit_frame->AddFrame(hf,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
632 frmMain->AddFrame(exit_frame,
new TGLayoutHints(kLHintsExpandX | kLHintsBottom, 0, 0, 0, 0));
635 frmMain->MapSubwindows();
637 frmMain->MapWindow();
638 browser->StopEmbedding(
"Event Control");
644 B2ERROR(
"widget ID too large!");
657 TEveViewerList* viewers = gEve->GetViewers();
658 TEveElement::List_ci end_it = viewers->EndChildren();
659 for (TEveElement::List_i it = viewers->BeginChildren(); it != end_it; ++it) {
660 TEveViewer* v =
static_cast<TEveViewer*
>(*it);
661 TGLViewer* glv = v->GetGLViewer();
663 bool dark = glv->ColorSet().Background().GetColorIndex() != kWhite;
664 glv->RefLightColorSet().Background().SetColor(kWhite);
665 glv->RefDarkColorSet().Background().SetColor(kBlack);
667 glv->UseLightColorSet();
669 glv->UseDarkColorSet();
677 TEveViewerList* viewers = gEve->GetViewers();
678 TEveElement::List_ci end_it = viewers->EndChildren();
679 TEveViewer* activeViewer =
nullptr;
680 for (TEveElement::List_i it = viewers->BeginChildren(); it != end_it; ++it) {
681 TEveViewer* v =
static_cast<TEveViewer*
>(*it);
682 if (v->GetGLViewer() == activeGLviewer) {
689 B2ERROR(
"No active viewer. Please select one by clicking on it.");
693 TEveCompositeFrameInMainFrame* packFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(activeViewer->GetEveFrame());
696 activeViewer->UndockWindow();
699 packFrame->MainFrameClosed();
705 const char* filetypes[] = {
706 "PNG (bitmap)",
"*.png",
707 "PDF (experimental!)",
"*.pdf",
712 fi.fFileTypes = filetypes;
715 new TGFileDialog(gEve->GetBrowser()->GetClient()->GetDefaultRoot(), gEve->GetBrowser(), kFDSave, &fi);
719 bool success =
false;
721 success = v->SavePicture(fi.fFilename);
723 char returnString[256];
724 new TGInputDialog(gEve->GetBrowser()->GetClient()->GetDefaultRoot(), gEve->GetBrowser(),
725 "Bitmap width (pixels) [Note: Values larger than ~5000 may cause crashes.]",
728 if (returnString[0] ==
'\0')
730 const TString t(returnString);
732 B2ERROR(
"Given width is not a number!");
735 const int width = t.Atoi();
736 B2INFO(
"Saving bitmap (width: " << width <<
"px)...");
737 success = v->SavePictureWidth(fi.fFilename, width,
false);
741 B2INFO(
"Saved image in: " << fi.fFilename);
743 new TGMsgBox(gEve->GetBrowser()->GetClient()->GetDefaultRoot(), gEve->GetBrowser(),
"Saving image failed",
744 TString::Format(
"Couldn't save to '%s'! Please verify you used an appropriate image file extension in the file name. Check console output for further information.",
749 gEve->FullRedraw3D(
false);
754 B2INFO(
"Starting automatic run.");
766 B2INFO(
"Saving event " << i);
769 gEve->FullRedraw3D();
771 TEveViewerList* viewers = gEve->GetViewers();
772 TEveElement::List_ci end_it = viewers->EndChildren();
773 for (TEveElement::List_i it = viewers->BeginChildren(); it != end_it; ++it) {
774 TEveViewer* v =
static_cast<TEveViewer*
>(*it);
775 TGLViewer* glv = v->GetGLViewer();
777 TString projectionName(v->GetName());
778 projectionName.ReplaceAll(
" viewer",
"");
779 projectionName.ReplaceAll(
"/",
"");
781 const bool scalePixelObjects =
false;
782 TString name = TString::Format(
"%s_%s_%d.png",
m_autoFileNamePrefix->GetText(), projectionName.Data(), i);
783 glv->SavePictureWidth(name, width, scalePixelObjects);
799 if (state != (numEvents > 0))
807 eventMetaData->setEndOfData();
810 gROOT->SetInterrupt();
817 gEve->GetBrowser()->Disconnect();
819 gEve->GetSelection()->Disconnect();
820 gEve->GetHighlight()->Disconnect();
822 gEve->GetBrowser()->UnmapWindow();
823 gEve->GetBrowser()->SendCloseMessage();
827 B2INFO(
"The display and the basf2 process will now be gracefully terminated.");
833 static std::map<std::string, BrowsableWrapper*> wrapperMap;
834 for (
auto& entry : wrapperMap) {
839 static TGFileBrowser* fileBrowser = NULL;
841 gEve->GetBrowser()->StartEmbedding(0);
842 fileBrowser = gEve->GetBrowser()->MakeFileBrowser();
843 gEve->GetBrowser()->StopEmbedding(
"Histograms");
846 gEve->GetBrowser()->StartEmbedding(TRootBrowser::kRight);
847 TEveWindowSlot* slot = TEveWindow::CreateWindowMainFrame();
848 gEve->GetBrowser()->StopEmbedding();
849 slot->StartEmbedding();
851 slot->StopEmbedding(
"Canvas");
856 std::map<std::string, TVirtualPad*> nameMap;
857 for (
const auto& entry : padMap) {
858 nameMap[entry.second] = entry.first;
861 for (
unsigned int i = 0; i < displayData.
m_histograms.size(); i++) {
862 std::string name(displayData.
m_histograms.at(i)->GetName());
863 if (!wrapperMap[name])
866 wrapperMap[name]->setWrapped(displayData.
m_histograms.at(i));
869 if (nameMap.find(name) != nameMap.end()) {
870 TVirtualPad* oldGpad = gPad;
873 wrapper->Browse(fileBrowser->Browser());
878 fileBrowser->Add(wrapper);
886 const TObject* obj = array[pair.second];
890 B2WARNING(
"Cannot select object " << pair.first <<
"[" << pair.second <<
"], not found. Is the array available?");
static bool isAsync()
returns true if the current process is on the receiving (async) side of an AsyncWrapper.
static int numAvailableEvents()
Retun number of events available in the RingBuffer.
A wrapper for browsable objects to enable automatic redrawing.
static const std::map< TVirtualPad *, std::string > & getPads()
Get list of pads (static).
Add custom information to the display.
std::vector< TH1 * > m_histograms
Histograms to be shown in Eve.
std::vector< std::pair< std::string, unsigned int > > m_selectedObjects
List of selected objects (array name, index).
void clearEvent()
remove all event data in current event.
void next()
Go to next event.
TGLabel * m_eventLabel
show event/run/exp number for current event.
void handleEvent(Event_t *event)
Handles keyboard shortcuts.
long m_currentEntry
Current entry id.
std::vector< Parameter > m_paramList
List of run time configurable module parameters.
void startAutomaticRun()
switch to automatic mode, where visualisations are saved for each event, with no interactive control.
void autoAdvanceDelayChanged()
m_autoAdvanceDelay was changed, update m_timer if enabled.
void togglePlayPause()
Handle Play/Pause button clicks.
TGButton * m_prevButton
Button to switch to previous event.
void closeAndExit()
Close window and exit immediately.
bool m_automatic
If true, disable interactive control and call automaticEvent() instead.
bool getReturnValue() const
Return value for current event, only makes sense if allowFlaggingEvents(true) was called.
void setTitle(const std::string &fileName="")
Set title of Eve window.
DisplayUI(bool automatic=false, bool advance=false)
Constructor.
TEveElementList * m_eventData
List of event data, including projections.
void automaticEvent()
The actual per-event functionality for automatic saving.
void selectionHandler(TEveElement *eveObj)
Handle special actions when objects are selected.
void makeGui()
Build the buttons for event navigation.
void pollNewEvents()
Check if new events are available, and go to next event.
SplitGLView * getViewPane()
return right-side pane with viewers.
TGButton * m_nextButton
Button to switch to next event.
TGPictureButton * m_playPauseButton
Play / Pause button.
TTimer * m_timer
Polling/auto-advance timer.
void handleParameterChange(int id)
Called when one of the module parameters is changed via UI.
bool m_guiInitialized
Was GUI already built?
void toggleUndock()
dock/undock active viewer.
void updateUI()
Update UI after a new event was loaded, as well as m_currentEntry.
TGNumberEntry * m_autoAdvanceDelay
Delay for automatic advance, in seconds.
void goToEvent(Long_t id)
Go to event with index id.
TGNumberEntry * m_eventNumberWidget
Event switcher with numeric entry.
void addParameter(const std::string &label, ModuleParam< bool > ¶m, int level)
Generate UI elements so the given module parameter can be changed at run time.
void savePicture(bool highres=false)
Save the current view to a user-defined filename.
TGCheckButton * m_flagEvent
Show control for flagging events (to set module return value).
void toggleColorScheme()
Toggle between light and dark color scheme for viewers.
bool startDisplay()
Start interactive display for current event.
void showUserData(const DisplayData &displayData)
Add user-defined data (histograms, etc.).
void prev()
Go to previous event.
TGNumberEntry * m_autoPictureWidth
width of saved PNGs.
void goToEventWidget()
go to the event given by m_eventNumberWidget.
bool m_reshowCurrentEvent
Show current event again after startDisplay() returns?
bool m_advance
If true, start advancing through the events on startup.
TGTextEntry * m_autoFileNamePrefix
File name prefix (prefix + event number + "_" + projection + ".png").
void showJumpToEventDialog()
Show a dialog to to enter exp, run, event numbers.
void saveHiResPicture()
alias for savePicture(true).
SplitGLView * m_viewPane
pointer to right-side pane with viewers.
std::vector< std::string > m_hideObjects
objects which are to be hidden (can be manually re-enabled in tree view).
void allowFlaggingEvents(const std::string &description="")
Show control for flagging events (to set module return value).
bool m_cumulative
If true, DisplayModule shouldn't clear previous data (i.e.
A single parameter of the module.
Responsible for arranging the GL viewers and providing related functionality.
TEveProjectionManager * getRhoZMgr() const
return Rho-Z projection manager.
TGLEmbeddedViewer * getActiveGLViewer()
return TGLEmbeddedViewer that is active right now.
InfoWidget * getInfoWidget() const
text-based info viewer.
TEveProjectionManager * getRPhiMgr() const
return R-Phi projection manager.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
const TObject * getDataStoreObject(TEveElement *elem) const
Get object represented by given visual representation.
static VisualRepMap * getInstance()
get instance pointer.
void selectRelated(TEveElement *eveObj) const
Select related objects.
void selectOnly(const TEveElement *eveObj) const
Deselect all other objects.
void select(const TObject *object) const
Select the representation of the given object.
Abstract base class for different kinds of events.
Wraps a module parameter that can be toggled from the UI.