Commit 895ca346 authored by nkx Nicholas's avatar nkx Nicholas
Browse files

TRestBrowser: updated to both display/switch row, event id, sub event id

parent 53e4e3cc
...@@ -29,14 +29,24 @@ class TRestBrowser { ...@@ -29,14 +29,24 @@ class TRestBrowser {
// Frames and buttons // Frames and buttons
TGVerticalFrame* fVFrame = 0; //! < Vertical frame. TGVerticalFrame* fVFrame = 0; //! < Vertical frame.
TGNumberEntry* fNEvent = 0; //! Event number. TGLabel* fEventRowLabel = 0; //! label(content"plot options:")
TGLabel* fLabel = 0; //! label(content"plot options:") TGLabel* fEventIdLabel = 0; //! label(content"plot options:")
TGPictureButton* fButPrev = 0; //! Previous event. TGLabel* fEventSubIdLabel = 0; //! label(content"plot options:")
TGPictureButton* fLoadEvent = 0; //! Load Event button TGNumberEntry* fEventRowNumberBox = 0; //! Event number.
TGPictureButton* fButNext = 0; //! Next number. TGNumberEntry* fEventIdNumberBox = 0; //! Event number.
TGNumberEntry* fEventSubIdNumberBox = 0; //! Event number.
TGPictureButton* fButEventPrev = 0; //! Previous event.
TGPictureButton* fButEventLoad = 0; //! Load Event button
TGPictureButton* fButEventNext = 0; //! Next number.
TGPictureButton* fMenuOpen = 0; //! Open file TGPictureButton* fMenuOpen = 0; //! Open file
TGTextButton* fExit = 0; //! Load Event button TGTextButton* fExit = 0; //! Load Event button
TGLabel* fPlotOptionLabel = 0; //! label(content"plot options:")
TGTextEntry* fPlotOptionTextBox = 0;
TGTextButton* fButOptPrev = 0; //! Previous event.
TGTextButton* fButOptLoad = 0; //! Load Event button
TGTextButton* fButOptNext = 0; //! Next number.
TCanvas* fCanDefault = 0; //! TCanvas* fCanDefault = 0; //!
TBrowser* b = 0; //! TBrowser* b = 0; //!
...@@ -47,10 +57,11 @@ class TRestBrowser { ...@@ -47,10 +57,11 @@ class TRestBrowser {
#ifndef __CINT__ #ifndef __CINT__
Bool_t pureAnalysis; Bool_t pureAnalysis;
TString fInputFileName; TString fInputFileName;
Int_t fCurrentEntry = 0;
Int_t fCurrentId = 0;
TRestEventViewer* fEventViewer = 0; //! TRestEventViewer* fEventViewer = 0; //!
Bool_t LoadEventId(Int_t id, Int_t subid = -1);
Bool_t LoadEventEntry(Int_t n);
#endif #endif
public: public:
...@@ -63,6 +74,7 @@ class TRestBrowser { ...@@ -63,6 +74,7 @@ class TRestBrowser {
void Initialize(TString opt = "FI"); void Initialize(TString opt = "FI");
void InitFromConfigFile(); void InitFromConfigFile();
Bool_t OpenFile(TString filename);
void SetViewer(TRestEventViewer* eV); void SetViewer(TRestEventViewer* eV);
void SetViewer(TString viewerName); void SetViewer(TString viewerName);
...@@ -74,18 +86,17 @@ class TRestBrowser { ...@@ -74,18 +86,17 @@ class TRestBrowser {
TRestEventViewer* GetViewer() { return fEventViewer; } TRestEventViewer* GetViewer() { return fEventViewer; }
TGVerticalFrame* generateNewFrame(); // actions
void addFrame(TGFrame* f);
void LoadEventAction();
void LoadNextEventAction();
void LoadPrevEventAction();
void LoadFileAction(); void LoadFileAction();
void ExitAction(); void ExitAction();
Bool_t OpenFile(TString fName); void RowValueChangedAction(Long_t val);
Bool_t LoadEventId(Int_t id); void IdValueChangedAction(Long_t val);
Bool_t LoadEventEntry(Int_t n);
void NextPlotOptionAction();
void PreviousPlotOptionAction();
void PlotAction();
}; };
#endif #endif
...@@ -34,33 +34,21 @@ class TRestEventViewer { ...@@ -34,33 +34,21 @@ class TRestEventViewer {
protected: protected:
TGeoManager* fGeometry = 0; //! TGeoManager* fGeometry = 0; //!
TRestEvent* fEvent = 0; //! TRestEvent* fEvent = 0; //!
TRestBrowser* fController = 0; //!
TPad* fPad = 0; TPad* fPad = 0;
TCanvas* fCanvas = 0; TCanvas* fCanvas = 0;
TGTextButton* fButNext = 0; //! Next signal.
TGTextButton* fButPrev = 0; //! Previous signal.
TGLabel* fLabel = 0; //! label(content"plot options:")
TGTextEntry* fOptwindow = 0; //! option input window.
TGTextButton* fButOpt = 0; //! draw with option.
public: public:
virtual void Initialize(); virtual void Initialize();
virtual void AddEvent(TRestEvent* ev); virtual void AddEvent(TRestEvent* ev);
void NextOption(); virtual void Plot(const char* option);
void PreviousOption();
void OptionPlot();
virtual void DeleteCurrentEvent(); virtual void DeleteCurrentEvent();
// Setters // Setters
virtual void SetGeometry(TGeoManager* geo) { fGeometry = geo; } virtual void SetGeometry(TGeoManager* geo) { fGeometry = geo; }
void SetEvent(TRestEvent* ev) { fEvent = ev; } void SetEvent(TRestEvent* ev) { fEvent = ev; }
void SetController(TRestBrowser* b) { fController = b; }
// Getters // Getters
TGeoManager* GetGeometry() { return fGeometry; } TGeoManager* GetGeometry() { return fGeometry; }
TRestEvent* GetEvent() { return fEvent; } TRestEvent* GetEvent() { return fEvent; }
......
...@@ -53,8 +53,6 @@ TRestBrowser::~TRestBrowser() { ...@@ -53,8 +53,6 @@ TRestBrowser::~TRestBrowser() {
void TRestBrowser::Initialize(TString opt) { void TRestBrowser::Initialize(TString opt) {
pureAnalysis = kFALSE; pureAnalysis = kFALSE;
fCurrentEntry = 0;
fCurrentId = 0;
r = new TRestRun(); r = new TRestRun();
...@@ -85,7 +83,6 @@ void TRestBrowser::SetViewer(TRestEventViewer* eV) { ...@@ -85,7 +83,6 @@ void TRestBrowser::SetViewer(TRestEventViewer* eV) {
} }
if (eV != NULL) { if (eV != NULL) {
fEventViewer = eV; fEventViewer = eV;
eV->SetController(this);
b->StartEmbedding(1, -1); b->StartEmbedding(1, -1);
eV->Initialize(); eV->Initialize();
b->StopEmbedding(); b->StopEmbedding();
...@@ -107,32 +104,42 @@ void TRestBrowser::SetViewer(TString viewerName) { ...@@ -107,32 +104,42 @@ void TRestBrowser::SetViewer(TString viewerName) {
void TRestBrowser::setButtons() { void TRestBrowser::setButtons() {
TString icondir = (TString)getenv("ROOTSYS") + "/icons/"; TString icondir = (TString)getenv("ROOTSYS") + "/icons/";
fVFrame = generateNewFrame(); auto fVFrame = new TGVerticalFrame(frmMain);
fVFrame->Resize(300, 200);
fLabel = new TGLabel(fVFrame, "EventId:"); // row in the tree
fVFrame->AddFrame(fLabel, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); fEventRowLabel = new TGLabel(fVFrame, "Row:");
fVFrame->AddFrame(fEventRowLabel, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
fNEvent = new TGNumberEntry(fVFrame, fCurrentId); fEventRowNumberBox = new TGNumberEntry(fVFrame, 0);
fNEvent->SetIntNumber(fCurrentId); fEventRowNumberBox->Connect("ValueSet(Long_t)", "TRestBrowser", this, "RowValueChangedAction(Long_t)");
fVFrame->AddFrame(fNEvent, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); fVFrame->AddFrame(fEventRowNumberBox, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
auto controlbar = new TGHorizontalFrame(fVFrame); // event id and sub event id
auto labelbar = new TGHorizontalFrame(fVFrame);
{ {
fButPrev = new TGPictureButton(controlbar, gClient->GetPicture(icondir + "GoBack.gif")); fEventIdLabel = new TGLabel(labelbar, "Event ID:");
fButPrev->Connect("Clicked()", "TRestBrowser", this, "LoadPrevEventAction()"); labelbar->AddFrame(fEventIdLabel, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
controlbar->AddFrame(fButPrev, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
fEventSubIdLabel = new TGLabel(labelbar, "Sub ID:");
fLoadEvent = new TGPictureButton( labelbar->AddFrame(fEventSubIdLabel, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
controlbar, gClient->GetPicture(icondir + "refresh.png")); ///< Load Event button }
fLoadEvent->Connect("Clicked()", "TRestBrowser", this, "LoadEventAction()"); fVFrame->AddFrame(labelbar, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
controlbar->AddFrame(fLoadEvent, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
auto numberboxbar = new TGHorizontalFrame(fVFrame);
fButNext = new TGPictureButton(controlbar, gClient->GetPicture(icondir + "GoForward.gif")); {
fButNext->Connect("Clicked()", "TRestBrowser", this, "LoadNextEventAction()"); fEventIdNumberBox = new TGNumberEntry(numberboxbar, 0);
controlbar->AddFrame(fButNext, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); fEventIdNumberBox->Connect("ValueSet(Long_t)", "TRestBrowser", this, "IdValueChangedAction(Long_t)");
numberboxbar->AddFrame(fEventIdNumberBox, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
fEventSubIdNumberBox = new TGNumberEntry(numberboxbar, 0);
fEventSubIdNumberBox->Connect("ValueSet(Long_t)", "TRestBrowser", this,
"IdValueChangedAction(Long_t)");
numberboxbar->AddFrame(fEventSubIdNumberBox, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
} }
fVFrame->AddFrame(controlbar, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); fVFrame->AddFrame(numberboxbar, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
// tool buttoms
fMenuOpen = new TGPictureButton(fVFrame, gClient->GetPicture(icondir + "bld_open.png")); fMenuOpen = new TGPictureButton(fVFrame, gClient->GetPicture(icondir + "bld_open.png"));
fMenuOpen->Connect("Clicked()", "TRestBrowser", this, "LoadFileAction()"); fMenuOpen->Connect("Clicked()", "TRestBrowser", this, "LoadFileAction()");
fVFrame->AddFrame(fMenuOpen, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); fVFrame->AddFrame(fMenuOpen, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
...@@ -141,16 +148,33 @@ void TRestBrowser::setButtons() { ...@@ -141,16 +148,33 @@ void TRestBrowser::setButtons() {
fExit->Connect("Clicked()", "TRestBrowser", this, "ExitAction()"); fExit->Connect("Clicked()", "TRestBrowser", this, "ExitAction()");
fVFrame->AddFrame(fExit, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); fVFrame->AddFrame(fExit, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
addFrame(fVFrame); // plot option buttoms
fPlotOptionLabel = new TGLabel(fVFrame, "Plot Options:");
fVFrame->AddFrame(fPlotOptionLabel, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
// frmMain->AddFrame(fVFrame,new TGLayoutHints(kLHintsExpandX | fPlotOptionTextBox = new TGTextEntry(fVFrame, "");
// kLHintsExpandY)); fPlotOptionTextBox->SetText("");
} fVFrame->AddFrame(fPlotOptionTextBox, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
auto frame1 = new TGHorizontalFrame(fVFrame);
{
fButOptPrev = new TGTextButton(frame1, "<<Previous"); ///< Load Event button
fButOptPrev->Connect("Clicked()", "TRestBrowser", this, "PreviousPlotOptionAction()");
frame1->AddFrame(fButOptPrev, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
fButOptLoad = new TGTextButton(frame1, "Plot"); ///< Load Event button
fButOptLoad->Connect("Clicked()", "TRestBrowser", this, "PlotAction()");
frame1->AddFrame(fButOptLoad, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
fButOptNext = new TGTextButton(frame1, "Next>>"); ///< Load Event button
fButOptNext->Connect("Clicked()", "TRestBrowser", this, "NextPlotOptionAction()");
frame1->AddFrame(fButOptNext, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
}
fVFrame->AddFrame(frame1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
void TRestBrowser::addFrame(TGFrame* f) { frmMain->Resize(TGDimension(300, frmMain->GetHeight() + fVFrame->GetHeight()));
frmMain->Resize(TGDimension(300, frmMain->GetHeight() + f->GetHeight()));
frmMain->AddFrame(f, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); frmMain->AddFrame(fVFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
// frmMain->DontCallClose(); // frmMain->DontCallClose();
frmMain->MapSubwindows(); frmMain->MapSubwindows();
// frmMain->Resize(); // frmMain->Resize();
...@@ -158,76 +182,7 @@ void TRestBrowser::addFrame(TGFrame* f) { ...@@ -158,76 +182,7 @@ void TRestBrowser::addFrame(TGFrame* f) {
frmMain->MapWindow(); frmMain->MapWindow();
} }
TGVerticalFrame* TRestBrowser::generateNewFrame() { void TRestBrowser::InitFromConfigFile() { cout << __PRETTY_FUNCTION__ << endl; }
auto frame = new TGVerticalFrame(frmMain);
frame->Resize(300, 200);
return frame;
}
void TRestBrowser::LoadEventAction() {
Int_t eventN = (Int_t)fNEvent->GetNumber();
debug << "TRestBrowser::LoadEventAction. Id:" << eventN << endl;
LoadEventId(eventN);
}
void TRestBrowser::LoadNextEventAction() {
Int_t nextEvent = fCurrentEntry + 1;
debug << "TRestBrowser::LoadNextEventAction. Next entry:" << nextEvent << endl;
LoadEventEntry(nextEvent);
}
void TRestBrowser::LoadPrevEventAction() {
Int_t prevEvent = fCurrentEntry - 1;
debug << "TRestBrowser::LoadNextEventAction. Previous entry:" << prevEvent << endl;
LoadEventEntry(prevEvent);
}
void TRestBrowser::LoadFileAction() {
TGFileInfo fi;
new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
TString dir = fi.fFilename;
cout << "Opening " << dir.Data() << endl;
if (TRestTools::fileExists(dir.Data())) {
OpenFile(dir);
fNEvent->SetIntNumber(fCurrentId);
}
}
Bool_t TRestBrowser::OpenFile(TString fName) {
if (!TRestTools::fileExists((string)fName)) {
cout << "WARNING. Input file " << fName << " does not exist" << endl;
return kFALSE;
}
fInputFileName = fName;
r->OpenInputFile(fName);
TFile* f = r->GetInputFile();
TTree* t = r->GetEventTree();
fCurrentEntry = r->GetCurrentEntry();
TGeoManager* geometry = gGeoManager;
if (t != NULL) {
// init viewer
pureAnalysis = kFALSE;
if (fEventViewer == NULL) SetViewer("TRestEventViewer");
if (geometry != NULL && fEventViewer != NULL) fEventViewer->SetGeometry(geometry);
LoadEventAction();
} else {
pureAnalysis = kTRUE;
}
return kTRUE;
}
void TRestBrowser::SetInputEvent(TRestEvent* eve) { void TRestBrowser::SetInputEvent(TRestEvent* eve) {
if (r != NULL) { if (r != NULL) {
...@@ -244,15 +199,19 @@ Bool_t TRestBrowser::LoadEventEntry(Int_t n) { ...@@ -244,15 +199,19 @@ Bool_t TRestBrowser::LoadEventEntry(Int_t n) {
warning << "TRestBrowser::LoadEventEntry. This is a pure analysis file..." << endl; warning << "TRestBrowser::LoadEventEntry. This is a pure analysis file..." << endl;
return kFALSE; return kFALSE;
} }
if (r->GetAnalysisTree() != NULL && n < r->GetAnalysisTree()->GetEntries() && n >= 0) { if (r->GetAnalysisTree() != NULL && n < r->GetAnalysisTree()->GetEntries() && n >= 0) {
r->GetEntry(n); r->GetEntry(n);
TRestEvent* ev = r->GetInputEvent();
fCurrentEntry = r->GetCurrentEntry(); if (!ev) {
fCurrentId = r->GetAnalysisTree()->GetEventID(); ferr << "internal error!" << endl;
debug << "TRestBrowser:LoadEventEntry. Setting current id : " << fCurrentId << endl; } else {
debug << "TRestBrowser:LoadEventEntry. Setting current entry : " << fCurrentEntry << endl; fEventRowNumberBox->SetIntNumber(r->GetCurrentEntry());
fEventIdNumberBox->SetIntNumber(ev->GetID());
fNEvent->SetIntNumber(fCurrentId); fEventSubIdNumberBox->SetIntNumber(ev->GetSubID());
r->GetAnalysisTree()->PrintObservables();
cout << endl;
}
} else { } else {
warning << "TRestBrowser::LoadEventEntry. Event out of limits" << endl; warning << "TRestBrowser::LoadEventEntry. Event out of limits" << endl;
return kFALSE; return kFALSE;
...@@ -260,15 +219,14 @@ Bool_t TRestBrowser::LoadEventEntry(Int_t n) { ...@@ -260,15 +219,14 @@ Bool_t TRestBrowser::LoadEventEntry(Int_t n) {
if (fEventViewer != NULL) { if (fEventViewer != NULL) {
fEventViewer->AddEvent(r->GetInputEvent()); fEventViewer->AddEvent(r->GetInputEvent());
fEventViewer->Plot(fPlotOptionTextBox->GetText());
} }
r->GetAnalysisTree()->PrintObservables();
fCanDefault->cd(); fCanDefault->cd();
return kTRUE; return kTRUE;
} }
Bool_t TRestBrowser::LoadEventId(Int_t id) { Bool_t TRestBrowser::LoadEventId(Int_t id, Int_t subid) {
if (r->GetInputFile() == NULL || r->GetInputFile()->IsZombie()) { if (r->GetInputFile() == NULL || r->GetInputFile()->IsZombie()) {
warning << "TRestBrowser::LoadEventEntry. No File..." << endl; warning << "TRestBrowser::LoadEventEntry. No File..." << endl;
return kFALSE; return kFALSE;
...@@ -278,19 +236,20 @@ Bool_t TRestBrowser::LoadEventId(Int_t id) { ...@@ -278,19 +236,20 @@ Bool_t TRestBrowser::LoadEventId(Int_t id) {
warning << "TRestBrowser::LoadEventEntry. This is a pure analysis file..." << endl; warning << "TRestBrowser::LoadEventEntry. This is a pure analysis file..." << endl;
return kFALSE; return kFALSE;
} }
if (r->GetAnalysisTree() != NULL && r->GetAnalysisTree()->GetEntries() > 0) { if (r->GetAnalysisTree() != NULL && r->GetAnalysisTree()->GetEntries() > 0) {
TRestEvent* ev = r->GetEventWithID(id); TRestEvent* ev = r->GetEventWithID(id, subid);
if (!ev) { if (!ev) {
warning << "Event ID : " << id << " not found!" << endl; warning << "Event ID : " << id << " not found!" << endl;
warning << "Getting entry 0" << endl; fEventIdNumberBox->SetBackgroundColor(kRed);
r->GetEntry(0); fEventSubIdNumberBox->SetForegroundColor(kRed);
} else {
fEventRowNumberBox->SetIntNumber(r->GetCurrentEntry());
fEventIdNumberBox->SetIntNumber(ev->GetID());
fEventSubIdNumberBox->SetIntNumber(ev->GetSubID());
r->GetAnalysisTree()->PrintObservables();
cout << endl;
} }
fCurrentEntry = r->GetCurrentEntry();
fCurrentId = r->GetAnalysisTree()->GetEventID();
debug << "TRestBrowser:LoadEventId. Setting current id : " << fCurrentId << endl;
debug << "TRestBrowser:LoadEventId. Setting current entry : " << fCurrentEntry << endl;
} else { } else {
warning << "TRestBrowser::LoadEventEntry. Event out of limits" << endl; warning << "TRestBrowser::LoadEventEntry. Event out of limits" << endl;
return kFALSE; return kFALSE;
...@@ -298,14 +257,99 @@ Bool_t TRestBrowser::LoadEventId(Int_t id) { ...@@ -298,14 +257,99 @@ Bool_t TRestBrowser::LoadEventId(Int_t id) {
if (fEventViewer != NULL) { if (fEventViewer != NULL) {
fEventViewer->AddEvent(r->GetInputEvent()); fEventViewer->AddEvent(r->GetInputEvent());
fEventViewer->Plot(fPlotOptionTextBox->GetText());
} }
r->GetAnalysisTree()->PrintObservables();
fCanDefault->cd(); fCanDefault->cd();
return kTRUE; return kTRUE;
} }
void TRestBrowser::ExitAction() { gSystem->Exit(0); } Bool_t TRestBrowser::OpenFile(TString filename) {
if (TRestTools::fileExists(filename.Data())) {
fInputFileName = filename;
r->OpenInputFile(fInputFileName);
TFile* f = r->GetInputFile();
TTree* t = r->GetEventTree();
TGeoManager* geometry = gGeoManager;
if (t != NULL) {
// init viewer
pureAnalysis = kFALSE;
if (fEventViewer == NULL) SetViewer("TRestEventViewer");
if (geometry != NULL && fEventViewer != NULL) fEventViewer->SetGeometry(geometry);
RowValueChangedAction(0);
} else {
pureAnalysis = kTRUE;
}
void TRestBrowser::InitFromConfigFile() { cout << __PRETTY_FUNCTION__ << endl; } TRestEvent* ev = r->GetInputEvent();
if (!ev) {
ferr << "internal error!" << endl;
} else {
fEventRowNumberBox->SetIntNumber(r->GetCurrentEntry());
fEventIdNumberBox->SetIntNumber(ev->GetID());
fEventSubIdNumberBox->SetIntNumber(ev->GetSubID());
}
}
}
void TRestBrowser::NextPlotOptionAction() {
string text = fPlotOptionTextBox->GetText();
if (text == "") {
text = "0";
} else if (isANumber(text)) {
text = ToString(StringToInteger(text) + 1);
}
fPlotOptionTextBox->SetText(text.c_str());
PlotAction();
}
void TRestBrowser::PreviousPlotOptionAction() {
string text = fPlotOptionTextBox->GetText();
if (text == "") {
text = "0";
} else if (isANumber(text)) {
text = ToString(StringToInteger(text) - 1);
}
fPlotOptionTextBox->SetText(text.c_str());
PlotAction();
}
void TRestBrowser::PlotAction() {
if (fEventViewer != NULL) {
fEventViewer->Plot(fPlotOptionTextBox->GetText());
}
}
void TRestBrowser::RowValueChangedAction(Long_t val) {
int entryN = (Int_t)fEventRowNumberBox->GetNumber();
debug << "TRestBrowser::LoadEventAction. Entry:" << entryN << endl;
LoadEventEntry(entryN);
}
void TRestBrowser::IdValueChangedAction(Long_t val) {
int eventN = (Int_t)fEventIdNumberBox->GetNumber();
int eventsubN = (Int_t)fEventSubIdNumberBox->GetNumber();
debug << "TRestBrowser::LoadEventAction. Event ID: " << eventN << ", Sub ID: " << eventsubN << endl;
LoadEventId(eventN, eventsubN);
}
void TRestBrowser::LoadFileAction() {
TGFileInfo fi;
new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
TString dir = fi.fFilename;
cout << "Opening " << dir.Data() << endl;
OpenFile(dir);
}
void TRestBrowser::ExitAction() { gSystem->Exit(0); }
...@@ -39,80 +39,26 @@ void TRestEventViewer::Initialize() { ...@@ -39,80 +39,26 @@ void TRestEventViewer::Initialize() {
fCanvas = new TCanvas("Event Viewer", "Event Viewer"); fCanvas = new TCanvas("Event Viewer", "Event Viewer");
fCanvas->SetWindowPosition(350, 10); fCanvas->SetWindowPosition(350, 10);
if (fController == NULL) {
return;
}
auto frame = fController->generateNewFrame();
fLabel = new TGLabel(frame, "Plot Options:");
frame->AddFrame(fLabel, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));