MiniballSort
Loading...
Searching...
No Matches
MiniballGUI.hh
Go to the documentation of this file.
1// Very basic ROOT GUI to perform sorting of Miniball data
2//
3// Liam Gaffney (liam.gaffney@cern.ch) - 02/05/2017
4
5#ifndef __MINIBALLGUI_HH
6#define __MINIBALLGUI_HH
7
8// ROOT include
9#include <TSystem.h>
10#include <TEnv.h>
11#include <TGFileDialog.h>
12#include <TGFontDialog.h>
13#include <TGTextEntry.h>
14#include <TGNumberEntry.h>
15#include <TGButton.h>
16#include <TGButtonGroup.h>
17#include <TGProgressBar.h>
18#include <TGLabel.h>
19#include <TColor.h>
20#include <TGFrame.h>
21#include <TGWindow.h>
22#include <TApplication.h>
23#include <TGListBox.h>
24#include <TList.h>
25#include <TString.h>
26#include <TObjString.h>
27#include <TG3DLine.h>
28#include <RQ_OBJECT.h>
29
30// Settings header
31#ifndef __SETTINGS_HH
32# include "Settings.hh"
33#endif
34
35// Calibration header
36#ifndef __CALIBRATION_HH
37# include "Calibration.hh"
38#endif
39
40// Reaction header
41#ifndef __REACTION_HH
42# include "Reaction.hh"
43#endif
44
45// Converter headers
46#ifndef __MIDASCONVERTER_HH
47# include "MidasConverter.hh"
48#endif
49#ifndef __MBSSCONVERTER_HH
50# include "MbsConverter.hh"
51#endif
52
53// EventBuilder header
54#ifndef __EVENTBUILDER_HH
55# include "EventBuilder.hh"
56#endif
57
58// Histogrammer header
59#ifndef __HISTOGRAMMER_HH
60# include "Histogrammer.hh"
61#endif
62
63
64// C++ include.
65#include <string>
66#include <sstream>
67#include <fstream>
68#include <vector>
69#include <iostream>
70#include <memory>
71//#include <filesystem>
72
73
74class MyDialog {
75
76 RQ_OBJECT( "MyDialog" )
77
78private:
79
80 // Popup dialogs
81 TGTransientFrame *fDialog;
82 TGTextButton *but_yes, *but_no;
83 TGLabel *dialog_msg;
84 TGHorizontalFrame *frame_button;
85
86 // Answer
87 bool answer;
88
89public:
90
91 // Popup dialogs
92 MyDialog( const TGWindow *p, const TGWindow *main, TString msg, bool &ans );
93 virtual ~MyDialog();
94
95 // Do the answer
96 void SayYes();
97 void SayNo();
98
99 ClassDef( MyDialog, 0 )
100
101};
102
104
105 RQ_OBJECT( "MiniballGUI" )
106
107protected:
108
109 // Frames
110 TGMainFrame *main_frame; // main frame
111 TGVerticalFrame *left_frame; // left frame
112 TGHorizontalFrame *fbut_frame; // sub frame for add/remove files buttons
113 TGVerticalFrame *centre_frame; // centre frame for input files and directories, etc
114 TGHorizontalFrame *centre_files; // centre frame for input files and directories, etc
115 TGVerticalFrame *centre_label; // centre frame for input files and directories, etc
116 TGVerticalFrame *centre_text; // centre frame for input files and directories, etc
117 TGVerticalFrame *centre_button; // centre frame for input files and directories, etc
118 TGHorizontalFrame *centre_go; // bottom of frame for buttons and options
119 TGVerticalFrame *centre_progress; // centre frame for progress bars
120
121 // Separators
122 TGVertical3DLine *fVertical_0;
123 TGHorizontal3DLine *fHorizontal_0;
124
125 // Progress bars
126 std::shared_ptr<TGHProgressBar> prog_conv;
127 std::shared_ptr<TGHProgressBar> prog_sort;
128 std::shared_ptr<TGHProgressBar> prog_evnt;
129 std::shared_ptr<TGHProgressBar> prog_hist;
130
131
132 // Labels
133 TGLabel *lab_run_files; // label for run file list
134 TGLabel *lab_set_file; // label for settings file
135 TGLabel *lab_cal_file; // label for calibration file
136 TGLabel *lab_rea_file; // label for reaction file
137 TGLabel *lab_out_dir; // label for output directory
138 TGLabel *lab_out_file; // label for output file
139
140 // Run list box
141 TGListBox *run_list_box;
143
144 // Text entries
145 TGTextEntry *text_add_file; // text entry for adding a file
146 TGTextEntry *text_set_file; // text entry for settings file
147 TGTextEntry *text_cal_file; // text entry for calibration file
148 TGTextEntry *text_rea_file; // text entry for reaction file
149 TGTextEntry *text_out_dir; // text entry for output directory
150 TGTextEntry *text_out_file; // text entry for output file
151
152 // Check buttons
153 TGCheckButton *check_force; // check button to force resort
154 TGCheckButton *check_event; // check button to rebuild events
155 TGCheckButton *check_source; // check button to rebuild events
156 TGCheckButton *check_mbs; // check button to define MBS data
157 TGCheckButton *check_ebis; // check button to enable EBIS only sort
158
159 // Action buttons
160 TGTextButton *but_sel; // button to select files
161 TGTextButton *but_add; // button to add files
162 TGTextButton *but_del; // button to remove files
163 TGTextButton *but_open; // button to open configuration
164 TGTextButton *but_save; // button to save configuration
165 TGTextButton *but_sort; // button to do the sorting
166 TGTextButton *but_set; // button to open settings file
167 TGTextButton *but_cal; // button to open calibration file
168 TGTextButton *but_rea; // button to open reaction file
169 TGTextButton *but_dir; // button to open output directory
170 TGTextButton *but_out; // button to open output file
171
172
173 // Files
174 std::shared_ptr<MiniballSettings> myset;
175 std::shared_ptr<MiniballCalibration> mycal;
176 std::shared_ptr<MiniballReaction> myrea;
177
178 // select what steps of the analysis to be forced
179 std::vector<bool> force_convert;
187
188
189public:
190
191 MiniballGUI(); // constructor
192 virtual ~MiniballGUI(); // destructor
193
194 // Analysis steps
195 void gui_convert();
196 void gui_sort();
197 void gui_build();
198 void gui_hist();
199
200 // Slots
201 TString get_filename();
202 TString get_directory();
203 inline void on_set_clicked(){ text_set_file->SetText( get_filename() ); };
204 inline void on_cal_clicked(){ text_cal_file->SetText( get_filename() ); };
205 inline void on_rea_clicked(){ text_rea_file->SetText( get_filename() ); };
206 inline void on_dir_clicked(){ text_out_dir->SetText( get_directory() ); };
207 inline void on_out_clicked(){ text_out_file->SetText( get_filename() ); };
208 inline void on_open_clicked(){ LoadSetup( get_filename() ); };
209 inline void on_save_clicked(){ SaveSetup( get_filename() ); };
210 void on_del_clicked();
211 void on_sel_clicked();
212 void on_add_clicked();
213 void on_sort_clicked();
214
215 // Save setup
216 void SaveSetup( TString setupfile );
217 void LoadSetup( TString setupfile );
218
219 // File list
220 std::vector<TString> filelist;
221 std::vector<bool> filestatus;
222 std::string datadir_name;
223
224
225
226 ClassDef( MiniballGUI, 0 )
227
228};
229
230#endif
std::string datadir_name
void on_cal_clicked()
std::shared_ptr< TGHProgressBar > prog_conv
void on_open_clicked()
TGVertical3DLine * fVertical_0
TGVerticalFrame * centre_text
TGTextEntry * text_out_file
TGListBox * run_list_box
TGCheckButton * check_ebis
TGTextEntry * text_cal_file
TGHorizontal3DLine * fHorizontal_0
void on_sort_clicked()
TGVerticalFrame * centre_button
TGTextButton * but_del
TGVerticalFrame * centre_progress
TGLabel * lab_cal_file
TGLabel * lab_rea_file
void LoadSetup(TString setupfile)
TGLabel * lab_out_file
std::shared_ptr< TGHProgressBar > prog_sort
TGHorizontalFrame * fbut_frame
std::vector< bool > force_convert
TGCheckButton * check_event
void on_save_clicked()
TGTextEntry * text_rea_file
TGTextEntry * text_out_dir
TList * run_selected
TGTextButton * but_add
TGTextButton * but_cal
TGTextButton * but_sort
void on_add_clicked()
TGLabel * lab_out_dir
TString get_filename()
void on_del_clicked()
void gui_hist()
TGVerticalFrame * left_frame
TGTextButton * but_rea
TGTextEntry * text_set_file
TGTextButton * but_open
TGLabel * lab_set_file
std::vector< bool > filestatus
TString get_directory()
std::vector< TString > filelist
void on_rea_clicked()
TGTextEntry * text_add_file
TGHorizontalFrame * centre_go
TGTextButton * but_out
TGLabel * lab_run_files
TGVerticalFrame * centre_frame
TGCheckButton * check_mbs
std::shared_ptr< MiniballCalibration > mycal
TGTextButton * but_save
TGMainFrame * main_frame
void gui_build()
std::shared_ptr< MiniballSettings > myset
void gui_convert()
void on_out_clicked()
TGTextButton * but_set
virtual ~MiniballGUI()
TGCheckButton * check_source
TGTextButton * but_sel
std::shared_ptr< MiniballReaction > myrea
void on_set_clicked()
std::shared_ptr< TGHProgressBar > prog_hist
void SaveSetup(TString setupfile)
TGCheckButton * check_force
TGTextButton * but_dir
void on_sel_clicked()
void gui_sort()
std::shared_ptr< TGHProgressBar > prog_evnt
TGHorizontalFrame * centre_files
void on_dir_clicked()
TGVerticalFrame * centre_label
TGTextButton * but_no
TGHorizontalFrame * frame_button
TGTextButton * but_yes
MyDialog(const TGWindow *p, const TGWindow *main, TString msg, bool &ans)
void SayYes()
TGLabel * dialog_msg
bool answer
void SayNo()
virtual ~MyDialog()
TGTransientFrame * fDialog
int main(int argc, char *argv[])
Definition mb_sort.cc:939