REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestBrowser.h
1 #ifndef RestCore_TRestBrowser
2 #define RestCore_TRestBrowser
3 
4 #include <TApplication.h>
5 #include <TBrowser.h>
6 #include <TCanvas.h>
7 #include <TGButton.h>
8 #include <TGComboBox.h>
9 #include <TGDimension.h>
10 #include <TGFileDialog.h>
11 #include <TGFrame.h>
12 #include <TGLabel.h>
13 #include <TGNumberEntry.h>
14 #include <TGTextEntry.h>
15 #include <TObject.h>
16 #include <TROOT.h>
17 #include <TRestEventViewer.h>
18 #include <TRestRun.h>
19 #include <TSystem.h>
20 
21 #include <iostream>
22 
24 class TRestBrowser {
25  protected:
26  TGMainFrame* frmMain = nullptr;
27  TGMainFrame* frmBot = nullptr;
28 
29  // Frames and buttons on left//!
30  TGVerticalFrame* fVFrame = nullptr;
31  TGLabel* fEventRowLabel = nullptr;
32  TGLabel* fEventIdLabel = nullptr;
33  TGLabel* fEventSubIdLabel = nullptr;
34  TGNumberEntry* fEventRowNumberBox = nullptr;
35  TGNumberEntry* fEventIdNumberBox = nullptr;
36  TGNumberEntry* fEventSubIdNumberBox = nullptr;
37 
38  TGLabel* fEventTypeLabel = nullptr;
39  TGComboBox* fEventTypeComboBox = nullptr;
40 
41  TGLabel* fPlotOptionLabel = nullptr;
42  TGTextEntry* fPlotOptionTextBox = nullptr;
43  TGPictureButton* fButOptPrev = nullptr;
44  TGTextButton* fButOptRefresh = nullptr;
45  TGPictureButton* fButOptNext = nullptr;
46 
47  TGPictureButton* fMenuOpen = nullptr;
48  TGPictureButton* fExit = nullptr;
49 
50  // Frames and buttons on bottom
51  TGVerticalFrame* fHFrame = nullptr;
52  TGLabel* fSelectionTextBoxLabel = nullptr;
53  TGTextEntry* fSelectionTextBox = nullptr;
54  TGTextButton* fButEvePrev = nullptr;
55  TGTextButton* fButEveNext = nullptr;
56 
57  TCanvas* fCanDefault = nullptr;
58  Int_t fEventRow = 0;
59  Int_t fEventId = 0;
60  Int_t fEventSubId = 0;
61 
62  TBrowser* fBrowser = nullptr;
63  TRestRun* fRestRun = nullptr;
64 
65  private:
66  Bool_t pureAnalysis;
67  TString fInputFileName;
68 
69  TRestEventViewer* fEventViewer = nullptr;
70 
71  void SetViewer(TRestEventViewer* eV, Double_t geomScale = 0.1);
72  void SetViewer(const TString& viewerName, Double_t geomScale = 0.1);
73  void SetLeftPanelButtons();
74  void SetBottomPanelButtons();
75  Bool_t LoadEventId(Int_t eventID, Int_t subEventID = -1);
76  Bool_t LoadEventEntry(Int_t n);
77 
78  public:
79  // tool method
80  void Initialize(const TString& opt = "FI");
81  static void InitFromConfigFile();
82  Bool_t OpenFile(const TString& filename);
83 
84  // setters
85  void SetInputEvent(TRestEvent*);
86  inline void SetWindowName(const TString& windowName) { frmMain->SetWindowName(windowName.Data()); }
87 
88  // getters
89  inline TRestEventViewer* GetViewer() const { return fEventViewer; }
90 
91  // actions
92  void LoadFileAction();
93  static void ExitAction();
94 
95  void RowValueChangedAction(Long_t val);
96  void IdValueChangedAction(Long_t val);
97  void NextEventAction();
98  void PreviousEventAction();
99 
100  void EventTypeChangedAction(Int_t id);
101 
102  void NextPlotOptionAction();
103  void PreviousPlotOptionAction();
104  void PlotAction();
105 
106  // Constructors
107  TRestBrowser();
108  TRestBrowser(const TString& viewerName, Double_t geomScale = 0.1);
109 
110  // Destructor
111  ~TRestBrowser();
112 };
113 #endif
Event browser for different input file.
Definition: TRestBrowser.h:24
TGNumberEntry * fEventSubIdNumberBox
For Event number.
Definition: TRestBrowser.h:36
TGPictureButton * fExit
Open file button.
Definition: TRestBrowser.h:48
TGTextButton * fButEveNext
Previous plot option.
Definition: TRestBrowser.h:55
TGTextButton * fButOptRefresh
Previous plot option.
Definition: TRestBrowser.h:44
TGNumberEntry * fEventIdNumberBox
For row number.
Definition: TRestBrowser.h:35
TGVerticalFrame * fHFrame
Exit button.
Definition: TRestBrowser.h:51
TGLabel * fEventTypeLabel
For sub Event number.
Definition: TRestBrowser.h:38
TGPictureButton * fButOptNext
Refresh plot.
Definition: TRestBrowser.h:45
TGLabel * fEventRowLabel
< The main vertical frame for browser controlling
Definition: TRestBrowser.h:31
void SetBottomPanelButtons()
TGTextButton * fButEvePrev
TextBox for plot options.
Definition: TRestBrowser.h:54
TGPictureButton * fMenuOpen
Next plot option.
Definition: TRestBrowser.h:47
TCanvas * fCanDefault
Refresh plot.
Definition: TRestBrowser.h:57
TGPictureButton * fButOptPrev
TextBox for plot options.
Definition: TRestBrowser.h:43
A base class for any REST event.
Definition: TRestEvent.h:38
Data provider and manager in REST.
Definition: TRestRun.h:18