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