1 | // class EusoMainFrame |
---|
2 | // GUI interface for ESAF : Euso Simulation and Analysis Framework |
---|
3 | // M. Pallavicini created 28-12-2001 |
---|
4 | // new structure 09-02-2002 |
---|
5 | // |
---|
6 | |
---|
7 | #include "EusoMainFrame.hh" |
---|
8 | #include "SimuApplication.hh" |
---|
9 | #include "DetectorConfigDlg.hh" |
---|
10 | #include "ConfigEditorDlg.hh" |
---|
11 | #include "OutputRenameDlg.hh" |
---|
12 | #include "ShowHistoDlg.hh" |
---|
13 | #include "Config.hh" |
---|
14 | #include "TGFileDialog.h" |
---|
15 | #include "TROOT.h" |
---|
16 | #include "TGMsgBox.h" |
---|
17 | #include "TKey.h" |
---|
18 | #include "TTree.h" |
---|
19 | |
---|
20 | #include <stdlib.h> |
---|
21 | |
---|
22 | ClassImp(EusoMainFrame) |
---|
23 | |
---|
24 | #define NOT_IMPLEMENTED_YET() { new TGMsgBox(fClient->GetRoot(),\ |
---|
25 | this,\ |
---|
26 | "ESAF Message",\ |
---|
27 | "This function is not implemented yet. Sorry!",\ |
---|
28 | kMBIconExclamation);} |
---|
29 | |
---|
30 | // file extension and description for Configuration files |
---|
31 | static const char *gConfigFileTypes[] = { "Euso Config Files", "*.cfg" , |
---|
32 | "All files", "*.*", |
---|
33 | 0,0 }; |
---|
34 | |
---|
35 | // file extensions and descriptions for input files |
---|
36 | static const char *gInputFileTypes[] = { "Shower Tracks", "*.stk" , |
---|
37 | "Light in Atmosphere", "*.lgt", |
---|
38 | "Photons at Euso", "*.pht", |
---|
39 | "All files", "*.*", |
---|
40 | 0,0 }; |
---|
41 | |
---|
42 | // file extensions and descriptions for root files |
---|
43 | static const char *gRootFileTypes[] = { "Euso root files", "*.root" , |
---|
44 | "All files", "*.*", |
---|
45 | 0,0 }; |
---|
46 | |
---|
47 | // build the main window with its menu |
---|
48 | EusoMainFrame::EusoMainFrame( SimuApplication* app, const TGWindow *p , |
---|
49 | UInt_t w, UInt_t h ) : TGMainFrame( p, w, h ), theApp( app ) { |
---|
50 | |
---|
51 | if ( !theApp ) { |
---|
52 | fprintf(stdout,"Error: SimuApplication not valid\n"); |
---|
53 | exit(2); |
---|
54 | } |
---|
55 | |
---|
56 | // layout hints for menu items and menu bar |
---|
57 | fMenuLayout = new TGLayoutHints(kLHintsTop|kLHintsLeft|kLHintsExpandX,0,0,1,1); |
---|
58 | fItemLayout = new TGLayoutHints(kLHintsTop|kLHintsLeft,0,4,0,0); |
---|
59 | fHelpLayout = new TGLayoutHints(kLHintsTop|kLHintsRight); |
---|
60 | |
---|
61 | // create main menu |
---|
62 | // file |
---|
63 | fMenuFile = new TGPopupMenu( fClient->GetRoot() ); |
---|
64 | fMenuFile->AddLabel("Input file"); |
---|
65 | fMenuFile->AddEntry("&Open",E_FILE_OPEN_INPUT); |
---|
66 | fMenuFile->AddEntry("&Close",E_FILE_CLOSE_INPUT); |
---|
67 | fMenuFile->AddSeparator(); |
---|
68 | fMenuFile->AddLabel("Output file"); |
---|
69 | fMenuFile->AddEntry("&Rename",E_FILE_RENAME_OUTPUT); |
---|
70 | fMenuFile->AddSeparator(); |
---|
71 | fMenuFile->AddLabel("Root file"); |
---|
72 | fMenuFile->AddEntry("O&pen input",E_FILE_OPEN_ROOT_INP); |
---|
73 | fMenuFile->AddEntry("C&lose input",E_FILE_CLOSE_ROOT_INP); |
---|
74 | fMenuFile->AddEntry("Clo&se output",E_FILE_CLOSE_ROOT_OUT); |
---|
75 | fMenuFile->AddSeparator(); |
---|
76 | fMenuFile->AddEntry("E&xit",E_FILE_EXIT_PROGRAM); |
---|
77 | fMenuFile->Associate( this ); |
---|
78 | fMenuFile->DisableEntry(E_FILE_CLOSE_INPUT); |
---|
79 | fMenuFile->DisableEntry(E_FILE_CLOSE_ROOT_INP); |
---|
80 | fMenuFile->DisableEntry(E_FILE_CLOSE_ROOT_OUT); |
---|
81 | |
---|
82 | // config |
---|
83 | fMenuConfig = new TGPopupMenu( fClient->GetRoot() ); |
---|
84 | fMenuConfig->AddLabel("Files"); |
---|
85 | fMenuConfig->AddEntry("&Edit files",E_CONFIG_SELECT_FILES); |
---|
86 | fMenuConfig->AddSeparator(); |
---|
87 | fMenuConfig->AddLabel("Parameters"); |
---|
88 | |
---|
89 | fCascadeShowerMenu = new TGPopupMenu(fClient->GetRoot()); |
---|
90 | fCascadeShowerMenu->AddEntry("Slast",E_CONFIG_SHOWER_SLAST); |
---|
91 | fCascadeShowerMenu->AddEntry("Corsika",E_CONFIG_SHOWER_CORSIKA); |
---|
92 | fCascadeShowerMenu->AddEntry("AP Gil",E_CONFIG_SHOWER_APGIL); |
---|
93 | |
---|
94 | fCascadeLightMenu = new TGPopupMenu(fClient->GetRoot()); |
---|
95 | fCascadeLightMenu->AddEntry("TestLightToEuso",E_CONFIG_TESTLIGHTTOEUSO); |
---|
96 | fCascadeLightMenu->AddEntry("2",E_NOT_IMPLEMENTED); |
---|
97 | |
---|
98 | fCascadeAtmosphereMenu = new TGPopupMenu(fClient->GetRoot()); |
---|
99 | fCascadeAtmosphereMenu->AddEntry("1",E_NOT_IMPLEMENTED); |
---|
100 | fCascadeAtmosphereMenu->AddEntry("2",E_NOT_IMPLEMENTED); |
---|
101 | |
---|
102 | fCascadeDetectorMenu = new TGPopupMenu(fClient->GetRoot()); |
---|
103 | fCascadeDetectorMenu->AddEntry("Euso",E_CONFIG_EUSO); |
---|
104 | |
---|
105 | fMenuConfig->AddPopup("Shower Generators",fCascadeShowerMenu); |
---|
106 | fMenuConfig->AddPopup("Light Generators",fCascadeLightMenu); |
---|
107 | fMenuConfig->AddPopup("Atmosphere",fCascadeAtmosphereMenu); |
---|
108 | fMenuConfig->AddPopup("Euso Detector",fCascadeDetectorMenu); |
---|
109 | |
---|
110 | fMenuConfig->Associate( this ); |
---|
111 | |
---|
112 | // run |
---|
113 | fMenuRun = new TGPopupMenu( fClient->GetRoot() ); |
---|
114 | fMenuRun->AddEntry("&Single",E_RUN_SINGLE); |
---|
115 | fMenuRun->AddEntry("&All",E_RUN_ALL); |
---|
116 | fMenuRun->AddSeparator(); |
---|
117 | fMenuRun->AddEntry("&Rerun last",E_RUN_REDO); |
---|
118 | fMenuRun->AddEntry("&Rerun all",E_RUN_REDOALL); |
---|
119 | fMenuRun->AddSeparator(); |
---|
120 | fMenuRun->AddEntry("&Parameters",E_RUN_SET); |
---|
121 | fMenuRun->Associate( this ); |
---|
122 | |
---|
123 | // event display |
---|
124 | fMenuDisplay = new TGPopupMenu( fClient->GetRoot() ); |
---|
125 | fMenuDisplay->AddEntry("&Show",E_DISPLAY_SHOW_DATA); // single event histograms |
---|
126 | fMenuDisplay->AddEntry("&Dump",E_DISPLAY_DUMP_DATA); // dump some useful numbers |
---|
127 | fMenuDisplay->AddEntry("&Print",E_DISPLAY_PRINT_DATA); // print ( same as dump ) |
---|
128 | fMenuDisplay->AddSeparator(); |
---|
129 | fMenuDisplay->AddEntry("&Toggle 3D Display",E_DISPLAY_3D_EVENT); // enable/dis 3D viewer |
---|
130 | fMenuDisplay->Associate( this ); |
---|
131 | EnableDisplay(kFALSE); |
---|
132 | |
---|
133 | // root objects: histograms and tree |
---|
134 | fMenuRoot = new TGPopupMenu( fClient->GetRoot() ); |
---|
135 | fMenuRoot->AddEntry("&Histograms",E_ROOT_HIST); // set of histogram with all events in root file |
---|
136 | fMenuRoot->AddEntry("&Tree View",E_ROOT_TREE); // open tree viewer |
---|
137 | fMenuRoot->AddEntry("&Browser",E_ROOT_BROWSER); // open TBrowser |
---|
138 | fMenuRoot->Associate( this ); |
---|
139 | |
---|
140 | // help |
---|
141 | fMenuHelp = new TGPopupMenu( fClient->GetRoot() ); |
---|
142 | fMenuHelp->AddEntry("&Contents",E_HELP_CONTENTS); |
---|
143 | fMenuHelp->AddEntry("&About",E_HELP_ABOUT); |
---|
144 | fMenuHelp->Associate( this ); |
---|
145 | |
---|
146 | fMenu = new TGMenuBar( this, 1, 1, kHorizontalFrame ); |
---|
147 | fMenu->AddPopup("&File",fMenuFile,fItemLayout); |
---|
148 | fMenu->AddPopup("&Config",fMenuConfig,fItemLayout); |
---|
149 | fMenu->AddPopup("&Run",fMenuRun,fItemLayout); |
---|
150 | fMenu->AddPopup("Event &Display",fMenuDisplay,fItemLayout); |
---|
151 | fMenu->AddPopup("Roo&t",fMenuRoot,fItemLayout); |
---|
152 | fMenu->AddPopup("&Help",fMenuHelp,fHelpLayout); |
---|
153 | AddFrame( fMenu, fMenuLayout ); |
---|
154 | |
---|
155 | // crate main window |
---|
156 | fWindow = new TGCanvas( this, 300, 100 ); |
---|
157 | fWindowContainer = new TGCompositeFrame( fWindow->GetViewPort(), 300, 100); |
---|
158 | fWindow->SetContainer( fWindowContainer ); |
---|
159 | AddFrame( fWindow, new TGLayoutHints(kLHintsTop|kLHintsLeft)); |
---|
160 | |
---|
161 | SetWindowName("ESAF Main"); |
---|
162 | MapSubwindows(); |
---|
163 | Resize( GetDefaultSize() ); |
---|
164 | MapWindow(); |
---|
165 | |
---|
166 | fRootInputFile = NULL; |
---|
167 | } |
---|
168 | |
---|
169 | // dtor |
---|
170 | EusoMainFrame::~EusoMainFrame() { |
---|
171 | } |
---|
172 | |
---|
173 | // close the main Window and exit the program |
---|
174 | void EusoMainFrame::CloseWindow() { |
---|
175 | theApp->EndJob(); |
---|
176 | TGMainFrame::CloseWindow(); |
---|
177 | gApplication->Terminate(0); |
---|
178 | } |
---|
179 | |
---|
180 | // handle menu commands and main window commands |
---|
181 | Bool_t |
---|
182 | EusoMainFrame::ProcessMessage( Long_t msg, Long_t p1, Long_t p2) { |
---|
183 | switch ( GET_MSG( msg ) ) { |
---|
184 | case kC_COMMAND: |
---|
185 | switch ( GET_SUBMSG( msg ) ) { |
---|
186 | case kCM_BUTTON: |
---|
187 | break; |
---|
188 | case kCM_MENUSELECT: |
---|
189 | break; |
---|
190 | case kCM_MENU: // message from the main menu |
---|
191 | HandleMenuCommand( p1 ); |
---|
192 | break; |
---|
193 | default: |
---|
194 | break; |
---|
195 | } |
---|
196 | break; |
---|
197 | default: |
---|
198 | break; |
---|
199 | } |
---|
200 | return kTRUE; |
---|
201 | } |
---|
202 | |
---|
203 | // enable or disable Event Display menu commands |
---|
204 | void EusoMainFrame::EnableDisplay( Bool_t enable ) { |
---|
205 | if ( enable ) { |
---|
206 | fMenuDisplay->EnableEntry(E_DISPLAY_SHOW_DATA); |
---|
207 | fMenuDisplay->EnableEntry(E_DISPLAY_DUMP_DATA); |
---|
208 | fMenuDisplay->EnableEntry(E_DISPLAY_PRINT_DATA); |
---|
209 | } else { |
---|
210 | fMenuDisplay->DisableEntry(E_DISPLAY_SHOW_DATA); |
---|
211 | fMenuDisplay->DisableEntry(E_DISPLAY_DUMP_DATA); |
---|
212 | fMenuDisplay->DisableEntry(E_DISPLAY_PRINT_DATA); |
---|
213 | } |
---|
214 | fMenuDisplay->UnCheckEntry(E_DISPLAY_3D_EVENT); |
---|
215 | } |
---|
216 | |
---|
217 | // enable or disable Compare |
---|
218 | void EusoMainFrame::EnableCompare( Bool_t enable ) { |
---|
219 | if ( enable ) { |
---|
220 | } else { |
---|
221 | } |
---|
222 | } |
---|
223 | |
---|
224 | // handle a gui command |
---|
225 | #define EusoCommandAssociate(s1,s2) {if(p==s1) { s2; return; }} |
---|
226 | void EusoMainFrame::HandleMenuCommand(Int_t p ) { |
---|
227 | EusoCommandAssociate(E_FILE_OPEN_INPUT, GuiFileOpenInput()); |
---|
228 | EusoCommandAssociate(E_FILE_CLOSE_INPUT, GuiFileCloseInput()); |
---|
229 | EusoCommandAssociate(E_FILE_RENAME_OUTPUT,GuiFileRenameOutput()); |
---|
230 | EusoCommandAssociate(E_FILE_OPEN_ROOT_INP,GuiFileOpenRootInput()); |
---|
231 | EusoCommandAssociate(E_FILE_CLOSE_ROOT_INP,GuiFileCloseRootInput()); |
---|
232 | EusoCommandAssociate(E_FILE_CLOSE_ROOT_OUT,GuiFileCloseRootOutput()); |
---|
233 | EusoCommandAssociate(E_FILE_EXIT_PROGRAM, CloseWindow()); |
---|
234 | EusoCommandAssociate(E_CONFIG_SELECT_FILES, GuiConfigSelectFiles()); |
---|
235 | EusoCommandAssociate(E_CONFIG_SHOWER_SLAST, GuiConfigShowerBySlast()); |
---|
236 | EusoCommandAssociate(E_CONFIG_TESTLIGHTTOEUSO, GuiConfigTestLightToEuso()); |
---|
237 | EusoCommandAssociate(E_CONFIG_EUSO, GuiConfigEuso()); |
---|
238 | EusoCommandAssociate(E_RUN_SINGLE, GuiRunSingle() ); |
---|
239 | EusoCommandAssociate(E_RUN_ALL,GuiRunAll()); |
---|
240 | EusoCommandAssociate(E_RUN_REDO,GuiRunRedo()); |
---|
241 | EusoCommandAssociate(E_RUN_REDOALL, GuiRunRedoAll()); |
---|
242 | EusoCommandAssociate(E_RUN_SET, GuiRunSet()); |
---|
243 | EusoCommandAssociate(E_DISPLAY_SHOW_DATA,GuiDisplayShowData()); |
---|
244 | EusoCommandAssociate(E_DISPLAY_DUMP_DATA,GuiDisplayDumpData()); |
---|
245 | EusoCommandAssociate(E_DISPLAY_3D_EVENT,GuiDisplayToggle3DViewer()); |
---|
246 | EusoCommandAssociate(E_ROOT_HIST,GuiRootHistos()); |
---|
247 | EusoCommandAssociate(E_ROOT_TREE,GuiRootTree()); |
---|
248 | EusoCommandAssociate(E_ROOT_BROWSER,GuiRootBrowser()); |
---|
249 | } |
---|
250 | |
---|
251 | // individual command functions |
---|
252 | |
---|
253 | // open input file |
---|
254 | // FIXME: just demo right now.... |
---|
255 | void EusoMainFrame::GuiFileOpenInput() { |
---|
256 | TGFileInfo *info = new TGFileInfo(); |
---|
257 | info->fIniDir = new char[500]; |
---|
258 | sprintf(info->fIniDir,"./"); |
---|
259 | info->fFilename = 0; |
---|
260 | info->fFileTypes = gInputFileTypes; |
---|
261 | new TGFileDialog(fClient->GetRoot(),this,kFDOpen,info); |
---|
262 | if ( info->fFilename ) { |
---|
263 | ConfigFileParser* runpar = Config::Get()->GetCF("General","Run"); |
---|
264 | runpar->ReplaceStr("InputFileName",string(info->fFilename) ); |
---|
265 | fMenuFile->DisableEntry(E_FILE_OPEN_INPUT); |
---|
266 | fMenuFile->EnableEntry(E_FILE_CLOSE_INPUT); |
---|
267 | } |
---|
268 | delete info; |
---|
269 | EnableDisplay( kFALSE ); |
---|
270 | } |
---|
271 | |
---|
272 | // close input file |
---|
273 | void EusoMainFrame::GuiFileCloseInput() { |
---|
274 | fMenuFile->DisableEntry(E_FILE_CLOSE_INPUT); |
---|
275 | fMenuFile->EnableEntry(E_FILE_OPEN_INPUT); |
---|
276 | EnableDisplay( kFALSE ); |
---|
277 | } |
---|
278 | |
---|
279 | // rename output file name (root file) |
---|
280 | void EusoMainFrame::GuiFileRenameOutput() { |
---|
281 | // fClient->WaitFor( new OutputRenameDlg(fClient->GetRoot(),this)); |
---|
282 | NOT_IMPLEMENTED_YET(); |
---|
283 | } |
---|
284 | |
---|
285 | // open existing root file for reading |
---|
286 | void EusoMainFrame::GuiFileOpenRootInput() { |
---|
287 | if ( theApp->Manager()->GetFile() ) { |
---|
288 | char s[300]; |
---|
289 | sprintf(s,"Simulation of event %d completed",theApp->EvCounter()); |
---|
290 | new TGMsgBox(fClient->GetRoot(), this, |
---|
291 | "ESAF Message", |
---|
292 | "You must close the root output file first!!\nGo to \"File\" --> Close output", |
---|
293 | kMBIconExclamation); |
---|
294 | return; |
---|
295 | } |
---|
296 | TGFileInfo *info = new TGFileInfo(); |
---|
297 | info->fIniDir = new char[500]; |
---|
298 | sprintf(info->fIniDir,"./"); |
---|
299 | info->fFilename = 0; |
---|
300 | info->fFileTypes = gRootFileTypes; |
---|
301 | new TGFileDialog(fClient->GetRoot(),this,kFDOpen,info); |
---|
302 | if ( info->fFilename ) { |
---|
303 | OpenRootInputFile( info->fFilename ); |
---|
304 | } |
---|
305 | delete info; |
---|
306 | fMenuFile->EnableEntry(E_FILE_CLOSE_ROOT_INP); |
---|
307 | fMenuFile->DisableEntry(E_FILE_OPEN_ROOT_INP); |
---|
308 | EnableDisplay( kTRUE); |
---|
309 | } |
---|
310 | |
---|
311 | // helper functions for opening and closing root file |
---|
312 | void EusoMainFrame::CloseRootInputFile() { |
---|
313 | if ( RootInputFile()) |
---|
314 | RootInputFile()->Close(); |
---|
315 | fRootInputFile = NULL; |
---|
316 | } |
---|
317 | |
---|
318 | void EusoMainFrame::OpenRootInputFile( const char* fname) { |
---|
319 | CloseRootInputFile(); |
---|
320 | fRootInputFile = new TFile( fname ); |
---|
321 | if ( fRootInputFile->IsZombie() ) { |
---|
322 | char msg[300]; |
---|
323 | sprintf(msg,"File %s not found",fname); |
---|
324 | new TGMsgBox(fClient->GetRoot(),this,"ESAF Message",msg,kMBIconExclamation); |
---|
325 | fRootInputFile = NULL; |
---|
326 | } |
---|
327 | } |
---|
328 | |
---|
329 | // close root file for reading |
---|
330 | void EusoMainFrame::GuiFileCloseRootInput() { |
---|
331 | if ( RootInputFile() ) |
---|
332 | CloseRootInputFile(); |
---|
333 | fMenuFile->EnableEntry(E_FILE_OPEN_ROOT_INP); |
---|
334 | fMenuFile->DisableEntry(E_FILE_CLOSE_ROOT_INP); |
---|
335 | } |
---|
336 | |
---|
337 | // close root file for writing |
---|
338 | void EusoMainFrame::GuiFileCloseRootOutput() { |
---|
339 | if ( theApp->Manager()->GetFile() ) |
---|
340 | theApp->Manager()->Close(); |
---|
341 | fMenuFile->EnableEntry(E_FILE_OPEN_ROOT_INP); |
---|
342 | fMenuFile->DisableEntry(E_FILE_CLOSE_ROOT_INP); |
---|
343 | } |
---|
344 | |
---|
345 | // edit config file |
---|
346 | void EusoMainFrame::GuiConfigSelectFiles() { |
---|
347 | theApp->SetLock(); |
---|
348 | TGFileInfo *info = new TGFileInfo(); |
---|
349 | info->fIniDir = new char[500]; |
---|
350 | sprintf(info->fIniDir,"./config"); |
---|
351 | info->fFilename=0; |
---|
352 | info->fFileTypes = gConfigFileTypes; |
---|
353 | new TGFileDialog(fClient->GetRoot(),this,kFDOpen,info); |
---|
354 | if ( info->fFilename ) { |
---|
355 | new ConfigEditorDlg(theApp,info->fFilename,this); |
---|
356 | } |
---|
357 | delete info; |
---|
358 | } |
---|
359 | |
---|
360 | // configure ShowerBySlast parameters |
---|
361 | void EusoMainFrame::GuiConfigShowerBySlast() { |
---|
362 | theApp->SetLock(); |
---|
363 | fClient->WaitFor( new ConfigEditorDlg(theApp, |
---|
364 | "config/LightToEuso/SlastLightToEuso.cfg",this ) ); |
---|
365 | theApp->SetLock( false ); |
---|
366 | theApp->SetChanged(kESAFLight); |
---|
367 | theApp->Build(); |
---|
368 | } |
---|
369 | |
---|
370 | // configure TestLightToEuso parameters |
---|
371 | void EusoMainFrame::GuiConfigTestLightToEuso(){ |
---|
372 | theApp->SetLock(); |
---|
373 | fClient->WaitFor(new ConfigEditorDlg(theApp, |
---|
374 | "./config/LightToEuso/TestLightToEuso.cfg",this)); |
---|
375 | theApp->SetLock( false ); |
---|
376 | theApp->SetChanged(kESAFLight); |
---|
377 | theApp->Build(); |
---|
378 | } |
---|
379 | |
---|
380 | // configure euso detector parameters |
---|
381 | void EusoMainFrame::GuiConfigEuso() { |
---|
382 | theApp->SetLock(); |
---|
383 | fClient->WaitFor( new DetectorConfigDlg(theApp,fClient->GetRoot(),this ) ); |
---|
384 | theApp->SetLock( false ); |
---|
385 | } |
---|
386 | |
---|
387 | // execute one single event |
---|
388 | // run program on a single event |
---|
389 | void EusoMainFrame::DoEvent() { |
---|
390 | if ( ! (theApp->DoEvent()) ) { |
---|
391 | char s[300]; |
---|
392 | sprintf(s,"An error occurred during simulation of event %d", |
---|
393 | theApp->EvCounter() ); |
---|
394 | new TGMsgBox(fClient->GetRoot(), this, |
---|
395 | "Euso Application Error",s,kMBIconExclamation); |
---|
396 | } |
---|
397 | else { |
---|
398 | char s[300]; |
---|
399 | sprintf(s,"Simulation of event %d completed",theApp->EvCounter()); |
---|
400 | new TGMsgBox(fClient->GetRoot(), this, |
---|
401 | "Euso Application Message", s,kMBIconExclamation); |
---|
402 | } |
---|
403 | } |
---|
404 | |
---|
405 | |
---|
406 | // run program on a single event |
---|
407 | // in this case the root file is not written and the event just kept in memory |
---|
408 | // |
---|
409 | void EusoMainFrame::GuiRunSingle() { |
---|
410 | theApp->ResetCopies(); |
---|
411 | EnableCompare( false ); |
---|
412 | if ( theApp->Manager()->GetFile() ) { |
---|
413 | theApp->Manager()->Close(); |
---|
414 | fMenuFile->DisableEntry(E_FILE_CLOSE_ROOT_OUT); |
---|
415 | } |
---|
416 | |
---|
417 | // theApp->CreateRootEvent(); |
---|
418 | DoEvent(); |
---|
419 | EnableDisplay(); |
---|
420 | } |
---|
421 | |
---|
422 | // redo last event |
---|
423 | void EusoMainFrame::GuiRunRedo() { |
---|
424 | // keep a copy of last event |
---|
425 | theApp->CopyEvent(); |
---|
426 | // do event |
---|
427 | DoEvent(); |
---|
428 | EnableCompare( true ); |
---|
429 | } |
---|
430 | |
---|
431 | // run all events |
---|
432 | void EusoMainFrame::GuiRunAll() { |
---|
433 | NOT_IMPLEMENTED_YET(); |
---|
434 | } |
---|
435 | |
---|
436 | // re-run from beginning |
---|
437 | void EusoMainFrame::GuiRunRedoAll() { |
---|
438 | NOT_IMPLEMENTED_YET(); |
---|
439 | } |
---|
440 | |
---|
441 | // set run parameters |
---|
442 | void EusoMainFrame::GuiRunSet() { |
---|
443 | NOT_IMPLEMENTED_YET(); |
---|
444 | } |
---|
445 | |
---|
446 | // show data (histograms and numbers ) for last simulated event |
---|
447 | // just open a dedicated dialog and returns |
---|
448 | void EusoMainFrame::GuiDisplayShowData() { |
---|
449 | new ShowHistoDlg(theApp,fClient->GetRoot(),this); |
---|
450 | } |
---|
451 | |
---|
452 | // dump data for last simulated event |
---|
453 | void EusoMainFrame::GuiDisplayDumpData() { |
---|
454 | NOT_IMPLEMENTED_YET(); |
---|
455 | } |
---|
456 | |
---|
457 | // enable/disable 3D viewer |
---|
458 | void EusoMainFrame::GuiDisplayToggle3DViewer() { |
---|
459 | } |
---|
460 | |
---|
461 | // histograms from one root file |
---|
462 | void EusoMainFrame::GuiRootHistos() { |
---|
463 | TTree *tree = GetTree(); |
---|
464 | if ( tree ) { |
---|
465 | new ShowHistoDlg(theApp,fClient->GetRoot(),this,tree); |
---|
466 | } |
---|
467 | } |
---|
468 | |
---|
469 | TTree* EusoMainFrame::GetTree() { |
---|
470 | if ( RootInputFile() ) { |
---|
471 | RootInputFile()->cd(); |
---|
472 | TTree* tree = (TTree*)gDirectory->FindObject( "etree" ); |
---|
473 | if ( !tree ) { |
---|
474 | tree = (TTree*)gDirectory->GetKey("etree")->ReadObj(); |
---|
475 | if (!tree) { |
---|
476 | new TGMsgBox(fClient->GetRoot(),this,"ESAF Message", |
---|
477 | "Cannot find a valid Euso Tree", |
---|
478 | kMBIconExclamation); |
---|
479 | } |
---|
480 | } |
---|
481 | return tree; |
---|
482 | } |
---|
483 | new TGMsgBox(fClient->GetRoot(), this, "ESAF Message", |
---|
484 | "File not opened", kMBIconExclamation ); |
---|
485 | return 0; |
---|
486 | } |
---|
487 | |
---|
488 | // open tree viewer |
---|
489 | void EusoMainFrame::GuiRootTree() { |
---|
490 | } |
---|
491 | |
---|
492 | // display root browser |
---|
493 | void EusoMainFrame::GuiRootBrowser() { |
---|
494 | TBrowser *Browser = new TBrowser("EusoBrowser","Euso root objects"); |
---|
495 | Browser->Show(); |
---|
496 | } |
---|
497 | |
---|
498 | |
---|