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