BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
BesClient.cxx
Go to the documentation of this file.
1//
2// BesClient.cxx
3//
4
5
6#include "BesVisClient/BesClient.h"
7#include "BesVisClient/BesAboutHelp.h"
8#include "BesVisClient/BesMdcPalette.h"
9#include "BesVisLib/BesVisDisplay.h"
10#include "BesVisLib/BesCursor.h"
11#include <iostream>
12#include <sstream>
13#include <fstream>
14
15#include <TList.h>
16#include <TRootEmbeddedCanvas.h>
17#include <TTimer.h>
18#include <TApplication.h>
19#include <TInterpreter.h>
20#include <TBranch.h>
21#include <TFile.h>
22#include <TTree.h>
23#include <TSystem.h>
24#include <TGeoManager.h>
25#include <TGButton.h>
26#include <TGMenu.h>
27#include <TGLayout.h>
28#include <TGStatusBar.h>
29#include <TGFileDialog.h>
30#include <TGNumberEntry.h>
31#include <TGMsgBox.h>
32#include <TGProgressBar.h>
33#include <TGTab.h>
34#include <TGSplitter.h>
35#include <TGCanvas.h>
36#include <TSystem.h>
37#include <TGListTree.h>
38#include <TGLabel.h>
39#include <TGButtonGroup.h>
40#include <TGTextEntry.h>
41#include <TGTextBuffer.h>
42#include <TG3DLine.h>
43#include <TGSlider.h>
44#include <TCanvas.h>
45#include <TView.h>
46#include <TGeometry.h>
47#include <TASImage.h>
48#include <TColor.h>
49#include <TViewerX3D.h>
50// tianhl, TViewerOpneGL has been removed; waiting for new Class
51//#include <TViewerOpenGL.h>
52#include <TVirtualViewer3D.h>
53//#include <TGLEditor.h>
54#include <TVirtualGL.h>
55#include <TVirtualGeoPainter.h>
56#include <TRootHelpDialog.h>
57#include <TRootDialog.h>
58
59#include "RootEventData/TRecTrackEvent.h"
60#include "RootEventData/TDigiEvent.h"
61#include "RootEventData/TDisTrack.h"
62#include "RootEventData/TRecEvTime.h"
63using namespace std;
64
65//#ifndef __CINT__
67//#endif
68
69const char gHelpBesVis[] = "\
70 PRESS \n\
71 \tg\t--- save graph\n\
72 \tn\t--- next event\n\
73 \tp\t--- previous event\n\n\
74 \tw\t--- move up\n\
75 \ta\t--- move left\n\
76 \ts\t--- move down\n\
77 \td\t--- move right\n\n\
78 \tq\t--- zoom out\n\
79 \te\t--- zoom in\n\n" //hehe, too long string literal :)))
80 "\n\
81 Add more...";
82
83const char *OpenGeoTypes[] = {"ROOT files", "*.root",
84 "GDML files", "*.gdml",
85 0, 0
86 };
87
88const char *SaveGeoTypes[] = {"REC files", "*.rec",
89 "ROOT files", "*.root",
90 0, 0
91 };
92
93const char *OpenEventTypes[] = {"ROOT files", "*.root",
94 "rec files", "*.rec",
95 "raw files", "*.rtraw",
96//#ifdef CF__ZSMSM
97 "Generic Adamo files", "*.cz",
98//#endif
99 0, 0
100 };
101
102const char *SavePicTypes[] = {"GIF", "*.gif",
103 "JPG", "*.jpg",
104 "PS", "*.ps",
105 "EPS", "*.eps",
106 "XPM", "*.xpm",
107 "PNG", "*.png",
108 "TIFF", "*.tiff",
109 0, 0
110 };
111
112const char *SavePicPS[] = {"PS", "*.ps",
113 0, 0
114 };
115
116extern char *optarg;
117extern int optint, opterr;
118
119struct sembuf acquire = {
120 0, -1, SEM_UNDO
121};
122struct sembuf release = {
123 0, 1, SEM_UNDO
124};
125
126
127//__________________________________________________________________
128// BesClient
129// Bes event display client
130//
131//
132BesClient::BesClient(const TGWindow *p, const char* title,
133 UInt_t width, UInt_t height, Option_t *option, Int_t argc, char **argv) :
134 TGMainFrame(p, width, height) {
135
136 //
137 // BesClient default contructor
138 if ( gDebug ) cout << "BesClient ctor called" << endl;
139
140 //// acquire semaphore, decrease resource supply
141 //acquire.sem_num = 0;
142 //acquire.sem_op = -1;
143 //acquire.sem_flg = SEM_UNDO;
144
145 //// release semaphore, increase resource supply
146 //release.sem_num = 0;
147 //release.sem_op = 1;
148 //release.sem_flg = SEM_UNDO;
149 //recdis = NULL;
150 recTrack1 = NULL;
151 mdchit = NULL;
152 //kalTrack = NULL;
153 tofTrack = NULL;
154 muctrk = NULL;
155 emcshower = NULL;
156 // fRecEvent_1 =0;
157
158
159 fEventTree = 0;
160
161 // init parameters
162 this->InitParameter();
163
164 // init local variables
165 this->InitLocal();
166
167 // Create toplevel widget
168 this->CreateWidget(title, fWindowWidth, fWindowHeight);
169
170 // connections to messaging queues
171 this->InitConnections();
172
173 this->SetBackgroundPixmap(GetPic("background.gif"));
174
175 f_bossMode = false;
176 int optchar;
177 static char optstring[] = "g:e:B:";
178 opterr = 0;
179 fEventFile = NULL;
180
181 // detail information about getopt can be get by man order in shell
182 while ((optchar = getopt(argc, argv, optstring)) != -1)
183 switch (optchar) {
184 case 'g':
185 f_geoFile = optarg;
186 cout << "Load Geometry file with arguments" << endl;
187 cout << "Geofile: " << f_geoFile << endl;
188 break;
189 case 'e':
190 f_evtFile = optarg;
191 cout << "Load Event file with argments" << endl;
192 cout << "Evtfile: " << f_evtFile << endl;
193 break;
194 case 'B':
195 f_bossMode = true;
196 f_pid = atoi(optarg);
197 cout << "Run in the Boss Framework: " << f_bossMode << endl;
198 cout << "parent pid: " << f_pid << endl;
199 break;
200 case '?':
201 cout << "Found an option that was not in optstring!" << endl;
202 }
203 if (optind < argc)
204 cout << "Left off at: " << argv[optind] << endl;
205
206 this->LoadGeoFile();
207
208 if ( f_bossMode == false){
209 if ( f_evtFile.Length() != 0){
210 this->OpenEventFile(f_evtFile);
211 // this->GetEvent(0);
212 }
213 }
214 else if (f_bossMode == true){
215 fAutoDisplayEvent = kTRUE;
216 f_runStatus = RUN_SMOOTH;
217 cout << "Load event file: " << f_evtFile << endl;
218 fCurrentEvent = 0;
219 this->GetRecEvent();
220 }
221
222 this->UpdateStatus();
223}
224
225//___________________________________________________________________
226
228 //
229 // BesClient standard destructor
230 if ( gDebug ) {
231 cout << "BesClient dtor called" << endl;
232 }
233
234 fWidgets->Delete();
235 delete fWidgets;
236}
237
238//__________________________________________________________________
239
240void BesClient::CreateWidget(const char* title, UInt_t width, UInt_t height) {
241 //
242 // Create display
243
244 //CreateHorizontalRuler();
245
246 // Create menu bar
248 //fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 10, 100, 2, 2);
249 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 0);
250 fWidgets->Add(fLayout);
251 this->AddFrame(fMenuBar, fLayout);
252
253 //CreateHorizontalRuler();
254
255 // Create upButton bar
257 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 0, 0, 1);
258 fWidgets->Add(fLayout);
259 this->AddFrame(fUpButtonBarFrame, fLayout);
260
261 //CreateHorizontalRuler();
262
263 // Create title bar
265 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 5, 5, 0, 0);
266 fWidgets->Add(fLayout);
267 this->AddFrame(fTitleFrame, fLayout);
268
269 //CreateHorizontalRuler();
270
271 // Create main frame
273 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0);
274 fWidgets->Add(fLayout);
275 this->AddFrame(fMainFrame, fLayout);
276
277 // Create display mode bar
279 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0);
280 fWidgets->Add(fLayout);
281 this->AddFrame(fDisplayModeBarFrame, fLayout);
282
283 // Create toolbar
285 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 3, 0, 1, 0);
286 fWidgets->Add(fLayout);
287 this->AddFrame(fToolBarFrame, fLayout);
288
289 // Create status bar
291 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0);
292 fWidgets->Add(fLayout);
293 this->AddFrame(fStatusBar, fLayout);
294
295 // Toplevel widget layout
296 TString ttitle(title);
297 ttitle.Append("@");
298 ttitle.Append(gSystem->HostName());
299 SetWindowName(ttitle);
300 SetIconName(title);
301 SetIconPixmap( (fBesVisPath + TString("/icons/LogoBesVisMini.gif")).Data() );
302 SetClassHints("BesVis", "Bes Event Visualisation");
303
304 SetWMPosition(10, 10); // position of the window
305 SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless);
306 MapSubwindows();
307 Resize(GetDefaultSize());
308 Resize(width, height);
309 MapWindow();
310}
311
313 //
314 // Add horizontal ruler
315 // cout << " horizontal ruler" << endl;
316 fLayout = new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0);
317 fWidgets->Add(fLayout);
318 this->AddFrame(new TGHorizontal3DLine(this), fLayout);
319}
320
321//__________________________________________________________________
322
324 //
325 // Create the menu bar and popup menus
326
327 // Layouts
328 fMenuBarFirstItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft,
329 30, 0, 1, 2);
330 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft,
331 20, 0, 1, 2);
332 fMenuBarLastItemLayout = new TGLayoutHints(kLHintsTop | kLHintsRight,
333 20, 20, 1, 2);
334
335 //const TGPicture *label2 = gClient->GetPicture("popMenuLabel2.gif");
336 const TGPicture *viewGeometryIcon = gClient->GetPicture("viewGeometry.gif");
337 //const TGPicture *normalPopupEntryIcon = gClient->GetPicture("normalPopupEntry1.gif");
338
339 //
340 // File menu
341 // =========
342 fMenuFile = new TGPopupMenu(gClient->GetRoot());
343 //fMenuFile->SetBackgroundPixmap(GetPic("2.gif"));
344 fMenuFile->AddEntry("Load &Geometry File...", kM_File_LoadGeo);
345 fMenuFile->AddEntry("&Save Geometry as...", kM_File_SaveGeoAs);
346 fMenuFile->AddEntry("Load &Event File...", kM_File_OpenEvent);
347 fMenuFile->AddEntry("Save &Picture as...", kM_File_SavePicAs);
348 fMenuFile->AddSeparator();
349 fMenuFile->AddEntry("&Quit BesVis", kM_File_Exit);
350
351 //
352 // Edit menu
353 // =========
354 fMenuEdit = new TGPopupMenu(gClient->GetRoot());
355 //fMenuEdit->SetBackgroundPixmap(GetPic("popMenuBorder.gif"));
356 fMenuEdit->AddEntry("&Editor", kM_Edit_Editor);
357
358 //
359 // View-Option Header menu
360 // =======================
361 fMenuViewOptionHeader = new TGPopupMenu(gClient->GetRoot());
362 fMenuViewOptionHeader->AddEntry("Show Header",kM_Header_On);
363
364 //
365 // View-Option Mdc menu
366 // ====================
367 fMenuViewOptionMdc = new TGPopupMenu(gClient->GetRoot());
368 fMenuViewOptionMdc->AddEntry("Global", kM_Mdc_Global);
369 fMenuViewOptionMdc->AddEntry("Tube", kM_Mdc_Tubes);
370 fMenuViewOptionMdc->AddEntry("Wires", kM_Mdc_Wires);
371 //
372 // View-Option Tof menu
373 // ====================
374 fMenuViewOptionTof = new TGPopupMenu(gClient->GetRoot());
375 fMenuViewOptionTof->AddEntry("Global", kM_Tof_Global);
376 fMenuViewOptionTof->AddEntry("East", kM_Tof_East);
377 fMenuViewOptionTof->AddEntry("Barrel", kM_Tof_Barrel);
378 fMenuViewOptionTof->AddEntry("West", kM_Tof_West);
379 //
380 // View-Option Emc menu
381 // ====================
382 fMenuViewOptionEmc = new TGPopupMenu(gClient->GetRoot());
383 fMenuViewOptionEmc->AddEntry("Global", kM_Emc_Global);
384 fMenuViewOptionEmc->AddEntry("East", kM_Emc_East);
385 fMenuViewOptionEmc->AddEntry("Barrel", kM_Emc_Barrel);
386 fMenuViewOptionEmc->AddEntry("West", kM_Emc_West);
387 fMenuViewOptionEmc->AddEntry("Side", kM_Emc_Side);
388 //
389 // View-Option Muc menu
390 // ====================
391 fMenuViewOptionMuc = new TGPopupMenu(gClient->GetRoot());
392 fMenuViewOptionMuc->AddEntry("Global", kM_Muc_Global);
393 fMenuViewOptionMuc->AddEntry("East", kM_Muc_East);
394 fMenuViewOptionMuc->AddEntry("Barrel", kM_Muc_Barrel);
395 fMenuViewOptionMuc->AddEntry("West", kM_Muc_West);
396 fMenuViewOptionMuc->AddEntry("Strips", kM_Muc_Strips);
397 //
398 // View-Option Full3D menu
399 // ====================
400 fMenuViewOptionFull3D = new TGPopupMenu(gClient->GetRoot());
401 fMenuViewOptionFull3D->AddEntry("Mdc", kM_Full3D_Mdc);
402 fMenuViewOptionFull3D->AddEntry("Tof", kM_Full3D_Tof);
403 fMenuViewOptionFull3D->AddEntry("Emc", kM_Full3D_Emc);
404 fMenuViewOptionFull3D->AddEntry("Muc", kM_Full3D_Muc);
405 //
406 // View-Option Others menu
407 // ====================
408 fMenuViewOptionOthers = new TGPopupMenu(gClient->GetRoot());
409 fMenuViewOptionOthers->AddEntry("BeamPipe", kM_BeamPipe);
410 fMenuViewOptionOthers->AddEntry("ZRPlaneOnXY", kM_ZRPlaneOnXY);
411 fMenuViewOptionOthers->AddEntry("Axis", kM_Axis);
412
413 //
414 // View-Option Mdc Hits menu
415 // ====================
416 fMenuViewOptionMdcHits = new TGPopupMenu(gClient->GetRoot());
417 fMenuViewOptionMdcHits->AddEntry("Hits",kM_MdcHits_Hits);
418 //
419 // View-Option Tof Hits menu
420 // =========================
421 fMenuViewOptionTofHits = new TGPopupMenu(gClient->GetRoot());
422 fMenuViewOptionTofHits->AddEntry("Global Hits", kM_TofHits_Global);
423 fMenuViewOptionTofHits->AddEntry("East Hits", kM_TofHits_East);
424 fMenuViewOptionTofHits->AddEntry("Barrel Hits", kM_TofHits_Barrel);
425 fMenuViewOptionTofHits->AddEntry("West Hits", kM_TofHits_West);
426 //
427 // View-Option Emc Hits menu
428 // =========================
429 fMenuViewOptionEmcHits = new TGPopupMenu(gClient->GetRoot());
430 fMenuViewOptionEmcHits->AddEntry("Global Hits", kM_EmcHits_Global);
431 fMenuViewOptionEmcHits->AddEntry("East Hits", kM_EmcHits_East);
432 fMenuViewOptionEmcHits->AddEntry("Barrel Hits", kM_EmcHits_Barrel);
433 fMenuViewOptionEmcHits->AddEntry("West Hits", kM_EmcHits_West);
434 fMenuViewOptionEmcHits->AddEntry("Side Hits", kM_EmcHits_Side);
435 //
436 // View-Option Muc Hits menu
437 // =========================
438 fMenuViewOptionMucHits = new TGPopupMenu(gClient->GetRoot());
439 fMenuViewOptionMucHits->AddEntry("Global Hits", kM_MucHits_Global);
440 fMenuViewOptionMucHits->AddEntry("East Hits", kM_MucHits_East);
441 fMenuViewOptionMucHits->AddEntry("Barrel Hits", kM_MucHits_Barrel);
442 fMenuViewOptionMucHits->AddEntry("West Hits", kM_MucHits_West);
443 //
444 // View-Option Tracks menu
445 // =========================
446 fMenuViewOptionTracks = new TGPopupMenu(gClient->GetRoot());
447 fMenuViewOptionTracks->AddEntry("Global ", kM_Tracks_Global);
448 fMenuViewOptionTracks->AddEntry("Mdc ", kM_Tracks_Mdc);
449 fMenuViewOptionTracks->AddEntry("Tof ", kM_Tracks_Tof);
450 fMenuViewOptionTracks->AddEntry("Emc ", kM_Tracks_Emc);
451 fMenuViewOptionTracks->AddEntry("Muc ", kM_Tracks_Muc);
452 fMenuViewOptionTracks->AddEntry("Ext ", kM_Tracks_Ext);
453
454 //
455 // View menu
456 // =========
457 fMenuView = new TGPopupMenu(gClient->GetRoot());
458 //fMenuView->SetBackgroundPixmap(GetPic("2.gif"));
459 fMenuView->AddLabel("General");
460 fMenuView->AddSeparator();
461 fMenuView->AddPopup("Header",fMenuViewOptionHeader);
462 fMenuView->AddSeparator();
463 fMenuView->AddLabel("Detector", viewGeometryIcon);
464 fMenuView->AddSeparator();
465 fMenuView->AddPopup("Mdc",fMenuViewOptionMdc);
466 fMenuView->AddPopup("Tof",fMenuViewOptionTof);
467 fMenuView->AddPopup("Emc",fMenuViewOptionEmc);
468 fMenuView->AddPopup("Muc",fMenuViewOptionMuc);
469 fMenuView->AddPopup("Full3D",fMenuViewOptionFull3D);
470 fMenuView->AddPopup("Others",fMenuViewOptionOthers);
471 fMenuView->AddSeparator();
472 //fMenuView->AddLabel("DST");
473 fMenuView->AddLabel("REC");
474 fMenuView->AddSeparator();
475 fMenuView->AddPopup("Mdc Hits",fMenuViewOptionMdcHits);
476 fMenuView->AddPopup("Tof Hits",fMenuViewOptionTofHits);
477 fMenuView->AddPopup("Emc Hits",fMenuViewOptionEmcHits);
478 fMenuView->AddPopup("Muc Hits",fMenuViewOptionMucHits);
479 fMenuView->AddPopup("Tracks",fMenuViewOptionTracks);
480 fMenuView->AddSeparator();
481 fMenuView->AddLabel("Special Views");
482 fMenuView->AddSeparator();
483 //fMenuView->AddEntry("View with X3D", kM_View_X3D, 0, normalPopupEntryIcon);
484 fMenuView->AddEntry("View with X3D", kM_View_X3D);
485 fMenuView->AddEntry("View with OpenGL", kM_View_OpenGL);
486
487 //
488 // Help menu
489 // =========
490 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
491 //fMenuHelp->SetBackgroundPixmap(GetPic("popMenuBorder.gif"));
492 fMenuHelp->AddEntry("Help &Content", kM_Help_Content);
493 fMenuHelp->AddSeparator();
494 fMenuHelp->AddEntry("About", kM_Help_About);
495
496 // Create the menubar and add popup menus
497 fMenuBar = new BesGMenuBar(this, 1, 1, kHorizontalFrame);
498 fMenuBar->SetBackgroundPixmap(GetPic("MenuBarBckgnd.gif"));
499
500 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarFirstItemLayout);
501 //fMenuBar->AddPopup("&Edit", fMenuEdit, fMenuBarItemLayout); // dont show edit
502 fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
503 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarLastItemLayout);
504
505 fMenuBar->GetMenuTitle(0)->SetPicture(GetPic("MenuFile.gif"));
506 fMenuBar->GetMenuTitle(0)->SetPictureHL(GetPic("MenuFileHL.gif"));
507 fMenuBar->GetMenuTitle(1)->SetPicture(GetPic("MenuView.gif"));
508 fMenuBar->GetMenuTitle(1)->SetPictureHL(GetPic("MenuViewHL.gif"));
509 fMenuBar->GetMenuTitle(2)->SetPicture(GetPic("MenuHelp.gif"));
510 fMenuBar->GetMenuTitle(2)->SetPictureHL(GetPic("MenuHelpHL.gif"));
511
512 //
513 // Connect menu buttons to actions. Menu button messages are
514 // handled by the main frame (i.e. "this") HandleMenu() method., kHorizontalFrame);
515 fMenuFile->Connect("Activated(Int_t)","BesClient",this,"HandleMenu(Int_t)");
516 fMenuEdit->Connect("Activated(Int_t)","BesClient",this,"HandleMenu(Int_t)");
517 fMenuHelp->Connect("Activated(Int_t)","BesClient",this,"HandleMenu(Int_t)");
518 fMenuView->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
519 fMenuViewOptionHeader->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
520 fMenuViewOptionMdc->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
521 fMenuViewOptionTof->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
522 fMenuViewOptionEmc->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
523 fMenuViewOptionMuc->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
524 fMenuViewOptionFull3D->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
525 fMenuViewOptionOthers->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
526 fMenuViewOptionMdcHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
527 fMenuViewOptionTofHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
528 fMenuViewOptionEmcHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
529 fMenuViewOptionMucHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
530 fMenuViewOptionTracks->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
531
532 /*
533 TASImage *asImage = new TASImage("013.gif");
534 Pixmap_t pic1 = asImage->GetPixmap();
535 //asImage->Draw();
536 Pixmap_t pic1 = gVirtualX->ReadGIF(0, 0, "013.gif");
537 fMenuBar->SetBackgroundPixmap(pic1);
538 */
539
540 //fMenuBar->SetBackgroundPixmap(GetPic("background.gif"));
541
542 /*
543 TList *fMenuTitleList = fMenuBar->GetList();
544 cout << "Menu title size " << fMenuTitleList->GetSize() << endl;
545 for (Int_t iTitle = 0; iTitle < fMenuTitleList->GetSize(); iTitle++) {
546 cout << ((TGMenuTitle*)fMenuTitleList->At(iTitle))->GetName() << endl;
547 TGFrameElement *el = (TGFrameElement *)fMenuTitleList->At(iTitle);
548 TGMenuTitle *t = (TGMenuTitle *)el->fFrame;
549 t->SetBackgroundPixmap(GetPic("test.gif"));
550 cout << t->GetName() << endl;
551 t->SetBackgroundColor(kBlack);
552 if (iTitle == 0) {
553 //t->SetHeight(10);
554 t->SetForegroundColor(kWhite);
555 }
556 }
557 */
558}
559
560//__________________________________________________________________
561
563 //
564 fUpButtonBarFrame = new TGCompositeFrame(this, 300, 25, kHorizontalFrame);
565 fUpButtonBarFrame->SetBackgroundPixmap(GetPic("UpButtonBarBckgnd.gif"));
566
567 fUpButtonBarFirstItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 15, 0, 1, 2);
568 fUpButtonBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 2);
569 fUpButtonBarLastItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 13, 1, 2);
570
571 Int_t width = 23, height = 22;
572 Int_t h, charw, w; // of number entry
573 Int_t nUpSplitter = 0;
574
575 // Up Button Splitter
576 for (Int_t i = 0; i < kNUpSplitter; i++) {
577 fUpButtonSplitter[i] = new BesGPictureButton(fUpButtonBarFrame,
578 gClient->GetPicture("UpButtonSplitter.gif"));
579 fUpButtonSplitter[i]->SetHeight(20);
580 fUpButtonSplitter[i]->SetWidth(5);
581 fUpButtonSplitter[i]->SetState(kButtonDisabled);
582 }
583
584 // Load Geo File
585 fLoadGeoFileButton = new BesGPictureButton(fUpButtonBarFrame,
586 gClient->GetPicture("ButtonLoadGeoFile.gif"),
588 fLoadGeoFileButton->SetPictureHL(gClient->GetPicture("ButtonLoadGeoFileHL.gif"));
589 fLoadGeoFileButton->SetToolTipText("Load Geometry File");
590 fLoadGeoFileButton->SetHeight(height);
591 fLoadGeoFileButton->SetWidth(width);
592 fLoadGeoFileButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
593 fUpButtonBarFrame->AddFrame(fLoadGeoFileButton, fUpButtonBarFirstItemLayout);
594
595 // Open Event File
596 fOpenEventFileButton = new BesGPictureButton(fUpButtonBarFrame,
597 gClient->GetPicture("ButtonOpenEventFile.gif"),
599 fOpenEventFileButton->SetPictureHL(gClient->GetPicture("ButtonOpenEventFileHL.gif"));
600 fOpenEventFileButton->SetToolTipText("Open Event File");
601 fOpenEventFileButton->SetHeight(height);
602 fOpenEventFileButton->SetWidth(width);
603 fOpenEventFileButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
604 fUpButtonBarFrame->AddFrame(fOpenEventFileButton, fUpButtonBarItemLayout);
605
606 // Save Pic As
607 fSavePicAsButton = new BesGPictureButton(fUpButtonBarFrame,
608 gClient->GetPicture("ButtonSavePicAs.gif"),
610 fSavePicAsButton->SetPictureHL(gClient->GetPicture("ButtonSavePicAsHL.gif"));
611 fSavePicAsButton->SetToolTipText("Save Picture as");
612 fSavePicAsButton->SetHeight(height);
613 fSavePicAsButton->SetWidth(width);
614 fSavePicAsButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
615 fUpButtonBarFrame->AddFrame(fSavePicAsButton, fUpButtonBarItemLayout);
616
617 // Save Pic As PS
618 fSavePicAsPSButton = new BesGPictureButton(fUpButtonBarFrame,
619 gClient->GetPicture("ButtonSavePicAsPS.gif"),
621 fSavePicAsPSButton->SetPictureHL(gClient->GetPicture("ButtonSavePicAsPSHL.gif"));
622 fSavePicAsPSButton->SetToolTipText("Save Picture as besvis.ps");
623 fSavePicAsPSButton->SetHeight(height);
624 fSavePicAsPSButton->SetWidth(width);
625 fSavePicAsPSButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
626 fUpButtonBarFrame->AddFrame(fSavePicAsPSButton, fUpButtonBarItemLayout);
627
628 // Up Button Splitter
629 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
630 nUpSplitter++;
631
632 // Refresh
633 fRefreshButton = new BesGPictureButton(fUpButtonBarFrame,
634 gClient->GetPicture("ButtonRefresh.gif"),
636 fRefreshButton->SetPictureHL(gClient->GetPicture("ButtonRefreshHL.gif"));
637 fRefreshButton->SetToolTipText("Refresh");
638 fRefreshButton->SetHeight(height);
639 fRefreshButton->SetWidth(width);
640 fRefreshButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
641 fUpButtonBarFrame->AddFrame(fRefreshButton, fUpButtonBarItemLayout);
642
643 // Reset Current
644 fResetCurrentButton = new BesGPictureButton(fUpButtonBarFrame,
645 gClient->GetPicture("ButtonResetCurrent.gif"),
647 fResetCurrentButton->SetPictureHL(gClient->GetPicture("ButtonResetCurrentHL.gif"));
648 fResetCurrentButton->SetToolTipText("Reset Current Pad");
649 fResetCurrentButton->SetHeight(height);
650 fResetCurrentButton->SetWidth(width);
651 fResetCurrentButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
652 fUpButtonBarFrame->AddFrame(fResetCurrentButton, fUpButtonBarItemLayout);
653
654 // Reset All
655 fResetAllButton = new BesGPictureButton(fUpButtonBarFrame,
656 gClient->GetPicture("ButtonResetAll.gif"),
658 fResetAllButton->SetPictureHL(gClient->GetPicture("ButtonResetAllHL.gif"));
659 fResetAllButton->SetToolTipText("Reset All Pads");
660 fResetAllButton->SetHeight(height);
661 fResetAllButton->SetWidth(width);
662 fResetAllButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
663 fUpButtonBarFrame->AddFrame(fResetAllButton, fUpButtonBarItemLayout);
664
665 // Up Button Splitter
666 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
667 nUpSplitter++;
668
669 // Zoom Out
670 fZoomOutButton = new BesGPictureButton(fUpButtonBarFrame,
671 gClient->GetPicture("ButtonZoomOut.gif"),
673 fZoomOutButton->SetPictureHL(gClient->GetPicture("ButtonZoomOutHL.gif"));
674 fZoomOutButton->SetToolTipText("Zoom Out");
675 fZoomOutButton->SetHeight(height);
676 fZoomOutButton->SetWidth(width);
677 fZoomOutButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
678 fUpButtonBarFrame->AddFrame(fZoomOutButton, fUpButtonBarItemLayout);
679
680 // Zoom Ratio number
681 fZoomRatioNumber = new TGNumberEntryField( fUpButtonBarFrame, kM_Button_ZoomRatioNumber,
682 100.0,
683 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
684 fZoomRatioNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
685 h = Int_t(fZoomRatioNumber->GetDefaultHeight()/1.2); // default height 22
686 charw = fZoomRatioNumber->GetCharWidth("0123456");
687 w = charw * TMath::Abs(5) / 10 + 8 + 2 * h / 3 + 2; // 5 is digit width, default width 46
688 //cout << h << " " << w << endl;
689 fZoomRatioNumber->Resize(w, h);
690
691 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
692 fWidgets->Add(fLayout);
693 fUpButtonBarFrame->AddFrame(fZoomRatioNumber, fLayout);
694
695 // "%"
696 fZoomRatioPercentButton = new BesGPictureButton(fUpButtonBarFrame,
697 gClient->GetPicture("ButtonZoomRatioPercent.gif"));
698 fZoomRatioPercentButton->SetHeight(20);
699 fZoomRatioPercentButton->SetWidth(10);
700 fZoomRatioPercentButton->SetState(kButtonDisabled);
701 fUpButtonBarFrame->AddFrame(fZoomRatioPercentButton, fUpButtonBarItemLayout);
702
703 // Zoom In
704 fZoomInButton = new BesGPictureButton(fUpButtonBarFrame,
705 gClient->GetPicture("ButtonZoomIn.gif"),
707 fZoomInButton->SetPictureHL(gClient->GetPicture("ButtonZoomInHL.gif"));
708 fZoomInButton->SetToolTipText("Zoom In");
709 fZoomInButton->SetHeight(height);
710 fZoomInButton->SetWidth(width);
711 fZoomInButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
712 fUpButtonBarFrame->AddFrame(fZoomInButton, fUpButtonBarItemLayout);
713
714 // Cursor Pick
715 fCursorButton[0] = new BesGPictureButton(fUpButtonBarFrame,
716 gClient->GetPicture("ButtonCursorPickST.gif"),
718 fCursorButton[0]->SetState(true); // with "Button***ST" should set state on
719 fCursorButton[0]->SetPictureHL(gClient->GetPicture("ButtonCursorPickHL.gif"));
720 fCursorButton[0]->SetToolTipText("Select Tool");
721 //fCursorButton[0]->SetState(kButtonEngaged);
722
723 // Cursor Hand
724 fCursorButton[1] = new BesGPictureButton(fUpButtonBarFrame,
725 gClient->GetPicture("ButtonCursorHand.gif"),
727 fCursorButton[1]->SetPictureHL(gClient->GetPicture("ButtonCursorHandHL.gif"));
728 fCursorButton[1]->SetToolTipText("Hand Tool");
729
730 for (int i = 0; i < kNCursorState; i++) {
731 fCursorButton[i]->SetHeight(height);
732 fCursorButton[i]->SetWidth(width);
733 fCursorButton[i]->Connect("Clicked()", "BesClient", this, "HandleButtons()");
734 fUpButtonBarFrame->AddFrame(fCursorButton[i], fUpButtonBarItemLayout);
735 }
736
737 // Up Button Splitter
738 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
739 nUpSplitter++;
740
741 // Switch Display Mode
742 fSwitchDisplayModeButton = new BesGPictureButton(fUpButtonBarFrame,
743 gClient->GetPicture("ButtonSwitchDisplayMode.gif"),
745 fSwitchDisplayModeButton->SetPictureHL(gClient->GetPicture("ButtonSwitchDisplayModeHL.gif"));
746 fSwitchDisplayModeButton->SetToolTipText("Switch Display Mode");
747 fSwitchDisplayModeButton->SetHeight(height);
748 fSwitchDisplayModeButton->SetWidth(width);
749 fSwitchDisplayModeButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
750 fUpButtonBarFrame->AddFrame(fSwitchDisplayModeButton, fUpButtonBarItemLayout);
751
752 // Set Home
753 fSetHomeButton = new BesGPictureButton(fUpButtonBarFrame,
754 gClient->GetPicture("ButtonSetHome.gif"),
756 fSetHomeButton->SetPictureHL(gClient->GetPicture("ButtonSetHomeHL.gif"));
757 fSetHomeButton->SetToolTipText("Set home position");
758 fSetHomeButton->SetHeight(height);
759 fSetHomeButton->SetWidth(width);
760 fSetHomeButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
761 fUpButtonBarFrame->AddFrame(fSetHomeButton, fUpButtonBarItemLayout);
762
763 // Go Home
764 fGoHomeButton = new BesGPictureButton(fUpButtonBarFrame,
765 gClient->GetPicture("ButtonGoHome.gif"),
767 fGoHomeButton->SetPictureHL(gClient->GetPicture("ButtonGoHomeHL.gif"));
768 fGoHomeButton->SetToolTipText("Go to home position");
769 fGoHomeButton->SetHeight(height);
770 fGoHomeButton->SetWidth(width);
771 fGoHomeButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
772 fUpButtonBarFrame->AddFrame(fGoHomeButton, fUpButtonBarItemLayout);
773
774 // Save My style
775 fSaveMyConfigButton = new BesGPictureButton(fUpButtonBarFrame,
776 gClient->GetPicture("ButtonSaveMyConfig.gif"),
778 fSaveMyConfigButton->SetPictureHL(gClient->GetPicture("ButtonSaveMyConfigHL.gif"));
779 fSaveMyConfigButton->SetToolTipText("Save My Style");
780 fSaveMyConfigButton->SetHeight(height);
781 fSaveMyConfigButton->SetWidth(width);
782 fSaveMyConfigButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
783 fUpButtonBarFrame->AddFrame(fSaveMyConfigButton, fUpButtonBarItemLayout);
784
785 // Load My style
786 fLoadMyConfigButton = new BesGPictureButton(fUpButtonBarFrame,
787 gClient->GetPicture("ButtonLoadMyConfig.gif"),
789 fLoadMyConfigButton->SetPictureHL(gClient->GetPicture("ButtonLoadMyConfigHL.gif"));
790 fLoadMyConfigButton->SetToolTipText("Load My Style");
791 fLoadMyConfigButton->SetHeight(height);
792 fLoadMyConfigButton->SetWidth(width);
793 fLoadMyConfigButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
794 fUpButtonBarFrame->AddFrame(fLoadMyConfigButton, fUpButtonBarItemLayout);
795
796 // Display mdc wire color palette
797 fPaletteButton = new BesGPictureButton(fUpButtonBarFrame,
798 gClient->GetPicture("ButtonPalette.gif"),
800 fPaletteButton->SetPictureHL(gClient->GetPicture("ButtonPaletteHL.gif"));
801 fPaletteButton->SetToolTipText("Palette");
802 fPaletteButton->SetHeight(height);
803 fPaletteButton->SetWidth(width);
804 fPaletteButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
805 fUpButtonBarFrame->AddFrame(fPaletteButton, fUpButtonBarItemLayout);
806
807 // Up Button Splitter
808 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
809 nUpSplitter++;
810
811 // Help
812 fHelpButton = new BesGPictureButton(fUpButtonBarFrame,
813 gClient->GetPicture("ButtonHelp.gif"),
815 fHelpButton->SetPictureHL(gClient->GetPicture("ButtonHelpHL.gif"));
816 fHelpButton->SetToolTipText("Help");
817 fHelpButton->SetHeight(height);
818 fHelpButton->SetWidth(width);
819 fHelpButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
820 fUpButtonBarFrame->AddFrame(fHelpButton, fUpButtonBarLastItemLayout);
821}
822
823//__________________________________________________________________
824
826
827 fDisplayModeBarFrame = new TGCompositeFrame(this, 300, 16, kHorizontalFrame);
828 fDisplayModeBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0);
829
830 fDisplayModeButton[0] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayMode2DST.gif"), kM_Button_DisplayMode2D);
831 fDisplayModeButton[1] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayModeXY.gif"), kM_Button_DisplayModeXY);
832 fDisplayModeButton[2] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayModeZR.gif"), kM_Button_DisplayModeZR);
833 fDisplayModeButton[3] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayMode3D.gif"), kM_Button_DisplayMode3D);
834 fDisplayModeButton[4] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayModeAll.gif"), kM_Button_DisplayModeAll);
835
836 fDisplayModeButton[0]->SetState(true);
837 fDisplayModeButton[1]->SetState(false);
838 fDisplayModeButton[2]->SetState(false);
839 fDisplayModeButton[3]->SetState(false);
840 fDisplayModeButton[4]->SetState(false);
841
842 fDisplayModeButton[0]->SetPictureHL(gClient->GetPicture("DisplayMode2DHL.gif"));
843 fDisplayModeButton[1]->SetPictureHL(gClient->GetPicture("DisplayModeXYHL.gif"));
844 fDisplayModeButton[2]->SetPictureHL(gClient->GetPicture("DisplayModeZRHL.gif"));
845 fDisplayModeButton[3]->SetPictureHL(gClient->GetPicture("DisplayMode3DHL.gif"));
846 fDisplayModeButton[4]->SetPictureHL(gClient->GetPicture("DisplayModeAllHL.gif"));
847
848 fDisplayModeButton[0]->SetToolTipText("XY+ZR view");
849 fDisplayModeButton[1]->SetToolTipText("XY view");
850 fDisplayModeButton[2]->SetToolTipText("ZR view");
851 fDisplayModeButton[3]->SetToolTipText("3D view");
852 fDisplayModeButton[4]->SetToolTipText("All view");
853
854 Int_t width = 16, height = 16;
855 for (Int_t i = 0; i < kNDisplayMode; i++) {
856 fDisplayModeButton[i]->SetState(kButtonUp);
857 fDisplayModeButton[i]->SetHeight(height);
858 fDisplayModeButton[i]->SetWidth(width);
859 fDisplayModeButton[i]->Connect("Clicked()", "BesClient", this, "HandleButtons()");
860 fDisplayModeBarFrame->AddFrame(fDisplayModeButton[i], fDisplayModeBarItemLayout);
861 }
862}
863
864//__________________________________________________________________
865
867
868 fToolBarFrame = new TGCompositeFrame(this, 300, 25, kHorizontalFrame);
869 fToolBarFrame->SetBackgroundPixmap(GetPic("ToolButtonBarBckgnd.gif"));
870
871 fToolBarFirstItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 0, 1, 2);
872 fToolBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 2);
873 fToolBarLastItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 14, 1, 2);
874
875 Int_t width = 23, height = 22;
876 Int_t nToolSplitter = 0;
877
878 // Tool Button Splitter
879 for (Int_t i = 0; i < kNToolSplitter; i++) {
880 fToolButtonSplitter[i] = new BesGPictureButton(fToolBarFrame,
881 gClient->GetPicture("ToolButtonSplitter.gif"));
882 fToolButtonSplitter[i]->SetHeight(20);
883 fToolButtonSplitter[i]->SetWidth(5);
884 fToolButtonSplitter[i]->SetState(kButtonDisabled);
885 }
886
887 // Switch Pad
888 fSwitchPadButton = new BesGPictureButton(fToolBarFrame,
889 gClient->GetPicture("ButtonSwitchPad.gif"),
891 fSwitchPadButton->SetPictureHL(gClient->GetPicture("ButtonSwitchPadHL.gif"));
892 fSwitchPadButton->SetToolTipText("Switch Among Pads");
893 fSwitchPadButton->SetHeight(height);
894 fSwitchPadButton->SetWidth(width);
895 fSwitchPadButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
896 fToolBarFrame->AddFrame(fSwitchPadButton, fToolBarFirstItemLayout);
897
898 // Tool Button Splitter
899 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarItemLayout);
900 nToolSplitter++;
901
902 // Show Info
903 fShowInfoButton = new BesGPictureButton(fToolBarFrame,
904 gClient->GetPicture("ButtonShowInfoST.gif"),
906 fShowInfoButton->SetState(true);
907 fShowInfoButton->SetPictureHL(gClient->GetPicture("ButtonShowInfoHL.gif"));
908 fShowInfoButton->SetToolTipText("Show Info");
909 fShowInfoButton->SetHeight(height);
910 fShowInfoButton->SetWidth(width);
911 fShowInfoButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
912 fToolBarFrame->AddFrame(fShowInfoButton, fToolBarItemLayout);
913
914 // Show Axis
915 fShowAxisButton = new BesGPictureButton(fToolBarFrame,
916 gClient->GetPicture("ButtonShowAxis.gif"),
918 fShowAxisButton->SetPictureHL(gClient->GetPicture("ButtonShowAxisHL.gif"));
919 fShowAxisButton->SetToolTipText("Show Axis");
920 fShowAxisButton->SetHeight(height);
921 fShowAxisButton->SetWidth(width);
922 fShowAxisButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
923 fToolBarFrame->AddFrame(fShowAxisButton, fToolBarItemLayout);
924
925 // Tool Button Splitter
926 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarItemLayout);
927 nToolSplitter++;
928
929 // FishEye View
930 fFishEyeViewButton = new BesGPictureButton(fToolBarFrame,
931 gClient->GetPicture("ButtonFishEyeView.gif"),
933 fFishEyeViewButton->SetPictureHL(gClient->GetPicture("ButtonFishEyeViewHL.gif"));
934 fFishEyeViewButton->SetToolTipText("FishEye View");
935 fFishEyeViewButton->SetHeight(height);
936 fFishEyeViewButton->SetWidth(width);
937 fFishEyeViewButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
938 fToolBarFrame->AddFrame(fFishEyeViewButton, fToolBarItemLayout);
939
940 // ParallelView
941 fParallelViewButton = new BesGPictureButton(fToolBarFrame,
942 gClient->GetPicture("ButtonParallelViewST.gif"),
944 fParallelViewButton->SetState(true);
945 fParallelViewButton->SetPictureHL(gClient->GetPicture("ButtonParallelViewHL.gif"));
946 fParallelViewButton->SetToolTipText("Parallel View");
947 fParallelViewButton->SetHeight(height);
948 fParallelViewButton->SetWidth(width);
949 fParallelViewButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
950 fToolBarFrame->AddFrame(fParallelViewButton, fToolBarItemLayout);
951
952 // Perspective View
953 fPerspectiveViewButton = new BesGPictureButton(fToolBarFrame,
954 gClient->GetPicture("ButtonPerspectiveView.gif"),
956 fPerspectiveViewButton->SetPictureHL(gClient->GetPicture("ButtonPerspectiveViewHL.gif"));
957 fPerspectiveViewButton->SetToolTipText("Perspective View");
958 fPerspectiveViewButton->SetHeight(height);
959 fPerspectiveViewButton->SetWidth(width);
960 fPerspectiveViewButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
961 fToolBarFrame->AddFrame(fPerspectiveViewButton, fToolBarItemLayout);
962
963 // Tool Button Splitter
964 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarItemLayout);
965 nToolSplitter++;
966
967 // OpenGL
968 fOpenGLButton = new BesGPictureButton(fToolBarFrame,
969 gClient->GetPicture("ButtonOpenGL.gif"),
971 fOpenGLButton->SetPictureHL(gClient->GetPicture("ButtonOpenGLHL.gif"));
972 fOpenGLButton->SetToolTipText("OpenGL View");
973 fOpenGLButton->SetHeight(height);
974 fOpenGLButton->SetWidth(width);
975 fOpenGLButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
976 fToolBarFrame->AddFrame(fOpenGLButton, fToolBarItemLayout);
977
978 // X3D
979 fX3DButton = new BesGPictureButton(fToolBarFrame,
980 gClient->GetPicture("ButtonX3D.gif"),
982 fX3DButton->SetPictureHL(gClient->GetPicture("ButtonX3DHL.gif"));
983 fX3DButton->SetToolTipText("X3D View");
984 fX3DButton->SetHeight(height);
985 fX3DButton->SetWidth(width);
986 fX3DButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
987 fToolBarFrame->AddFrame(fX3DButton, fToolBarItemLayout);
988
989 // Tool Button Splitter
990 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarLastItemLayout);
991 nToolSplitter++;
992}
993
994//__________________________________________________________________
995
997 //
998 // Create the title bar
999
1000 // Create frame
1001 fTitleFrame = new TGHorizontalFrame(this, this->GetWidth(), 10);
1002}
1003
1004//__________________________________________________________________
1005
1007 //
1008 // Create status bar
1009 Int_t nPart = 3;
1010 Int_t parts[] = {40, 50, 10};
1011 fStatusBar = new TGStatusBar(this, this->GetWidth(), 20, kHorizontalFrame);
1012 fStatusBar->SetParts(parts, nPart);
1013 fStatusBar->SetBackgroundPixmap(GetPic("StatusBarBckgnd.gif"));
1014 for (Int_t iPart = 0; iPart < nPart; iPart++) {
1015 fStatusBar->GetBarPart(iPart)->SetBackgroundPixmap(GetPic("StatusBarBckgnd.gif"));
1016 }
1017
1018 // Set text
1019 fStatusBar->SetText("Ready", 0);
1020}
1021
1022//__________________________________________________________________
1023
1025 //
1026 // Create main frame containing a tab list,
1027 // the canvas and a toolbar
1028 fMainFrame = new TGHorizontalFrame(this, this->GetWidth(), this->GetHeight()-26);
1029
1030 // This vertical frame is needed for splitter
1031 fV1 = new TGVerticalFrame(fMainFrame, 250, fMainFrame->GetHeight(), kFixedWidth);
1032
1033 // Create display tabs
1034 CreateCanvas();
1035
1036 // Create control tabs
1037 CreateTabs();
1038
1039 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 0, 2, 0, 0);
1040 fWidgets->Add(fLayout);
1041 fV1->AddFrame(fTabs, fLayout);
1042
1043 // Configure Splitter
1044 // fV1->Resize(fTabs->GetWidth(), fV1->GetDefaultHeight());
1045
1046 fMainFrame->AddFrame(fEmbeddedCanvas, fECLayout);
1047
1048 fLayout = new TGLayoutHints(kLHintsRight | kLHintsExpandY);
1049 fWidgets->Add(fLayout);
1050 fMainFrame->AddFrame(fV1, fLayout);
1051
1052 TGVSplitter *VSplitter = new TGVSplitter(fMainFrame);
1053 VSplitter->SetFrame(fV1, kFALSE);
1054 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandY);
1055 fWidgets->Add(fLayout);
1056 fMainFrame->AddFrame(VSplitter, fLayout);
1057}
1058
1059
1060//__________________________________________________________________
1061
1063 //
1064 // Create the embedded canvas
1065 // Create embedded canvas
1066 fECLayout = new TGLayoutHints( kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0);
1067 fEmbeddedCanvas = new TRootEmbeddedCanvas(0, fMainFrame, fMainFrame->GetWidth()/4*3-12, fMainFrame->GetHeight()-46);
1068 Int_t wid = fEmbeddedCanvas->GetCanvasWindowId();
1069 fCanvas = new TCanvas("BesVis", fEmbeddedCanvas->GetWidth(), fEmbeddedCanvas->GetHeight()-10, wid);
1070 fEmbeddedCanvas->AdoptCanvas(fCanvas);
1071 fCanvas->cd();
1072
1073 fDisplay = new BesVisDisplay("BESIII Event Display");
1074 fDisplay->SetCanvas(fCanvas);
1075 fDisplay->Init();
1076
1077}
1078
1079//__________________________________________________________________
1080
1082
1083 //
1084 // Create tabs for event list and geometry check button lists
1085 fTabs = new TGTab(fV1, fV1->GetWidth(), fV1->GetHeight());
1086 //cout << "Tab width " << fV1->GetWidth() << " height " << fV1->GetHeight() << endl;
1087 //fTabs->SetBackgroundPixmap(GetPic("2.gif"));
1088
1089 TGCompositeFrame *tf = 0;
1090 Int_t h, charw, w;
1091
1092 //
1093 // "View" tab
1094 // ================
1095 tf = fTabs->AddTab("View");
1096 tf->SetBackgroundPixmap(GetPic("8.gif"));
1097
1098 //
1099 // frame for auto control
1100 // ===================
1101 fAutoFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
1102 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX , 15, 15, 15, 10);
1103 fWidgets->Add(fLayout);
1104 tf->AddFrame(fAutoFrame, fLayout);
1105 fAutoFrame->SetBackgroundPixmap(GetPic("AutoFrameBckgnd.gif"));
1106
1107 // lable "Auto control"
1108 fAutoTextFrame = new TGCompositeFrame(fAutoFrame, fAutoFrame->GetWidth(), 30, kHorizontalFrame);
1109 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
1110 fWidgets->Add(fLayout);
1111 fAutoFrame->AddFrame(fAutoTextFrame, fLayout);
1112 fAutoTextFrame->SetBackgroundPixmap(GetPic("AutoControlBckgnd.gif"));
1113
1114 fAutoTextLabel = new TGLabel(fAutoTextFrame,"Auto Control ");
1115 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 0);
1116 fWidgets->Add(fLayout);
1117 fAutoTextFrame->AddFrame(fAutoTextLabel, fLayout);
1118 fAutoTextLabel->SetBackgroundPixmap(GetPic("AutoControlBckgnd.gif"));
1119
1120 // --- Auto rotate ---
1121 fFrameAutoRotate = new TGGroupFrame(fAutoFrame, "");
1122 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0);
1123 //fLayout = new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5);
1124 fWidgets->Add(fLayout);
1125 fAutoFrame->AddFrame(fFrameAutoRotate, fLayout);
1126
1127 // "Auto"
1128 fChkBtnAutoRotate = new TGCheckButton(fFrameAutoRotate, "Auto", kM_Button_AutoRotate);
1129 fLayout = new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 2);
1130 fFrameAutoRotate->AddFrame(fChkBtnAutoRotate, fLayout);
1131 fChkBtnAutoRotate->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1132
1133 // rotate speed
1134 fRotateSpeedFrame = new TGCompositeFrame(fFrameAutoRotate, fFrameAutoRotate->GetWidth()-20, 30, kHorizontalFrame);
1135 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 0, 2, 2);
1136 fWidgets->Add(fLayout);
1137 fFrameAutoRotate->AddFrame(fRotateSpeedFrame, fLayout);
1138
1139 // input of rotate speed
1140 fNumEntryRotateSpeed = new TGNumberEntryField( fRotateSpeedFrame, kM_Button_RotateSpeed,
1141 this->GetRotateSpeed(),
1142 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 1 );
1143 h = fNumEntryRotateSpeed->GetDefaultHeight();
1144 charw = fNumEntryRotateSpeed->GetCharWidth("0123456");
1145 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3; // 4 is digit width
1146 fNumEntryRotateSpeed->Resize(w, h);
1147
1148 //fNumEntryRotateSpeed = new TGNumberEntry(fRotateSpeedFrame,this->GetRotateSpeed(), 5 ,kM_Button_RotateSpeed,(TGNumberFormat::EStyle) 1,(TGNumberFormat::EAttribute) 1);
1149 fNumEntryRotateSpeed->SetHeight(20);
1150 fNumEntryRotateSpeed->SetNumber(this->GetRotateSpeed());
1151 fNumEntryRotateSpeed->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1152 fNumEntryRotateSpeed->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
1153 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 2, 2);
1154 fWidgets->Add(fLayout);
1155 fRotateSpeedFrame->AddFrame(fNumEntryRotateSpeed, fLayout);
1156
1157 // label " deg/sec "
1158 fRotateSpeedLabel = new TGLabel(fRotateSpeedFrame," deg/sec ");
1159 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 4, 2, 2);
1160 fWidgets->Add(fLayout);
1161 fRotateSpeedFrame->AddFrame(fRotateSpeedLabel, fLayout);
1162
1163 // rotate FPS
1164 fRotateFPSFrame = new TGCompositeFrame(fFrameAutoRotate, fFrameAutoRotate->GetWidth()-20, 30, kHorizontalFrame);
1165 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 0, 2, 2);
1166 fWidgets->Add(fLayout);
1167 fFrameAutoRotate->AddFrame(fRotateFPSFrame, fLayout);
1168
1169 // input of rotate speed
1170 fNumEntryRotateFPS = new TGNumberEntry(fRotateFPSFrame,this->GetRotateFPS(), 3, kM_Button_RotateFPS,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1);
1171 fNumEntryRotateFPS->SetHeight(20);
1172 fNumEntryRotateFPS->SetNumber(this->GetRotateFPS());
1173 fNumEntryRotateFPS->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1174 fNumEntryRotateFPS->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
1175 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 2, 2);
1176 fWidgets->Add(fLayout);
1177 fRotateFPSFrame->AddFrame(fNumEntryRotateFPS, fLayout);
1178
1179 // label " fps "
1180 fRotateFPSLabel = new TGLabel(fRotateFPSFrame," fps ");
1181 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 4, 2, 2);
1182 fWidgets->Add(fLayout);
1183 fRotateFPSFrame->AddFrame(fRotateFPSLabel, fLayout);
1184
1185
1186 //
1187 // frame for view control
1188 // ===================
1189 fViewFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
1190 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX , 15, 15, 15, 10);
1191 fWidgets->Add(fLayout);
1192 tf->AddFrame(fViewFrame, fLayout);
1193 fViewFrame->SetBackgroundPixmap(GetPic("ViewFrameBckgnd.gif"));
1194
1195 // lable "View control"
1196 fViewTextFrame = new TGCompositeFrame(fViewFrame, fViewFrame->GetWidth(), 30, kHorizontalFrame);
1197 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
1198 fWidgets->Add(fLayout);
1199 fViewFrame->AddFrame(fViewTextFrame, fLayout);
1200 fViewTextFrame->SetBackgroundPixmap(GetPic("ViewControlBckgnd.gif"));
1201
1202 fViewTextLabel = new TGLabel(fViewTextFrame,"View Control ");
1203 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 4);
1204 fWidgets->Add(fLayout);
1205 fViewTextFrame->AddFrame(fViewTextLabel, fLayout);
1206 fViewTextLabel->SetBackgroundPixmap(GetPic("ViewControlBckgnd.gif"));
1207
1208
1209 // rotate step
1210 fRotateStepFrame = new TGCompositeFrame(fViewFrame, fViewFrame->GetWidth()-20, 30, kHorizontalFrame);
1211 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 0, 8, 5);
1212 fWidgets->Add(fLayout);
1213 fViewFrame->AddFrame(fRotateStepFrame, fLayout);
1214
1215 // label " Step: "
1216 fRotateStepLabel = new TGLabel(fRotateStepFrame," Step:");
1217 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 10, 2, 0, 0);
1218 fWidgets->Add(fLayout);
1219 fRotateStepFrame->AddFrame(fRotateStepLabel, fLayout);
1220
1221 // input of rotate step
1222 fNumEntryRotateStep = new TGNumberEntryField( fRotateStepFrame, kM_Button_RotateStep,
1223 this->GetRotateStep(),
1224 (TGNumberFormat::EStyle) 2, (TGNumberFormat::EAttribute) 1 );
1225 h = fNumEntryRotateStep->GetDefaultHeight();
1226 charw = fNumEntryRotateStep->GetCharWidth("0123456");
1227 w = charw * TMath::Abs(5) / 10 + 8 + 2 * h / 3; // 5 is digit width
1228 fNumEntryRotateStep->Resize(w, h);
1229
1230 fNumEntryRotateStep->SetHeight(20);
1231 fNumEntryRotateStep->SetNumber(this->GetRotateStep());
1232 fNumEntryRotateStep->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1233 fNumEntryRotateStep->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
1234 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 0, 0, 0);
1235 fWidgets->Add(fLayout);
1236 fRotateStepFrame->AddFrame(fNumEntryRotateStep, fLayout);
1237
1238 // label " deg "
1239 fRotateStepUnitLabel = new TGLabel(fRotateStepFrame," deg ");
1240 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 0, 4, 0, 0);
1241 fWidgets->Add(fLayout);
1242 fRotateStepFrame->AddFrame(fRotateStepUnitLabel, fLayout);
1243
1244 // frame ViewContent
1245 fViewContentFrame = new TGCompositeFrame(fViewFrame, fViewFrame->GetWidth(), fViewFrame->GetHeight()-30, kVerticalFrame);
1246 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY , 0, 0, 0, 0);
1247 fWidgets->Add(fLayout);
1248 fViewFrame->AddFrame(fViewContentFrame, fLayout);
1249
1250 // frame ViewContent Line1
1251 fViewContent1Frame = new TGCompositeFrame(fViewContentFrame, fViewFrame->GetWidth(), 39, kHorizontalFrame);
1252 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 0, 0, 3, 0);
1253 fWidgets->Add(fLayout);
1254 fViewContent1Frame->SetBackgroundPixmap(GetPic("ViewContent1Bckgnd.gif"));
1255 fViewContentFrame->AddFrame(fViewContent1Frame, fLayout);
1256
1257 // button ViewCounterClockwise
1258 fViewCounterClockWiseButton = new BesGPictureButton(fViewContent1Frame,
1259 gClient->GetPicture("ViewCounterClockwise.gif"),
1261 fViewCounterClockWiseButton->SetToolTipText("Rotate Counter Clockwise");
1262 fViewCounterClockWiseButton->SetHeight(37);
1263 fViewCounterClockWiseButton->SetWidth(37);
1264 fViewCounterClockWiseButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1265
1266 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 22, 0, 0);
1267 fWidgets->Add(fLayout);
1268 fViewContent1Frame->AddFrame(fViewCounterClockWiseButton, fLayout);
1269
1270 // button ViewMoveUp
1271 fViewMoveUpButton = new BesGPictureButton(fViewContent1Frame,
1272 gClient->GetPicture("ViewMoveUp.gif"),
1274 fViewMoveUpButton->SetToolTipText("Move Up");
1275 fViewMoveUpButton->SetHeight(20);
1276 fViewMoveUpButton->SetWidth(23);
1277 fViewMoveUpButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1278
1279 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 5, 5, 0, 0);
1280 fWidgets->Add(fLayout);
1281 fViewContent1Frame->AddFrame(fViewMoveUpButton, fLayout);
1282
1283 // button ViewClockwise
1284 fViewClockWiseButton = new BesGPictureButton(fViewContent1Frame,
1285 gClient->GetPicture("ViewClockwise.gif"),
1287 fViewClockWiseButton->SetToolTipText("Rotate Clockwise");
1288 fViewClockWiseButton->SetHeight(37);
1289 fViewClockWiseButton->SetWidth(37);
1290 fViewClockWiseButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1291
1292 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 22, 5, 0, 0);
1293 fWidgets->Add(fLayout);
1294 fViewContent1Frame->AddFrame(fViewClockWiseButton, fLayout);
1295
1296 // frame ViewContent Line2
1297 fViewContent2Frame = new TGCompositeFrame(fViewContentFrame, fViewFrame->GetWidth(), 23, kHorizontalFrame);
1298 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 0, 0, 0, 0);
1299 fWidgets->Add(fLayout);
1300 fViewContent2Frame->SetBackgroundPixmap(GetPic("ViewContent2Bckgnd.gif"));
1301 fViewContentFrame->AddFrame(fViewContent2Frame, fLayout);
1302
1303 // button ViewMoveLeft
1304 fViewMoveLeftButton = new BesGPictureButton(fViewContent2Frame,
1305 gClient->GetPicture("ViewMoveLeft.gif"),
1307 fViewMoveLeftButton->SetToolTipText("Move Left");
1308 fViewMoveLeftButton->SetHeight(23);
1309 fViewMoveLeftButton->SetWidth(23);
1310 fViewMoveLeftButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1311
1312 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 49, 2, 0, 0);
1313 fWidgets->Add(fLayout);
1314 fViewContent2Frame->AddFrame(fViewMoveLeftButton, fLayout);
1315
1316 // button ViewMoveMoveCenter
1317 fViewMoveCenterButton = new BesGPictureButton(fViewContent2Frame,
1318 gClient->GetPicture("ViewMoveCenter.gif"),
1320 fViewMoveCenterButton->SetToolTipText("Move Center");
1321 fViewMoveCenterButton->SetHeight(13);
1322 fViewMoveCenterButton->SetWidth(13);
1323 fViewMoveCenterButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1324
1325 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 0, 0, 0, 0);
1326 fWidgets->Add(fLayout);
1327 fViewContent2Frame->AddFrame(fViewMoveCenterButton, fLayout);
1328
1329 // button ViewMoveRight
1330 fViewMoveRightButton = new BesGPictureButton(fViewContent2Frame,
1331 gClient->GetPicture("ViewMoveRight.gif"),
1333 fViewMoveRightButton->SetToolTipText("Move Right");
1334 fViewMoveRightButton->SetHeight(23);
1335 fViewMoveRightButton->SetWidth(23);
1336 fViewMoveRightButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1337
1338 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 2, 49, 0, 0);
1339 fWidgets->Add(fLayout);
1340 fViewContent2Frame->AddFrame(fViewMoveRightButton, fLayout);
1341
1342 // frame ViewContent Line3
1343 fViewContent3Frame = new TGCompositeFrame(fViewContentFrame, fViewFrame->GetWidth(), 32, kHorizontalFrame);
1344 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 0, 0, 0, 3);
1345 fWidgets->Add(fLayout);
1346 fViewContent3Frame->SetBackgroundPixmap(GetPic("ViewContent3Bckgnd.gif"));
1347 fViewContentFrame->AddFrame(fViewContent3Frame, fLayout);
1348
1349 // button ViewMoveDown
1350 fViewMoveDownButton = new BesGPictureButton(fViewContent3Frame,
1351 gClient->GetPicture("ViewMoveDown.gif"),
1353 fViewMoveDownButton->SetToolTipText("Move Down");
1354 fViewMoveDownButton->SetHeight(32);
1355 fViewMoveDownButton->SetWidth(23);
1356 fViewMoveDownButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1357
1358 //fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 69, 69, 0, 0);
1359 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 69, 0, 0, 0);
1360 fWidgets->Add(fLayout);
1361 fViewContent3Frame->AddFrame(fViewMoveDownButton, fLayout);
1362
1363 // reset angle button
1364 fViewResetAngleButton = new BesGPictureButton(fViewContent3Frame,
1365 gClient->GetPicture("ViewResetAngle.gif"),
1367
1368 fViewResetAngleButton->SetToolTipText("Reset Angles");
1369 fViewResetAngleButton->SetHeight(27);
1370 fViewResetAngleButton->SetWidth(27);
1371 fViewResetAngleButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1372
1373 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 30, 0, 0, 0);
1374 fWidgets->Add(fLayout);
1375 fViewContent3Frame->AddFrame(fViewResetAngleButton, fLayout);
1376
1377
1378 // frame ViewAngle
1379 fViewAngleFrame = new TGCompositeFrame(fViewContentFrame, fViewContentFrame->GetWidth(), 50, kHorizontalFrame);
1380 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 4, 4, 0, 0);
1381 fWidgets->Add(fLayout);
1382 fViewContentFrame->AddFrame(fViewAngleFrame, fLayout);
1383
1384 // frame ViewAngleTheta
1385 fViewAngleThetaFrame = new TGCompositeFrame(fViewAngleFrame, fViewAngleFrame->GetWidth(), 50, kVerticalFrame);
1386 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 3, 3, 3, 3);
1387 fWidgets->Add(fLayout);
1388 fViewAngleFrame->AddFrame(fViewAngleThetaFrame, fLayout);
1389
1390 // button ViewAngleThetaMinus
1391 fViewAngleThetaMinusButton = new BesGPictureButton(fViewAngleThetaFrame,
1392 gClient->GetPicture("ViewAngleMinus.gif"),
1394 fViewAngleThetaMinusButton->SetToolTipText("Theta -");
1395 fViewAngleThetaMinusButton->SetHeight(22);
1396 fViewAngleThetaMinusButton->SetWidth(22);
1397 fViewAngleThetaMinusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1398
1399 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
1400 fWidgets->Add(fLayout);
1401 fViewAngleThetaFrame->AddFrame(fViewAngleThetaMinusButton, fLayout);
1402
1403 // slider for ViewAngleTheta
1404 fViewAngleThetaSlider = new TGVSlider(fViewAngleThetaFrame, 120, kSlider2 | kScaleBoth, kM_Slider_ViewAngleTheta);
1405 fViewAngleThetaSlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
1406 fViewAngleThetaSlider->SetRange(0, 180);
1407 fViewAngleThetaSlider->SetPosition(0);
1408 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandY, 5, 5, 0, 0);
1409 fWidgets->Add(fLayout);
1410 fViewAngleThetaFrame->AddFrame(fViewAngleThetaSlider, fLayout);
1411
1412 // button ViewAngleThetaPlus
1413 fViewAngleThetaPlusButton = new BesGPictureButton(fViewAngleThetaFrame,
1414 gClient->GetPicture("ViewAnglePlus.gif"),
1416 fViewAngleThetaPlusButton->SetToolTipText("Theta +");
1417 fViewAngleThetaPlusButton->SetHeight(22);
1418 fViewAngleThetaPlusButton->SetWidth(22);
1419 fViewAngleThetaPlusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1420
1421 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
1422 fWidgets->Add(fLayout);
1423 fViewAngleThetaFrame->AddFrame(fViewAngleThetaPlusButton, fLayout);
1424
1425 // number ViewAngleTheta
1426 //fViewAngleThetaNumber = new TGNumberEntry( fViewAngleThetaFrame, 0, 3, kM_Button_ViewAngleThetaNumber,
1427 // (TGNumberFormat::EStyle) 6, (TGNumberFormat::EAttribute) 0 );
1428 fViewAngleThetaNumber = new TGNumberEntryField( fViewAngleThetaFrame, kM_Button_ViewAngleThetaNumber,
1429 fViewAngleThetaSlider->GetPosition(),
1430 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
1431 fViewAngleThetaNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1432 h = fViewAngleThetaNumber->GetDefaultHeight();
1433 charw = fViewAngleThetaNumber->GetCharWidth("0123456");
1434 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3; // 4 is digit width
1435 fViewAngleThetaNumber->Resize(w, h);
1436
1437 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 0);
1438 fWidgets->Add(fLayout);
1439 fViewAngleThetaFrame->AddFrame(fViewAngleThetaNumber, fLayout);
1440
1441 // label theta
1442 fViewAngleThetaLabel = new TGLabel(fViewAngleThetaFrame,"theta");
1443 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 2);
1444 fWidgets->Add(fLayout);
1445 fViewAngleThetaFrame->AddFrame(fViewAngleThetaLabel, fLayout);
1446
1447 // frame ViewAnglePhi
1448 fViewAnglePhiFrame = new TGCompositeFrame(fViewAngleFrame, fViewAngleFrame->GetWidth(), 50, kVerticalFrame);
1449 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 3, 3, 3, 3);
1450 fWidgets->Add(fLayout);
1451 fViewAngleFrame->AddFrame(fViewAnglePhiFrame, fLayout);
1452
1453 // button ViewAnglePhiMinus
1454 fViewAnglePhiMinusButton = new BesGPictureButton(fViewAnglePhiFrame,
1455 gClient->GetPicture("ViewAngleMinus.gif"),
1457 fViewAnglePhiMinusButton->SetToolTipText("Phi -");
1458 fViewAnglePhiMinusButton->SetHeight(22);
1459 fViewAnglePhiMinusButton->SetWidth(22);
1460 fViewAnglePhiMinusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1461
1462 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
1463 fWidgets->Add(fLayout);
1464 fViewAnglePhiFrame->AddFrame(fViewAnglePhiMinusButton, fLayout);
1465
1466 // slider for ViewAnglePhi
1467 fViewAnglePhiSlider = new TGVSlider(fViewAnglePhiFrame, 120, kSlider2 | kScaleBoth, kM_Slider_ViewAnglePhi);
1468 fViewAnglePhiSlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
1469 fViewAnglePhiSlider->SetRange(0, 360);
1470 fViewAnglePhiSlider->SetPosition(0);
1471 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandY, 5, 5, 0, 0);
1472 fWidgets->Add(fLayout);
1473 fViewAnglePhiFrame->AddFrame(fViewAnglePhiSlider, fLayout);
1474
1475 // button ViewAnglePhiPlus
1476 fViewAnglePhiPlusButton = new BesGPictureButton(fViewAnglePhiFrame,
1477 gClient->GetPicture("ViewAnglePlus.gif"),
1479 fViewAnglePhiPlusButton->SetToolTipText("Phi +");
1480 fViewAnglePhiPlusButton->SetHeight(22);
1481 fViewAnglePhiPlusButton->SetWidth(22);
1482 fViewAnglePhiPlusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1483
1484 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
1485 fWidgets->Add(fLayout);
1486 fViewAnglePhiFrame->AddFrame(fViewAnglePhiPlusButton, fLayout);
1487
1488 // number ViewAnglePhi
1489 //fViewAnglePhiNumber = new TGNumberEntry( fViewAnglePhiFrame, 0, 3, kM_Button_ViewAnglePhiNumber,
1490 // (TGNumberFormat::EStyle) 6, (TGNumberFormat::EAttribute) 0 );
1491 fViewAnglePhiNumber = new TGNumberEntryField( fViewAnglePhiFrame, kM_Button_ViewAnglePhiNumber,
1492 fViewAnglePhiSlider->GetPosition(),
1493 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
1494 fViewAnglePhiNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1495 h = fViewAnglePhiNumber->GetDefaultHeight();
1496 charw = fViewAnglePhiNumber->GetCharWidth("0123456");
1497 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3; // 4 is digit width
1498 fViewAnglePhiNumber->Resize(w, h);
1499
1500 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 0);
1501 fWidgets->Add(fLayout);
1502 fViewAnglePhiFrame->AddFrame(fViewAnglePhiNumber, fLayout);
1503
1504 // label phi
1505 fViewAnglePhiLabel = new TGLabel(fViewAnglePhiFrame,"phi");
1506 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 2);
1507 fWidgets->Add(fLayout);
1508 fViewAnglePhiFrame->AddFrame(fViewAnglePhiLabel, fLayout);
1509
1510 // frame ViewAnglePsi
1511 fViewAnglePsiFrame = new TGCompositeFrame(fViewAngleFrame, fViewAngleFrame->GetWidth(), 50, kVerticalFrame);
1512 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 3, 3, 3, 3);
1513 fWidgets->Add(fLayout);
1514 fViewAngleFrame->AddFrame(fViewAnglePsiFrame, fLayout);
1515
1516 // button ViewAnglePsiMinus
1517 fViewAnglePsiMinusButton = new BesGPictureButton(fViewAnglePsiFrame,
1518 gClient->GetPicture("ViewAngleMinus.gif"),
1520 fViewAnglePsiMinusButton->SetToolTipText("Psi -");
1521 fViewAnglePsiMinusButton->SetHeight(22);
1522 fViewAnglePsiMinusButton->SetWidth(22);
1523 fViewAnglePsiMinusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1524
1525 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
1526 fWidgets->Add(fLayout);
1527 fViewAnglePsiFrame->AddFrame(fViewAnglePsiMinusButton, fLayout);
1528
1529 // slider for ViewAnglePsi
1530 fViewAnglePsiSlider = new TGVSlider(fViewAnglePsiFrame, 120, kSlider2 | kScaleBoth, kM_Slider_ViewAnglePsi);
1531 fViewAnglePsiSlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
1532 fViewAnglePsiSlider->SetRange(0, 360);
1533 fViewAnglePsiSlider->SetPosition(270);
1534 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandY, 5, 5, 0, 0);
1535 fWidgets->Add(fLayout);
1536 fViewAnglePsiFrame->AddFrame(fViewAnglePsiSlider, fLayout);
1537
1538 // button ViewAnglePsiPlus
1539 fViewAnglePsiPlusButton = new BesGPictureButton(fViewAnglePsiFrame,
1540 gClient->GetPicture("ViewAnglePlus.gif"),
1542 fViewAnglePsiPlusButton->SetToolTipText("Psi +");
1543 fViewAnglePsiPlusButton->SetHeight(22);
1544 fViewAnglePsiPlusButton->SetWidth(22);
1545 fViewAnglePsiPlusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1546
1547 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
1548 fWidgets->Add(fLayout);
1549 fViewAnglePsiFrame->AddFrame(fViewAnglePsiPlusButton, fLayout);
1550
1551 // number ViewAnglePsi
1552 //fViewAnglePsiNumber = new TGNumberEntry( fViewAnglePsiFrame, 0, 3, kM_Button_ViewAnglePsiNumber,
1553 // (TGNumberFormat::EStyle) 6, (TGNumberFormat::EAttribute) 0 );
1554 fViewAnglePsiNumber = new TGNumberEntryField( fViewAnglePsiFrame, kM_Button_ViewAnglePsiNumber,
1555 fViewAnglePsiSlider->GetPosition(),
1556 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
1557 fViewAnglePsiNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1558 h = fViewAnglePsiNumber->GetDefaultHeight();
1559 charw = fViewAnglePsiNumber->GetCharWidth("0123456");
1560 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3; // 4 is digit width
1561 fViewAnglePsiNumber->Resize(w, h);
1562
1563 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 0);
1564 fWidgets->Add(fLayout);
1565 fViewAnglePsiFrame->AddFrame(fViewAnglePsiNumber, fLayout);
1566
1567 // label psi
1568 fViewAnglePsiLabel = new TGLabel(fViewAnglePsiFrame,"psi");
1569 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 2);
1570 fWidgets->Add(fLayout);
1571 fViewAnglePsiFrame->AddFrame(fViewAnglePsiLabel, fLayout);
1572
1573 //
1574 // "Event" tab
1575 // ================
1576 tf = fTabs->AddTab("Event");
1577 tf->SetBackgroundPixmap(GetPic("8.gif"));
1578
1579 //
1580 // frame for event control
1581 // =====================
1582 fEventControlFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
1583 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX , 15, 15, 15, 10);
1584 fWidgets->Add(fLayout);
1585 tf->AddFrame(fEventControlFrame, fLayout);
1586 fEventControlFrame->SetBackgroundPixmap(GetPic("EventFrameBckgnd.gif"));
1587
1588
1589 // lable "Event control"
1590 fEventControlTextFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
1591 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
1592 fWidgets->Add(fLayout);
1593 fEventControlFrame->AddFrame(fEventControlTextFrame, fLayout);
1594 fEventControlTextFrame->SetBackgroundPixmap(GetPic("EventControlBckgnd.gif"));
1595
1596 fEventControlTextLabel = new TGLabel(fEventControlTextFrame,"Event Control ");
1597 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 4);
1598 fWidgets->Add(fLayout);
1599 fEventControlTextFrame->AddFrame(fEventControlTextLabel, fLayout);
1600 fEventControlTextLabel->SetBackgroundPixmap(GetPic("EventControlBckgnd.gif"));
1601
1602 // input of run nr
1603 fBesRunFrame = new TGHorizontalFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 25);
1604 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 4, 4, 4, 4);
1605 fWidgets->Add(fLayout);
1606 fEventControlFrame->AddFrame(fBesRunFrame, fLayout);
1607 fBesRunFrame->SetBackgroundPixmap(GetPic("EventFrameBckgnd.gif"));
1608
1609 fBesLabelRun = new TGLabel(fBesRunFrame, "Run : ");
1610 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
1611 fWidgets->Add(fLayout);
1612 fBesRunFrame->AddFrame(fBesLabelRun, fLayout);
1613
1614 fNumEntryRunNo = new TGNumberEntry(fBesRunFrame,this->GetBesRunNo(),12,kM_Button_BesRun,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1); // 16 is ditits number in the entry
1615 fNumEntryRunNo->SetHeight(20);
1616 fNumEntryRunNo->SetNumber(this->GetBesRunNo());
1617 fNumEntryRunNo->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1618 fNumEntryRunNo->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
1619 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 4, 4, 4, 4);
1620 fWidgets->Add(fLayout);
1621 fBesRunFrame->AddFrame(fNumEntryRunNo, fLayout);
1622
1623 // input of Event nr
1624 fBesEventFrame = new TGHorizontalFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 25);
1625 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 4, 4, 4, 4);
1626 fWidgets->Add(fLayout);
1627 fEventControlFrame->AddFrame(fBesEventFrame, fLayout);
1628
1629 fBesLabelEvent = new TGLabel(fBesEventFrame, "Event : ");
1630 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
1631 fWidgets->Add(fLayout);
1632 fBesEventFrame->AddFrame(fBesLabelEvent, fLayout);
1633
1634 fNumEntryEventNo = new TGNumberEntry(fBesEventFrame,this->GetBesEventNo(),12,kM_Button_BesEvent,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1);
1635 fNumEntryEventNo->SetHeight(20);
1636 fNumEntryEventNo->SetNumber(this->GetBesEventNo());
1637 fNumEntryEventNo->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1638 fNumEntryEventNo->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
1639 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 4, 4, 4, 4);
1640 fWidgets->Add(fLayout);
1641 fBesEventFrame->AddFrame(fNumEntryEventNo, fLayout);
1642
1643 //
1644 // frame for event play
1645 // ====================
1646
1647 // slider for event play
1648 fEventPlaySlider = new TGHSlider(fEventControlFrame, 40, kSlider1 | kScaleNo, kM_Slider_EventPlay);
1649 fEventPlaySlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
1650 fEventPlaySlider->SetRange(0, 100);
1651 fEventPlaySlider->SetPosition(0);
1652 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 0);
1653 fWidgets->Add(fLayout);
1654 fEventControlFrame->AddFrame(fEventPlaySlider, fLayout);
1655
1656 // event play buttons
1657 fEventPlayButtonFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
1658 //fEventNavFrame->SetBackgroundPixmap(GetPic("1.gif"));
1659 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 2, 2, 2, 2);
1660 fWidgets->Add(fLayout);
1661 fEventControlFrame->AddFrame(fEventPlayButtonFrame, fLayout);
1662
1663 // prev button
1664 fPrevEventButton = new BesGPictureButton(fEventPlayButtonFrame,
1665 gClient->GetPicture("ButtonEventPrev.gif"),
1667 fPrevEventButton->SetToolTipText("Previous Event");
1668 fPrevEventButton->SetHeight(26);
1669 fPrevEventButton->SetWidth(25);
1670 fPrevEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1671
1672 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 8, 0, 0, 4);
1673 fWidgets->Add(fLayout);
1674 fEventPlayButtonFrame->AddFrame(fPrevEventButton, fLayout);
1675
1676 // next button
1677 fNextEventButton = new BesGPictureButton(fEventPlayButtonFrame,
1678 gClient->GetPicture("ButtonEventNext.gif"), kM_Button_NextEvent);
1679 fNextEventButton->SetToolTipText("Next Event");
1680 fNextEventButton->SetHeight(26);
1681 fNextEventButton->SetWidth(26);
1682 fNextEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1683
1684 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 10, 0, 4);
1685 fWidgets->Add(fLayout);
1686 fEventPlayButtonFrame->AddFrame(fNextEventButton, fLayout);
1687
1688 // play button
1689 fPlayEventButton = new BesGPictureButton(fEventPlayButtonFrame,
1690 gClient->GetPicture("ButtonEventPlay.gif"),
1692 fPlayEventButton->SetToolTipText("Play Event");
1693 fPlayEventButton->SetHeight(35);
1694 fPlayEventButton->SetWidth(34);
1695 fPlayEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1696
1697 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 0, 0, 4);
1698 fWidgets->Add(fLayout);
1699 fEventPlayButtonFrame->AddFrame(fPlayEventButton, fLayout);
1700
1701 // first button
1702 fFirstEventButton = new BesGPictureButton(fEventPlayButtonFrame,
1703 gClient->GetPicture("ButtonEventReturn.gif"),
1705 fFirstEventButton->SetToolTipText("First Event");
1706 fFirstEventButton->SetHeight(35);
1707 fFirstEventButton->SetWidth(25);
1708 fFirstEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
1709
1710 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 0, 4);
1711 fWidgets->Add(fLayout);
1712 fEventPlayButtonFrame->AddFrame(fFirstEventButton, fLayout);
1713
1714 // lable "Event Play"
1715 fEventPlayTextFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
1716 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 2, 2, 2, 2);
1717 fWidgets->Add(fLayout);
1718 fEventControlFrame->AddFrame(fEventPlayTextFrame, fLayout);
1719
1720 fEventPlayTextLabel = new TGLabel(fEventPlayTextFrame,"Prev,Next,Play/Stop,Return");
1721 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 4, 2, 5);
1722 fWidgets->Add(fLayout);
1723 fEventPlayTextFrame->AddFrame(fEventPlayTextLabel, fLayout);
1724
1725
1726 // play speed
1727 fEventPlaySpeedFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
1728 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 4, 4, 4, 4);
1729 fWidgets->Add(fLayout);
1730 fEventControlFrame->AddFrame(fEventPlaySpeedFrame, fLayout);
1731
1732 // input of speed
1733 fNumEntryEventPlaySpeed = new TGNumberEntry(fEventPlaySpeedFrame,(Double_t)this->GetEventPlaySpeed()/1000.0,4,
1735 (TGNumberFormat::EStyle) 1,(TGNumberFormat::EAttribute) 1);
1736 fNumEntryEventPlaySpeed->SetHeight(20);
1737 fNumEntryEventPlaySpeed->SetNumber(this->GetEventPlaySpeed()/1000.0);
1738 fNumEntryEventPlaySpeed->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
1739 fNumEntryEventPlaySpeed->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
1740 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
1741 fWidgets->Add(fLayout);
1742 fEventPlaySpeedFrame->AddFrame(fNumEntryEventPlaySpeed, fLayout);
1743
1744 // label "Play Speed : "
1745 fEventPlaySpeedLabel = new TGLabel(fEventPlaySpeedFrame," sec/event ");
1746 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 4, 4, 10);
1747 fWidgets->Add(fLayout);
1748 fEventPlaySpeedFrame->AddFrame(fEventPlaySpeedLabel, fLayout);
1749
1750
1751 /*
1752 //
1753 // frame for file list
1754 // ===================
1755 fEventListFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
1756 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsBottom | kLHintsExpandX | kLHintsExpandY , 15, 15, 10, 200);
1757 fWidgets->Add(fLayout);
1758 //tf->AddFrame(fEventListFrame, fLayout);
1759 fEventListFrame->SetBackgroundPixmap(GetPic("12.gif"));
1760
1761 // lable "File list"
1762 fEventListTextFrame = new TGCompositeFrame(fEventListFrame, fEventListFrame->GetWidth(), 30, kHorizontalFrame);
1763 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
1764 fWidgets->Add(fLayout);
1765 fEventListFrame->AddFrame(fEventListTextFrame, fLayout);
1766 fEventListTextFrame->SetBackgroundPixmap(GetPic("11.gif"));
1767
1768 fEventListTextLabel = new TGLabel(fEventListTextFrame,"Event file list ");
1769 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 4);
1770 fWidgets->Add(fLayout);
1771 fEventListTextFrame->AddFrame(fEventListTextLabel, fLayout);
1772 fEventListTextLabel->SetBackgroundPixmap(GetPic("11.gif"));
1773
1774 // frame EventListContent
1775 fEventListContentFrame = new TGCompositeFrame(fEventListFrame, fEventListFrame->GetWidth(), fEventListFrame->GetHeight()-30, kVerticalFrame);
1776 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10);
1777 fWidgets->Add(fLayout);
1778 fEventListFrame->AddFrame(fEventListContentFrame, fLayout);
1779
1780 fEventListView = new TGCanvas(fEventListContentFrame, 2, 2, kSunkenFrame | kDoubleBorder);
1781
1782 fEventListTree = new TGListTree(fEventListView->GetViewPort(), 2, 2, kHorizontalFrame);
1783
1784 fEventListView->SetContainer(fEventListTree);
1785 fEventListTree->SetCanvas(fEventListView);
1786 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0);
1787 fWidgets->Add(fLayout);
1788 fEventListContentFrame->AddFrame(fEventListView, fLayout);
1789
1790 // Connect event list tree
1791 fEventListTree->Connect("Clicked(TGListTreeItem*, Int_t)",
1792 "BesClient", this,
1793 "HandleEventList(TGListTreeItem*, Int_t)");
1794
1795 // init active tree item
1796 fItem = 0;
1797 fRunItem = 0;
1798 */
1799
1800
1801 // "Show DST Info" tab
1802 // ================
1803 tf = fTabs->AddTab("REC");
1804 //tf = fTabs->AddTab("DST");
1805 tf->SetBackgroundPixmap(GetPic("8.gif"));
1806
1807 //Header
1808 fFrameHeader =new TGGroupFrame(tf, "Header");
1809 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
1810 fWidgets->Add(fLayout);
1811 tf->AddFrame(fFrameHeader, fLayout);
1812 fChkBtnHeaderGlobal = new TGCheckButton(fFrameHeader, "Header", kM_Header_Global);
1813 fFrameHeader->AddFrame(fChkBtnHeaderGlobal);
1814 fChkBtnHeaderGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1815
1816 // Hits
1817 fFrameHits = new TGGroupFrame(tf, "Hits");
1818 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
1819 fWidgets->Add(fLayout);
1820 tf->AddFrame(fFrameHits, fLayout);
1821
1822 fChkBtnMdcHitsGlobal = new TGCheckButton(fFrameHits, "Mdc hits", kM_MdcHits_Global);
1823 fFrameHits->AddFrame(fChkBtnMdcHitsGlobal);
1824
1825 fChkBtnTofHitsGlobal = new TGCheckButton(fFrameHits, "Tof hits", kM_TofHits_Global);
1826 fFrameHits->AddFrame(fChkBtnTofHitsGlobal);
1827
1828 fChkBtnTofHitsEast = new TGCheckButton(fFrameHits, " East ", kM_TofHits_East);
1829 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1830 fWidgets->Add(fLayout);
1831 fFrameHits->AddFrame(fChkBtnTofHitsEast, fLayout);
1832
1833 fChkBtnTofHitsBarrel = new TGCheckButton(fFrameHits, " Barrel ", kM_TofHits_Barrel);
1834 fFrameHits->AddFrame(fChkBtnTofHitsBarrel, fLayout);
1835
1836 fChkBtnTofHitsWest = new TGCheckButton(fFrameHits, " West ", kM_TofHits_West);
1837 fFrameHits->AddFrame(fChkBtnTofHitsWest, fLayout);
1838
1839 fChkBtnEmcHitsGlobal = new TGCheckButton(fFrameHits, "Emc hits", kM_EmcHits_Global);
1840 fFrameHits->AddFrame(fChkBtnEmcHitsGlobal);
1841
1842 fChkBtnEmcHitsEast = new TGCheckButton(fFrameHits, " East ", kM_EmcHits_East);
1843 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1844 fWidgets->Add(fLayout);
1845 fFrameHits->AddFrame(fChkBtnEmcHitsEast, fLayout);
1846
1847 fChkBtnEmcHitsBarrel = new TGCheckButton(fFrameHits, " Barrel ", kM_EmcHits_Barrel);
1848 fFrameHits->AddFrame(fChkBtnEmcHitsBarrel, fLayout);
1849
1850 fChkBtnEmcHitsWest = new TGCheckButton(fFrameHits, " West ", kM_EmcHits_West);
1851 fFrameHits->AddFrame(fChkBtnEmcHitsWest, fLayout);
1852
1853 fChkBtnEmcHitsSide = new TGCheckButton(fFrameHits, " Side ", kM_EmcHits_Side);
1854 fFrameHits->AddFrame(fChkBtnEmcHitsSide, fLayout);
1855
1856 fChkBtnMucHitsGlobal = new TGCheckButton(fFrameHits, "Muc hits", kM_MucHits_Global);
1857 fFrameHits->AddFrame(fChkBtnMucHitsGlobal);
1858
1859 fChkBtnMucHitsEast = new TGCheckButton(fFrameHits, " East ", kM_MucHits_East);
1860 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1861 fWidgets->Add(fLayout);
1862 fFrameHits->AddFrame(fChkBtnMucHitsEast, fLayout);
1863
1864 fChkBtnMucHitsBarrel = new TGCheckButton(fFrameHits, " Barrel ", kM_MucHits_Barrel);
1865 fFrameHits->AddFrame(fChkBtnMucHitsBarrel, fLayout);
1866
1867 fChkBtnMucHitsWest = new TGCheckButton(fFrameHits, " West ", kM_MucHits_West);
1868 fFrameHits->AddFrame(fChkBtnMucHitsWest, fLayout);
1869
1870 fChkBtnMdcHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1871 fChkBtnTofHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1872 fChkBtnTofHitsEast ->Connect("Clicked()", "BesClient", this, "SetState()");
1873 fChkBtnTofHitsBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
1874 fChkBtnTofHitsWest ->Connect("Clicked()", "BesClient", this, "SetState()");
1875 fChkBtnEmcHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1876 fChkBtnEmcHitsEast ->Connect("Clicked()", "BesClient", this, "SetState()");
1877 fChkBtnEmcHitsBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
1878 fChkBtnEmcHitsWest ->Connect("Clicked()", "BesClient", this, "SetState()");
1879 fChkBtnEmcHitsSide ->Connect("Clicked()", "BesClient", this, "SetState()");
1880 fChkBtnMucHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1881 fChkBtnMucHitsEast ->Connect("Clicked()", "BesClient", this, "SetState()");
1882 fChkBtnMucHitsBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
1883 fChkBtnMucHitsWest ->Connect("Clicked()", "BesClient", this, "SetState()");
1884
1885 // Tracks
1886 fFrameTracks = new TGGroupFrame(tf, "Tracks");
1887 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
1888 fWidgets->Add(fLayout);
1889 tf->AddFrame(fFrameTracks, fLayout);
1890
1891 fChkBtnTracksGlobal = new TGCheckButton(fFrameTracks, "Tracks", kM_Tracks_Global);
1892 fFrameTracks->AddFrame(fChkBtnTracksGlobal);
1893
1894 fChkBtnTracksMdc = new TGCheckButton(fFrameTracks, " Mdc ", kM_Tracks_Mdc);
1895 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1896 fWidgets->Add(fLayout);
1897 fFrameTracks->AddFrame(fChkBtnTracksMdc, fLayout);
1898
1899 fChkBtnTracksTof = new TGCheckButton(fFrameTracks, " Tof ", kM_Tracks_Tof);
1900 fFrameTracks->AddFrame(fChkBtnTracksTof, fLayout);
1901
1902 fChkBtnTracksEmc = new TGCheckButton(fFrameTracks, " Emc ", kM_Tracks_Emc);
1903 fFrameTracks->AddFrame(fChkBtnTracksEmc, fLayout);
1904
1905 fChkBtnTracksMuc = new TGCheckButton(fFrameTracks, " Muc ", kM_Tracks_Muc);
1906 fFrameTracks->AddFrame(fChkBtnTracksMuc, fLayout);
1907
1908 fChkBtnTracksExt = new TGCheckButton(fFrameTracks, " Ext ", kM_Tracks_Ext);
1909 fFrameTracks->AddFrame(fChkBtnTracksExt, fLayout);
1910
1911 fChkBtnTracksGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1912 fChkBtnTracksMdc->Connect("Clicked()", "BesClient", this, "SetState()");
1913 fChkBtnTracksTof->Connect("Clicked()", "BesClient", this, "SetState()");
1914 fChkBtnTracksEmc->Connect("Clicked()", "BesClient", this, "SetState()");
1915 fChkBtnTracksMuc->Connect("Clicked()", "BesClient", this, "SetState()");
1916 fChkBtnTracksExt->Connect("Clicked()", "BesClient", this, "SetState()");
1917
1918 //
1919 // "Show Detector" tab
1920 // ===================
1921 tf = fTabs->AddTab("Detector");
1922 tf->SetBackgroundPixmap(GetPic("8.gif"));
1923 //tf->SetBackgroundPixmap(GetPic("3.gif"));
1924
1925 fFrameSubDetector = new TGGroupFrame(tf, "Sub-Detector");
1926
1927 // SubDetector
1928 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
1929 fWidgets->Add(fLayout);
1930 tf->AddFrame(fFrameSubDetector, fLayout);
1931
1932 // Mdc
1933 fChkBtnMdcGlobal = new TGCheckButton(fFrameSubDetector, "Mdc", kM_Mdc_Global);
1934 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
1935 fFrameSubDetector->AddFrame(fChkBtnMdcGlobal, fLayout);
1936 fChkBtnMdcGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1937
1938 fChkBtnMdcTubes = new TGCheckButton(fFrameSubDetector, "Tubes", kM_Mdc_Tubes);
1939 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1940 fFrameSubDetector->AddFrame(fChkBtnMdcTubes, fLayout);
1941 fChkBtnMdcTubes->Connect("Clicked()", "BesClient", this, "SetState()");
1942
1943 fChkBtnMdcWires = new TGCheckButton(fFrameSubDetector, "Wires", kM_Mdc_Wires);
1944 fFrameSubDetector->AddFrame(fChkBtnMdcWires, fLayout);
1945 fChkBtnMdcWires->Connect("Clicked()", "BesClient", this, "SetState()");
1946
1947 // Tof
1948 fChkBtnTofGlobal = new TGCheckButton(fFrameSubDetector, "Tof", kM_Tof_Global);
1949 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
1950 fFrameSubDetector->AddFrame(fChkBtnTofGlobal, fLayout);
1951 fChkBtnTofGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1952
1953 fChkBtnTofEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Tof_East);
1954 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1955 fFrameSubDetector->AddFrame(fChkBtnTofEast, fLayout);
1956 fChkBtnTofEast->Connect("Clicked()", "BesClient", this, "SetState()");
1957
1958 fChkBtnTofBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Tof_Barrel);
1959 fFrameSubDetector->AddFrame(fChkBtnTofBarrel, fLayout);
1960 fChkBtnTofBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
1961
1962 fChkBtnTofWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Tof_West);
1963 fFrameSubDetector->AddFrame(fChkBtnTofWest, fLayout);
1964 fChkBtnTofWest->Connect("Clicked()", "BesClient", this, "SetState()");
1965
1966 // Emc
1967 fChkBtnEmcGlobal = new TGCheckButton(fFrameSubDetector, "Emc", kM_Emc_Global);
1968 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
1969 fFrameSubDetector->AddFrame(fChkBtnEmcGlobal, fLayout);
1970 fChkBtnEmcGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1971
1972 fChkBtnEmcEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Emc_East);
1973 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1974 fFrameSubDetector->AddFrame(fChkBtnEmcEast, fLayout);
1975 fChkBtnEmcEast->Connect("Clicked()", "BesClient", this, "SetState()");
1976
1977 fChkBtnEmcBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Emc_Barrel);
1978 fFrameSubDetector->AddFrame(fChkBtnEmcBarrel, fLayout);
1979 fChkBtnEmcBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
1980
1981 fChkBtnEmcWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Emc_West);
1982 fFrameSubDetector->AddFrame(fChkBtnEmcWest, fLayout);
1983 fChkBtnEmcWest->Connect("Clicked()", "BesClient", this, "SetState()");
1984
1985 fChkBtnEmcSide = new TGCheckButton(fFrameSubDetector, "Side ", kM_Emc_Side);
1986 fFrameSubDetector->AddFrame(fChkBtnEmcSide, fLayout);
1987 fChkBtnEmcSide->Connect("Clicked()", "BesClient", this, "SetState()");
1988
1989 // Muc
1990 fChkBtnMucGlobal = new TGCheckButton(fFrameSubDetector, "Muc", kM_Muc_Global);
1991 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
1992 fFrameSubDetector->AddFrame(fChkBtnMucGlobal, fLayout);
1993 fChkBtnMucGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
1994
1995 fChkBtnMucEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Muc_East);
1996 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
1997 fFrameSubDetector->AddFrame(fChkBtnMucEast, fLayout);
1998 fChkBtnMucEast->Connect("Clicked()", "BesClient", this, "SetState()");
1999
2000 fChkBtnMucBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Muc_Barrel);
2001 fFrameSubDetector->AddFrame(fChkBtnMucBarrel, fLayout);
2002 fChkBtnMucBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
2003
2004 fChkBtnMucWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Muc_West);
2005 fFrameSubDetector->AddFrame(fChkBtnMucWest, fLayout);
2006 fChkBtnMucWest->Connect("Clicked()", "BesClient", this, "SetState()");
2007
2008 fChkBtnMucStrips = new TGCheckButton(fFrameSubDetector, "Strips", kM_Muc_Strips);
2009 fFrameSubDetector->AddFrame(fChkBtnMucStrips, fLayout);
2010 fChkBtnMucStrips->Connect("Clicked()", "BesClient", this, "SetState()");
2011
2012 // Other parts
2013 fFrameOthers = new TGGroupFrame (tf, "Others");
2014 fLayout = new TGLayoutHints (kLHintsExpandX, 15, 15, 15, 15);
2015 fWidgets->Add(fLayout);
2016 tf->AddFrame (fFrameOthers, fLayout);
2017
2018 fChkBtnBeamPipe = new TGCheckButton (fFrameOthers, "Beam Pipe", kM_BeamPipe);
2019 fFrameOthers->AddFrame (fChkBtnBeamPipe);
2020 fChkBtnBeamPipe->Connect("Clicked()", "BesClient", this, "SetState()");
2021
2022 fChkBtnZRPlaneOnXY = new TGCheckButton (fFrameOthers, "ZR plane on XY", kM_ZRPlaneOnXY);
2023 fFrameOthers->AddFrame (fChkBtnZRPlaneOnXY);
2024 fChkBtnZRPlaneOnXY->Connect("Clicked()", "BesClient", this, "SetState()");
2025
2026 fChkBtnAxis = new TGCheckButton (fFrameOthers, "Axis", kM_Axis);
2027 fFrameOthers->AddFrame (fChkBtnAxis);
2028 fChkBtnAxis->Connect("Clicked()", "BesClient", this, "SetState()");
2029
2030 //
2031 // "Others" tab
2032 // ================
2033 tf = fTabs->AddTab("Others");
2034 tf->SetBackgroundPixmap(GetPic("8.gif"));
2035
2036 //Mdc TQMatch
2037 fFrameMdcMatch =new TGGroupFrame(tf, "Mdc Status");
2038 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2039 fWidgets->Add(fLayout);
2040 tf->AddFrame(fFrameMdcMatch, fLayout);
2041
2042 fChkBtnMdcTMatchGlobal = new TGCheckButton(fFrameMdcMatch, "T Fire", kM_Mdc_TMatch_Global);
2043 fChkBtnMdcTMatchGlobal->SetState(kButtonDown);
2044 //fChkBtnMdcTMatchGlobal->SetOn();
2045 fFrameMdcMatch->AddFrame(fChkBtnMdcTMatchGlobal);
2046 fChkBtnMdcTMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2047
2048 fChkBtnMdcQMatchGlobal = new TGCheckButton(fFrameMdcMatch, "Q Fire", kM_Mdc_QMatch_Global);
2049 fChkBtnMdcQMatchGlobal->SetState(kButtonDown);
2050 //fChkBtnMdcQMatchGlobal->SetOn();
2051 fFrameMdcMatch->AddFrame(fChkBtnMdcQMatchGlobal);
2052 fChkBtnMdcQMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2053
2054 fChkBtnMdcQOverflowGlobal = new TGCheckButton(fFrameMdcMatch, "Q Not Overflow", kM_Mdc_QNotOverflow_Global);
2055 fChkBtnMdcQOverflowGlobal->SetState(kButtonUp);
2056 //fChkBtnMdcQOverflowGlobal->SetOn();
2057 fFrameMdcMatch->AddFrame(fChkBtnMdcQOverflowGlobal);
2058 fChkBtnMdcQOverflowGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2059
2060 //Colorful Mdc Wire
2061 fChkBtnMdcColorfulWireGlobal = new TGCheckButton(fFrameMdcMatch, "Colorful Wire", kM_Mdc_ColorfulWire_Global);
2062 fChkBtnMdcColorfulWireGlobal->SetState(kButtonUp);
2063 fFrameMdcMatch->AddFrame(fChkBtnMdcColorfulWireGlobal);
2064 fChkBtnMdcColorfulWireGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2065
2066 //Mdc time substract event start time
2067 fChkBtnMdcTimeSubEvTimeGlobal = new TGCheckButton(fFrameMdcMatch, "Sub EvTime", kM_Mdc_MdcTimeSubEvTime_Global);
2068 fChkBtnMdcTimeSubEvTimeGlobal->SetState(kButtonUp);
2069 fFrameMdcMatch->AddFrame(fChkBtnMdcTimeSubEvTimeGlobal);
2070 fChkBtnMdcTimeSubEvTimeGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2071
2072 //Tof TQMatch
2073 fFrameTofMatch =new TGGroupFrame(tf, "Tof TQ Match");
2074 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2075 fWidgets->Add(fLayout);
2076 tf->AddFrame(fFrameTofMatch, fLayout);
2077
2078 fChkBtnTofTMatchGlobal = new TGCheckButton(fFrameTofMatch, "T Match", kM_Tof_TMatch_Global);
2079 fChkBtnTofTMatchGlobal->SetState(kButtonDown);
2080 //fChkBtnTofTMatchGlobal->SetOn();
2081 fFrameTofMatch->AddFrame(fChkBtnTofTMatchGlobal);
2082 fChkBtnTofTMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2083
2084 fChkBtnTofQMatchGlobal = new TGCheckButton(fFrameTofMatch, "Q Match", kM_Tof_QMatch_Global);
2085 fChkBtnTofQMatchGlobal->SetState(kButtonDown);
2086 //fChkBtnTofQMatchGlobal->SetOn();
2087 fFrameTofMatch->AddFrame(fChkBtnTofQMatchGlobal);
2088 fChkBtnTofQMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2089
2090 // Magnetic field
2091 fFrameMagnetic =new TGGroupFrame(tf, "Magnetic Field(Tesla)");
2092 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2093 fWidgets->Add(fLayout);
2094 tf->AddFrame(fFrameMagnetic, fLayout);
2095
2096 // input of Magnetic field
2097 fNumEntryMagnetic = new TGNumberEntry(fFrameMagnetic,
2098 1.0, 4,
2100 TGNumberFormat::kNESRealTwo,
2101 TGNumberFormat::kNEAAnyNumber);
2102 fNumEntryMagnetic->SetHeight(20);
2103 fNumEntryMagnetic->SetNumber(1.0);
2104 fNumEntryMagnetic->GetNumberEntry()
2105 ->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
2106 fNumEntryMagnetic->GetNumberEntry()
2107 ->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
2108 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
2109 fWidgets->Add(fLayout);
2110 fFrameMagnetic->AddFrame(fNumEntryMagnetic, fLayout);
2111
2112
2113 for (Int_t iTab = 0; iTab < fTabs->GetNumberOfTabs(); iTab++) {
2114 fTabs->GetTabTab(iTab)->SetBackgroundPixmap(GetPic("8.gif"));
2115 }
2116}
2117
2118void BesClient::SetMdcQNotOverflow(Bool_t input){
2119 if (gBesGeometry){
2121 }
2122}
2123
2124
2125void BesClient::SetMdcTFire(Bool_t input){
2126 if (gBesGeometry){
2128 }
2129}
2130
2131void BesClient::SetMdcQFire(Bool_t input){
2132 if (gBesGeometry){
2134 }
2135}
2136
2137void BesClient::SetMdcColorfulWire(Bool_t input){
2138 if (gBesGeometry){
2140 }
2141}
2142
2143void BesClient::SetMdcTimeSubEvTime(Bool_t input){
2144 if (gBesGeometry){
2146 }
2147}
2148
2149void BesClient::SetTofTMatch(Bool_t input){
2150 if (gBesGeometry){
2152 }
2153}
2154
2155void BesClient::SetTofQMatch(Bool_t input){
2156 if (gBesGeometry){
2158 }
2159}
2160//_____________________________________________________
2161
2163 //
2164 // init local variables
2165 if (gDebug) cout << "BesClient::InitLocal called!" << endl;
2166
2167 // init widget list
2168 fWidgets = new TList();
2169 fLayout = 0;
2170
2171 gGeometry = 0;
2172 gBesCursor = new BesCursor();
2174 gBesCursor->SetShowInfo(true);
2175
2176 fAutoDisplayEventTimer = new TTimer(fEventPlaySpeed);
2177 Connect(fAutoDisplayEventTimer,"Timeout()","BesClient",this,"AutoDisplayEventCommand()");
2178
2179 fAutoRotateTimer = new TTimer((Int_t)1000/fRotateFPS);
2180 Connect(fAutoRotateTimer,"Timeout()","BesClient",this,"AutoRotateCommand()");
2181
2182 /*TColor *milk = */
2183 new TColor(1001, 1.0, 1.0, 225/255.0);
2184 /*TColor *pink = */
2185 new TColor(1002, 227/255.0, 186/255.0, 227/255.0);
2186 /*TColor *lightYellow = */
2187 new TColor(1003, 232/255.0, 234/255.0, 117/255.0);
2188 /*TColor *orange = */
2189 new TColor(1004, 254/255.0, 216/255.0, 31/255.0);
2190 /*TColor *lightBlue = */
2191 new TColor(1005, 175/255.0, 192/255.0, 227/255.0);
2192 /*TColor *lightGreen = */
2193 new TColor(1006, 192/255.0, 227/255.0, 226/255.0);
2194 /*TColor *lightBrown = */
2195 new TColor(1007, 225/255.0, 199/255.0, 162/255.0);
2196}
2197
2198//_____________________________________________________
2199
2201 //
2202 // init local variables
2203 if (gDebug) cout << "BesClient::InitParameter called!" << endl;
2204
2205 // init command line parameter
2206 fWindowWidth = 1000;
2207 fWindowHeight = 710;
2208
2209 fBesVisPath = TString(getenv("BESVISLIBROOT"));
2210
2211 fEventPlaySpeed = 1000; // 1000 ms/event
2212 fAutoDisplayEvent = kFALSE;
2213
2214 for (Int_t i = 0; i < 3; i++) {
2215 fHomeX[i] = 0.0;
2216 fHomeY[i] = 0.0;
2217 }
2218
2219 fMoveFactor = 0.1; // factor of move
2220 fRotateStep = 1.0; // 0.1 deg/frame
2221 fRotateSpeed = 10.0; // 1.0 deg/sec
2222 fRotateFPS = 10; // 10 frame/sec
2223
2224 fAutoRotate = kFALSE;
2225 fAutoRotateClockWise = 0;
2226 fAutoRotateTheta = 0;
2227 fAutoRotatePhi = 0;
2228 fAutoRotatePsi = 0;
2229
2230 fBesRunNo = 0;
2231 fBesEventNo = 0;
2232
2233 fViewer3DMode = 0;
2234}
2235
2236//_____________________________________________________
2237
2239 //
2240 // init connections to internal messaging queues
2241 if (gDebug) cout << "BesClient::InitConnections called!" << endl;
2242
2243 // Connect canvas to mouse actions
2244 Connect((TCanvas*)fEmbeddedCanvas->GetCanvas(),"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "BesClient",
2245 this, "ExecuteEvent(Int_t, Int_t, Int_t, TObject*)");
2246
2247 // Connect close button
2248 Connect("CloseWindow()", "BesClient", this, "CloseWindow()");
2249}
2250
2251//__________________________________________________________________
2252
2254 //
2255 // Handle menu items.
2256
2257 switch (id) {
2258
2259 // File
2260 case kM_File_LoadGeo:
2261 LoadGeoFile();
2262 break;
2263 case kM_File_SaveGeoAs:
2264 SaveGeoAs();
2265 break;
2266 case kM_File_OpenEvent:
2267 OpenEventFile();
2268 break;
2269 case kM_File_SavePicAs:
2270 SavePicAs();
2271 break;
2272 case kM_File_Close:
2273 gInterpreter->DeleteGlobal(this);
2274 delete this;
2275 break;
2276 case kM_File_Exit:
2277 CloseWindow(); // terminate theApp no need to use SendCloseMessage()
2278 break;
2279
2280 // Edit
2281 case kM_Edit_Editor:
2282 fEmbeddedCanvas->GetCanvas()->EditorBar();
2283 break;
2284
2285 // Help
2286 case kM_Help_Content:
2287 Help();
2288 break;
2289
2290 case kM_Help_About:
2291 new BesAboutHelp(gClient->GetRoot(), this);
2292 break;
2293
2294 // Default
2295 default:
2296 cerr << "Menu item" << id << "selected" << endl;
2297 break;
2298 }
2299}
2300
2301//_____________________________________________________
2302
2304 //
2305 // Handle view option menu items.
2306 BesView *view = (BesView*)gPad->GetView();
2307 if (!view) {
2308 cout << "BesClient::HandleViewOptionMenu(), BesView does not exist in this pad" << endl;
2309 return;
2310 }
2311
2312 //Int_t i = 0, px = 0, py = 0;
2313 //TVirtualGeoPainter *painter = 0;
2314
2315 switch (id) {
2316 case kM_Header_On:
2317 if ( fMenuViewOptionHeader->IsEntryChecked(kM_Header_On) ) {
2318 fMenuViewOptionHeader->UnCheckEntry(kM_Header_On);
2319 //canvas->SetHeaderOn(kFALSE);
2320 } else {
2321 fMenuViewOptionHeader->CheckEntry(kM_Header_On);
2322 //canvas->SetHeaderOn(kTRUE);
2323 }
2324 break;
2325
2326 case kM_Mdc_Global:
2327 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Global) ) {
2328 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Global);
2329 view->SetVisMdcGlobal(0);
2330 } else {
2331 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Global);
2332 view->SetVisMdcGlobal(1);
2333 }
2334 break;
2335
2336 case kM_Mdc_Tubes:
2337 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Tubes) ) {
2338 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Tubes);
2339 view->SetVisMdcTubes(0);
2340 } else {
2341 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Tubes);
2342 view->SetVisMdcTubes(1);
2343 }
2344 break;
2345
2346 case kM_Mdc_Wires:
2347 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Wires) ) {
2348 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Wires);
2349 view->SetVisMdcWires(0);
2350 } else {
2351 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Wires);
2352 view->SetVisMdcWires(1);
2353 }
2354 break;
2355
2356 case kM_Tof_Global:
2357 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_Global) ) {
2358 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Global);
2359 view->SetVisTofGlobal(0);
2360 } else {
2361 fMenuViewOptionTof->CheckEntry(kM_Tof_Global);
2362 view->SetVisTofGlobal(1);
2363 }
2364 break;
2365
2366 case kM_Tof_East:
2367 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_East) ) {
2368 fMenuViewOptionTof->UnCheckEntry(kM_Tof_East);
2369 view->SetVisTofEast(0);
2370 } else {
2371 fMenuViewOptionTof->CheckEntry(kM_Tof_East);
2372 view->SetVisTofEast(1);
2373 }
2374 break;
2375
2376 case kM_Tof_Barrel:
2377 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_Barrel) ) {
2378 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Barrel);
2379 view->SetVisTofBarrel(0);
2380 } else {
2381 fMenuViewOptionTof->CheckEntry(kM_Tof_Barrel);
2382 view->SetVisTofBarrel(1);
2383 }
2384 break;
2385
2386 case kM_Tof_West:
2387 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_West) ) {
2388 fMenuViewOptionTof->UnCheckEntry(kM_Tof_West);
2389 view->SetVisTofWest(0);
2390 } else {
2391 fMenuViewOptionTof->CheckEntry(kM_Tof_West);
2392 view->SetVisTofWest(1);
2393 }
2394 break;
2395
2396 case kM_Emc_Global:
2397 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Global) ) {
2398 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Global);
2399 view->SetVisEmcGlobal(0);
2400 } else {
2401 fMenuViewOptionEmc->CheckEntry(kM_Emc_Global);
2402 view->SetVisEmcGlobal(1);
2403 }
2404 break;
2405
2406 case kM_Emc_East:
2407 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_East) ) {
2408 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_East);
2409 view->SetVisEmcEast(0);
2410 } else {
2411 fMenuViewOptionEmc->CheckEntry(kM_Emc_East);
2412 view->SetVisEmcEast(1);
2413 }
2414 break;
2415
2416 case kM_Emc_Barrel:
2417 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Barrel) ) {
2418 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Barrel);
2419 view->SetVisEmcBarrel(0);
2420 } else {
2421 fMenuViewOptionEmc->CheckEntry(kM_Emc_Barrel);
2422 view->SetVisEmcBarrel(1);
2423 }
2424 break;
2425
2426 case kM_Emc_West:
2427 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_West) ) {
2428 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_West);
2429 view->SetVisEmcWest(0);
2430 } else {
2431 fMenuViewOptionEmc->CheckEntry(kM_Emc_West);
2432 view->SetVisEmcWest(1);
2433 }
2434 break;
2435
2436 case kM_Emc_Side:
2437 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Side) ) {
2438 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Side);
2439 view->SetVisEmcSide(0);
2440 } else {
2441 fMenuViewOptionEmc->CheckEntry(kM_Emc_Side);
2442 view->SetVisEmcSide(1);
2443 }
2444 break;
2445
2446 case kM_Muc_Global:
2447 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Global) ) {
2448 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Global);
2449 view->SetVisMucGlobal(0);
2450 } else {
2451 fMenuViewOptionMuc->CheckEntry(kM_Muc_Global);
2452 view->SetVisMucGlobal(1);
2453 }
2454 break;
2455
2456 case kM_Muc_East:
2457 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_East) ) {
2458 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_East);
2459 view->SetVisMucEast(0);
2460 } else {
2461 fMenuViewOptionMuc->CheckEntry(kM_Muc_East);
2462 view->SetVisMucEast(1);
2463 }
2464 break;
2465
2466 case kM_Muc_Barrel:
2467 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Barrel) ) {
2468 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Barrel);
2469 view->SetVisMucBarrel(0);
2470 } else {
2471 fMenuViewOptionMuc->CheckEntry(kM_Muc_Barrel);
2472 view->SetVisMucBarrel(1);
2473 }
2474 break;
2475
2476 case kM_Muc_West:
2477 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_West) ) {
2478 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_West);
2479 view->SetVisMucWest(0);
2480 } else {
2481 fMenuViewOptionMuc->CheckEntry(kM_Muc_West);
2482 view->SetVisMucWest(1);
2483 }
2484 break;
2485
2486 case kM_Muc_Strips:
2487 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Strips) ) {
2488 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Strips);
2489 view->SetVisMucStrips(0);
2490 } else {
2491 fMenuViewOptionMuc->CheckEntry(kM_Muc_Strips);
2492 view->SetVisMucStrips(1);
2493 }
2494 break;
2495
2496 case kM_Full3D_Mdc:
2497 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Mdc) ) {
2498 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Mdc);
2499 view->SetVisFull3DMdc(0);
2500 } else {
2501 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Mdc);
2502 view->SetVisFull3DMdc(1);
2503 }
2504
2505 if (gBesGeometry) {
2508 }
2509 break;
2510
2511 case kM_Full3D_Tof:
2512 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Tof) ) {
2513 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Tof);
2514 view->SetVisFull3DTof(0);
2515 } else {
2516 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Tof);
2517 view->SetVisFull3DTof(1);
2518 }
2519
2520 if (gBesGeometry) {
2523 }
2524 break;
2525
2526 case kM_Full3D_Emc:
2527 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Emc) ) {
2528 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Emc);
2529 view->SetVisFull3DEmc(0);
2530 } else {
2531 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Emc);
2532 view->SetVisFull3DEmc(1);
2533 }
2534
2535 if (gBesGeometry) {
2538 }
2539 break;
2540
2541 case kM_Full3D_Muc:
2542 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Muc) ) {
2543 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Muc);
2544 view->SetVisFull3DMuc(0);
2545 } else {
2546 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Muc);
2547 view->SetVisFull3DMuc(1);
2548 }
2549
2550 if (gBesGeometry) {
2553 }
2554 break;
2555
2556 case kM_BeamPipe:
2557 if ( fMenuViewOptionOthers->IsEntryChecked(kM_BeamPipe) ) {
2558 fMenuViewOptionOthers->UnCheckEntry(kM_BeamPipe);
2559 view->SetVisBeamPipe(0);
2560 } else {
2561 fMenuViewOptionOthers->CheckEntry(kM_BeamPipe);
2562 view->SetVisBeamPipe(1);
2563 }
2564 break;
2565
2566 case kM_ZRPlaneOnXY:
2567 if ( fMenuViewOptionOthers->IsEntryChecked(kM_ZRPlaneOnXY) ) {
2568 fMenuViewOptionOthers->UnCheckEntry(kM_ZRPlaneOnXY);
2569 view->SetVisZRPlaneOnXY(0);
2570 } else {
2571 fMenuViewOptionOthers->CheckEntry(kM_ZRPlaneOnXY);
2572 view->SetVisZRPlaneOnXY(1);
2573 }
2574 break;
2575
2576 case kM_Axis:
2577 if ( fMenuViewOptionOthers->IsEntryChecked(kM_Axis) ) {
2578 fMenuViewOptionOthers->UnCheckEntry(kM_Axis);
2579 view->SetVisAxis(0);
2580 } else {
2581 fMenuViewOptionOthers->CheckEntry(kM_Axis);
2582 view->SetVisAxis(1);
2583 }
2584 break;
2585
2586 case kM_MdcHits_Hits:
2587 if ( fMenuViewOptionMdcHits->IsEntryChecked(kM_MdcHits_Hits) ) {
2588 fMenuViewOptionMdcHits->UnCheckEntry(kM_MdcHits_Hits);
2589 view->SetVisMdcHits(0);
2590 } else {
2591 fMenuViewOptionMdcHits->CheckEntry(kM_MdcHits_Hits);
2592 view->SetVisMdcHits(1);
2593 }
2594 break;
2595
2596 case kM_TofHits_Global:
2597 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_Global) ) {
2598 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Global);
2599 view->SetVisTofHitsGlobal(0);
2600 } else {
2601 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Global);
2602 view->SetVisTofHitsGlobal(1);
2603 }
2604 break;
2605
2606 case kM_TofHits_East:
2607 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_East) ) {
2608 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_East);
2609 view->SetVisTofHitsEast(0);
2610 } else {
2611 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_East);
2612 view->SetVisTofHitsEast(1);
2613 }
2614 break;
2615
2616 case kM_TofHits_Barrel:
2617 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_Barrel) ) {
2618 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Barrel);
2619 view->SetVisTofHitsBarrel(0);
2620 } else {
2621 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Barrel);
2622 view->SetVisTofHitsBarrel(1);
2623 }
2624 break;
2625
2626 case kM_TofHits_West:
2627 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_West) ) {
2628 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_West);
2629 view->SetVisTofHitsWest(0);
2630 } else {
2631 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_West);
2632 view->SetVisTofHitsWest(1);
2633 }
2634 break;
2635
2636 case kM_EmcHits_Global:
2637 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Global) ) {
2638 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Global);
2639 view->SetVisEmcHitsGlobal(0);
2640 } else {
2641 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Global);
2642 view->SetVisEmcHitsGlobal(1);
2643 }
2644 break;
2645
2646 case kM_EmcHits_East:
2647 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_East) ) {
2648 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_East);
2649 view->SetVisEmcHitsEast(0);
2650 } else {
2651 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_East);
2652 view->SetVisEmcHitsEast(1);
2653 }
2654 break;
2655
2656 case kM_EmcHits_Barrel:
2657 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Barrel) ) {
2658 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Barrel);
2659 view->SetVisEmcHitsBarrel(0);
2660 } else {
2661 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Barrel);
2662 view->SetVisEmcHitsBarrel(1);
2663 }
2664 break;
2665
2666 case kM_EmcHits_West:
2667 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_West) ) {
2668 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_West);
2669 view->SetVisEmcHitsWest(0);
2670 } else {
2671 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_West);
2672 view->SetVisEmcHitsWest(1);
2673 }
2674 break;
2675
2676 case kM_EmcHits_Side:
2677 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Side) ) {
2678 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Side);
2679 view->SetVisEmcHitsSide(0);
2680 } else {
2681 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Side);
2682 view->SetVisEmcHitsSide(1);
2683 }
2684 break;
2685
2686 case kM_MucHits_Global:
2687 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_Global) ) {
2688 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Global);
2689 view->SetVisMucHitsGlobal(0);
2690 } else {
2691 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Global);
2692 view->SetVisMucHitsGlobal(1);
2693 }
2694 break;
2695
2696 case kM_MucHits_East:
2697 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_East) ) {
2698 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_East);
2699 view->SetVisMucHitsEast(0);
2700 } else {
2701 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_East);
2702 view->SetVisMucHitsEast(1);
2703 }
2704 break;
2705
2706 case kM_MucHits_Barrel:
2707 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_Barrel) ) {
2708 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Barrel);
2709 view->SetVisMucHitsBarrel(0);
2710 } else {
2711 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Barrel);
2712 view->SetVisMucHitsBarrel(1);
2713 }
2714 break;
2715
2716 case kM_MucHits_West:
2717 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_West) ) {
2718 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_West);
2719 view->SetVisMucHitsWest(0);
2720 } else {
2721 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_West);
2722 view->SetVisMucHitsWest(1);
2723 }
2724 break;
2725
2726 case kM_Tracks_Global:
2727 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Global) ) {
2728 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Global);
2729 view->SetVisTracksGlobal(0);
2730 } else {
2731 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Global);
2732 view->SetVisTracksGlobal(1);
2733 }
2734 break;
2735
2736 case kM_Tracks_Mdc:
2737 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Mdc) ) {
2738 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Mdc);
2739 view->SetVisTracksMdc(0);
2740 } else {
2741 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Mdc);
2742 view->SetVisTracksMdc(1);
2743 }
2744 break;
2745
2746 case kM_Tracks_Tof:
2747 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Tof) ) {
2748 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Tof);
2749 view->SetVisTracksTof(0);
2750 } else {
2751 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Tof);
2752 view->SetVisTracksTof(1);
2753 }
2754 break;
2755
2756 case kM_Tracks_Emc:
2757 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Emc) ) {
2758 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Emc);
2759 view->SetVisTracksEmc(0);
2760 } else {
2761 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Emc);
2762 view->SetVisTracksEmc(1);
2763 }
2764 break;
2765
2766 case kM_Tracks_Muc:
2767 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Muc) ) {
2768 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Muc);
2769 view->SetVisTracksMuc(0);
2770 } else {
2771 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Muc);
2772 view->SetVisTracksMuc(1);
2773 }
2774 break;
2775
2776 case kM_Tracks_Ext:
2777 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Ext) ) {
2778 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Ext);
2779 view->SetVisTracksExt(0);
2780 } else {
2781 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Ext);
2782 view->SetVisTracksExt(1);
2783 }
2784 break;
2785
2786 case kM_View_X3D:
2787 X3D();
2788 break;
2789
2790 case kM_View_OpenGL:
2791 OpenGL();
2792 break;
2793
2794 // Default
2795 default:
2796 cerr << "MenuViewOption item" << id << "selected" << endl;
2797 break;
2798 }
2799
2800 view->UpdateView(0);
2801 UpdateStatus();
2802
2803 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Modified();
2804 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Update();
2805}
2806
2807//__________________________________________________________________
2808
2809void BesClient::HandleError(const char* msg) {
2810 //
2811 // Error handling
2812 new TGMsgBox(gClient->GetRoot(), this,
2813 "Error", msg,
2814 gClient->GetPicture("mb_stop_s.xpm"));
2815}
2816
2817//__________________________________________________________________
2818
2819void BesClient::HandleInfoBar(const char* msg) {
2820 //
2821 // Info handling
2822 fStatusBar->SetText(msg, 1);
2823}
2824
2825//__________________________________________________________________
2826
2827void BesClient::HandleStatusBar(const char* msg) {
2828 //
2829 // Client status handling
2830 fStatusBar->SetText(msg, 0);
2831}
2832
2833//__________________________________________________________________
2834
2836 //
2837 // Show display
2838 MapWindow();
2839 MapRaised();
2840}
2841
2842//__________________________________________________________________
2843
2845 //
2846 // Load BesVis geometry file
2847
2848 if ( f_geoFile.Length() != 0){
2849 cout << "Load geoFile f_geoFile: " << f_geoFile << endl;
2850 this->OpenGeoFile(f_geoFile);
2851 }
2852 else {
2853 // Open file browser
2854 static TString GeoDir = fBesVisPath + TString("/geom/"); // "."
2855 TGFileInfo fi;
2856 fi.fFileTypes = OpenGeoTypes;
2857 fi.fIniDir = StrDup(GeoDir);
2858 char msg[256];
2859 sprintf(msg, "Loading Geometry File");
2860 HandleStatusBar(msg);
2861 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
2862 if (&fi == 0) return;
2863 GeoDir = fi.fIniDir;
2864 this->OpenGeoFile(fi.fFilename); // fi.fFilename: full path of geofile
2865 }
2866}
2867
2868//__________________________________________________________________
2869
2870void BesClient::OpenGeoFile(TString fname) {
2871 //
2872 // Open BesVis geometry file
2873 HandleStatusBar("Open Geometry File");
2874 char msg[256];
2875
2876 if (gDebug) cout << fname << " fname Length " << fname.Length() << endl;
2877 Ssiz_t posLastSlash = fname.Last('/'); // /scratch/youzy/BesVis/geom.root
2878 // |
2879 TString fpath = fname;
2880 fpath = fpath.Remove(posLastSlash+1, fname.Length()-posLastSlash-1);
2881
2882 if (fpath.Length() == 0) return; // Cancel Button pressed.
2883
2884 if (fDisplay->GetBesGeometry()) {
2885 Int_t ret;
2886 const char *txt;
2887 txt = Form("Geometry has already been build, Yes to rebuild it? \n (Each rebuild increase memory ~80MB)");
2888 new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
2889 "Geometry Exist", txt, kMBIconExclamation,
2890 kMBYes | kMBNo, &ret);
2891 if (ret == kMBNo) return;
2892 }
2893
2894 if ( fname.Contains(".gdml") ) {
2895 fDisplay->InitGeometryFromGDML(fpath);
2896 fDisplay->Draw();
2897 return ;
2898 }
2899
2900 if ( fname.Contains(".root") ) {
2901 fGeoFile = TFile::Open(fname, "read");
2902
2903 TGeoVolume *volBes = (TGeoVolume*)(fGeoFile->Get("volBes"));
2904
2905 if (volBes) {
2906 fDisplay->InitGeometryFromROOT(volBes);
2907 fDisplay->Draw();
2908 return ;
2909 }
2910 else {
2911 this->HandleError("This File is not a valid BesVis geometry file : \n TopVolume \"volBes\" not found!");
2912 sprintf(msg, "This File is not a valid BesVis geometry file");
2913 HandleStatusBar(msg);
2914 return;
2915 }
2916 HandleStatusBar("Ready");
2917 }
2918}
2919
2920//_____________________________________________________
2921
2923 //
2924 // save object of Top Volume "volBes" to a ROOT file
2925 // Open file browser
2926
2927 if (!fDisplay) {
2928 this->HandleError("fDisplay not found !");
2929 return;
2930 }
2931
2932 if (!fDisplay->GetBesGeometry()) {
2933 this->HandleError("Bes Geometry not found, Load from ROOT or GDML files first !");
2934 return;
2935 }
2936
2937 TGeoVolume *volBes = fDisplay->GetBesGeometry()->GetVolBes();
2938 if (volBes) {
2939 // get name to save volBes to
2940 static TString EventDir(".");
2941 TGFileInfo fi;
2942 fi.fFileTypes = SaveGeoTypes;
2943 fi.fIniDir = StrDup(EventDir);
2944 char msg[256];
2945 sprintf(msg, "Saving Geometry ----> BUSY!");
2946 HandleStatusBar(msg);
2947 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
2948
2949 TFile *f = new TFile( fi.fFilename,"RECREATE");
2950 volBes->Write();
2951 f->Close();
2952 }
2953 else {
2954 this->HandleError("TGeoVolume \"volBes\" not found !");
2955 return;
2956 }
2957
2958 HandleStatusBar("Ready");
2959}
2960
2961//__________________________________________________________________
2962
2964 //
2965 // Load BesVis event file
2966 if (!gBesGeometry) {
2967 this->HandleError("Geometry not intialized, Load Geometry file first!");
2968 return;
2969 }
2970
2971 // Open file browser
2972 static TString EventDir(".");
2973 TGFileInfo fi;
2974 fi.fFileTypes = OpenEventTypes;
2975 fi.fIniDir = StrDup(EventDir);
2976 char msg[256];
2977 sprintf(msg, "Loading Event File");
2978 HandleStatusBar(msg);
2979 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
2980 EventDir = fi.fIniDir;
2981 this->OpenEventFile(fi.fFilename);
2982}
2983
2984//__________________________________________________________________
2985
2986void BesClient::OpenEventFile(TString fname) {
2987 //
2988 // Open BesVis event file
2989
2990 std::cout << "OpenEventFile: " << fname << std::endl;
2991 HandleStatusBar("Open Event File");
2992 char msg[256];
2993 f_evtFile_1 = fname;
2994 if ( fname.Contains(".root")||fname.Contains(".rtraw")||fname.Contains(".rec") ) {
2995 fEvent = 0;
2996 gEvent = 0;
2997 fEvent = new BesEvent();
2998 gEvent = fEvent;
2999
3000 fEventFile = TFile::Open(fname, "read");
3001
3002 if (fEventFile){
3003 fEventTree = 0;
3004 fEventTree = (TTree*)fEventFile->Get("Event");
3005 }
3006 else {
3007 this->HandleError("This File is not a valid BesVis ROOT Event File!");
3008 sprintf(msg, "This File is not valid");
3009 HandleStatusBar(msg);
3010 return;
3011 }
3012
3013 if (fEventTree) {
3014 Long64_t nEvents = fEventTree->GetEntries();
3015 fEventPlaySlider->SetRange(0, nEvents-1);
3016 fEventPlaySlider->SetPosition(0);
3017
3018 fBesEventNo = 0;
3019 if (nEvents > 0) {
3020 if(f_bossMode == false){
3021 fDigiEvent = 0;
3022 fEvtHeader = 0;
3023 //fTrigEvent = 0;
3024 fRecEvent_1 = 0;
3025 fEventTree->SetBranchAddress("TDigiEvent" , &fDigiEvent);
3026 fEventTree->SetBranchAddress("TRecEvent" , &fRecEvent_1);
3027 fEventTree->SetBranchAddress("TEvtHeader" , &fEvtHeader);
3028 //fEventTree->SetBranchAddress("TTrigEvent" , &fTrigEvent);
3029 }
3030
3031 GetEvent(fBesEventNo);
3032 }
3033
3034 fEventPlaySlider->SetRange(0, nEvents); // tianhl change it
3035 fEventPlaySlider->SetPosition(0);
3036 }
3037 else {
3038 this->HandleError("This File is not a valid BesVis ROOT Event File : \n Event Tree \"Event\" not found!");
3039 sprintf(msg, "This File contains no Event Tree \"Event\"");
3040 HandleStatusBar(msg);
3041 return;
3042 }
3043 HandleStatusBar("Ready");
3044 }
3045}
3046
3047//_____________________________________________________
3048
3050 //
3051 // save picture of canvas in file
3052 // Open file browser
3053
3054 // get name to save events to
3055 static TString EventDir(".");
3056 TGFileInfo fi;
3057 fi.fFileTypes = SavePicTypes;
3058 fi.fIniDir = StrDup(EventDir);
3059 char msg[256];
3060 sprintf(msg, "Saving Picture ----> BUSY!");
3061 HandleStatusBar(msg);
3062 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
3063
3064 if ( fi.fFilename ) {
3065 TString filename = fi.fFilename;
3066 if ( filename.EndsWith("gif") || filename.EndsWith("GIF") ) {
3067 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"gif");
3068 }
3069 else if ( filename.EndsWith("jpg") || filename.EndsWith("JPG") ) {
3070 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"jpg");
3071 }
3072 else if ( filename.EndsWith("eps") || filename.EndsWith("EPS") ) {
3073 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"eps");
3074 }
3075 else if ( filename.EndsWith("ps") || filename.EndsWith("PS") ) {
3076 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
3077 }
3078 else if ( filename.EndsWith("xpm") || filename.EndsWith("XPM") ) {
3079 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"xmp");
3080 }
3081 else if ( filename.EndsWith("png") || filename.EndsWith("PNG") ) {
3082 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"png");
3083 }
3084 else if ( filename.EndsWith("tiff") || filename.EndsWith("TIFF") ) {
3085 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"tiff");
3086 }
3087 else if ( filename.EndsWith("cxx") || filename.EndsWith("CXX") ) {
3088 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"cxx");
3089 }
3090 else if ( filename.EndsWith("xml") || filename.EndsWith("XML") ) {
3091 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"xml");
3092 }
3093 else if ( filename.EndsWith("root") || filename.EndsWith("ROOT") ) {
3094 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"root");
3095 }
3096 else {
3097 new TGMsgBox(gClient->GetRoot(), this,"Error", "Please give Name and Extension of Filename! \n Valid Extensions are *.gif, *.jpg, *.ps, *.eps, *.xpm, *.png, *.tiff!",gClient->GetPicture("mb_stop_s.xpm"));
3098 SavePicAs();
3099 return;
3100 }
3101 }
3102 HandleStatusBar("Ready");
3103}
3104
3105//_____________________________________________________
3106
3108 //
3109 // save picture of canvas in file
3110 // Open file browser
3111
3112 // get name to save events to
3113 static TString PSEventDir(".");
3114 TGFileInfo fi;
3115 fi.fFileTypes = SavePicPS;
3116 fi.fIniDir = StrDup(PSEventDir);
3117 char msg[256];
3118 sprintf(msg, "Saving Picture as PS ----> BUSY!");
3119 HandleStatusBar(msg);
3120 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
3121
3122 if ( fi.fFilename ) {
3123 TString filename = fi.fFilename;
3124 if ( filename.EndsWith("ps") || filename.EndsWith("PS") ) {
3125 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
3126 }
3127 else {
3128 filename += ".ps";
3129 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
3130 }
3131 }
3132 HandleStatusBar("Ready");
3133}
3134
3135//_____________________________________________________
3136
3138
3139 BesView *view = (BesView*)gPad->GetView();
3140 if (view) {
3141 Double_t x1, y1, x2, y2;
3142 gPad->GetRange(x1, y1, x2, y2);
3143 //cout << "x1 " << x1 << " x2 " << x2 << " y1 " << y1 << " y2 " << y2 << endl;
3144 Int_t iPad = 0;
3145 if (view->GetViewType() == kXYView) iPad = 0;
3146 else if (view->GetViewType() == kZRView) iPad = 1;
3147 else if (view->GetViewType() == k3DView) iPad = 2;
3148 fHomeX[iPad] = 0.5*(x1+x2);
3149 fHomeY[iPad] = 0.5*(y1+y2);
3150 }
3151}
3152
3153//_____________________________________________________
3154
3156
3157 BesView *view = (BesView*)gPad->GetView();
3158 if (view) {
3159 Double_t x1, y1, x2, y2, dx, dy;
3160 gPad->GetRange(x1, y1, x2, y2);
3161 dx = x2 - x1;
3162 dy = y2 - y1;
3163
3164 Int_t iPad = 0;
3165 if (view->GetViewType() == kXYView) iPad = 0;
3166 else if (view->GetViewType() == kZRView) iPad = 1;
3167 else if (view->GetViewType() == k3DView) iPad = 2;
3168
3169 gPad->Range(fHomeX[iPad]-0.5*dx, fHomeY[iPad]-0.5*dy, fHomeX[iPad]+0.5*dx, fHomeY[iPad]+0.5*dy);
3170 }
3171}
3172
3173//_____________________________________________________
3174
3176 //
3177 // save current style to ~/.besvisMyConfig.txt
3178
3179 Int_t ret;
3180 const char *txt;
3181 txt = Form("Save current style to ~/.besvisMyConfig.txt, Yes to save it? ");
3182 new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
3183 "Save My Style", txt, kMBIconExclamation,
3184 kMBYes | kMBNo, &ret);
3185 if (ret == kMBNo) return;
3186
3187 string homePath = getenv("HOME");
3188 string fileName = homePath + string("/.besvisMyConfig.txt");
3189 //cout << "fileName " << fileName << endl;
3190 ofstream fileMyConfig(fileName.c_str(), ios_base::out);
3191
3192 if (fDisplay) {
3193 BesView *viewXY = (BesView*)fDisplay->GetPadXY()->GetView();
3194 if (viewXY) {
3195 BesStatus *status = (BesStatus*)viewXY->GetStatusXY();
3196 fileMyConfig << *status;
3197 //cout << "viewXY " << *status << endl;
3198 }
3199
3200 BesView *viewZR = (BesView*)fDisplay->GetPadZR()->GetView();
3201 if (viewZR) {
3202 BesStatus *status = (BesStatus*)viewZR->GetStatusZR();
3203 fileMyConfig << *status;
3204 //cout << "viewZR " << *status << endl;
3205 }
3206
3207 BesView *view3D = (BesView*)fDisplay->GetPad3D()->GetView();
3208 if (view3D) {
3209 BesStatus *status = (BesStatus*)view3D->GetStatus3D();
3210 fileMyConfig << *status;
3211 //cout << "view3D " << *status << endl;
3212 }
3213 }
3214}
3215
3216//_____________________________________________________
3217
3219 //
3220 // load my style from ~/.besvisMyConfig.txt
3221
3222 string homePath = getenv("HOME");
3223 string fileName = homePath + string("/.besvisMyConfig.txt");
3224 //cout << "fileName " << fileName << endl;
3225
3226 ostringstream s;
3227 s << "The config file: " << fileName.c_str() << " does not exist ! \n Maybe You have not save your config";
3228 if (!FileExists(TString(fileName))) {
3229 this->HandleError(s.str().c_str());
3230 return;
3231 }
3232
3233 ifstream fileMyConfig(fileName.c_str());
3234 if (fDisplay) {
3235 BesView *viewXY = (BesView*)fDisplay->GetPadXY()->GetView();
3236 if (viewXY) {
3237 BesStatus status;
3238 fileMyConfig >> status;
3239 viewXY->GetStatusCurrent()->Transfer(&status, true);
3240 }
3241
3242 BesView *viewZR = (BesView*)fDisplay->GetPadZR()->GetView();
3243 if (viewZR) {
3244 BesStatus status;
3245 fileMyConfig >> status;
3246 viewZR->GetStatusCurrent()->Transfer(&status, true);
3247 }
3248
3249 BesView *view3D = (BesView*)fDisplay->GetPad3D()->GetView();
3250 if (view3D) {
3251 BesStatus status;
3252 fileMyConfig >> status;
3253 view3D->GetStatusCurrent()->Transfer(&status, true);
3254 }
3255 }
3256
3257 UpdateStatus();
3258 UpdateAllView();
3259}
3260
3261//_____________________________________________________
3262
3264 cout<<"BesClient Loading PaletteAxis ... "<<endl;
3265
3266 new BesMdcPalette(gClient->GetRoot(), this);
3267
3268 //TRootHelpDialog* hd1 = new TRootHelpDialog(this, "Mdc Wire Palette",200, 600);
3269 //hd1->ChangeSubframesBackground(GetPic("MdcPalette.gif"));
3270 //hd1->Popup();
3271}
3272
3273//_____________________________________________________
3274
3276
3277 //char str[32];
3278 //sprintf(str, "BesVis Help %s...", gROOT->GetVersion());
3279 //TRootHelpDialog * hd = new TRootHelpDialog(this, str, 600, 400);
3280
3281 TRootHelpDialog * hd = new TRootHelpDialog(this, "Help on BesVis...", 600, 400);
3282 hd->SetText(gHelpBesVis);
3283 hd->Popup();
3284}
3285
3286//_____________________________________________________
3287
3289
3290 fDisplayModeButton[0]->SetPicture(gClient->GetPicture("DisplayMode2D.gif"));
3291 fDisplayModeButton[1]->SetPicture(gClient->GetPicture("DisplayModeXY.gif"));
3292 fDisplayModeButton[2]->SetPicture(gClient->GetPicture("DisplayModeZR.gif"));
3293 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3D.gif"));
3294 fDisplayModeButton[4]->SetPicture(gClient->GetPicture("DisplayModeAll.gif"));
3295
3296 for (Int_t i = 0; i < 5; i++) fDisplayModeButton[i]->SetState(false);
3297}
3298
3299//_____________________________________________________
3300
3302
3303 /*
3304 painter = gGeoManager->GetGeomPainter();
3305 //if (!painter) return;
3306 painter->SetRaytracing(true);
3307 //if (!gPad) return;
3308 gPad->Modified();
3309 gPad->Update();
3310 */
3311
3312 BesView *view = (BesView*)gPad->GetView();
3313 if (!view) return;
3314
3315 if (view && view->GetViewType() & k3DView) {
3316 //gPad->x3d();
3317 gPad->GetViewer3D();
3318 // use TPad::Getviewer3D() instead of depreciated function x3d()
3319 // changed by tianhl at Mon Aug 20 2007
3320 fViewer3DMode = 1;
3321
3322 TViewerX3D *x3d = 0;
3323 x3d = (TViewerX3D*)gPad->GetViewer3D();
3324 //x3d = (TViewerX3D*)TViewerX3D::Viewer3D("x3d");
3325 if (!x3d) cout << " x3d does not exist "<< endl;
3326 else
3327 x3d->ExecCommand(0,0,'r');
3328 //x3d->ExecCommand(0,0,'w');
3329 }
3330 else {
3331 string s("Could not start X3D for 2D view, swith to 3D view first");
3332 this->HandleError(s.c_str());
3333 }
3334}
3335
3336//_____________________________________________________
3337
3339
3340 BesView *view = (BesView*)gPad->GetView();
3341 if (!view) return;
3342
3343 // if (view->GetViewType() & k3DView) {
3344 // //gPad->x3d("ogl");
3345 // gPad->GetViewer3D("ogl");
3346 // // use TPad::GetViewer3D() instead of depreciated function TPad::x3d
3347 // // changed by tianhl at Mon Aug 20 2007
3348 // fViewer3DMode = 2;
3349 //
3350 // //TViewerOpenGL *ogl = 0;
3351 // //ogl = (TViewerOpenGL*)gPad->GetViewer3D();
3352 // // update from 4.04 to 5.14
3353 // TVirtualViewer3D *ogl = 0;
3354 // ogl = (TVirtualViewer3D*)gPad->GetViewer3D("ogl");
3355 //
3356 // if (!ogl) cout << " ogl does not exist " << endl;
3357 // UpdateCurrentPad();
3358 // }
3359 // else {
3360 // string s("Could not start OpenGL for 2D view, swith to 3D view first");
3361 // this->HandleError(s.c_str());
3362 // }
3363}
3364
3365
3366//__________________________________________________________________
3367
3369 //
3370 // Got close message for this MainFrame. Calls parent CloseWindow())
3371 // (which destroys the window) and terminate the application.
3372 // The close message is generated by the window manager when its close
3373 // window menu item is selected.
3374 TGMainFrame::CloseWindow();
3375 gApplication->Terminate(0); // 0 = OK
3376}
3377
3378//_____________________________________________________
3379
3380Bool_t BesClient::GetEvent(Long64_t i)
3381{
3382 if (fEventTree) {
3383
3384 Long64_t nEvents = fEventTree->GetEntries();
3385 if (i >= 0 && i < nEvents) {
3386
3387 fDigiEvent = 0;
3388 fEvtHeader = 0;
3389 fRecEvTime = 0;
3390 //fTrigEvent = 0;
3391 TDisTrack * fRecEvent = new TDisTrack();
3392 if (f_bossMode == true){
3393 TBranch *digiEvent = fEventTree->GetBranch("TDigiEvent");
3394 TBranch *evtHeader = fEventTree->GetBranch("TEvtHeader");
3395 //TBranch *trigEvent = fEventTree->GetBranch("TTrigEvent");
3396 TBranch *disTrack = fEventTree->GetBranch("TDisTrack");
3397 digiEvent->SetAddress(&fDigiEvent);
3398 //trigEvent->SetAddress(&fTrigEvent);
3399 disTrack->SetAddress(&fRecEvent);
3400 disTrack->GetEntry(i);
3401 digiEvent->GetEntry(i);
3402 evtHeader->GetEntry(i);
3403 //trigEvent->GetEntry(i);
3404 }
3405
3406 if (f_bossMode == false){
3407 fEventTree->GetEntry(i);
3408 if (recTrack1){
3409 delete [] recTrack1;
3410 recTrack1 = NULL;
3411 }
3412 //yzhang get event start time
3413 if(fRecEvent_1){
3414 if(fRecEvent_1->getEvTimeCol()->GetEntries()==1){
3415 fRecEvTime = (TRecEvTime*) fRecEvent_1->getEvTimeCol()->At(0);
3416 }else{
3417 cout<<"WARNING:EsTimeCol size!=1, size="<<fRecEvent_1->getEvTimeCol()->GetEntries()<<endl;
3418 }
3419 }
3420 //zhangy
3421
3422 int no = 0;
3423
3424 recTrack1 = new TRecMdcTrack[20];
3425
3426 if (fRecEvent_1){
3427 if (fRecEvent_1->getRecMdcTrackCol()){
3428 no=(fRecEvent_1->getRecMdcTrackCol())->GetEntries();
3429 }
3430 if (no>20) no=20;
3431 for (int i=0;i<no;i++){
3432 const TRecMdcTrack* recTrack =fRecEvent_1->getRecMdcTrack(i);
3433 (recTrack1+i)->setTRecMdcTrack(recTrack);
3434 fRecEvent->addRecMdcTrack(recTrack1+i);
3435 }
3436
3437 ////yzhang
3438 //if (kalTrack){
3439 // delete [] kalTrack;
3440 // kalTrack = NULL;
3441 //}
3442 //kalTrack = new TRecMdcKalTrack[20];
3443 //no=0;
3444 //if (fRecEvent_1->getRecMdcKalTrackCol()){
3445 // no=(fRecEvent_1->getRecMdcKalTrackCol())->GetEntries();
3446 //}
3447 //if (no>20) no=20;
3448 //for (int i=0;i<no;i++){
3449 // TRecMdcKalTrack* kalTrack1 = const_cast<TRecMdcKalTrack*> (fRecEvent_1->getRecMdcKalTrack(i));
3450 // //(kalTrack+i)->setTRecMdcKalTrack(kalTrack1);
3451 // fRecEvent->addRecMdcKalTrack(kalTrack1);
3452 //}
3453 ////zhangy
3454
3455 if (tofTrack){
3456 delete [] tofTrack;
3457 tofTrack = NULL;
3458 }
3459 tofTrack = new TRecTofTrack[200];
3460 no=0;
3461 if (fRecEvent_1->getTofTrackCol()){
3462 no = (fRecEvent_1->getTofTrackCol())->GetEntries();
3463 }
3464
3465 if (no>200) no =200;
3466 for (int i=0;i<no;i++){
3467 const TRecTofTrack* tofTrack1 =fRecEvent_1->getTofTrack(i);
3468 (tofTrack+i)->setTRecTofTrack(tofTrack1);
3469 fRecEvent->addTofTrack(tofTrack+i);
3470 }
3471
3472 if (mdchit){
3473 delete [] mdchit;
3474 mdchit = NULL;
3475 }
3476 mdchit = new TRecMdcHit[1000];
3477 no=0;
3478 if (fRecEvent_1->getRecMdcHitCol()){
3479 no = (fRecEvent_1->getRecMdcHitCol())->GetEntries();
3480 }
3481 if (no>1000) no =1000;
3482 for (int i=0;i<no;i++){
3483 const TRecMdcHit* mdchit1 =fRecEvent_1->getRecMdcHit(i);
3484 (mdchit+i)->setTRecMdcHit(mdchit1);
3485 fRecEvent->addRecMdcHit(mdchit+i);
3486 }
3487
3488 if (muctrk){
3489 delete [] muctrk;
3490 muctrk= NULL;
3491 }
3492 muctrk = new TRecMucTrack[20];
3493 no=0;
3494 if (fRecEvent_1->getMucTrackCol()){
3495 no = (fRecEvent_1->getMucTrackCol())->GetEntries();
3496 }
3497 if (no>20) no=20;
3498 for (int i=0;i<no;i++){
3499 const TRecMucTrack* mucTrack1 =fRecEvent_1->getMucTrack(i);
3500 (muctrk+i)->setTRecMucTrack(mucTrack1);
3501 fRecEvent->addMucTrack(muctrk+i);
3502 }
3503
3504 if (emcshower){
3505 delete [] emcshower;
3506 emcshower=NULL;
3507 }
3508 emcshower = new TRecEmcShower[20];
3509 no=0;
3510 if (fRecEvent_1->getEmcShowerCol()){
3511 no = (fRecEvent_1->getEmcShowerCol())->GetEntries();
3512 }
3513 if (no>20) no=20;
3514 for (int i=0;i<no;i++){
3515 const TRecEmcShower* rec_emc =fRecEvent_1->getEmcShower(i);
3516 (emcshower+i)->setTRecEmcShower(rec_emc);
3517 fRecEvent->addEmcShower(emcshower+i);
3518 }
3519 }
3520 }
3521
3522
3523 //fEvent->SetEvent(fDigiEvent, fRecEvent, fEvtHeader, fTrigEvent);
3524 fEvent->SetEvent(fDigiEvent, fRecEvent, fEvtHeader, fRecEvTime);
3525 //delete fRecEvent;
3526 UpdateAllView();
3527 UpdateStatus();
3528 return true;
3529 }
3530 else {
3531 fAutoDisplayEvent = kFALSE;
3532 if (fAutoDisplayEventTimer) {
3533 fAutoDisplayEventTimer->TurnOff();
3534 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventPlay.gif"));
3535 }
3536
3537 ostringstream s;
3538 s << "Request event entry " << i
3539 << " does not exist ! \n valid ("
3540 << 0 << "~" << nEvents - 1 << ")";
3541 this->HandleError(s.str().c_str());
3542 return false;
3543 }
3544 }
3545 else {
3546 fAutoDisplayEvent = kFALSE;
3547 if (fAutoDisplayEventTimer) fAutoDisplayEventTimer->TurnOff();
3548 this->HandleError("Event Tree does not exist !");
3549 return false;
3550 }
3551}
3552
3554 int semid, shmid, n, runNo;
3555 int *shmptr;
3556 int sem_value_F, sem_value_O;
3557
3558 // set autodisplay on
3559 if (fAutoDisplayEvent){
3560 if (fAutoDisplayEventTimer)
3561 fAutoDisplayEventTimer->TurnOn();
3562 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventStop.gif"));
3563 }
3564
3565 // access semaphore
3566 if ((semid = semget(f_pid, 2, 0)) == -1){
3567 perror("concumer -- access -- semget");
3568 exit(0);
3569 }
3570 else {
3571 acquire.sem_num = OUTPUT_STORE;
3572 //*******************************
3573 // Debug information
3574 //*******************************
3575 //std::cout << "acquire.sem_num: " << OUTPUT_STORE << std::endl;
3576 //std::cout << "acquire.sem_num: " << acquire.sem_num << std::endl;
3577 //std::cout << "acquire.sem_op: " << acquire.sem_op << std::endl;
3578 //
3579 //std::cout << "Current Event No. : " << fCurrentEvent << std::endl;
3580 //std::cout << "besvis has gotten semid: " << semid << std::endl;
3581 //std::cout << "before change OUTPUT_STORE" << std::endl;
3582
3583 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
3584 // perror("Can not get FREE_SPACE");
3585 //}
3586 ////if (sem_value_F == 1) return true;
3587 //std::cout << "Semaphore FREE_SPACE has value of(refer 0) " << sem_value_F << std::endl;
3588
3589
3590 //std::cout << "OUTPUT_STORE will decrease from 1 to 0" << std::endl;
3591 //*******************************
3592 // operate semaphore:OUTPUT_STORE
3593 //*******************************
3594 if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
3595 perror("Can not get OUTPUT_STORE");
3596 }
3597 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 1) " << sem_value_O << std::endl;
3598 if (sem_value_O == 0) return true;
3599 if (f_runStatus == RUN_ERROR){
3600 release.sem_num = FREE_SPACE;
3601 if (semop(semid, &release, 1) == -1){
3602 perror("consumer -- increase -- freeSpace");
3603 exit(0);
3604 }
3605 std::cout << "read data error " << std::endl;
3606 f_runStatus = RUN_SMOOTH;
3607 return true;
3608 }
3609 f_runStatus = RUN_ERROR;
3610
3611 if (semop(semid, &acquire, 1) == -1){
3612 perror("consumer -- decrease -- storage");
3613 exit(0);
3614 }
3615
3616 //*******************************
3617 // Debug information
3618 //*******************************
3619 //std::cout << "Current Event No. : " << fCurrentEvent << std::endl;
3620 //std::cout << "besvis has gotten semid: " << semid << std::endl;
3621 //std::cout << "besvis will read data" << std::endl;
3622 //std::cout << "OUTPUT_STORE must decrease from 1 to 0" << std::endl;
3623
3624 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
3625 // perror("Can not get FREE_SPACE");
3626 //}
3627 //std::cout << "Semaphore FREE_SPACE has value of(refer 0) " << sem_value_F << std::endl;
3628 //
3629 //if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
3630 // perror("Can not get OUTPUT_STORE");
3631 //}
3632 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 0) " << sem_value_O << std::endl;
3633 //*******************************
3634 if (fCurrentEvent >= 1){
3635 if (fDigiEvent){
3636 //fDigiEvent->Clear();
3637 delete fDigiEvent;
3638 fDigiEvent=0;
3639 }
3640 if (fEvtHeader){
3641 fEvtHeader->Clear();
3642 delete fEvtHeader;
3643 fEvtHeader=0;
3644 }
3645 //if (fTrigEvent){
3646 // //fTrigEvent->Clear();
3647 // delete fTrigEvent;
3648 // fTrigEvent=0;
3649 //}
3650 if (fEvent){
3651 delete fEvent;
3652 fEvent = NULL;
3653 }
3654 }
3655
3656
3657 //*******************************
3658 // read from share file
3659 //*******************************
3660 OpenEventFile(f_evtFile);
3661 if (fEventFile == NULL){
3662 return true;
3663 }
3664 if (fEventTree)
3665 delete fEventTree;
3666 fEventFile->Close();
3667 delete fEventFile;
3668 //*******************************
3669
3670 release.sem_num = FREE_SPACE;
3671 //*******************************
3672 // Debug information
3673 //*******************************
3674 //std::cout << "release.sem_num: " << FREE_SPACE << std::endl;
3675 //std::cout << "release.sem_num: " << release.sem_num << std::endl;
3676 //std::cout << "release.sem_op: " << release.sem_op << std::endl;
3677 //
3678 //std::cout << "Current Event No. : " << fCurrentEvent << std::endl;
3679 //std::cout << "besvis has gotten semid: " << semid << std::endl;
3680 //std::cout << "besvis has read data" << std::endl;
3681 //std::cout << "before change FREE_SPACE" << std::endl;
3682
3683 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
3684 // perror("Can not get FREE_SPACE");
3685 //}
3686 //std::cout << "Semaphore FREE_SPACE has value of(refer 0) " << sem_value_F << std::endl;
3687 //
3688 //if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
3689 // perror("Can not get OUTPUT_STORE");
3690 //}
3691 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 0) " << sem_value_O << std::endl;
3692 //
3693 //std::cout << "FREE_SPACE will increase from 0 to 1" << std::endl;
3694 //*******************************
3695 // operate semaphore:FREE_SPACE
3696 //*******************************
3697 if (semop(semid, &release, 1) == -1){
3698 perror("consumer -- increase -- freeSpace");
3699 exit(0);
3700 }
3701 std::cout << "Current Event No. : " << fCurrentEvent++ << std::endl;
3702 //*******************************
3703 // Debug information
3704 //*******************************
3705 //std::cout << "besvis has gotten semid: " << semid << std::endl;
3706 //std::cout << "besvis has read data" << std::endl;
3707 //std::cout << "FREE_SPACE must increase from 0 to 1" << std::endl;
3708
3709 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
3710 // perror("Can not get FREE_SPACE");
3711 //}
3712 //std::cout << "Semaphore FREE_SPACE has value of(refer 1) " << sem_value_F << std::endl;
3713 //
3714 //if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
3715 // perror("Can not get OUTPUT_STORE");
3716 //}
3717 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 0) " << sem_value_O << std::endl;
3718 //*******************************
3719 }
3720 f_runStatus = RUN_SMOOTH;
3721 return true;
3722}
3723//_____________________________________________________
3724
3726{
3727 Bool_t status;
3728 fBesEventNo++;
3729 if ( f_bossMode == false) {
3730 status = GetEvent(fBesEventNo);
3731 }
3732 else if ( f_bossMode == true) {
3733 std::cout << "In Boss Mode, execute NextEvent()" << std::endl;
3734 status = GetRecEvent();
3735 }
3736 if (!status) fBesEventNo--;
3737 return status;
3738}
3739
3740//_____________________________________________________
3741
3743{
3744 Bool_t status;
3745 fBesEventNo--;
3746 if ( f_bossMode == false){
3747 status = GetEvent(fBesEventNo);
3748 }
3749 else if ( f_bossMode == true){
3750 // add error box
3751 this->HandleError("Boss Mode can not get previous event!");
3752 }
3753 if (!status) fBesEventNo++;
3754 return status;
3755}
3756
3757//_____________________________________________________
3758
3760{
3761 Bool_t status;
3762 if ( f_bossMode == false){
3763 fBesEventNo = 0;
3764 status = GetEvent(fBesEventNo);
3765 }
3766 else if ( f_bossMode == true){
3767 // add error box
3768 this->HandleError("Boss Mode can not get first event!");
3769 }
3770 return status;
3771}
3772
3773//_____________________________________________________
3774
3776{
3777 //if (fEventTree) {
3778 fAutoDisplayEvent = !fAutoDisplayEvent;
3779 std::cout << "(AutoDisplayEvent)fAutoDisplayEvent: " << fAutoDisplayEvent << std::endl;
3780 if (fAutoDisplayEventTimer) {
3781 if (fAutoDisplayEvent) {
3782 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventStop.gif"));
3783 fAutoDisplayEventTimer->TurnOn();
3784 }
3785 else {
3786 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventPlay.gif"));
3787 fAutoDisplayEventTimer->TurnOff();
3788 }
3789 }
3790 //}
3791
3792 /*
3793 fAutoDisplayEvent = kTRUE;
3794 if (gDebug) cout << "Into AutoDisplayEvent(), fAutoDisplayEvent = " << fAutoDisplayEvent << " fEventPlaySpeed " << fEventPlaySpeed << endl;
3795
3796 if (fAutoDisplayEventTimer) fAutoDisplayEventTimer->TurnOn();
3797 */
3798}
3799
3800//_____________________________________________________
3801
3803{
3804 NextEvent();
3806}
3807
3808//_____________________________________________________
3809
3811{
3812 fAutoRotate = !fAutoRotate;
3813
3814 if (!fAutoRotate) {
3815 fAutoRotateClockWise = 0;
3816 fAutoRotateTheta = 0;
3817 fAutoRotatePhi = 0;
3818 fAutoRotatePsi = 0;
3819 }
3820
3821 if (fAutoRotateTimer) {
3822 if (fAutoRotate) fAutoRotateTimer->TurnOn();
3823 else fAutoRotateTimer->TurnOff();
3824 }
3825}
3826
3827//_____________________________________________________
3828
3830{
3831 if (fAutoRotateClockWise != 0) {
3832 RotateClockWise(fAutoRotateClockWise);
3833 }
3834
3835 if (fAutoRotateTheta != 0) {
3836 RotateTheta(fAutoRotateTheta);
3837 }
3838
3839 if (fAutoRotatePhi != 0) {
3840 RotatePhi(fAutoRotatePhi);
3841 }
3842
3843 if (fAutoRotatePsi != 0) {
3844 RotatePsi(fAutoRotatePsi);
3845 }
3846
3847 /*
3848 Int_t iret;
3849 if (fDisplay->GetPadXY()->GetView()) {
3850 fDisplay->GetPadXY()->GetView()->SetView(fDisplay->GetPadXY()->GetView()->GetLongitude()+fRotateStep,
3851 fDisplay->GetPadXY()->GetView()->GetLatitude(),
3852 fDisplay->GetPadXY()->GetView()->GetPsi(), iret);
3853 fDisplay->GetPadXY()->Modified();
3854 fDisplay->GetPadXY()->Update();
3855 }
3856 if (fDisplay->GetPadZR()->GetView()) {
3857 fDisplay->GetPadZR()->GetView()->SetView(fDisplay->GetPadZR()->GetView()->GetLongitude()+fRotateStep,
3858 fDisplay->GetPadZR()->GetView()->GetLatitude(),
3859 fDisplay->GetPadZR()->GetView()->GetPsi(), iret);
3860 fDisplay->GetPadZR()->Modified();
3861 fDisplay->GetPadZR()->Update();
3862 }
3863 */
3864
3867}
3868
3869//_____________________________________________________
3870
3871void BesClient::RotateClockWise(int clockwise) // -1 = counterclockwise
3872{
3873 Double_t phi = 0.0;
3874 Int_t iret;
3875 if (fDisplay->GetPadXY()->GetView()) {
3876 phi = fDisplay->GetPadXY()->GetView()->GetLongitude();
3877 phi += clockwise * fRotateStep;
3878 fDisplay->GetPadXY()->GetView()->SetView(phi,
3879 fDisplay->GetPadXY()->GetView()->GetLatitude(),
3880 fDisplay->GetPadXY()->GetView()->GetPsi(), iret);
3881 fDisplay->GetPadXY()->Modified();
3882 fDisplay->GetPadXY()->Update();
3883 }
3884 if (fDisplay->GetPadZR()->GetView()) {
3885 //phi = fDisplay->GetPadZR()->GetView()->GetLongitude();
3886 //phi += clockwise * fRotateStep;
3887 phi += 180.0;
3888 fDisplay->GetPadZR()->GetView()->SetView(phi,
3889 fDisplay->GetPadZR()->GetView()->GetLatitude(),
3890 fDisplay->GetPadZR()->GetView()->GetPsi(), iret);
3891 fDisplay->GetPadZR()->Modified();
3892 fDisplay->GetPadZR()->Update();
3893 }
3894}
3895
3896//_____________________________________________________
3897
3898void BesClient::RotateTheta(int pn) // 1 plus, -1 minus
3899{
3900 BesView *view = (BesView*)gPad->GetView();
3901
3902 if (view) {
3903 Double_t theta = view->GetLatitude() + pn*fRotateStep;
3904 Int_t iret;
3905 SetRange(theta, 0.0, 180.0);
3906 view->SetView(view->GetLongitude(), theta, view->GetPsi(), iret);
3907 //gPad->Modified();
3908 //gPad->Update();
3909 }
3910}
3911
3912//_____________________________________________________
3913
3914void BesClient::RotatePhi(int pn) // 1 plus, -1 minus
3915{
3916 BesView *view = (BesView*)gPad->GetView();
3917
3918 if (view) {
3919 Double_t phi = view->GetLongitude() + pn*fRotateStep;
3920 Int_t iret;
3921 SetRange(phi, 0.0, 360.0);
3922 view->SetView(phi, view->GetLatitude(), view->GetPsi(), iret);
3923 //gPad->Modified();
3924 //gPad->Update();
3925 }
3926}
3927
3928//_____________________________________________________
3929
3930void BesClient::RotatePsi(int pn) // 1 plus, -1 minus
3931{
3932 BesView *view = (BesView*)gPad->GetView();
3933
3934 if (view) {
3935 Double_t psi = view->GetPsi() + pn*fRotateStep;
3936 Int_t iret;
3937 SetRange(psi, 0.0, 360.0);
3938 view->SetView(view->GetLongitude(), view->GetLatitude(), psi, iret);
3939 //gPad->Modified();
3940 //gPad->Update();
3941 }
3942}
3943
3944//__________________________________________________________________
3945
3946void BesClient::HandleEventList(TGListTreeItem *entry, Int_t btn) {
3947 //
3948 // Event list handling for buttons
3949
3950 if ( entry->GetFirstChild() != 0 ) {
3951 // Run folder
3952 if ( entry->IsOpen() ) {
3953 fEventListTree->CloseItem(entry);
3954 } else {
3955 fEventListTree->OpenItem(entry);
3956 }
3957 } else {
3958 fEventListTree->HighlightItem(entry);
3959 gClient->NeedRedraw(fEventListTree);
3960
3961 // Event item
3962 fItem = entry;
3963 fRunItem = entry->GetParent();
3964 TString msg1("Displaying Run ");
3965 HandleStatusBar(msg1.Data());
3966
3967 SetState(); // includes canvas update
3968
3969 TString msg2("Run ");
3970 HandleStatusBar(msg2.Data());
3971 }
3972
3973 // Redraw canvas
3974 TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
3975 canvas->Modified();
3976 canvas->Update();
3977}
3978
3979//__________________________________________________________________
3980
3981void BesClient::ExecuteEvent(Int_t event, Int_t px, Int_t py, TObject *sel) {
3982 //
3983 // Actions in reponse to mouse button events
3984
3985 // Get view from current pad
3986 if ( !gBesGeometry ) {
3987 cout << "there is not BesGeometry" << endl; // added by tianhl to debug event
3988 return;
3989 }
3990
3991
3992 BesView *view = (BesView*)gPad->GetView();
3993 TString viewInfo;
3994 if (view) viewInfo = TString(view->GetObjectInfo(px, py));
3995
3996 switch (event) {
3997
3998 case kKeyPress:
3999 // px = char code of pressed key
4000 // py = counter
4001 if ( py <= 0 ) py = 1; // Reset counter
4002 switch ( Char_t(px) ) {
4003 case '-': // Zoom out
4004 case 'k':
4005 case 'K':
4006 case 'q':
4007 case 'Q':
4008 view->ZoomOut();
4009 break;
4010 case '+': // Zoom in
4011 case 'j':
4012 case 'J':
4013 case 'e':
4014 case 'E':
4015 view->ZoomIn();
4016 break;
4017 case 'h': // Move to the left
4018 case 'H':
4019 case 'a':
4020 case 'A':
4021 view->Move(-10,0);
4022 fEmbeddedCanvas->GetCanvas()->Update();
4023 break;
4024 case 'l': // Move to the right
4025 case 'L':
4026 case 'd':
4027 case 'D':
4028 view->Move(10,0);
4029 fEmbeddedCanvas->GetCanvas()->Update();
4030 break;
4031 case 'u': // Move up
4032 case 'U':
4033 case 'w':
4034 case 'W':
4035 view->Move(0,-10);
4036 fEmbeddedCanvas->GetCanvas()->Update();
4037 break;
4038 case 'i': // Move down
4039 case 'I':
4040 case 's':
4041 case 'S':
4042 view->Move(0,10);
4043 fEmbeddedCanvas->GetCanvas()->Update();
4044 break;
4045 case 'n':
4046 case 'N':
4047 this->NextEvent();
4048 break;
4049 case 'p':
4050 case 'P':
4051 this->PrevEvent();
4052 break;
4053 case 'g':
4054 case 'G':
4055 this->SavePicAs();
4056 default:
4057 break;
4058 }
4059 break;
4060
4061 default:
4062 if ( sel != 0 ) {
4063 //if ( !gPad->InheritsFrom("BesCanvas") ) {
4064 if ( gPad->GetName() != TString("PadHeader")) {
4065 TString info(sel->GetTitle());
4066 info.Append(": ");
4067 info.Append(sel->GetObjectInfo(px, py));
4068 //info.Append(viewInfo);
4069 HandleInfoBar(info.Data());
4070 }
4071 }
4072 break;
4073 }
4074
4076 }
4077
4078 //__________________________________________________________________
4079
4080 void BesClient::SetState(Int_t id) {
4081 //
4082 // set geometry state and update Canvas
4083 if (id == -1) {
4084 TGButton *btn = (TGButton *) gTQSender;
4085 id = btn->WidgetId();
4086 }
4087
4088 BesView *view = (BesView*)gPad->GetView();
4089 if ( view ) {
4090 switch (id) {
4091
4092 case kM_Header_Global:
4093 break;
4094
4095 case kM_Mdc_Global:
4096 view->SetVisMdcGlobal(fChkBtnMdcGlobal->GetState());
4097 //gBesGeometry->GetMdcROOTGeo()->SetDetectorOn();
4098 //cout << "Mdc Global vis " << endl;
4099 break;
4100
4101 case kM_Mdc_Tubes:
4102 view->SetVisMdcTubes(fChkBtnMdcTubes->GetState());
4103 //HandleViewOptionMenu(kM_Mdc_Tubes);
4104 break;
4105
4106 case kM_Mdc_Wires:
4107 view->SetVisMdcWires(fChkBtnMdcWires->GetState());
4108 //HandleViewOptionMenu(kM_Mdc_Wires);
4109 break;
4110
4111 case kM_Tof_Global:
4112 view->SetVisTofGlobal(fChkBtnTofGlobal->GetState());
4113 //cout << "Tof Global vis " << endl;
4114 break;
4115
4116 case kM_Tof_East:
4117 view->SetVisTofEast(fChkBtnTofEast->GetState());
4118 break;
4119
4120 case kM_Tof_Barrel:
4121 view->SetVisTofBarrel(fChkBtnTofBarrel->GetState());
4122 break;
4123
4124 case kM_Tof_West:
4125 view->SetVisTofWest(fChkBtnTofWest->GetState());
4126 break;
4127
4128 case kM_Emc_Global:
4129 view->SetVisEmcGlobal(fChkBtnEmcGlobal->GetState());
4130 //cout << "Emc Global vis " << endl;
4131 break;
4132
4133 case kM_Emc_East:
4134 view->SetVisEmcEast(fChkBtnEmcEast->GetState());
4135 break;
4136
4137 case kM_Emc_Barrel:
4138 view->SetVisEmcBarrel(fChkBtnEmcBarrel->GetState());
4139 break;
4140
4141 case kM_Emc_West:
4142 view->SetVisEmcWest(fChkBtnEmcWest->GetState());
4143 break;
4144
4145 case kM_Emc_Side:
4146 view->SetVisEmcSide(fChkBtnEmcSide->GetState());
4147 break;
4148
4149 case kM_Muc_Global:
4150 view->SetVisMucGlobal(fChkBtnMucGlobal->GetState());
4151 //cout << "Muc Global vis " << endl;
4152 break;
4153
4154 case kM_Muc_East:
4155 view->SetVisMucEast(fChkBtnMucEast->GetState());
4156 break;
4157
4158 case kM_Muc_Barrel:
4159 view->SetVisMucBarrel(fChkBtnMucBarrel->GetState());
4160 break;
4161
4162 case kM_Muc_West:
4163 view->SetVisMucWest(fChkBtnMucWest->GetState());
4164 break;
4165
4166 case kM_Muc_Strips:
4167 view->SetVisMucStrips(fChkBtnMucStrips->GetState());
4168 break;
4169
4170 case kM_BeamPipe:
4171 view->SetVisBeamPipe(fChkBtnBeamPipe->GetState());
4172 break;
4173
4174 case kM_ZRPlaneOnXY:
4175 view->SetVisZRPlaneOnXY(fChkBtnZRPlaneOnXY->GetState());
4176 break;
4177
4178 case kM_Axis:
4179 view->SetVisAxis(fChkBtnAxis->GetState());
4180 break;
4181
4182 case kM_MdcHits_Global:
4183 view->SetVisMdcHitsGlobal(fChkBtnMdcHitsGlobal->GetState());
4184 break;
4185
4186 case kM_TofHits_Global:
4187 view->SetVisTofHitsGlobal(fChkBtnTofHitsGlobal->GetState());
4188 break;
4189
4190 case kM_TofHits_East:
4191 view->SetVisTofHitsEast(fChkBtnTofHitsEast->GetState());
4192 break;
4193
4194 case kM_TofHits_Barrel:
4195 view->SetVisTofHitsBarrel(fChkBtnTofHitsBarrel->GetState());
4196 break;
4197
4198 case kM_TofHits_West:
4199 view->SetVisTofHitsWest(fChkBtnTofHitsWest->GetState());
4200 break;
4201
4202 case kM_EmcHits_Global:
4203 view->SetVisEmcHitsGlobal(fChkBtnEmcHitsGlobal->GetState());
4204 break;
4205
4206 case kM_EmcHits_East:
4207 view->SetVisEmcHitsEast(fChkBtnEmcHitsEast->GetState());
4208 break;
4209
4210 case kM_EmcHits_Barrel:
4211 view->SetVisEmcHitsBarrel(fChkBtnEmcHitsBarrel->GetState());
4212 break;
4213
4214 case kM_EmcHits_West:
4215 view->SetVisEmcHitsWest(fChkBtnEmcHitsWest->GetState());
4216 break;
4217
4218 case kM_EmcHits_Side:
4219 view->SetVisEmcHitsSide(fChkBtnEmcHitsSide->GetState());
4220 break;
4221
4222 case kM_MucHits_Global:
4223 view->SetVisMucHitsGlobal(fChkBtnMucHitsGlobal->GetState());
4224 break;
4225
4226 case kM_MucHits_East:
4227 view->SetVisMucHitsEast(fChkBtnMucHitsEast->GetState());
4228 break;
4229
4230 case kM_MucHits_Barrel:
4231 view->SetVisMucHitsBarrel(fChkBtnMucHitsBarrel->GetState());
4232 break;
4233
4234 case kM_MucHits_West:
4235 view->SetVisMucHitsWest(fChkBtnMucHitsWest->GetState());
4236 break;
4237
4238 case kM_Tracks_Global:
4239 view->SetVisTracksGlobal(fChkBtnTracksGlobal->GetState());
4240 break;
4241
4242 case kM_Tracks_Mdc:
4243 view->SetVisTracksMdc(fChkBtnTracksMdc->GetState());
4244 break;
4245
4246 case kM_Tracks_Tof:
4247 view->SetVisTracksTof(fChkBtnTracksTof->GetState());
4248 break;
4249
4250 case kM_Tracks_Emc:
4251 view->SetVisTracksEmc(fChkBtnTracksEmc->GetState());
4252 break;
4253
4254 case kM_Tracks_Muc:
4255 view->SetVisTracksMuc(fChkBtnTracksMuc->GetState());
4256 break;
4257
4258 case kM_Tracks_Ext:
4259 view->SetVisTracksExt(fChkBtnTracksExt->GetState());
4260 break;
4261
4263 this->SetMdcTFire(fChkBtnMdcTMatchGlobal->GetState());
4264 break;
4265
4267 this->SetMdcQFire(fChkBtnMdcQMatchGlobal->GetState());
4268 break;
4269
4270 //case kM_Mdc_TOverflow_Global:
4271 // this->SetMdcTOverflow(fChkBtnMdcTOverflowGlobal->GetState());
4272 // break;
4273
4275 this->SetMdcQNotOverflow(fChkBtnMdcQOverflowGlobal->GetState());
4276 break;
4277
4279 this->SetMdcColorfulWire(fChkBtnMdcColorfulWireGlobal->GetState());
4280 break;
4281
4283 this->SetMdcTimeSubEvTime(fChkBtnMdcTimeSubEvTimeGlobal->GetState());
4284 break;
4285
4287 this->SetTofTMatch(fChkBtnTofTMatchGlobal->GetState());
4288 break;
4289
4291 this->SetTofQMatch(fChkBtnTofQMatchGlobal->GetState());
4292 break;
4293 }
4294
4295
4296 view->UpdateView(0);
4297
4298 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Modified();
4299 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Update();
4300 }
4301
4302 UpdateStatus();
4303 }
4304
4305 //_____________________________________________________
4306
4308 //
4309 // get status from active BesView instance
4310 BesView *view = (BesView*)gPad->GetView();
4311
4312 if ( view ) {
4313 fZoomRatioNumber->SetNumber(view->GetStatusCurrent()->fZoom*100.0);//yzhang
4314 view->SetZoomRatio(view->GetStatusCurrent()->fZoom);//yzhang
4315
4316 // fish eye tick in zview menu
4317 view->SetFishEye(view->GetFishEyeStatus());
4318
4319 // Mdc global
4320 fChkBtnMdcGlobal->SetOn(view->GetVisMdcGlobal());
4321
4322 // Mdc Tubes
4323 fChkBtnMdcTubes->SetOn(view->GetVisMdcTubes());
4324
4325 // Mdc Wires
4326 fChkBtnMdcWires->SetOn(view->GetVisMdcWires());
4327
4328 // Tof global
4329 fChkBtnTofGlobal->SetOn(view->GetVisTofGlobal());
4330
4331 // Tof east
4332 fChkBtnTofEast->SetOn(view->GetVisTofEast());
4333
4334 // Tof barrel
4335 fChkBtnTofBarrel->SetOn(view->GetVisTofBarrel());
4336
4337 // Tof west
4338 fChkBtnTofWest->SetOn(view->GetVisTofWest());
4339
4340 // Emc global
4341 fChkBtnEmcGlobal->SetOn(view->GetVisEmcGlobal());
4342
4343 // Emc east
4344 fChkBtnEmcEast->SetOn(view->GetVisEmcEast());
4345
4346 // Emc barrel
4347 fChkBtnEmcBarrel->SetOn(view->GetVisEmcBarrel());
4348
4349 // Emc west
4350 fChkBtnEmcWest->SetOn(view->GetVisEmcWest());
4351
4352 // Emc side
4353 fChkBtnEmcSide->SetOn(view->GetVisEmcSide());
4354
4355 // Muc global
4356 fChkBtnMucGlobal->SetOn(view->GetVisMucGlobal());
4357
4358 // Muc east
4359 fChkBtnMucEast->SetOn(view->GetVisMucEast());
4360
4361 // Muc barrel
4362 fChkBtnMucBarrel->SetOn(view->GetVisMucBarrel());
4363
4364 // Muc west
4365 fChkBtnMucWest->SetOn(view->GetVisMucWest());
4366
4367 // Muc strips
4368 fChkBtnMucStrips->SetOn(view->GetVisMucStrips());
4369
4370 // BeamPipe
4371 fChkBtnBeamPipe->SetOn(view->GetVisBeamPipe());
4372
4373 // ZRPlaneOnXY
4374 fChkBtnZRPlaneOnXY->SetOn(view->GetVisZRPlaneOnXY());
4375
4376 // Axis
4377 fChkBtnAxis->SetOn(view->GetVisAxis());
4378
4379 // Mdc Hits global
4380 fChkBtnMdcHitsGlobal->SetOn(view->GetVisMdcHitsGlobal());
4381
4382 // Tof Hits global
4383 fChkBtnTofHitsGlobal->SetOn(view->GetVisTofHitsGlobal());
4384
4385 // Tof Hits east
4386 fChkBtnTofHitsEast->SetOn(view->GetVisTofHitsEast());
4387
4388 // Tof Hits barrel
4389 fChkBtnTofHitsBarrel->SetOn(view->GetVisTofHitsBarrel());
4390
4391 // Tof Hits west
4392 fChkBtnTofHitsWest->SetOn(view->GetVisTofHitsWest());
4393
4394 // Emc Hits global
4395 fChkBtnEmcHitsGlobal->SetOn(view->GetVisEmcHitsGlobal());
4396
4397 // Emc Hits east
4398 fChkBtnEmcHitsEast->SetOn(view->GetVisEmcHitsEast());
4399
4400 // Emc Hits barrel
4401 fChkBtnEmcHitsBarrel->SetOn(view->GetVisEmcHitsBarrel());
4402
4403 // Emc Hits west
4404 fChkBtnEmcHitsWest->SetOn(view->GetVisEmcHitsWest());
4405
4406 // Emc Hits side
4407 fChkBtnEmcHitsSide->SetOn(view->GetVisEmcHitsSide());
4408
4409 // Muc Hits global
4410 fChkBtnMucHitsGlobal->SetOn(view->GetVisMucHitsGlobal());
4411
4412 // Muc Hits east
4413 fChkBtnMucHitsEast->SetOn(view->GetVisMucHitsEast());
4414
4415 // Muc Hits barrel
4416 fChkBtnMucHitsBarrel->SetOn(view->GetVisMucHitsBarrel());
4417
4418 // Muc Hits west
4419 fChkBtnMucHitsWest->SetOn(view->GetVisMucHitsWest());
4420
4421
4422 // Tracks global
4423 fChkBtnTracksGlobal->SetOn(view->GetVisTracksGlobal());
4424
4425 // Tracks mdc
4426 fChkBtnTracksMdc->SetOn(view->GetVisTracksMdc());
4427
4428 // Tracks tof
4429 fChkBtnTracksTof->SetOn(view->GetVisTracksTof());
4430
4431 // Tracks emc
4432 fChkBtnTracksEmc->SetOn(view->GetVisTracksEmc());
4433
4434 // Tracks muc
4435 fChkBtnTracksMuc->SetOn(view->GetVisTracksMuc());
4436
4437 // Tracks ext
4438 fChkBtnTracksExt->SetOn(view->GetVisTracksExt());
4439
4440
4441 // Mdc Global
4442 if ( view->GetVisMdcGlobal() )
4443 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Global);
4444 else
4445 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Global);
4446
4447 // Mdc Tubes
4448 if ( view->GetVisMdcTubes() )
4449 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Tubes);
4450 else
4451 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Tubes);
4452
4453 // Mdc Wires
4454 if ( view->GetVisMdcWires() )
4455 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Wires);
4456 else
4457 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Wires);
4458
4459 // Tof Global
4460 if ( view->GetVisTofGlobal() )
4461 fMenuViewOptionTof->CheckEntry(kM_Tof_Global);
4462 else
4463 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Global);
4464
4465 // Tof East
4466 if ( view->GetVisTofEast() )
4467 fMenuViewOptionTof->CheckEntry(kM_Tof_East);
4468 else
4469 fMenuViewOptionTof->UnCheckEntry(kM_Tof_East);
4470
4471 // Tof Barrel
4472 if ( view->GetVisTofBarrel() )
4473 fMenuViewOptionTof->CheckEntry(kM_Tof_Barrel);
4474 else
4475 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Barrel);
4476
4477 // Tof West
4478 if ( view->GetVisTofWest() )
4479 fMenuViewOptionTof->CheckEntry(kM_Tof_West);
4480 else
4481 fMenuViewOptionTof->UnCheckEntry(kM_Tof_West);
4482
4483 // Emc Global
4484 if ( view->GetVisEmcGlobal() )
4485 fMenuViewOptionEmc->CheckEntry(kM_Emc_Global);
4486 else
4487 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Global);
4488
4489 // Emc East
4490 if ( view->GetVisEmcEast() )
4491 fMenuViewOptionEmc->CheckEntry(kM_Emc_East);
4492 else
4493 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_East);
4494
4495 // Emc Barrel
4496 if ( view->GetVisEmcBarrel() )
4497 fMenuViewOptionEmc->CheckEntry(kM_Emc_Barrel);
4498 else
4499 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Barrel);
4500
4501 // Emc West
4502 if ( view->GetVisEmcWest() )
4503 fMenuViewOptionEmc->CheckEntry(kM_Emc_West);
4504 else
4505 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_West);
4506
4507 // Emc Side
4508 if ( view->GetVisEmcSide() )
4509 fMenuViewOptionEmc->CheckEntry(kM_Emc_Side);
4510 else
4511 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Side);
4512
4513 // Muc Global
4514 if ( view->GetVisMucGlobal() )
4515 fMenuViewOptionMuc->CheckEntry(kM_Muc_Global);
4516 else
4517 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Global);
4518
4519 // Muc East
4520 if ( view->GetVisMucEast() )
4521 fMenuViewOptionMuc->CheckEntry(kM_Muc_East);
4522 else
4523 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_East);
4524
4525 // Muc Barrel
4526 if ( view->GetVisMucBarrel() )
4527 fMenuViewOptionMuc->CheckEntry(kM_Muc_Barrel);
4528 else
4529 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Barrel);
4530
4531 // Muc West
4532 if ( view->GetVisMucWest() )
4533 fMenuViewOptionMuc->CheckEntry(kM_Muc_West);
4534 else
4535 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_West);
4536
4537 // Muc Strips
4538 if ( view->GetVisMucStrips() )
4539 fMenuViewOptionMuc->CheckEntry(kM_Muc_Strips);
4540 else
4541 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Strips);
4542
4543 // Full3D Mdc
4544 if ( view->GetVisFull3DMdc() )
4545 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Mdc);
4546 else
4547 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Mdc);
4548
4549 // Full3D Tof
4550 if ( view->GetVisFull3DTof() )
4551 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Tof);
4552 else
4553 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Tof);
4554
4555 // Full3D Emc
4556 if ( view->GetVisFull3DEmc() )
4557 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Emc);
4558 else
4559 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Emc);
4560
4561 // Full3D Muc
4562 if ( view->GetVisFull3DMuc() )
4563 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Muc);
4564 else
4565 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Muc);
4566
4567 // BeamPipe
4568 if ( view->GetVisBeamPipe() )
4569 fMenuViewOptionOthers->CheckEntry(kM_BeamPipe);
4570 else
4571 fMenuViewOptionOthers->UnCheckEntry(kM_BeamPipe);
4572
4573 // ZRPlaneOnXY
4574 if ( view->GetVisZRPlaneOnXY() )
4575 fMenuViewOptionOthers->CheckEntry(kM_ZRPlaneOnXY);
4576 else
4577 fMenuViewOptionOthers->UnCheckEntry(kM_ZRPlaneOnXY);
4578
4579 // Axis
4580 if ( view->GetVisAxis() ) {
4581 fMenuViewOptionOthers->CheckEntry(kM_Axis);
4582 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxisST.gif"));
4583 fShowAxisButton->SetState(true);
4584 }
4585 else {
4586 fMenuViewOptionOthers->UnCheckEntry(kM_Axis);
4587 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxis.gif"));
4588 fShowAxisButton->SetState(false);
4589 }
4590
4591 // Mdc Hits
4592 if ( view->GetVisMdcHits() )
4593 fMenuViewOptionMdcHits->CheckEntry(kM_MdcHits_Hits);
4594 else
4595 fMenuViewOptionMdcHits->UnCheckEntry(kM_MdcHits_Hits);
4596
4597 // Tof hits Global
4598 if ( view->GetVisTofHitsGlobal() )
4599 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Global);
4600 else
4601 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Global);
4602
4603 // Tof hits East
4604 if ( view->GetVisTofHitsEast() )
4605 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_East);
4606 else
4607 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_East);
4608
4609 // Tof hits Barrel
4610 if ( view->GetVisTofHitsBarrel() )
4611 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Barrel);
4612 else
4613 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Barrel);
4614
4615 // Tof hits West
4616 if ( view->GetVisTofHitsWest() )
4617 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_West);
4618 else
4619 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_West);
4620
4621 // Emc hits Global
4622 if ( view->GetVisEmcHitsGlobal() )
4623 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Global);
4624 else
4625 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Global);
4626
4627 // Emc hits East
4628 if ( view->GetVisEmcHitsEast() )
4629 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_East);
4630 else
4631 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_East);
4632
4633 // Emc hits Barrel
4634 if ( view->GetVisEmcHitsBarrel() )
4635 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Barrel);
4636 else
4637 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Barrel);
4638
4639 // Emc hits West
4640 if ( view->GetVisEmcHitsWest() )
4641 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_West);
4642 else
4643 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_West);
4644
4645 // Emc hits Side
4646 if ( view->GetVisEmcHitsSide() )
4647 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Side);
4648 else
4649 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Side);
4650
4651 // Muc hits Global
4652 if ( view->GetVisMucHitsGlobal() )
4653 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Global);
4654 else
4655 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Global);
4656
4657 // Muc hits East
4658 if ( view->GetVisMucHitsEast() )
4659 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_East);
4660 else
4661 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_East);
4662
4663 // Muc hits Barrel
4664 if ( view->GetVisMucHitsBarrel() )
4665 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Barrel);
4666 else
4667 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Barrel);
4668
4669 // Muc hits West
4670 if ( view->GetVisMucHitsWest() )
4671 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_West);
4672 else
4673 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_West);
4674
4675 // Tracks Global
4676 if ( view->GetVisTracksGlobal() )
4677 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Global);
4678 else
4679 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Global);
4680
4681 // Tracks Mdc
4682 if ( view->GetVisTracksMdc() )
4683 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Mdc);
4684 else
4685 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Mdc);
4686
4687 // Tracks Tof
4688 if ( view->GetVisTracksTof() )
4689 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Tof);
4690 else
4691 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Tof);
4692
4693 // Tracks Emc
4694 if ( view->GetVisTracksEmc() )
4695 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Emc);
4696 else
4697 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Emc);
4698
4699 // Tracks Muc
4700 if ( view->GetVisTracksMuc() )
4701 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Muc);
4702 else
4703 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Muc);
4704
4705 // Tracks Ext
4706 if ( view->GetVisTracksExt() )
4707 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Ext);
4708 else
4709 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Ext);
4710
4711 // Fish Eye View
4712 if ( view->GetFishEye() ) {
4713 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeViewST.gif"));
4714 }
4715 else {
4716 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeView.gif"));
4717 }
4718
4719 // Parallel or Perspective View
4720 if ( view->IsPerspective() ) {
4721 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelView.gif"));
4722 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveViewST.gif"));
4723 }
4724 else {
4725 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelViewST.gif"));
4726 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveView.gif"));
4727 }
4728 }
4730 }
4731
4732 //__________________________________________________________________
4733
4735 //
4736 // Handle different buttons
4737 if (id == -1) {
4738 TGButton *btn = (TGButton *) gTQSender;
4739 id = btn->WidgetId();
4740 }
4741
4742 //TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
4743 TString query = "";
4744 Int_t displayMode = 0;
4745
4746 Double_t xmin=0.0, ymin=0.0, xmax=0.0, ymax=0.0;
4747 if (gPad) {
4748 xmin = gPad->GetX1();
4749 ymin = gPad->GetY1();
4750 xmax = gPad->GetX2();
4751 ymax = gPad->GetY2();
4752 }
4753
4754 BesView *view = 0;
4755 if (gPad) view = (BesView*)gPad->GetView();
4756 Int_t iret;
4757 //Double_t theta, phi, psi;
4758
4759 switch ( id ) {
4760
4761 case kM_Button_LoadGeoFile: // Load geometry file
4762 LoadGeoFile();
4763 fLoadGeoFileButton->SetPicture(gClient->GetPicture("ButtonLoadGeoFile.gif"));
4764 break;
4765
4766 case kM_Button_OpenEventFile: // Load event file
4767 OpenEventFile();
4768 fOpenEventFileButton->SetPicture(gClient->GetPicture("ButtonOpenEventFile.gif"));
4769 break;
4770
4771 case kM_Button_SavePicAs: // Save picture as
4772 SavePicAs();
4773 fSavePicAsButton->SetPicture(gClient->GetPicture("ButtonSavePicAs.gif"));
4774 break;
4775
4776 case kM_Button_SavePicAsPS: // Save picture as *.ps
4777 fSavePicAsPSButton->SetPicture(gClient->GetPicture("ButtonSavePicAsPSHL.gif"));
4778 //SavePicAsPS();
4779 fEmbeddedCanvas->GetCanvas()->Print("besvis.ps", "ps");
4780 fSavePicAsPSButton->SetPicture(gClient->GetPicture("ButtonSavePicAsPS.gif"));
4781 break;
4782
4783 case kM_Button_Refresh: // Refresh all pads
4784 //fDisplay->SwitchDisplayMode(fDisplay->GetDisplayMode());
4785 //UpdateAllView();
4786 if (view) view->UpdateView(0);
4787 break;
4788
4789 case kM_Button_ResetCurrent: // reset active pad to default
4790 if (view) view->Reset();
4791 break;
4792
4793 case kM_Button_ResetAll: // Reset all pads to Default
4794 if (view) fDisplay->Reset();
4795 break;
4796
4797 case kM_Button_CursorPick: // Cursor Pick
4799 fCursorButton[0]->SetPicture(gClient->GetPicture("ButtonCursorPickST.gif"));
4800 fCursorButton[0]->SetState(true);
4801 fCursorButton[1]->SetPicture(gClient->GetPicture("ButtonCursorHand.gif"));
4802 fCursorButton[1]->SetState(false);
4803 //fCursorButton[0]->SetState(kButtonEngaged);
4804 //fCursorButton[1]->SetState(kButtonUp);
4805 break;
4806
4807 case kM_Button_CursorHand: // Cursor Hand
4809 fCursorButton[0]->SetPicture(gClient->GetPicture("ButtonCursorPick.gif"));
4810 fCursorButton[0]->SetState(false);
4811 fCursorButton[1]->SetPicture(gClient->GetPicture("ButtonCursorHandST.gif"));
4812 fCursorButton[1]->SetState(true);
4813 break;
4814
4815 case kM_Button_ZoomOut: // Zoom out
4816 if (view) view->ZoomOut();
4817 break;
4818
4819 case kM_Button_ZoomIn: // Zoom in
4820 if (view) view->ZoomIn();
4821 break;
4822
4823 case kM_Button_SetHome: // Set Home position
4824 SetHome();
4825 break;
4826
4827 case kM_Button_GoHome: // Go Home position
4828 GoHome();
4829 break;
4830
4832 SaveMyConfig();
4833 fSaveMyConfigButton->SetPicture(gClient->GetPicture("ButtonSaveMyConfig.gif"));
4834 break;
4835
4837 LoadMyConfig();
4838 fLoadMyConfigButton->SetPicture(gClient->GetPicture("ButtonLoadMyConfig.gif"));
4839 break;
4840
4841 case kM_Button_Palette:
4843 fPaletteButton->SetPicture(gClient->GetPicture("ButtonPalette.gif"));
4844 break;
4845
4846 case kM_Button_Help:
4847 Help();
4848 break;
4849
4850 case kM_Button_ShowInfo: // Show Info
4852 if (gBesCursor->GetShowInfo()) {
4853 fShowInfoButton->SetState(true);
4854 fShowInfoButton->SetPicture(gClient->GetPicture("ButtonShowInfoST.gif"));
4855 }
4856 else {
4857 fShowInfoButton->SetState(false);
4858 fShowInfoButton->SetPicture(gClient->GetPicture("ButtonShowInfo.gif"));
4859 }
4860 break;
4861
4862 case kM_Button_ShowAxis: // Show Axis
4863 if (view) {
4864 view->SetVisAxis(!view->GetVisAxis());
4865 if (view->GetVisAxis()) {
4866 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxisST.gif"));
4867 fShowAxisButton->SetState(true);
4868 }
4869 else {
4870 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxis.gif"));
4871 fShowAxisButton->SetState(false);
4872 }
4873 view->UpdateView(0);
4874 }
4875 break;
4876
4877 case kM_Button_FishEyeView: // FishEye View
4878 if (view) {
4879 view->SetFishEye(!view->GetFishEye());
4880 if (view->GetFishEye()) {
4881 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeViewST.gif"));
4882 fFishEyeViewButton->SetState(true);
4883 }
4884 else {
4885 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeView.gif"));
4886 fFishEyeViewButton->SetState(false);
4887 }
4888 }
4889 break;
4890
4891 case kM_Button_ParallelView: // Parallel View
4892 if (view && view->IsPerspective()) {
4893 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelViewST.gif"));
4894 fParallelViewButton->SetState(true);
4895 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveView.gif"));
4896 fPerspectiveViewButton->SetState(false);
4897 //view->SetParralel();
4898 view->SetParallel();
4899 // use SetParallel() instead of depreciated function SetParralel()
4900 // changed by tianhl at Mon Aug 20 2007
4901 view->UpdateView(0);
4902 }
4903 break;
4904
4905 case kM_Button_PerspectiveView: // Perspective View
4906 if (view && !view->IsPerspective()) {
4907 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelView.gif"));
4908 fParallelViewButton->SetState(false);
4909 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveViewST.gif"));
4910 fPerspectiveViewButton->SetState(true);
4911 view->SetPerspective();
4912 view->UpdateView(0);
4913 }
4914 break;
4915
4916 case kM_Button_X3D: // X3D
4917 X3D();
4918 fX3DButton->SetPicture(gClient->GetPicture("ButtonX3D.gif"));
4919 break;
4920
4921 case kM_Button_OpenGL: // OpenGL
4922 OpenGL();
4923 fOpenGLButton->SetPicture(gClient->GetPicture("ButtonOpenGL.gif"));
4924 break;
4925
4927 NextEvent();
4928 break;
4929
4931 PrevEvent();
4932 break;
4933
4936 break;
4937
4939 FirstEvent();
4940 break;
4941
4943 if (view->GetViewType() == k3DView) view->Front();
4944 if (view->GetViewType() == kXYView) view->SetView( 0, 0, 270, iret);
4945 if (view->GetViewType() == kZRView) view->SetView(180, 90, 90, iret);
4946 break;
4947
4949 RotateClockWise(-1);
4950 if (fAutoRotate) {
4951 if (fAutoRotateClockWise != -1) {
4952 fAutoRotateClockWise = -1;
4953 fAutoRotatePhi = 0;
4954 }
4955 else fAutoRotateClockWise = 0;
4956 }
4957 break;
4958
4960 RotateClockWise(1);
4961 if (fAutoRotate) {
4962 if (fAutoRotateClockWise != 1) {
4963 fAutoRotateClockWise = 1;
4964 fAutoRotatePhi = 0;
4965 }
4966 else fAutoRotateClockWise = 0;
4967 }
4968 break;
4969
4971 view->Move(0,10);
4972 //if (gPad) gPad->Range(xmin, ymin+fMoveFactor*(ymax-ymin), xmax, ymax+fMoveFactor*(ymax-ymin));
4973 break;
4974
4976 view->Move(0,-10);
4977 break;
4978
4980 view->Move(-10,0);
4981 break;
4982
4984 view->Move(10,0);
4985 break;
4986
4988 view->Center();
4989 break;
4990
4992 RotateTheta(1);
4993 if (fAutoRotate) {
4994 if (fAutoRotateTheta != 1) fAutoRotateTheta = 1;
4995 else fAutoRotateTheta = 0;
4996 }
4997 break;
4998
5000 RotateTheta(-1);
5001 if (fAutoRotate) {
5002 if (fAutoRotateTheta != -1) fAutoRotateTheta = -1;
5003 else fAutoRotateTheta = 0;
5004 }
5005 break;
5006
5008 RotatePhi(1);
5009 if (fAutoRotate) {
5010 if (fAutoRotatePhi != 1) {
5011 fAutoRotatePhi = 1;
5012 fAutoRotateClockWise = 0;
5013 }
5014 else fAutoRotatePhi = 0;
5015 }
5016 break;
5017
5019 RotatePhi(-1);
5020 if (fAutoRotate) {
5021 if (fAutoRotatePhi != -1) {
5022 fAutoRotatePhi = -1;
5023 fAutoRotateClockWise = 0;
5024 }
5025 else fAutoRotatePhi = 0;
5026 }
5027 break;
5028
5030 if (view->GetViewType() == k3DView) {
5031 RotatePsi(1);
5032 if (fAutoRotate) {
5033 if (fAutoRotatePsi != 1) fAutoRotatePsi = 1;
5034 else fAutoRotatePsi = 0;
5035 }
5036 }
5037 break;
5038
5040 if (view->GetViewType() == k3DView) {
5041 RotatePsi(-1);
5042 if (fAutoRotate) {
5043 if (fAutoRotatePsi != -1) fAutoRotatePsi = -1;
5044 else fAutoRotatePsi = 0;
5045 }
5046 }
5047 break;
5048
5050 AutoRotate();
5051 break;
5052
5055 fDisplayModeButton[0]->SetState(true);
5056 fDisplayModeButton[0]->SetPicture(gClient->GetPicture("DisplayMode2DST.gif"));
5057 fDisplay->SwitchDisplayMode(0);
5058 break;
5059
5062 fDisplayModeButton[1]->SetState(true);
5063 fDisplayModeButton[1]->SetPicture(gClient->GetPicture("DisplayModeXYST.gif"));
5064 fDisplay->SwitchDisplayMode(1);
5065 break;
5066
5069 fDisplayModeButton[2]->SetState(true);
5070 fDisplayModeButton[2]->SetPicture(gClient->GetPicture("DisplayModeZRST.gif"));
5071 fDisplay->SwitchDisplayMode(2);
5072 break;
5073
5076 fDisplayModeButton[3]->SetState(true);
5077 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
5078 fDisplay->SwitchDisplayMode(3);
5079 break;
5080
5083 fDisplayModeButton[4]->SetState(true);
5084 fDisplayModeButton[4]->SetPicture(gClient->GetPicture("DisplayModeAllST.gif"));
5085 fDisplay->SwitchDisplayMode(4);
5086 break;
5087
5089 displayMode = fDisplay->GetDisplayMode();
5090 displayMode++;
5091 if (displayMode >= 5) displayMode -= 5;
5092 fDisplay->SwitchDisplayMode(displayMode);
5093
5095 switch (displayMode) {
5096 case 0 :
5097 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayMode2DST.gif"));
5098 break;
5099 case 1 :
5100 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeXYST.gif"));
5101 break;
5102 case 2 :
5103 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeZRST.gif"));
5104 break;
5105 case 3 :
5106 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
5107 break;
5108 case 4 :
5109 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeAllST.gif"));
5110 break;
5111 default:
5112 break;
5113 }
5114 break;
5115
5117 fDisplay->SwitchPad();
5118 break;
5119 }
5120
5121 UpdateStatus();
5124 }
5125
5126 //__________________________________________________________________
5127
5128 void BesClient::HandleSliders(Int_t slider)
5129 {
5130 //
5131 // Handle slider events
5132 if (gDebug) cout << "BesClient::DoSlider called!" << endl;
5133
5134 TGButton *btn = (TGButton *) gTQSender;
5135 Int_t id = btn->WidgetId();
5136
5137 BesView *view = (BesView*)gPad->GetView();
5138 Int_t iret;
5139
5140 switch (id) {
5141
5143 fEventPlaySlider->SetPosition(slider);
5144 if (fEventTree) {
5145 fBesEventNo = slider;
5146 this->GetEvent(fBesEventNo);
5147 }
5148 break;
5149
5151 if (view) {
5152 view->SetView(view->GetLongitude(), slider, view->GetPsi(), iret);
5153 }
5154 break;
5155
5157 if (view) {
5158 view->SetView(slider, view->GetLatitude(), view->GetPsi(), iret);
5159 }
5160 break;
5161
5163 if (view && view->GetViewType() == k3DView) {
5164 view->SetView(view->GetLongitude(), view->GetLatitude(), slider, iret);
5165 }
5166 break;
5167 }
5168
5171 }
5172
5173 //_________________________________________________________________
5174
5176 {
5177 TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
5178 TPad *curPad = (TPad*)gPad;//canvas->GetSelectedPad();
5179
5180 fDisplay->GetPadXY()->cd();
5181 BesView *view = (BesView*)fDisplay->GetPadXY()->GetView();
5182 if (view) {
5183 view->UpdateView(0);
5184 cout << "update xy view" << endl;
5185 }
5186 else cout << "no xy view" << endl;
5187
5188 fDisplay->GetPadZR()->cd();
5189 view = (BesView*)fDisplay->GetPadZR()->GetView();
5190 if (view) {
5191 view->UpdateView(0);
5192 cout << "update zr view" << endl;
5193 }
5194 else cout << "no zr view" << endl;
5195
5196 fDisplay->GetPad3D()->cd();
5197 view = (BesView*)fDisplay->GetPad3D()->GetView();
5198 if (view) {
5199 view->UpdateView(0);
5200 cout << "update 3d view" << endl;
5201 }
5202 else cout << "no 3d view" << endl;
5203
5204 // Header show be drawn last, as it will update all pads and makes tracks in pad drawn first
5205 fDisplay->DrawHeader();
5206
5207 curPad->cd();
5208
5210
5211 // Redraw canvas
5212 canvas->Modified();
5213 canvas->Update();
5214 }
5215
5216 //_________________________________________________________________
5217
5219 {
5220 if (gPad) {
5221 gPad->Modified();
5222 gPad->Update();
5223 }
5224
5225 //BesView *view = (BesView*)gPad->GetView();
5226
5227 //TViewerX3D *x3d = 0;
5228 //x3d = (TViewerX3D*)gPad->GetViewer3D();
5229 //if (fViewer3DMode == 1 && view && x3d) {
5230 // x3d->ExecCommand(Int_t(2*view->GetLatitude()), Int_t(2*view->GetLongitude()), 0); //rotate
5231 //}
5232
5233 ////TViewerOpenGL *ogl = 0;
5234 ////ogl = (TViewerOpenGL*)gPad->GetViewer3D();
5235 //// update from 4.04 to 5.14
5236 //TVirtualViewer3D *ogl = 0;
5237 //ogl = (TVirtualViewer3D*)gPad->GetViewer3D("ogl");
5238 //if (fViewer3DMode == 2 && view && ogl) {
5239 // gVirtualGL->ClearGLColor(0.0,0.0,0.0,0.0); // set GL background color
5240 // gVirtualGL->SetGLLineWidth(5);
5241
5242 // Double_t deltaTheta = view->GetLatitude() - fViewThetaPreStep;
5243 // Double_t deltaPhi = view->GetLongitude() - fViewPhiPreStep;
5244 // if (deltaTheta > 90.0) deltaTheta -= 180.0;
5245 // if (deltaTheta < -90.0) deltaTheta += 180.0;
5246 // if (deltaPhi > 180.0) deltaPhi -= 360.0;
5247 // if (deltaPhi < -180.0) deltaPhi += 360.0;
5248
5249 // // update from 4.04 to 5.14, TViewerOpenGL has been removed,
5250 // // TVirtualViewer3D has none those memthods
5251 // //UInt_t width = ogl->GetWidth();
5252 // //UInt_t height = ogl->GetHeight();
5253 // //UInt_t xPos = width/2, yPos = height/2;
5254
5255 // //Event_t *event1 = new Event_t;
5256 // //event1->fType = kButtonPress;
5257 // //event1->fX = xPos; //(Int_t)view->GetLatitude();
5258 // //event1->fY = yPos; //(Int_t)view->GetLongitude();
5259 // //event1->fCode = kButton1;
5260 // //ogl->HandleContainerButton(event1);
5261
5262
5263 // //Event_t *event2 = new Event_t;
5264 // //event2->fType = kMotionNotify;
5265 // //event2->fX = (Int_t)(xPos + deltaTheta);
5266 // //event2->fY = (Int_t)(yPos + deltaPhi);
5267 // //ogl->HandleContainerMotion(event2);
5268
5269 // //Event_t *event3 = new Event_t;
5270 // //event3->fType = kButtonRelease;
5271 // //event3->fX = (Int_t)(xPos + deltaTheta); //(view->GetLatitude() + deltaPhi);
5272 // //event3->fY = (Int_t)(yPos + deltaPhi); //(view->GetLongitude() + deltaTheta);
5273 // //event3->fCode = kButton1;
5274 // //ogl->HandleContainerButton(event3);
5275
5276 // //fViewThetaPreStep = view->GetLatitude();
5277 // //fViewPhiPreStep = view->GetLongitude();
5278
5279 // //delete event1;
5280 // //delete event2;
5281 // //delete event3;
5282 //}
5283 }
5284
5285 //_________________________________________________________________
5286
5288 {
5289 fNumEntryRunNo->SetNumber(GetBesRunNo());
5290 fNumEntryEventNo->SetIntNumber(GetBesEventNo());
5291 fNumEntryEventPlaySpeed->SetNumber(Double_t(GetEventPlaySpeed()) / 1000.0);
5292 fEventPlaySlider->SetPosition(GetBesEventNo());
5293
5294 fNumEntryRotateStep->SetNumber(GetRotateStep());
5295 fNumEntryRotateSpeed->SetNumber(GetRotateSpeed());
5296 fNumEntryRotateFPS->SetIntNumber(GetRotateFPS());
5297
5298 BesView *view = (BesView*)gPad->GetView();
5299 if (view) {
5300 fZoomRatioNumber->SetNumber(view->GetZoomRatio()*100.0);
5301
5302 Double_t theta = view->GetLatitude();
5303 Double_t phi = view->GetLongitude();
5304 Double_t psi = view->GetPsi();
5305 SetRange(theta, 0.0, 180.0);
5306 SetRange(phi, 0.0, 360.0);
5307 SetRange(psi, 0.0, 360.0);
5308 fViewAngleThetaNumber->SetNumber(theta);
5309 fViewAnglePhiNumber->SetNumber(phi);
5310 fViewAnglePsiNumber->SetNumber(psi);
5311 }
5312 fViewAngleThetaSlider->SetPosition((Int_t)fViewAngleThetaNumber->GetNumber());
5313 fViewAnglePhiSlider->SetPosition((Int_t)fViewAnglePhiNumber->GetNumber());
5314 fViewAnglePsiSlider->SetPosition((Int_t)fViewAnglePsiNumber->GetNumber());
5315
5316 fChkBtnAutoRotate->SetOn(fAutoRotate);
5317 }
5318
5319 //_____________________________________________________
5320
5322 //
5323 // change focus on pressed tab
5324 if (gDebug) cout << "BesClient::ChangeFocus called!" << endl;
5325
5326 if ( gTQSender == fNumEntryRunNo->GetNumberEntry() ) {
5327 fNumEntryEventNo->GetNumberEntry()->SelectAll();
5328 fNumEntryEventNo->GetNumberEntry()->SetFocus();
5329 }
5330 else if ( gTQSender == fNumEntryEventPlaySpeed->GetNumberEntry() ) {
5331 fNumEntryEventPlaySpeed->GetNumberEntry()->SelectAll();
5332 fNumEntryEventPlaySpeed->GetNumberEntry()->SetFocus();
5333 }
5334 else if ( gTQSender == fNumEntryMagnetic->GetNumberEntry() ) {
5335 fNumEntryMagnetic->GetNumberEntry()->SelectAll();
5336 fNumEntryMagnetic->GetNumberEntry()->SetFocus();
5337 }
5338 }
5339
5340 //_____________________________________________________
5341
5343 //
5344 // execute if return was pressed
5345 if (gDebug) cout << "BesClient::ExecuteReturn called!" << endl;
5346
5347 BesView *view = (BesView*)gPad->GetView();
5348 //Double_t theta, phi, psi;
5349 Int_t iret;
5350
5351 if ( gTQSender == fZoomRatioNumber ) {
5352 if (view) view->SetZoomRatio(fZoomRatioNumber->GetNumber()/100.0);
5353 }
5354
5355 if ( gTQSender == fNumEntryEventNo->GetNumberEntry() ) {
5356 fBesEventNo = fNumEntryEventNo->GetIntNumber();
5357 this->GetEvent(fBesEventNo);
5358 }
5359
5360 else if ( gTQSender == fNumEntryEventPlaySpeed->GetNumberEntry() ) {
5361 fEventPlaySpeed = Int_t(fNumEntryEventPlaySpeed->GetNumber() * 1000);
5362 fAutoDisplayEventTimer->SetTime(fEventPlaySpeed);
5363 }
5364
5365 else if ( gTQSender == fNumEntryRotateSpeed ) {
5366 fRotateSpeed = fNumEntryRotateSpeed->GetNumber();
5367 this->SetRotateStep();
5368 cout << "fRotateSpeed " << fRotateSpeed << " fRotateStep " << fRotateStep << endl;
5369 //fAutoRotateTimer->SetTime((Int_t)1000/this->GetRotateFPS());
5370 }
5371
5372 else if ( gTQSender == fNumEntryRotateFPS->GetNumberEntry() ) {
5373 fRotateFPS = fNumEntryRotateFPS->GetIntNumber();
5374 this->SetRotateSpeed();
5375 fAutoRotateTimer->SetTime((Int_t)1000/fRotateFPS);
5376 cout << "fRotateFPS " << fRotateFPS << " fRotateStep " << fRotateStep << endl;
5377 }
5378
5379 else if ( gTQSender == fNumEntryMagnetic->GetNumberEntry() ) {
5380 if (gEvent){
5381 gEvent->SetMagnetic(fNumEntryMagnetic->GetNumber());
5382 }
5383 }
5384
5385 else if ( gTQSender == fNumEntryRotateStep ) {
5386 fRotateStep = fNumEntryRotateStep->GetNumber();
5387 fRotateSpeed = fRotateStep * fRotateFPS;
5388 cout << "fRotateSpeed " << fRotateSpeed << " fRotateStep " << fRotateStep << endl;
5389 }
5390
5391 else if ( gTQSender == fViewAngleThetaNumber ) {
5392 if (view) {
5393 view->SetView(view->GetLongitude(), fViewAngleThetaNumber->GetNumber(), view->GetPsi(), iret);
5394 }
5395 }
5396
5397 else if ( gTQSender == fViewAnglePhiNumber ) {
5398 if (view) {
5399 view->SetView(fViewAnglePhiNumber->GetNumber(), view->GetLatitude(), view->GetPsi(), iret);
5400 }
5401 }
5402
5403 else if ( gTQSender == fViewAnglePsiNumber ) {
5404 if (view && view->GetViewType() == k3DView) {
5405 view->SetView(view->GetLongitude(), view->GetLatitude(), fViewAnglePsiNumber->GetNumber(), iret);
5406 }
5407 }
5408
5409 fEmbeddedCanvas->RequestFocus(); // RequestFocus to let Hot Key "QWEASD.." work in ExecuteEvent, or it doesnt work after input
5412 }
5413
5414 Pixmap_t BesClient::GetPic(const char *file)
5415 {
5416 TString filePath = fBesVisPath;
5417 filePath += "/icons/";
5418 filePath += file;
5419
5420 TASImage asImage(filePath);
5421 Pixmap_t pic = asImage.GetPixmap();
5422 //asImage->Draw();
5423 return pic;
5424 }
5425
5426 Bool_t BesClient::FileExists(TString fname)
5427 {
5428 // gSystem return 0 if exist, 1 for not exist
5429 return (!gSystem->AccessPathName(fname, kFileExists));
5430 }
5431
5432 // makes min <= input < max
5433 void BesClient::SetRange(Double_t &input, Double_t min, Double_t max)
5434 {
5435 Double_t range = max - min;
5436 if (input < min) {
5437 do {
5438 input += range;
5439 }
5440 while (input < min);
5441 }
5442
5443 if (input >= max) {
5444 do {
5445 input -= range;
5446 }
5447 while (input >= max);
5448 }
5449 }
struct sembuf release
Definition: BesClient.cxx:122
const char * SavePicPS[]
Definition: BesClient.cxx:112
const char * OpenEventTypes[]
Definition: BesClient.cxx:93
const char * SavePicTypes[]
Definition: BesClient.cxx:102
int optint
const char * OpenGeoTypes[]
Definition: BesClient.cxx:83
struct sembuf acquire
Definition: BesClient.cxx:119
const char * SaveGeoTypes[]
Definition: BesClient.cxx:88
char * optarg
int opterr
Definition: BesClient.cxx:117
ClassImp(BesClient) const char gHelpBesVis[]
int runNo
Definition: DQA_TO_DB.cxx:12
char * file
Definition: DQA_TO_DB.cxx:15
const Int_t n
titledef title[20]
double w
XmlRpcServer s
Definition: HelloServer.cpp:11
virtual void X3D()
Definition: BesClient.cxx:3301
virtual void GoHome()
Definition: BesClient.cxx:3155
virtual void CreateMainFrame()
Definition: BesClient.cxx:1024
virtual void CreateTitleBar()
Definition: BesClient.cxx:996
virtual void UpdateAllView()
Definition: BesClient.cxx:5175
virtual void HandleMenu(Int_t id)
Definition: BesClient.cxx:2253
virtual void SetAllDisplayModeButtonUnHL()
Definition: BesClient.cxx:3288
virtual void CreateToolBar()
Definition: BesClient.cxx:866
virtual void SavePicAsPS()
Definition: BesClient.cxx:3107
virtual void CreateDisplayModeBar()
Definition: BesClient.cxx:825
virtual void HandleSliders(Int_t id)
Definition: BesClient.cxx:5128
virtual void CreateTabs()
Definition: BesClient.cxx:1081
virtual void SaveMyConfig()
Definition: BesClient.cxx:3175
virtual void RotatePsi(int pn)
Definition: BesClient.cxx:3930
virtual void Show()
Definition: BesClient.cxx:2835
virtual void SetHome()
Definition: BesClient.cxx:3137
virtual void RotateClockWise(int clockwise)
Definition: BesClient.cxx:3871
virtual void CreateMenuBar()
Definition: BesClient.cxx:323
BesClient(const TGWindow *p, const char *title, UInt_t width, UInt_t height, Option_t *option="", Int_t argc=0, char **argv=0)
Definition: BesClient.cxx:132
virtual Bool_t GetEvent(Long64_t i)
Definition: BesClient.cxx:3380
virtual void RotateTheta(int pn)
Definition: BesClient.cxx:3898
virtual ~BesClient()
Definition: BesClient.cxx:227
virtual void RotatePhi(int pn)
Definition: BesClient.cxx:3914
virtual void HandleViewOptionMenu(Int_t id)
Definition: BesClient.cxx:2303
virtual void OpenGL()
Definition: BesClient.cxx:3338
virtual void HandleEventList(TGListTreeItem *entry, Int_t btn)
Definition: BesClient.cxx:3946
virtual void OpenEventFile()
Definition: BesClient.cxx:2963
virtual void SavePicAs()
Definition: BesClient.cxx:3049
virtual void HandleStatusBar(const char *msg)
Definition: BesClient.cxx:2827
virtual Pixmap_t GetPic(const char *file)
Definition: BesClient.cxx:5414
virtual void AutoRotateCommand()
Definition: BesClient.cxx:3829
virtual void UpdateStatus()
Definition: BesClient.cxx:4307
virtual void CreateWidget(const char *title, UInt_t width, UInt_t height)
Definition: BesClient.cxx:240
virtual void CloseWindow()
Definition: BesClient.cxx:3368
virtual void CreateHorizontalRuler()
Definition: BesClient.cxx:312
virtual void InitConnections()
Definition: BesClient.cxx:2238
virtual void UpdateCurrentPad()
Definition: BesClient.cxx:5218
virtual void HandleError(const char *msg)
Definition: BesClient.cxx:2809
virtual void SaveGeoAs()
Definition: BesClient.cxx:2922
virtual void InitLocal()
Definition: BesClient.cxx:2162
virtual void CreateCanvas()
Definition: BesClient.cxx:1062
virtual void HandleInfoBar(const char *msg)
Definition: BesClient.cxx:2819
virtual Bool_t FirstEvent()
Definition: BesClient.cxx:3759
virtual void LoadMdcPalette()
Definition: BesClient.cxx:3263
virtual Bool_t GetRecEvent()
Definition: BesClient.cxx:3553
virtual void SetRange(Double_t &input, Double_t min, Double_t max)
Definition: BesClient.cxx:5433
virtual void AutoDisplayEvent()
Definition: BesClient.cxx:3775
virtual Bool_t NextEvent()
Definition: BesClient.cxx:3725
virtual void CreateStatusBar()
Definition: BesClient.cxx:1006
virtual void CreateUpButtonBar()
Definition: BesClient.cxx:562
virtual void AutoDisplayEventCommand()
Definition: BesClient.cxx:3802
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py, TObject *sel)
Definition: BesClient.cxx:3981
virtual void Help()
Definition: BesClient.cxx:3275
virtual void ExecuteReturn()
Definition: BesClient.cxx:5342
virtual void LoadMyConfig()
Definition: BesClient.cxx:3218
virtual Bool_t PrevEvent()
Definition: BesClient.cxx:3742
virtual void HandleButtons(Int_t id=-1)
Definition: BesClient.cxx:4734
virtual Bool_t FileExists(TString fname)
Definition: BesClient.cxx:5426
virtual void SetState(Int_t id=-1)
Definition: BesClient.cxx:4080
virtual void AutoRotate()
Definition: BesClient.cxx:3810
virtual void OpenGeoFile(TString filename)
Definition: BesClient.cxx:2870
virtual void ChangeFocus()
Definition: BesClient.cxx:5321
virtual void InitParameter()
Definition: BesClient.cxx:2200
virtual void UpdateBesInputFields()
Definition: BesClient.cxx:5287
virtual void LoadGeoFile()
Definition: BesClient.cxx:2844
virtual void SetEvent(TDigiEvent *digiEvent, TDisTrack *recEvent, TEvtHeader *evtHeader, TRecEvTime *recEvTime)
Definition: BesEvent.cxx:113
BesGMenuTitle * GetMenuTitle(Int_t i)
Definition: BesGMenuBar.cxx:80
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Definition: BesGMenuBar.cxx:14
virtual void SetPicture(const TGPicture *new_pic)
void Transfer(BesStatus *right, Bool_t set)
Definition: BesStatus.cxx:243
virtual void SetParallel()
Definition: BesTView.cxx:1432
virtual void GetRange(Float_t *min, Float_t *max)
Definition: BesTView.cxx:1137
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
Definition: BesTView.cxx:1525
virtual void SetPerspective()
Definition: BesTView.cxx:1442
void ZoomIn()
Definition: BesView.cxx:495
void Move(Int_t px, Int_t py)
Definition: BesView.cxx:424
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition: BesView.cxx:598
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition: BesView.cxx:800
void Center()
Definition: BesView.cxx:466
void ZoomOut()
Definition: BesView.cxx:532
void SetZoomRatio(Double_t ratio)
Definition: BesView.cxx:482
void Reset()
Definition: BesView.cxx:824
virtual void Reset()
virtual void SwitchPad()
virtual void DrawHeader()
virtual void Draw(Option_t *option="")
virtual void InitGeometryFromROOT(TGeoVolume *bes)
virtual void InitGeometryFromGDML(const TString fPath)
virtual void SwitchDisplayMode(Int_t mode)
virtual void SetCanvas(TCanvas *c=0)
void SetVisEmcDetector()
Set Emc detector visibility;.
void SetDetector()
Set default physical node attributes;.
void SetVisMdcDetector()
Set Mdc default detector visibility;.
void SetDetector()
Set default physical node attributes;.
void SetDetector()
Set Detecor (what is detector depends on you)
void SetVisMucDetector()
Set Muc detector visibility;.
void addRecMdcTrack(TRecMdcTrack *Track)
Add a TkrTrack into the Mdc data collection.
Definition: TDisTrack.cxx:109
void addTofTrack(TRecTofTrack *Track)
Definition: TDisTrack.cxx:131
void addMucTrack(TRecMucTrack *Track)
Add a MucTrack into the TOF Data collection.
Definition: TDisTrack.cxx:141
void addRecMdcHit(TRecMdcHit *Hit)
Add a Rec Mdc Hit into the Mdc data collection.
Definition: TDisTrack.cxx:120
void addEmcShower(TRecEmcShower *Track)
Add a TkrTrack into the Emc data collection.
Definition: TDisTrack.cxx:152
void Clear(Option_t *option="")
Definition: TEvtHeader.cxx:30
const TObjArray * getTofTrackCol() const
retrieve the whole TObjArray of TofTrack Data
const TRecTofTrack * getTofTrack(Int_t i) const
retrieve a TofTrack From the collection, using the index into the array
const TRecMdcTrack * getRecMdcTrack(Int_t i) const
retrieve a MdcTrack from the collection, using the index into the array
const TObjArray * getEmcShowerCol() const
retrieve the whole TObjArray of EmcShower Data
const TObjArray * getRecMdcTrackCol() const
retrieve the whole TObjArray of RecMdcTrack Data
const TRecEmcShower * getEmcShower(Int_t i) const
retrieve a EmcShower from the collection, using the index into the array *‍/
const TObjArray * getMucTrackCol() const
retrieve the whole TObjArray of MucTrack Data
const TRecMucTrack * getMucTrack(Int_t i) const
retrieve a MucTrack From the collection, using the index into the array
const TRecMdcHit * getRecMdcHit(Int_t i) const
retrieve a RecMdcHit from the collection, using the index into the array
const TObjArray * getRecMdcHitCol() const
retrieve the whole TObjArray of RecMdcHit Data
void SetDetector()
Draw Detecor (what is detector depends on you)
void SetVisTofDetector()
Set Tof detector visibility;.