CGEM BOSS 6.6.5.i
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
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
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 // ideal tracks
2066 fChkBtnTracksIdeal = new TGCheckButton(fFrameTracks, "Ideal Tracks", kM_Tracks_Ideal);
2067 fFrameTracks->AddFrame(fChkBtnTracksIdeal);
2068 fChkBtnTracksIdeal->Connect("Clicked()", "BesClient", this, "SetState()");
2069
2070 //
2071 // "Show Detector" tab
2072 // ===================
2073 tf = fTabs->AddTab("Detector");
2074 tf->SetBackgroundPixmap(GetPic("8.gif"));
2075 //tf->SetBackgroundPixmap(GetPic("3.gif"));
2076
2077 fFrameSubDetector = new TGGroupFrame(tf, "Sub-Detector");
2078
2079 // SubDetector
2080 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2081 fWidgets->Add(fLayout);
2082 tf->AddFrame(fFrameSubDetector, fLayout);
2083
2084 //Long Peixun's update: for CGEM
2085 fChkBtnCgemGlobal = new TGCheckButton(fFrameSubDetector, "CGEM", kM_Cgem_Global);
2086 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
2087 fFrameSubDetector->AddFrame(fChkBtnCgemGlobal, fLayout);
2088 fChkBtnCgemGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2089
2090 fChkBtnCgemLayers = new TGCheckButton(fFrameSubDetector, "Layers", kM_Cgem_Layers);
2091 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
2092 fFrameSubDetector->AddFrame(fChkBtnCgemLayers, fLayout);
2093 fChkBtnCgemLayers->Connect("Clicked()", "BesClient", this, "SetState()");
2094
2095 fChkBtnCgemXStrips = new TGCheckButton(fFrameSubDetector, "X-strips", kM_Cgem_XStrips);
2096 fFrameSubDetector->AddFrame(fChkBtnCgemXStrips, fLayout);
2097 fChkBtnCgemXStrips->Connect("Clicked()", "BesClient", this, "SetState()");
2098
2099 fChkBtnCgemVStrips = new TGCheckButton(fFrameSubDetector, "V-strips", kM_Cgem_VStrips);
2100 fFrameSubDetector->AddFrame(fChkBtnCgemVStrips, fLayout);
2101 fChkBtnCgemVStrips->Connect("Clicked()", "BesClient", this, "SetState()");
2102
2103 // Mdc
2104 fChkBtnMdcGlobal = new TGCheckButton(fFrameSubDetector, "Mdc", kM_Mdc_Global);
2105 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
2106 fFrameSubDetector->AddFrame(fChkBtnMdcGlobal, fLayout);
2107 fChkBtnMdcGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2108
2109 fChkBtnMdcTubes = new TGCheckButton(fFrameSubDetector, "Tubes", kM_Mdc_Tubes);
2110 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
2111 fFrameSubDetector->AddFrame(fChkBtnMdcTubes, fLayout);
2112 fChkBtnMdcTubes->Connect("Clicked()", "BesClient", this, "SetState()");
2113
2114 fChkBtnMdcWires = new TGCheckButton(fFrameSubDetector, "Wires", kM_Mdc_Wires);
2115 fFrameSubDetector->AddFrame(fChkBtnMdcWires, fLayout);
2116 fChkBtnMdcWires->Connect("Clicked()", "BesClient", this, "SetState()");
2117
2118 // Tof
2119 fChkBtnTofGlobal = new TGCheckButton(fFrameSubDetector, "Tof", kM_Tof_Global);
2120 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
2121 fFrameSubDetector->AddFrame(fChkBtnTofGlobal, fLayout);
2122 fChkBtnTofGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2123
2124 fChkBtnTofEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Tof_East);
2125 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
2126 fFrameSubDetector->AddFrame(fChkBtnTofEast, fLayout);
2127 fChkBtnTofEast->Connect("Clicked()", "BesClient", this, "SetState()");
2128
2129 fChkBtnTofBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Tof_Barrel);
2130 fFrameSubDetector->AddFrame(fChkBtnTofBarrel, fLayout);
2131 fChkBtnTofBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
2132
2133 fChkBtnTofWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Tof_West);
2134 fFrameSubDetector->AddFrame(fChkBtnTofWest, fLayout);
2135 fChkBtnTofWest->Connect("Clicked()", "BesClient", this, "SetState()");
2136
2137 // Emc
2138 fChkBtnEmcGlobal = new TGCheckButton(fFrameSubDetector, "Emc", kM_Emc_Global);
2139 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
2140 fFrameSubDetector->AddFrame(fChkBtnEmcGlobal, fLayout);
2141 fChkBtnEmcGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2142
2143 fChkBtnEmcEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Emc_East);
2144 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
2145 fFrameSubDetector->AddFrame(fChkBtnEmcEast, fLayout);
2146 fChkBtnEmcEast->Connect("Clicked()", "BesClient", this, "SetState()");
2147
2148 fChkBtnEmcBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Emc_Barrel);
2149 fFrameSubDetector->AddFrame(fChkBtnEmcBarrel, fLayout);
2150 fChkBtnEmcBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
2151
2152 fChkBtnEmcWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Emc_West);
2153 fFrameSubDetector->AddFrame(fChkBtnEmcWest, fLayout);
2154 fChkBtnEmcWest->Connect("Clicked()", "BesClient", this, "SetState()");
2155
2156 fChkBtnEmcSide = new TGCheckButton(fFrameSubDetector, "Side ", kM_Emc_Side);
2157 fFrameSubDetector->AddFrame(fChkBtnEmcSide, fLayout);
2158 fChkBtnEmcSide->Connect("Clicked()", "BesClient", this, "SetState()");
2159
2160 // Muc
2161 fChkBtnMucGlobal = new TGCheckButton(fFrameSubDetector, "Muc", kM_Muc_Global);
2162 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
2163 fFrameSubDetector->AddFrame(fChkBtnMucGlobal, fLayout);
2164 fChkBtnMucGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2165
2166 fChkBtnMucEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Muc_East);
2167 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
2168 fFrameSubDetector->AddFrame(fChkBtnMucEast, fLayout);
2169 fChkBtnMucEast->Connect("Clicked()", "BesClient", this, "SetState()");
2170
2171 fChkBtnMucBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Muc_Barrel);
2172 fFrameSubDetector->AddFrame(fChkBtnMucBarrel, fLayout);
2173 fChkBtnMucBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
2174
2175 fChkBtnMucWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Muc_West);
2176 fFrameSubDetector->AddFrame(fChkBtnMucWest, fLayout);
2177 fChkBtnMucWest->Connect("Clicked()", "BesClient", this, "SetState()");
2178
2179 fChkBtnMucStrips = new TGCheckButton(fFrameSubDetector, "Strips", kM_Muc_Strips);
2180 fFrameSubDetector->AddFrame(fChkBtnMucStrips, fLayout);
2181 fChkBtnMucStrips->Connect("Clicked()", "BesClient", this, "SetState()");
2182
2183 // Other parts
2184 fFrameOthers = new TGGroupFrame (tf, "Others");
2185 fLayout = new TGLayoutHints (kLHintsExpandX, 15, 15, 15, 15);
2186 fWidgets->Add(fLayout);
2187 tf->AddFrame (fFrameOthers, fLayout);
2188
2189 fChkBtnBeamPipe = new TGCheckButton (fFrameOthers, "Beam Pipe", kM_BeamPipe);
2190 fFrameOthers->AddFrame (fChkBtnBeamPipe);
2191 fChkBtnBeamPipe->Connect("Clicked()", "BesClient", this, "SetState()");
2192
2193 fChkBtnZRPlaneOnXY = new TGCheckButton (fFrameOthers, "ZR plane on XY", kM_ZRPlaneOnXY);
2194 fFrameOthers->AddFrame (fChkBtnZRPlaneOnXY);
2195 fChkBtnZRPlaneOnXY->Connect("Clicked()", "BesClient", this, "SetState()");
2196
2197 fChkBtnAxis = new TGCheckButton (fFrameOthers, "Axis", kM_Axis);
2198 fFrameOthers->AddFrame (fChkBtnAxis);
2199 fChkBtnAxis->Connect("Clicked()", "BesClient", this, "SetState()");
2200
2201 //
2202 // "Others" tab
2203 // ================
2204 tf = fTabs->AddTab("Others");
2205 tf->SetBackgroundPixmap(GetPic("8.gif"));
2206
2207 //Mdc TQMatch
2208 fFrameMdcMatch =new TGGroupFrame(tf, "Mdc Status");
2209 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2210 fWidgets->Add(fLayout);
2211 tf->AddFrame(fFrameMdcMatch, fLayout);
2212
2213 fChkBtnMdcTMatchGlobal = new TGCheckButton(fFrameMdcMatch, "T Fire", kM_Mdc_TMatch_Global);
2214 fChkBtnMdcTMatchGlobal->SetState(kButtonDown);
2215 //fChkBtnMdcTMatchGlobal->SetOn();
2216 fFrameMdcMatch->AddFrame(fChkBtnMdcTMatchGlobal);
2217 fChkBtnMdcTMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2218
2219 fChkBtnMdcQMatchGlobal = new TGCheckButton(fFrameMdcMatch, "Q Fire", kM_Mdc_QMatch_Global);
2220 fChkBtnMdcQMatchGlobal->SetState(kButtonDown);
2221 //fChkBtnMdcQMatchGlobal->SetOn();
2222 fFrameMdcMatch->AddFrame(fChkBtnMdcQMatchGlobal);
2223 fChkBtnMdcQMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2224
2225 fChkBtnMdcQOverflowGlobal = new TGCheckButton(fFrameMdcMatch, "Q Not Overflow", kM_Mdc_QNotOverflow_Global);
2226 fChkBtnMdcQOverflowGlobal->SetState(kButtonUp);
2227 //fChkBtnMdcQOverflowGlobal->SetOn();
2228 fFrameMdcMatch->AddFrame(fChkBtnMdcQOverflowGlobal);
2229 fChkBtnMdcQOverflowGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2230
2231 //Colorful Mdc Wire
2232 fChkBtnMdcColorfulWireGlobal = new TGCheckButton(fFrameMdcMatch, "Colorful Wire", kM_Mdc_ColorfulWire_Global);
2233 fChkBtnMdcColorfulWireGlobal->SetState(kButtonUp);
2234 fFrameMdcMatch->AddFrame(fChkBtnMdcColorfulWireGlobal);
2235 fChkBtnMdcColorfulWireGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2236
2237 //Mdc time substract event start time
2238 fChkBtnMdcTimeSubEvTimeGlobal = new TGCheckButton(fFrameMdcMatch, "Sub EvTime", kM_Mdc_MdcTimeSubEvTime_Global);
2239 fChkBtnMdcTimeSubEvTimeGlobal->SetState(kButtonUp);
2240 fFrameMdcMatch->AddFrame(fChkBtnMdcTimeSubEvTimeGlobal);
2241 fChkBtnMdcTimeSubEvTimeGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2242
2243 //Tof TQMatch
2244 fFrameTofMatch =new TGGroupFrame(tf, "Tof TQ Match");
2245 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2246 fWidgets->Add(fLayout);
2247 tf->AddFrame(fFrameTofMatch, fLayout);
2248
2249 fChkBtnTofTMatchGlobal = new TGCheckButton(fFrameTofMatch, "T Match", kM_Tof_TMatch_Global);
2250 fChkBtnTofTMatchGlobal->SetState(kButtonDown);
2251 //fChkBtnTofTMatchGlobal->SetOn();
2252 fFrameTofMatch->AddFrame(fChkBtnTofTMatchGlobal);
2253 fChkBtnTofTMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2254
2255 fChkBtnTofQMatchGlobal = new TGCheckButton(fFrameTofMatch, "Q Match", kM_Tof_QMatch_Global);
2256 fChkBtnTofQMatchGlobal->SetState(kButtonDown);
2257 //fChkBtnTofQMatchGlobal->SetOn();
2258 fFrameTofMatch->AddFrame(fChkBtnTofQMatchGlobal);
2259 fChkBtnTofQMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
2260
2261 // Magnetic field
2262 fFrameMagnetic =new TGGroupFrame(tf, "Magnetic Field(Tesla)");
2263 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
2264 fWidgets->Add(fLayout);
2265 tf->AddFrame(fFrameMagnetic, fLayout);
2266
2267 // input of Magnetic field
2268 fNumEntryMagnetic = new TGNumberEntry(fFrameMagnetic,
2269 1.0, 4,
2271 TGNumberFormat::kNESRealTwo,
2272 TGNumberFormat::kNEAAnyNumber);
2273 fNumEntryMagnetic->SetHeight(20);
2274 fNumEntryMagnetic->SetNumber(1.0);
2275 fNumEntryMagnetic->GetNumberEntry()
2276 ->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
2277 fNumEntryMagnetic->GetNumberEntry()
2278 ->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
2279 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
2280 fWidgets->Add(fLayout);
2281 fFrameMagnetic->AddFrame(fNumEntryMagnetic, fLayout);
2282
2283
2284 for (Int_t iTab = 0; iTab < fTabs->GetNumberOfTabs(); iTab++) {
2285 fTabs->GetTabTab(iTab)->SetBackgroundPixmap(GetPic("8.gif"));
2286 }
2287}
2288
2289void BesClient::SetMdcQNotOverflow(Bool_t input){
2290 if (gBesGeometry){
2292 }
2293}
2294
2295
2296void BesClient::SetMdcTFire(Bool_t input){
2297 if (gBesGeometry){
2299 }
2300}
2301
2302void BesClient::SetMdcQFire(Bool_t input){
2303 if (gBesGeometry){
2305 }
2306}
2307
2308void BesClient::SetMdcColorfulWire(Bool_t input){
2309 if (gBesGeometry){
2311 }
2312}
2313
2314void BesClient::SetMdcTimeSubEvTime(Bool_t input){
2315 if (gBesGeometry){
2317 }
2318}
2319
2320void BesClient::SetTofTMatch(Bool_t input){
2321 if (gBesGeometry){
2323 }
2324}
2325
2326void BesClient::SetTofQMatch(Bool_t input){
2327 if (gBesGeometry){
2329 }
2330}
2331//_____________________________________________________
2332
2334 //
2335 // init local variables
2336 if (gDebug) cout << "BesClient::InitLocal called!" << endl;
2337
2338 // init widget list
2339 fWidgets = new TList();
2340 fLayout = 0;
2341
2342 gGeometry = 0;
2343 gBesCursor = new BesCursor();
2345 gBesCursor->SetShowInfo(true);
2346
2347 fAutoDisplayEventTimer = new TTimer(fEventPlaySpeed);
2348 Connect(fAutoDisplayEventTimer,"Timeout()","BesClient",this,"AutoDisplayEventCommand()");
2349
2350 fAutoRotateTimer = new TTimer((Int_t)1000/fRotateFPS);
2351 Connect(fAutoRotateTimer,"Timeout()","BesClient",this,"AutoRotateCommand()");
2352
2353 /*TColor *milk = */
2354 new TColor(1001, 1.0, 1.0, 225/255.0);
2355 /*TColor *pink = */
2356 new TColor(1002, 227/255.0, 186/255.0, 227/255.0);
2357 /*TColor *lightYellow = */
2358 new TColor(1003, 232/255.0, 234/255.0, 117/255.0);
2359 /*TColor *orange = */
2360 new TColor(1004, 254/255.0, 216/255.0, 31/255.0);
2361 /*TColor *lightBlue = */
2362 new TColor(1005, 175/255.0, 192/255.0, 227/255.0);
2363 /*TColor *lightGreen = */
2364 new TColor(1006, 192/255.0, 227/255.0, 226/255.0);
2365 /*TColor *lightBrown = */
2366 new TColor(1007, 225/255.0, 199/255.0, 162/255.0);
2367}
2368
2369//_____________________________________________________
2370
2372 //
2373 // init local variables
2374 if (gDebug) cout << "BesClient::InitParameter called!" << endl;
2375
2376 // init command line parameter
2377 fWindowWidth = 1000;
2378 fWindowHeight = 710;
2379
2380 fBesVisPath = TString(getenv("BESVISLIBROOT"));
2381
2382 fEventPlaySpeed = 1000; // 1000 ms/event
2383 fAutoDisplayEvent = kFALSE;
2384
2385 for (Int_t i = 0; i < 3; i++) {
2386 fHomeX[i] = 0.0;
2387 fHomeY[i] = 0.0;
2388 }
2389
2390 fMoveFactor = 0.1; // factor of move
2391 fRotateStep = 1.0; // 0.1 deg/frame
2392 fRotateSpeed = 10.0; // 1.0 deg/sec
2393 fRotateFPS = 10; // 10 frame/sec
2394
2395 fAutoRotate = kFALSE;
2396 fAutoRotateClockWise = 0;
2397 fAutoRotateTheta = 0;
2398 fAutoRotatePhi = 0;
2399 fAutoRotatePsi = 0;
2400
2401 fBesRunNo = 0;
2402 fBesEventNo = 0;
2403
2404 fViewer3DMode = 0;
2405
2406 //Long Peixun's update: Load help.txt to f_HelpText
2407 TString docfile = fBesVisPath + "/docs/help.txt";
2408 ifstream ifile(docfile.Data());
2409 if (ifile)
2410 {
2411 stringstream ss;
2412 int ch = 0;
2413 while ((ch = ifile.get()) != EOF)
2414 {
2415 ss << static_cast<char>(ch);
2416 }
2417 f_HelpText = ss.str();
2418 }
2419
2420 //Long Peixun's update: Load geom_sel.txt
2421 docfile = fBesVisPath + "/docs/geom_sel.txt";
2422 InitGeoSelector(docfile.Data());
2423}
2424
2425//_____________________________________________________
2426//Long Peixun's update: Initialize geometry selector
2427void BesClient::InitGeoSelector(const char* geomsel_file)
2428{
2429 ifstream ifile(geomsel_file);
2430 if (ifile)
2431 {
2432 stringstream ss;
2433 string line, fname;
2434 int startno;
2435 int ich = 0;
2436 while ((ich = ifile.get()) != EOF)
2437 {
2438 char ch = static_cast<char>(ich);
2439 if (ch == '\n' || ch == '\r')
2440 {
2441 line = ss.str();
2442 if (line.length() == 0 || line.find('#') != string::npos)
2443 {
2444 ss.clear();
2445 ss.str("");
2446 }
2447 else
2448 {
2449 fname.clear();
2450 ss >> fname;
2451 startno = 0;
2452 ss >> startno;
2453 fSelector.addGeomFile(fname.c_str(), startno);
2454 ss.clear();
2455 ss.str("");
2456 }
2457 }
2458 else ss << ch;
2459 }
2460 }
2461 ifile.close();
2462}
2463
2464//_____________________________________________________
2465
2467 //
2468 // init connections to internal messaging queues
2469 if (gDebug) cout << "BesClient::InitConnections called!" << endl;
2470
2471 // Connect canvas to mouse actions
2472 Connect((TCanvas*)fEmbeddedCanvas->GetCanvas(),"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "BesClient",
2473 this, "ExecuteEvent(Int_t, Int_t, Int_t, TObject*)");
2474
2475 // Connect close button
2476 Connect("CloseWindow()", "BesClient", this, "CloseWindow()");
2477}
2478
2479//__________________________________________________________________
2480
2482 //
2483 // Handle menu items.
2484
2485 switch (id) {
2486
2487 // File
2488 case kM_File_LoadGeo:
2489 LoadGeoFile();
2490 break;
2491 case kM_File_SaveGeoAs:
2492 SaveGeoAs();
2493 break;
2494 case kM_File_OpenEvent:
2495 OpenEventFile();
2496 break;
2497 case kM_File_SavePicAs:
2498 SavePicAs();
2499 break;
2500 case kM_File_Close:
2501 gInterpreter->DeleteGlobal(this);
2502 delete this;
2503 break;
2504 case kM_File_Exit:
2505 CloseWindow(); // terminate theApp no need to use SendCloseMessage()
2506 break;
2507
2508 // Edit
2509 case kM_Edit_Editor:
2510 fEmbeddedCanvas->GetCanvas()->EditorBar();
2511 break;
2512
2513 // Help
2514 case kM_Help_Content:
2515 Help();
2516 break;
2517
2518 case kM_Help_About:
2519 new BesAboutHelp(gClient->GetRoot(), this);
2520 break;
2521
2522 // Default
2523 default:
2524 cerr << "Menu item" << id << "selected" << endl;
2525 break;
2526 }
2527}
2528
2529//_____________________________________________________
2530
2532 //
2533 // Handle view option menu items.
2534 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
2535 if (!view) {
2536 cout << "BesClient::HandleViewOptionMenu(), BesView does not exist in this pad" << endl;
2537 return;
2538 }
2539
2540 //Int_t i = 0, px = 0, py = 0;
2541 //TVirtualGeoPainter *painter = 0;
2542
2543 switch (id) {
2544 //Long Peixun's update: kM_Header_On -> kM_Header_Global
2545 case kM_Header_Global:
2546 if ( fMenuViewOptionHeader->IsEntryChecked(kM_Header_Global) ) {
2547 fMenuViewOptionHeader->UnCheckEntry(kM_Header_Global);
2548 fDisplay->SetVisHeader(0);
2549 } else {
2550 fMenuViewOptionHeader->CheckEntry(kM_Header_Global);
2551 fDisplay->SetVisHeader(1);
2552 }
2553 break;
2554
2555 //Long Peixun's update: Add CGEM control code
2556 case kM_Cgem_Global:
2557 if (fMenuViewOptionCgem->IsEntryChecked(kM_Cgem_Global))
2558 {
2559 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_Global);
2560 view->SetVisCgemGlobal(0);
2561 }
2562 else
2563 {
2564 fMenuViewOptionCgem->CheckEntry(kM_Cgem_Global);
2565 view->SetVisCgemGlobal(1);
2566 }
2567 break;
2568
2569 case kM_Cgem_Layers:
2570 if (fMenuViewOptionCgem->IsEntryChecked(kM_Cgem_Layers))
2571 {
2572 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_Layers);
2573 view->SetVisCgemLayers(0);
2574 }
2575 else
2576 {
2577 fMenuViewOptionCgem->CheckEntry(kM_Cgem_Layers);
2578 view->SetVisCgemLayers(1);
2579 }
2580 break;
2581
2582 case kM_Cgem_XStrips:
2583 if (fMenuViewOptionCgem->IsEntryChecked(kM_Cgem_XStrips))
2584 {
2585 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_XStrips);
2586 view->SetVisCgemXStrips(0);
2587 }
2588 else
2589 {
2590 fMenuViewOptionCgem->CheckEntry(kM_Cgem_XStrips);
2591 view->SetVisCgemXStrips(1);
2592 }
2593 break;
2594
2595 case kM_Cgem_VStrips:
2596 if (fMenuViewOptionCgem->IsEntryChecked(kM_Cgem_VStrips))
2597 {
2598 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_VStrips);
2599 view->SetVisCgemVStrips(0);
2600 }
2601 else
2602 {
2603 fMenuViewOptionCgem->CheckEntry(kM_Cgem_VStrips);
2604 view->SetVisCgemVStrips(1);
2605 }
2606 break;
2607
2608 case kM_Mdc_Global:
2609 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Global) ) {
2610 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Global);
2611 view->SetVisMdcGlobal(0);
2612 } else {
2613 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Global);
2614 view->SetVisMdcGlobal(1);
2615 }
2616 break;
2617
2618 case kM_Mdc_Tubes:
2619 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Tubes) ) {
2620 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Tubes);
2621 view->SetVisMdcTubes(0);
2622 } else {
2623 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Tubes);
2624 view->SetVisMdcTubes(1);
2625 }
2626 break;
2627
2628 case kM_Mdc_Wires:
2629 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Wires) ) {
2630 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Wires);
2631 view->SetVisMdcWires(0);
2632 } else {
2633 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Wires);
2634 view->SetVisMdcWires(1);
2635 }
2636 break;
2637
2638 case kM_Tof_Global:
2639 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_Global) ) {
2640 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Global);
2641 view->SetVisTofGlobal(0);
2642 } else {
2643 fMenuViewOptionTof->CheckEntry(kM_Tof_Global);
2644 view->SetVisTofGlobal(1);
2645 }
2646 break;
2647
2648 case kM_Tof_East:
2649 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_East) ) {
2650 fMenuViewOptionTof->UnCheckEntry(kM_Tof_East);
2651 view->SetVisTofEast(0);
2652 } else {
2653 fMenuViewOptionTof->CheckEntry(kM_Tof_East);
2654 view->SetVisTofEast(1);
2655 }
2656 break;
2657
2658 case kM_Tof_Barrel:
2659 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_Barrel) ) {
2660 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Barrel);
2661 view->SetVisTofBarrel(0);
2662 } else {
2663 fMenuViewOptionTof->CheckEntry(kM_Tof_Barrel);
2664 view->SetVisTofBarrel(1);
2665 }
2666 break;
2667
2668 case kM_Tof_West:
2669 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_West) ) {
2670 fMenuViewOptionTof->UnCheckEntry(kM_Tof_West);
2671 view->SetVisTofWest(0);
2672 } else {
2673 fMenuViewOptionTof->CheckEntry(kM_Tof_West);
2674 view->SetVisTofWest(1);
2675 }
2676 break;
2677
2678 case kM_Emc_Global:
2679 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Global) ) {
2680 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Global);
2681 view->SetVisEmcGlobal(0);
2682 } else {
2683 fMenuViewOptionEmc->CheckEntry(kM_Emc_Global);
2684 view->SetVisEmcGlobal(1);
2685 }
2686 break;
2687
2688 case kM_Emc_East:
2689 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_East) ) {
2690 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_East);
2691 view->SetVisEmcEast(0);
2692 } else {
2693 fMenuViewOptionEmc->CheckEntry(kM_Emc_East);
2694 view->SetVisEmcEast(1);
2695 }
2696 break;
2697
2698 case kM_Emc_Barrel:
2699 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Barrel) ) {
2700 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Barrel);
2701 view->SetVisEmcBarrel(0);
2702 } else {
2703 fMenuViewOptionEmc->CheckEntry(kM_Emc_Barrel);
2704 view->SetVisEmcBarrel(1);
2705 }
2706 break;
2707
2708 case kM_Emc_West:
2709 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_West) ) {
2710 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_West);
2711 view->SetVisEmcWest(0);
2712 } else {
2713 fMenuViewOptionEmc->CheckEntry(kM_Emc_West);
2714 view->SetVisEmcWest(1);
2715 }
2716 break;
2717
2718 case kM_Emc_Side:
2719 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Side) ) {
2720 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Side);
2721 view->SetVisEmcSide(0);
2722 } else {
2723 fMenuViewOptionEmc->CheckEntry(kM_Emc_Side);
2724 view->SetVisEmcSide(1);
2725 }
2726 break;
2727
2728 case kM_Muc_Global:
2729 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Global) ) {
2730 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Global);
2731 view->SetVisMucGlobal(0);
2732 } else {
2733 fMenuViewOptionMuc->CheckEntry(kM_Muc_Global);
2734 view->SetVisMucGlobal(1);
2735 }
2736 break;
2737
2738 case kM_Muc_East:
2739 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_East) ) {
2740 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_East);
2741 view->SetVisMucEast(0);
2742 } else {
2743 fMenuViewOptionMuc->CheckEntry(kM_Muc_East);
2744 view->SetVisMucEast(1);
2745 }
2746 break;
2747
2748 case kM_Muc_Barrel:
2749 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Barrel) ) {
2750 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Barrel);
2751 view->SetVisMucBarrel(0);
2752 } else {
2753 fMenuViewOptionMuc->CheckEntry(kM_Muc_Barrel);
2754 view->SetVisMucBarrel(1);
2755 }
2756 break;
2757
2758 case kM_Muc_West:
2759 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_West) ) {
2760 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_West);
2761 view->SetVisMucWest(0);
2762 } else {
2763 fMenuViewOptionMuc->CheckEntry(kM_Muc_West);
2764 view->SetVisMucWest(1);
2765 }
2766 break;
2767
2768 case kM_Muc_Strips:
2769 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Strips) ) {
2770 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Strips);
2771 view->SetVisMucStrips(0);
2772 } else {
2773 fMenuViewOptionMuc->CheckEntry(kM_Muc_Strips);
2774 view->SetVisMucStrips(1);
2775 }
2776 break;
2777
2778 //Long Peixun's update: for CGEM
2779 case kM_Full3D_Cgem:
2780 if (fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Cgem))
2781 {
2782 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Cgem);
2783 view->SetVisFull3DCgem(0);
2784 }
2785 else
2786 {
2787 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Cgem);
2788 view->SetVisFull3DCgem(1);
2789 }
2790
2791 if (gBesGeometry)
2792 {
2795 }
2796 break;
2797
2798 case kM_Full3D_Mdc:
2799 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Mdc) ) {
2800 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Mdc);
2801 view->SetVisFull3DMdc(0);
2802 } else {
2803 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Mdc);
2804 view->SetVisFull3DMdc(1);
2805 }
2806
2807 if (gBesGeometry) {
2810 }
2811 break;
2812
2813 case kM_Full3D_Tof:
2814 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Tof) ) {
2815 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Tof);
2816 view->SetVisFull3DTof(0);
2817 } else {
2818 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Tof);
2819 view->SetVisFull3DTof(1);
2820 }
2821
2822 if (gBesGeometry) {
2825 }
2826 break;
2827
2828 case kM_Full3D_Emc:
2829 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Emc) ) {
2830 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Emc);
2831 view->SetVisFull3DEmc(0);
2832 } else {
2833 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Emc);
2834 view->SetVisFull3DEmc(1);
2835 }
2836
2837 if (gBesGeometry) {
2840 }
2841 break;
2842
2843 case kM_Full3D_Muc:
2844 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Muc) ) {
2845 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Muc);
2846 view->SetVisFull3DMuc(0);
2847 } else {
2848 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Muc);
2849 view->SetVisFull3DMuc(1);
2850 }
2851
2852 if (gBesGeometry) {
2855 }
2856 break;
2857
2858 case kM_BeamPipe:
2859 if ( fMenuViewOptionOthers->IsEntryChecked(kM_BeamPipe) ) {
2860 fMenuViewOptionOthers->UnCheckEntry(kM_BeamPipe);
2861 view->SetVisBeamPipe(0);
2862 } else {
2863 fMenuViewOptionOthers->CheckEntry(kM_BeamPipe);
2864 view->SetVisBeamPipe(1);
2865 }
2866 break;
2867
2868 case kM_ZRPlaneOnXY:
2869 if ( fMenuViewOptionOthers->IsEntryChecked(kM_ZRPlaneOnXY) ) {
2870 fMenuViewOptionOthers->UnCheckEntry(kM_ZRPlaneOnXY);
2871 view->SetVisZRPlaneOnXY(0);
2872 } else {
2873 fMenuViewOptionOthers->CheckEntry(kM_ZRPlaneOnXY);
2874 view->SetVisZRPlaneOnXY(1);
2875 }
2876 break;
2877
2878 case kM_Axis:
2879 if ( fMenuViewOptionOthers->IsEntryChecked(kM_Axis) ) {
2880 fMenuViewOptionOthers->UnCheckEntry(kM_Axis);
2881 view->SetVisAxis(0);
2882 } else {
2883 fMenuViewOptionOthers->CheckEntry(kM_Axis);
2884 view->SetVisAxis(1);
2885 }
2886 break;
2887
2888 //Long Peixun's update: for CGEM hits
2889 //-----------------------------------
2890 case kM_CgemHits_Global:
2891 if (fMenuViewOptionCgemHits->IsEntryChecked(kM_CgemHits_Global))
2892 {
2893 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_Global);
2894 view->SetVisCgemHitsGlobal(0);
2895 }
2896 else
2897 {
2898 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_Global);
2899 view->SetVisCgemHitsGlobal(1);
2900 }
2901 break;
2902 case kM_CgemHits_XStrip:
2903 if (fMenuViewOptionCgemHits->IsEntryChecked(kM_CgemHits_XStrip))
2904 {
2905 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_XStrip);
2906 view->SetVisCgemHitsXStrip(0);
2907 }
2908 else
2909 {
2910 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_XStrip);
2911 view->SetVisCgemHitsXStrip(1);
2912 }
2913 break;
2914 case kM_CgemHits_VStrip:
2915 if (fMenuViewOptionCgemHits->IsEntryChecked(kM_CgemHits_VStrip))
2916 {
2917 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_VStrip);
2918 view->SetVisCgemHitsVStrip(0);
2919 }
2920 else
2921 {
2922 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_VStrip);
2923 view->SetVisCgemHitsVStrip(1);
2924 }
2925 break;
2927 if (fMenuViewOptionCgemHits->IsEntryChecked(kM_CgemHits_Clusters))
2928 {
2929 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_Clusters);
2930 view->SetVisCgemHitsClusters(0);
2931 }
2932 else
2933 {
2934 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_Clusters);
2935 view->SetVisCgemHitsClusters(1);
2936 }
2937 break;
2939 if (fMenuViewOptionCgemHits->IsEntryChecked(kM_CgemHits_FiredHL))
2940 {
2941 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_FiredHL);
2942 view->SetVisCgemHitsFiredHL(0);
2943 }
2944 else
2945 {
2946 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_FiredHL);
2947 view->SetVisCgemHitsFiredHL(1);
2948 }
2949 break;
2950 //--------------------------------------
2951
2952 case kM_MdcHits_Hits:
2953 if ( fMenuViewOptionMdcHits->IsEntryChecked(kM_MdcHits_Hits) ) {
2954 fMenuViewOptionMdcHits->UnCheckEntry(kM_MdcHits_Hits);
2955 view->SetVisMdcHits(0);
2956 } else {
2957 fMenuViewOptionMdcHits->CheckEntry(kM_MdcHits_Hits);
2958 view->SetVisMdcHits(1);
2959 }
2960 break;
2961
2962 case kM_TofHits_Global:
2963 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_Global) ) {
2964 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Global);
2965 view->SetVisTofHitsGlobal(0);
2966 } else {
2967 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Global);
2968 view->SetVisTofHitsGlobal(1);
2969 }
2970 break;
2971
2972 case kM_TofHits_East:
2973 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_East) ) {
2974 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_East);
2975 view->SetVisTofHitsEast(0);
2976 } else {
2977 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_East);
2978 view->SetVisTofHitsEast(1);
2979 }
2980 break;
2981
2982 case kM_TofHits_Barrel:
2983 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_Barrel) ) {
2984 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Barrel);
2985 view->SetVisTofHitsBarrel(0);
2986 } else {
2987 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Barrel);
2988 view->SetVisTofHitsBarrel(1);
2989 }
2990 break;
2991
2992 case kM_TofHits_West:
2993 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_West) ) {
2994 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_West);
2995 view->SetVisTofHitsWest(0);
2996 } else {
2997 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_West);
2998 view->SetVisTofHitsWest(1);
2999 }
3000 break;
3001
3002 case kM_EmcHits_Global:
3003 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Global) ) {
3004 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Global);
3005 view->SetVisEmcHitsGlobal(0);
3006 } else {
3007 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Global);
3008 view->SetVisEmcHitsGlobal(1);
3009 }
3010 break;
3011
3012 case kM_EmcHits_East:
3013 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_East) ) {
3014 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_East);
3015 view->SetVisEmcHitsEast(0);
3016 } else {
3017 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_East);
3018 view->SetVisEmcHitsEast(1);
3019 }
3020 break;
3021
3022 case kM_EmcHits_Barrel:
3023 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Barrel) ) {
3024 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Barrel);
3025 view->SetVisEmcHitsBarrel(0);
3026 } else {
3027 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Barrel);
3028 view->SetVisEmcHitsBarrel(1);
3029 }
3030 break;
3031
3032 case kM_EmcHits_West:
3033 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_West) ) {
3034 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_West);
3035 view->SetVisEmcHitsWest(0);
3036 } else {
3037 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_West);
3038 view->SetVisEmcHitsWest(1);
3039 }
3040 break;
3041
3042 case kM_EmcHits_Side:
3043 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Side) ) {
3044 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Side);
3045 view->SetVisEmcHitsSide(0);
3046 } else {
3047 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Side);
3048 view->SetVisEmcHitsSide(1);
3049 }
3050 break;
3051
3052 case kM_MucHits_Global:
3053 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_Global) ) {
3054 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Global);
3055 view->SetVisMucHitsGlobal(0);
3056 } else {
3057 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Global);
3058 view->SetVisMucHitsGlobal(1);
3059 }
3060 break;
3061
3062 case kM_MucHits_East:
3063 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_East) ) {
3064 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_East);
3065 view->SetVisMucHitsEast(0);
3066 } else {
3067 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_East);
3068 view->SetVisMucHitsEast(1);
3069 }
3070 break;
3071
3072 case kM_MucHits_Barrel:
3073 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_Barrel) ) {
3074 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Barrel);
3075 view->SetVisMucHitsBarrel(0);
3076 } else {
3077 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Barrel);
3078 view->SetVisMucHitsBarrel(1);
3079 }
3080 break;
3081
3082 case kM_MucHits_West:
3083 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_West) ) {
3084 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_West);
3085 view->SetVisMucHitsWest(0);
3086 } else {
3087 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_West);
3088 view->SetVisMucHitsWest(1);
3089 }
3090 break;
3091
3092 case kM_Tracks_Global:
3093 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Global) ) {
3094 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Global);
3095 view->SetVisTracksGlobal(0);
3096 } else {
3097 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Global);
3098 view->SetVisTracksGlobal(1);
3099 }
3100 break;
3101
3102 case kM_Tracks_Mdc:
3103 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Mdc) ) {
3104 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Mdc);
3105 view->SetVisTracksMdc(0);
3106 } else {
3107 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Mdc);
3108 view->SetVisTracksMdc(1);
3109 }
3110 break;
3111
3112 case kM_Tracks_Tof:
3113 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Tof) ) {
3114 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Tof);
3115 view->SetVisTracksTof(0);
3116 } else {
3117 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Tof);
3118 view->SetVisTracksTof(1);
3119 }
3120 break;
3121
3122 case kM_Tracks_Emc:
3123 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Emc) ) {
3124 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Emc);
3125 view->SetVisTracksEmc(0);
3126 } else {
3127 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Emc);
3128 view->SetVisTracksEmc(1);
3129 }
3130 break;
3131
3132 case kM_Tracks_Muc:
3133 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Muc) ) {
3134 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Muc);
3135 view->SetVisTracksMuc(0);
3136 } else {
3137 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Muc);
3138 view->SetVisTracksMuc(1);
3139 }
3140 break;
3141
3142 case kM_Tracks_Ext:
3143 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Ext) ) {
3144 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Ext);
3145 view->SetVisTracksExt(0);
3146 } else {
3147 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Ext);
3148 view->SetVisTracksExt(1);
3149 }
3150 break;
3151
3152 case kM_MC_TruthTrack:
3153 if ( fMenuViewOptionMC->IsEntryChecked(kM_MC_TruthTrack) ) {
3154 fMenuViewOptionMC->UnCheckEntry(kM_MC_TruthTrack);
3155 view->SetVisMCTruthTrack(0);
3156 } else {
3157 fMenuViewOptionMC->CheckEntry(kM_MC_TruthTrack);
3158 view->SetVisMCTruthTrack(1);
3159 }
3160 break;
3161
3162 case kM_View_X3D:
3163 X3D();
3164 break;
3165
3166 case kM_View_OpenGL:
3167 OpenGL();
3168 break;
3169
3170 // Default
3171 default:
3172 cerr << "MenuViewOption item" << id << "selected" << endl;
3173 break;
3174 }
3175
3176 view->UpdateView(0);
3177 UpdateStatus();
3178
3179 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Modified();
3180 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Update();
3181}
3182
3183//__________________________________________________________________
3184
3185void BesClient::HandleError(const char* msg) {
3186 //
3187 // Error handling
3188 new TGMsgBox(gClient->GetRoot(), this,
3189 "Error", msg,
3190 gClient->GetPicture("mb_stop_s.xpm"),
3191 kMBOk); //Long Peixun's update: kMBDismiss -> kMBOk
3192}
3193
3194//__________________________________________________________________
3195
3196void BesClient::HandleInfoBar(const char* msg) {
3197 //
3198 // Info handling
3199 fStatusBar->SetText(msg, 1);
3200}
3201
3202//__________________________________________________________________
3203
3204void BesClient::HandleStatusBar(const char* msg) {
3205 //
3206 // Client status handling
3207 fStatusBar->SetText(msg, 0);
3208}
3209
3210//__________________________________________________________________
3211
3213 //
3214 // Show display
3215 MapWindow();
3216 MapRaised();
3217}
3218
3219//__________________________________________________________________
3220
3222 //
3223 // Load BesVis geometry file
3224
3225 //Long Peixun's update: Always popup open geometry dialog box
3226 // if ( f_geoFile.Length() != 0){
3227 // cout << "Load geoFile f_geoFile: " << f_geoFile << endl;
3228 // this->OpenGeoFile(f_geoFile);
3229 // }
3230 // else {
3231 // Open file browser
3232 static TString GeoDir = fBesVisPath + TString("/geom/"); // "."
3233 TGFileInfo fi;
3234 fi.fFileTypes = OpenGeoTypes;
3235 fi.fIniDir = StrDup(GeoDir);
3236 char msg[256];
3237 sprintf(msg, "Loading Geometry File");
3238 HandleStatusBar(msg);
3239 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
3240 if (&fi == 0) return;
3241 GeoDir = fi.fIniDir;
3242 this->OpenGeoFile(fi.fFilename); // fi.fFilename: full path of geofile
3243 fAutoGeom = false; //Long Peixun's update: Current geometry was selected manually
3244 // }
3245}
3246
3247//__________________________________________________________________
3248
3249void BesClient::OpenGeoFile(TString fname) {
3250 //
3251 // Open BesVis geometry file
3252 //HandleStatusBar("Open Geometry File");
3253 if (fname.Length() == 0) return;
3254 char msg[256];
3255 if (gDebug) cout << fname << " fname Length " << fname.Length() << endl;
3256
3257 //Long Peixun's update: consider whether fname contains path or not
3258 TString fpath, fpurename;
3259 if (fname.Contains("/"))
3260 { //fname contains both path and file name
3261 Ssiz_t posLastSlash = fname.Last('/'); // /scratch/youzy/BesVis/geom.root
3262 // |
3263 fpath = fname;
3264 fpath = fpath.Remove(posLastSlash+1, fname.Length()-posLastSlash-1);
3265 fpurename = fname; //Long Peixun's update: Get pure name of file
3266 fpurename = fpurename.Remove(0, posLastSlash + 1);
3267 if (fpath.Length() == 0) return; // Cancel Button pressed.
3268 }
3269 else
3270 { //fname contains only file name
3271 fpath = TString("");
3272 fpurename = fname;
3273 }
3274
3275 //Long Peixun's update: Judge whether this geometry file is default geometry file;
3276 TString geompath = fBesVisPath + TString("/geom/");
3277 if (fname.BeginsWith(geompath))
3278 {
3279 if (fSelector.hasGeomFile(fpurename.Data()))
3280 {
3281 fCurGeom = fpurename;
3282 cout << "Open a default geometry " << fpurename.Data() << endl;
3283 }
3284 else
3285 {
3286 fCurGeom = TString("");
3287 cout << "Open a user-defined geometry " << fpurename.Data() << endl;
3288 }
3289 }
3290 else
3291 {
3292 fCurGeom = TString("");
3293 cout << "Open a user-defined geometry " << fpurename.Data() << endl;
3294 }
3295
3296 //Long Peixun's update: Rebuilding geometry is normal operation
3297 // if (fDisplay->GetBesGeometry()) {
3298 // Int_t ret;
3299 // const char *txt;
3300 // txt = Form("Geometry has already been build, Yes to rebuild it? \n (Each rebuild increase memory ~80MB)");
3301 // new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
3302 // "Geometry Exist", txt, kMBIconExclamation,
3303 // kMBYes | kMBNo, &ret);
3304 // if (ret == kMBNo) return;
3305 // }
3306
3307 if ( fname.EndsWith(".gdml") ) { //Long Peixun update: Contains->EndsWith
3308 //Long Peixun's update: Decide whether load MRPC and CGEM by the name of selected file
3309 bool mrpc = false, cgem = false;
3310 fpurename.ToUpper();
3311 if (fpurename.Contains("MRPC")) mrpc = true;
3312 if (fpurename.Contains("CGEM")) cgem = true;
3313
3314 fDisplay->InitGeometryFromGDML(fpath, mrpc, cgem);
3315 fDisplay->Draw();
3316 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
3317 return;
3318 }
3319
3320 if ( fname.EndsWith(".root") ) { //Long Peixun update: Contains->EndsWith
3321 fGeoFile = TFile::Open(fname, "read");
3322
3323 TGeoVolume *volBes = (TGeoVolume*)(fGeoFile->Get("volBes"));
3324
3325 if (volBes) {
3326 fDisplay->InitGeometryFromROOT(volBes);
3327 fDisplay->Draw();
3328 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
3329 return;
3330 }
3331 else {
3332 this->HandleError("This File is not a valid BesVis geometry file : \n TopVolume \"volBes\" not found!");
3333 sprintf(msg, "This File is not a valid BesVis geometry file");
3334 HandleStatusBar(msg);
3335 return;
3336 }
3337 }
3338}
3339
3340//_____________________________________________________
3341
3343 //
3344 // save object of Top Volume "volBes" to a ROOT file
3345 // Open file browser
3346
3347 if (!fDisplay) {
3348 this->HandleError("fDisplay not found !");
3349 return;
3350 }
3351
3352 if (!fDisplay->GetBesGeometry()) {
3353 this->HandleError("Bes Geometry not found, Load from ROOT or GDML files first !");
3354 return;
3355 }
3356
3357 TGeoVolume *volBes = fDisplay->GetBesGeometry()->GetVolBes();
3358 if (volBes) {
3359 // get name to save volBes to
3360 static TString EventDir(".");
3361 TGFileInfo fi;
3362 fi.fFileTypes = SaveGeoTypes;
3363 fi.fIniDir = StrDup(EventDir);
3364 char msg[256];
3365 sprintf(msg, "Saving Geometry ----> BUSY!");
3366 HandleStatusBar(msg);
3367 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
3368
3369 //Long Peixun's update: Consider cancel button
3370 if (fi.fFilename)
3371 {
3372 //Long Peixun's update: Add extension at the end of filename.
3373 TString filename = fi.fFilename;
3374 const char* ptype = SaveGeoTypes[fi.fFileTypeIdx + 1] + 1;
3375 if (!filename.EndsWith(ptype)) filename += ptype;
3376 TFile *f = new TFile(filename.Data() ,"RECREATE");
3377 volBes->Write();
3378 f->Close();
3379 }
3380 }
3381 else {
3382 this->HandleError("TGeoVolume \"volBes\" not found !");
3383 return;
3384 }
3385
3386 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: "Ready" -> GetCurrentPadString()
3387}
3388
3389//__________________________________________________________________
3390//Long Peixun's update: Modify OpenEventFile to adapt to geometry selection
3391//Long Peixun's update: Change geometry selection process
3393 //
3394 // Load BesVis event file
3395 char msg[256];
3396 sprintf(msg, "Loading Event File");
3397 HandleStatusBar(msg);
3398
3399 // Open file browser
3400 static TString EventDir(".");
3401 TGFileInfo fi;
3402 fi.fFileTypes = OpenEventTypes;
3403 fi.fIniDir = StrDup(EventDir);
3404 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
3405 EventDir = fi.fIniDir;
3406
3407 if (gBesGeometry)
3408 this->OpenEventFile(fi.fFilename, false);
3409 else
3410 this->OpenEventFile(fi.fFilename, true);
3411}
3412
3413//__________________________________________________________________
3414//Long Peixun's update: Add a parameter to determine whether choose a detector geometry automatically when open an event file.
3415void BesClient::OpenEventFile(TString fname, bool auto_sel_geom) {
3416 //
3417 // Open BesVis event file
3418
3419 std::cout << "OpenEventFile: " << fname << std::endl;
3420 HandleStatusBar("Open Event File");
3421 char msg[256];
3422 //Long Peixun's update: remove useless variable
3423 //f_evtFile_1 = fname;
3424
3425 //Long Peixun's update: Contains -> EndsWith; Add .dst
3426 if (fname.EndsWith(".root") || fname.EndsWith(".rtraw") || fname.EndsWith(".rec") || fname.EndsWith(".dst"))
3427 {
3428 //Long Peixun's update: Delete old file and events
3429 if (fEventFile) fEventFile->Close();
3430 delete fEventFile;
3431 fEventFile = 0;
3432 delete fEvent;
3433 fEvent = 0;
3434 gEvent = fEvent;
3435 fEventTree = 0;
3436
3437 fEventFile = TFile::Open(fname, "read");
3438
3439 if (fEventFile)
3440 {
3441 //Long Peixun's update: Check whether this event is REC event
3442 if (fname.EndsWith(".rec")) isRecEvent = true;
3443 else isRecEvent = false;
3444
3445 //Long Peixun's update: Show file name on window title
3446 TString ttitle(fTitleText);
3447 ttitle.Append(" - ");
3448 ttitle.Append(fname);
3449 SetWindowName(ttitle);
3450
3451 fEvent = new BesEvent();
3452 gEvent = fEvent;
3453 fEventTree = (TTree*)fEventFile->Get("Event");
3454
3455 //Long Peixun's update: Load events only if open file successfully
3456 if (fEventTree)
3457 {
3458 Long64_t nEvents = fEventTree->GetEntries();
3459 fBesEventNo = 0;
3460
3461 //Long Peixun's update: fix EventSlider range error
3462 if (nEvents > 0)
3463 {
3464 if(f_bossMode == false)
3465 {
3466 fDigiEvent = 0;
3467 fEvtHeader = 0;
3468 //fTrigEvent = 0;
3469 fRecEvent_1 = 0;
3470 fDstEvent = 0; //Long Peixun's update: for dst file
3471 fMcEvent = 0;
3472
3473 fEventTree->SetBranchAddress("TDigiEvent" , &fDigiEvent);
3474 fEventTree->SetBranchAddress("TRecEvent" , &fRecEvent_1);
3475 fEventTree->SetBranchAddress("TEvtHeader" , &fEvtHeader);
3476 fEventTree->SetBranchAddress("TDstEvent", &fDstEvent); //Long Peixun's update: for dst file
3477 //fEventTree->SetBranchAddress("TTrigEvent" , &fTrigEvent);
3478 fEventTree->SetBranchAddress("TMcEvent", &fMcEvent);
3479 }
3480 GetEvent(fBesEventNo, true, auto_sel_geom);
3481 fEventPlaySlider->SetRange(0, nEvents-1);
3482 fEventPlaySlider->SetPosition(0);
3483 }
3484 else
3485 {
3486 fEventPlaySlider->SetRange(0, 0);
3487 fEventPlaySlider->SetPosition(0);
3488 }
3489 }
3490 else
3491 {
3492 this->HandleError("This File is not a valid BesVis ROOT Event File : \n Event Tree \"Event\" not found!");
3493 sprintf(msg, "This File contains no Event Tree \"Event\"");
3494 HandleStatusBar(msg);
3495 return;
3496 }
3497 }
3498 else
3499 {
3500 this->HandleError("This File is not a valid BesVis ROOT Event File!");
3501 sprintf(msg, "This File is not valid");
3502 HandleStatusBar(msg);
3503 return;
3504 }
3505
3506 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: "Ready" -> GetCurrentPadString()
3507 }
3508}
3509
3510//_____________________________________________________
3511
3513 //
3514 // save picture of canvas in file
3515 // Open file browser
3516
3517 // get name to save events to
3518 static TString EventDir(".");
3519 TGFileInfo fi;
3520 fi.fFileTypes = SavePicTypes;
3521 fi.fIniDir = StrDup(EventDir);
3522 char msg[256];
3523 sprintf(msg, "Saving Picture ----> BUSY!");
3524 HandleStatusBar(msg);
3525 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
3526
3527 if ( fi.fFilename ) {
3528 TString filename = fi.fFilename;
3529
3530 //Long Peixun's update: Add extension at the end of filename.
3531 const char* ptype = SavePicTypes[fi.fFileTypeIdx + 1] + 1;
3532 if (!filename.EndsWith(ptype)) filename += ptype;
3533
3534 if ( filename.EndsWith("gif") || filename.EndsWith("GIF") ) {
3535 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"gif");
3536 }
3537 else if ( filename.EndsWith("jpg") || filename.EndsWith("JPG") ) {
3538 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"jpg");
3539 }
3540 else if ( filename.EndsWith("eps") || filename.EndsWith("EPS") ) {
3541 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"eps");
3542 }
3543 else if ( filename.EndsWith("ps") || filename.EndsWith("PS") ) {
3544 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
3545 }
3546 else if ( filename.EndsWith("xpm") || filename.EndsWith("XPM") ) {
3547 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"xmp");
3548 }
3549 else if ( filename.EndsWith("png") || filename.EndsWith("PNG") ) {
3550 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"png");
3551 }
3552 else if ( filename.EndsWith("tiff") || filename.EndsWith("TIFF") ) {
3553 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"tiff");
3554 }
3555 else if ( filename.EndsWith("cxx") || filename.EndsWith("CXX") ) {
3556 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"cxx");
3557 }
3558 else if ( filename.EndsWith("xml") || filename.EndsWith("XML") ) {
3559 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"xml");
3560 }
3561 else if ( filename.EndsWith("root") || filename.EndsWith("ROOT") ) {
3562 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"root");
3563 }
3564 //Long Peixun's update: Remove hint of filename being empty
3565 }
3566 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: "Ready" -> GetCurrentPadString()
3567}
3568
3569//_____________________________________________________
3570
3572 //
3573 // save picture of canvas in file
3574 // Open file browser
3575
3576 // get name to save events to
3577 static TString PSEventDir(".");
3578 TGFileInfo fi;
3579 fi.fFileTypes = SavePicPS;
3580 fi.fIniDir = StrDup(PSEventDir);
3581 char msg[256];
3582 sprintf(msg, "Saving Picture as PS ----> BUSY!");
3583 HandleStatusBar(msg);
3584 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
3585
3586 if ( fi.fFilename ) {
3587 TString filename = fi.fFilename;
3588 if ( filename.EndsWith("ps") || filename.EndsWith("PS") ) {
3589 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
3590 }
3591 else {
3592 filename += ".ps";
3593 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
3594 }
3595 }
3596 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: "Ready" -> GetCurrentPadString()
3597}
3598
3599//_____________________________________________________
3600
3602
3603 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
3604 if (view) {
3605 Double_t x1, y1, x2, y2;
3606 gPad->GetRange(x1, y1, x2, y2);
3607 //cout << "x1 " << x1 << " x2 " << x2 << " y1 " << y1 << " y2 " << y2 << endl;
3608 Int_t iPad = 0;
3609 if (view->GetViewType() == kXYView) iPad = 0;
3610 else if (view->GetViewType() == kZRView) iPad = 1;
3611 else if (view->GetViewType() == k3DView) iPad = 2;
3612 fHomeX[iPad] = 0.5*(x1+x2);
3613 fHomeY[iPad] = 0.5*(y1+y2);
3614 }
3615}
3616
3617//_____________________________________________________
3618
3620
3621 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
3622 if (view) {
3623 Double_t x1, y1, x2, y2, dx, dy;
3624 gPad->GetRange(x1, y1, x2, y2);
3625 dx = x2 - x1;
3626 dy = y2 - y1;
3627
3628 Int_t iPad = 0;
3629 if (view->GetViewType() == kXYView) iPad = 0;
3630 else if (view->GetViewType() == kZRView) iPad = 1;
3631 else if (view->GetViewType() == k3DView) iPad = 2;
3632
3633 gPad->Range(fHomeX[iPad]-0.5*dx, fHomeY[iPad]-0.5*dy, fHomeX[iPad]+0.5*dx, fHomeY[iPad]+0.5*dy);
3634 }
3635}
3636
3637//_____________________________________________________
3638
3640 //
3641 // save current style to ~/.besvisMyConfig.txt
3642
3643 // Int_t ret;
3644 // const char *txt;
3645 // txt = Form("Save current style to ~/.besvisMyConfig.txt, Yes to save it? ");
3646 // new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
3647 // "Save My Style", txt, kMBIconExclamation,
3648 // kMBYes | kMBNo, &ret);
3649 // if (ret == kMBNo) return;
3650 if (!fDisplay) return;
3651
3652 //Long Peixun's update: Popup a save dialog
3653 static TString EventDir(".");
3654 TGFileInfo fi;
3655 fi.fFileTypes = StyleTypes;
3656 fi.fIniDir = StrDup(EventDir);
3657 char msg[256];
3658 sprintf(msg, "Saving Style ----> BUSY!");
3659 HandleStatusBar(msg);
3660 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
3661
3662 if (fi.fFilename)
3663 {
3664 //Long Peixun's update: Handle save file process
3665 TString filename = fi.fFilename;
3666 const char* ptype = StyleTypes[fi.fFileTypeIdx + 1] + 1;
3667 if (!filename.EndsWith(ptype)) filename += ptype;
3668 ofstream fileMyConfig(filename.Data(), ios_base::out);
3669
3670 //Long Peixun's update: Add flag of BesVis at the head of file
3671 fileMyConfig << "BesVisStyle";
3672
3673 BesView *viewXY = dynamic_cast<BesView*>(fDisplay->GetPadXY()->GetView());
3674 if (viewXY) {
3675 BesStatus *status = viewXY->GetStatusXY();
3676 fileMyConfig << *status;
3677 //cout << "viewXY " << *status << endl;
3678 }
3679
3680 BesView *viewZR = dynamic_cast<BesView*>(fDisplay->GetPadZR()->GetView());
3681 if (viewZR) {
3682 BesStatus *status = viewZR->GetStatusZR();
3683 fileMyConfig << *status;
3684 //cout << "viewZR " << *status << endl;
3685 }
3686
3687 BesView *view3D = dynamic_cast<BesView*>(fDisplay->GetPad3D()->GetView());
3688 if (view3D) {
3689 BesStatus *status = view3D->GetStatus3D();
3690 fileMyConfig << *status;
3691 //cout << "view3D " << *status << endl;
3692 }
3693
3694 //Long Peixun's update: Save CGEM unfolded view config
3695 for (int i = 0; i < 3; ++i)
3696 {
3697 BesView* viewCgemUF = dynamic_cast<BesView*>(fDisplay->GetPadCgemUF(i)->GetView());
3698 if (viewCgemUF)
3699 {
3700 BesStatus* status = viewCgemUF->GetStatusCgemUF(i);
3701 fileMyConfig << *status;
3702 }
3703 }
3704
3705 fileMyConfig.close(); //Long Peixun's update: Close file stream
3706 cout << "Save my style finished." << endl;
3707 }
3708 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: "Ready" -> GetCurrentPadString()
3709}
3710
3711//_____________________________________________________
3712
3714 //
3715 // load my style from ~/.besvisMyConfig.txt
3716
3717 //string homePath = getenv("HOME");
3718 //string fileName = homePath + string("/.besvisMyConfig.txt");
3719 //cout << "fileName " << fileName << endl;
3720 if (!fDisplay) return;
3721
3722 //Long Peixun's update: Popup open file dialog
3723 static TString EventDir(".");
3724 TGFileInfo fi;
3725 fi.fFileTypes = StyleTypes;
3726 fi.fIniDir = StrDup(EventDir);
3727 char msg[256];
3728 sprintf(msg, "Loading Style File");
3729 HandleStatusBar(msg);
3730 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
3731 EventDir = fi.fIniDir;
3732
3733 if (fi.fFilename)
3734 {
3735 ifstream fileMyConfig(fi.fFilename);
3736
3737 //Long Peixun's update: Check header of file
3738 string header;
3739 fileMyConfig >> header;
3740 if (header != "BesVisStyle")
3741 {
3742 HandleError("This file is not a BesVis style file!");
3743 }
3744 else
3745 {
3746 BesView *viewXY = dynamic_cast<BesView*>(fDisplay->GetPadXY()->GetView());
3747 if (viewXY) {
3748 BesStatus status;
3749 fileMyConfig >> status;
3750 viewXY->GetStatusCurrent()->Transfer(&status, true);
3751 }
3752
3753 BesView *viewZR = dynamic_cast<BesView*>(fDisplay->GetPadZR()->GetView());
3754 if (viewZR) {
3755 BesStatus status;
3756 fileMyConfig >> status;
3757 viewZR->GetStatusCurrent()->Transfer(&status, true);
3758 }
3759 BesView *view3D = dynamic_cast<BesView*>(fDisplay->GetPad3D()->GetView());
3760 if (view3D) {
3761 BesStatus status;
3762 fileMyConfig >> status;
3763 view3D->GetStatusCurrent()->Transfer(&status, true);
3764 }
3765
3766 //Long Peixun's update: Load CGEM unfolded view config
3767 for (int i = 0; i < 3; ++i)
3768 {
3769 BesView* viewCgemUF = dynamic_cast<BesView*>(fDisplay->GetPadCgemUF(i)->GetView());
3770 if (viewCgemUF)
3771 {
3772 BesStatus status;
3773 fileMyConfig >> status;
3774 viewCgemUF->GetStatusCurrent()->Transfer(&status, true);
3775 }
3776 }
3777 }
3778
3779 //Long Peixun's update: Close file stream
3780 fileMyConfig.close();
3781 UpdateStatus();
3782 UpdateAllView();
3783 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: "Ready" -> GetCurrentPadString()
3784 }
3785}
3786
3787//_____________________________________________________
3788
3790 cout<<"BesClient Loading PaletteAxis ... "<<endl;
3791
3792 new BesMdcPalette(gClient->GetRoot(), this);
3793
3794 //TRootHelpDialog* hd1 = new TRootHelpDialog(this, "Mdc Wire Palette",200, 600);
3795 //hd1->ChangeSubframesBackground(GetPic("MdcPalette.gif"));
3796 //hd1->Popup();
3797}
3798
3799//_____________________________________________________
3800
3802
3803 //char str[32];
3804 //sprintf(str, "BesVis Help %s...", gROOT->GetVersion());
3805 //TRootHelpDialog * hd = new TRootHelpDialog(this, str, 600, 400);
3806
3807 TRootHelpDialog * hd = new TRootHelpDialog(this, "Help on BesVis...", 600, 400);
3808 hd->SetText(f_HelpText.c_str());
3809 hd->Popup();
3810}
3811
3812//_____________________________________________________
3813
3815
3816 fDisplayModeButton[0]->SetPicture(gClient->GetPicture("DisplayMode2D.gif"));
3817 fDisplayModeButton[1]->SetPicture(gClient->GetPicture("DisplayModeXY.gif"));
3818 fDisplayModeButton[2]->SetPicture(gClient->GetPicture("DisplayModeZR.gif"));
3819 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3D.gif"));
3820 fDisplayModeButton[4]->SetPicture(gClient->GetPicture("DisplayModeAll.gif"));
3821 //Long Peixun's update: Add Cgem UF View and Cgem UF All View
3822 fDisplayModeButton[5]->SetPicture(gClient->GetPicture("DisplayModeCgemUF.gif"));
3823 fDisplayModeButton[6]->SetPicture(gClient->GetPicture("DisplayModeCgemUFAll.gif"));
3824
3825 for (Int_t i = 0; i < kNDisplayMode; i++) fDisplayModeButton[i]->SetState(false); //Long Peixun's update: Ajust display mode
3826}
3827
3828//_____________________________________________________
3829
3831
3832 /*
3833 painter = gGeoManager->GetGeomPainter();
3834 //if (!painter) return;
3835 painter->SetRaytracing(true);
3836 //if (!gPad) return;
3837 gPad->Modified();
3838 gPad->Update();
3839 */
3840
3841 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
3842 if (!view) return;
3843
3844 if (view && view->GetViewType() & k3DView)
3845 {
3846 //gPad->GetViewer3D(); //Long Peixun's update: This line is unnecessary
3847 // use TPad::Getviewer3D() instead of depreciated function x3d()
3848 // changed by tianhl at Mon Aug 20 2007
3849 fViewer3DMode = 1;
3850 //Long Peixun's update: Add parameter "x3d"; dynamic_cast
3851 TViewerX3D *x3d = dynamic_cast<TViewerX3D*>(gPad->GetViewer3D("x3d"));
3852 if (!x3d) cout << " x3d does not exist "<< endl;
3853 else x3d->ExecCommand(0,0,'r');
3854 }
3855 else
3856 {
3857 //Long Peixun's update: Switching to 3D View instead of showing error message
3859 fDisplayModeButton[3]->SetState(true);
3860 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
3861 fDisplay->SwitchDisplayMode(3);
3862 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
3863 X3D();
3864 }
3865}
3866
3867//_____________________________________________________
3868
3870
3871 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
3872 if (!view) return;
3873
3874 //Long Peixun's update: Remove annotation
3875 if (view->GetViewType() & k3DView)
3876 {
3877 // use TPad::GetViewer3D() instead of depreciated function TPad::x3d
3878 // changed by tianhl at Mon Aug 20 2007
3879 fViewer3DMode = 2;
3880 //Long Peixun's update: TVirtualViewer3D -> TGLViewer; Don't reset when update; dynamic_cast
3881 TGLViewer *ogl = dynamic_cast<TGLViewer*>(gPad->GetViewer3D("ogl"));
3882 if (ogl)
3883 {
3884 ogl->SetResetCamerasOnUpdate(false);
3885 ogl->SetClearColor(kWhite);
3886 }
3887 else cout << " ogl does not exist " << endl;
3889 }
3890 else
3891 {
3892 //Long Peixun's update: Switching to 3D View instead of showing error message
3894 fDisplayModeButton[3]->SetState(true);
3895 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
3896 fDisplay->SwitchDisplayMode(3);
3897 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
3898 OpenGL();
3899 }
3900}
3901
3902
3903//__________________________________________________________________
3904
3906 //
3907 // Got close message for this MainFrame. Calls parent CloseWindow())
3908 // (which destroys the window) and terminate the application.
3909 // The close message is generated by the window manager when its close
3910 // window menu item is selected.
3911 TGMainFrame::CloseWindow();
3912 gApplication->Terminate(0); // 0 = OK
3913}
3914
3915//_____________________________________________________
3916//Long Peixun's update: Get run number and choose a detector geometry automatically when in need.
3917// Check detector geometry when in need.
3918Bool_t BesClient::GetEvent(Long64_t i, bool openfile, bool sel_geom)
3919{
3920 if (fEventTree) {
3921
3922 Long64_t nEvents = fEventTree->GetEntries();
3923 if (i >= 0 && i < nEvents) {
3924
3925 fDigiEvent = 0;
3926 fEvtHeader = 0;
3927 fRecEvTime = 0;
3928 //fTrigEvent = 0;
3929 TDisTrack * fRecEvent = new TDisTrack();
3930
3931 if (f_bossMode == true)
3932 {
3933 TBranch *digiEvent = fEventTree->GetBranch("TDigiEvent");
3934 TBranch *evtHeader = fEventTree->GetBranch("TEvtHeader");
3935 //TBranch *trigEvent = fEventTree->GetBranch("TTrigEvent");
3936 TBranch *disTrack = fEventTree->GetBranch("TDisTrack");
3937 digiEvent->SetAddress(&fDigiEvent);
3938 //trigEvent->SetAddress(&fTrigEvent);
3939 disTrack->SetAddress(&fRecEvent);
3940 disTrack->GetEntry(i);
3941 digiEvent->GetEntry(i);
3942 evtHeader->GetEntry(i);
3943 //trigEvent->GetEntry(i);
3944 }
3945
3946 if (f_bossMode == false)
3947 {
3948 //Long Peixun add these to debug opening event
3949 cout << "[DEBUG] Get Event Entry test begin" << endl;
3950 fEventTree->GetEntry(i); //There are some errors here when open event file again
3951 cout << "[DEBUG] Successfully get Event Entry" << endl;
3952
3953 //Long Peixun's update: Judge the change of run number
3954 /* Long64_t newrunno = fEvtHeader->getRunId();
3955 cout << "[DEBUG] fAutoGeom == ";
3956 if (fAutoGeom) cout << "true" << endl;
3957 else cout << "false" << endl;
3958 if (fAutoGeom && fBesRunNo != newrunno && !sel_geom)
3959 {
3960 cout << "[DEBUG] fBesRunNo has changed!" << endl;
3961 const char* ogfile = fSelector.getGeomFileNameFromRunNo(fBesRunNo);
3962 const char* ngfile = fSelector.getGeomFileNameFromRunNo(newrunno);
3963 if (strcmp(ogfile, ngfile) != 0 && ngfile[0] != '\0')
3964 {
3965 Int_t clkbtn = 0;
3966 new TGMsgBox(gClient->GetRoot(), this, "BesVis",
3967 "The run number has changed. Do you want to let BesVis change the detector geometry into a suitable one?",
3968 gClient->GetPicture("mb_question_s.xpm"), kMBYes | kMBNo, &clkbtn);
3969 if (clkbtn & kMBYes)
3970 {
3971 cout << "Select geometry file: " << ngfile << endl;
3972 TString geomfile = fBesVisPath + TString("/geom/");
3973 geomfile += ngfile;
3974 OpenGeoFile(geomfile);
3975 }
3976 }
3977 } */
3978
3979 //Long Peixun's update: Set fBesRunNo
3980 fBesRunNo = fEvtHeader->getRunId();
3981 cout << "Run Number: " << fBesRunNo << endl;
3982
3983 //Long Peixun's update: if flag sel_geom is true, select a suitable detector geometry
3984 if (openfile)
3985 {
3986 const char* ret = fSelector.getGeomFileNameFromRunNo(fBesRunNo);
3987 if (sel_geom)
3988 {
3989 if (ret[0] == '\0')
3990 {
3991 HandleError("There is no suitable delector geometry! Please select a geometry file.");
3992 LoadGeoFile();
3993 }
3994 else
3995 {
3996 cout << "Select geometry file: " << ret << endl;
3997 TString geomfile = fBesVisPath + TString("/geom/");
3998 geomfile += ret;
3999 OpenGeoFile(geomfile);
4000 fAutoGeom = true;
4001 }
4002 }
4003 else
4004 {
4005 if (fCurGeom.Length() > 0)
4006 {
4007 TString ts_ret = TString(ret);
4008 if (ts_ret != fCurGeom)
4009 {
4010 // new TGMsgBox(fClient->GetRoot(), GetMainFrame(), "BesVis",
4011 // "Maybe you have selected an unsuitable geometry!",
4012 // kMBIconExclamation, kMBDismiss);
4013
4014 Int_t clkbtn = 0;
4015 new TGMsgBox(gClient->GetRoot(), this, "BesVis",
4016 "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.",
4017 kMBIconExclamation, kMBYes | kMBNo, &clkbtn);
4018 if (clkbtn & kMBYes) fAutoGeom = false;
4019 else
4020 {
4021 if (ret[0] == '\0')
4022 {
4023 HandleError("There is no suitable delector geometry! Please select a geometry file.");
4024 LoadGeoFile();
4025 }
4026 else
4027 {
4028 cout << "Select geometry file: " << ret << endl;
4029 TString geomfile = fBesVisPath + TString("/geom/");
4030 geomfile += ret;
4031 OpenGeoFile(geomfile);
4032 fAutoGeom = true;
4033 }
4034 }
4035 }
4036 }
4037 fAutoGeom = false;
4038 }
4039 }
4040
4041 //yzhang get event start time
4042 if(fRecEvent_1){
4043 if(fRecEvent_1->getEvTimeCol()->GetEntries()==1){
4044 fRecEvTime = (TRecEvTime*) fRecEvent_1->getEvTimeCol()->At(0);
4045 }else{
4046 cout<<"WARNING:EsTimeCol size!=1, size="<<fRecEvent_1->getEvTimeCol()->GetEntries()<<endl;
4047 }
4048 }
4049 //zhangy
4050
4051 int no = 0;
4052
4053 //recTrack1 = new TRecMdcTrack[20];
4054 //if contains reconstruction information
4055 if (fRecEvent_1)
4056 {
4057 cout << "BesClient Construct REC tracks" << endl;
4058 //Mdc tracks
4059 //Long Peixun's update: Remove "if"; Move "delete [] recTrack1" here
4060 no = 0;
4061 delete [] recTrack1;
4062 if (fRecEvent_1->getRecMdcTrackCol())
4063 no = (fRecEvent_1->getRecMdcTrackCol())->GetEntries();
4064 //if (no>20) no=20;
4065 recTrack1 = new TRecMdcTrack[no]; //Long Peixun's update: Remove limit of Mdc tracks number
4066 for (int i = 0; i < no; i++){
4067 const TRecMdcTrack* recTrack = fRecEvent_1->getRecMdcTrack(i);
4068 recTrack1[i].setTRecMdcTrack(recTrack); //Long Peixun's update: "(pointer+i)->" -> "pointer[i].", more clear
4069 fRecEvent->addRecMdcTrack(recTrack1 + i);
4070 }
4071
4072 ////yzhang
4073 //if (kalTrack){
4074 // delete [] kalTrack;
4075 // kalTrack = NULL;
4076 //}
4077 //kalTrack = new TRecMdcKalTrack[20];
4078 //no=0;
4079 //if (fRecEvent_1->getRecMdcKalTrackCol()){
4080 // no=(fRecEvent_1->getRecMdcKalTrackCol())->GetEntries();
4081 //}
4082 //if (no>20) no=20;
4083 //for (int i=0;i<no;i++){
4084 // TRecMdcKalTrack* kalTrack1 = const_cast<TRecMdcKalTrack*> (fRecEvent_1->getRecMdcKalTrack(i));
4085 // //(kalTrack+i)->setTRecMdcKalTrack(kalTrack1);
4086 // fRecEvent->addRecMdcKalTrack(kalTrack1);
4087 //}
4088 ////zhangy
4089
4090 //Tof tracks
4091 //Long Peixun's update: Remove "if"
4092 delete [] tofTrack;
4093 no = 0;
4094 //tofTrack = new TRecTofTrack[200];
4095 if (fRecEvent_1->getTofTrackCol())
4096 no = (fRecEvent_1->getTofTrackCol())->GetEntries();
4097 //if (no>200) no =200;
4098 tofTrack = new TRecTofTrack[no]; //Long Peixun's update: Remove limit of Tof tracks number
4099 for (int i = 0; i < no; i++){
4100 const TRecTofTrack* tofTrack1 = fRecEvent_1->getTofTrack(i);
4101 tofTrack[i].setTRecTofTrack(tofTrack1); //Long Peixun's update: "(pointer+i)->" -> "pointer[i].", more clear
4102 fRecEvent->addTofTrack(tofTrack + i);
4103 }
4104
4105 //Mdc hits
4106 //Long Peixun's update: Remove "if"
4107 delete [] mdchit;
4108 //mdchit = new TRecMdcHit[1000];
4109 no = 0;
4110 if (fRecEvent_1->getRecMdcHitCol())
4111 no = (fRecEvent_1->getRecMdcHitCol())->GetEntries();
4112 //if (no>1000) no =1000;
4113 mdchit = new TRecMdcHit[no]; //Long Peixun's update: Remove limit of Mdc hits number
4114 for (int i = 0; i < no; i++){
4115 const TRecMdcHit* mdchit1 = fRecEvent_1->getRecMdcHit(i);
4116 mdchit[i].setTRecMdcHit(mdchit1); //Long Peixun's update: "(pointer+i)->" -> "pointer[i].", more clear
4117 fRecEvent->addRecMdcHit(mdchit + i);
4118 }
4119
4120 //Muc Hits
4121 //Long Peixun's update: Remove "if"
4122 delete [] muctrk;
4123 //muctrk = new TRecMucTrack[20];
4124 no = 0;
4125 if (fRecEvent_1->getMucTrackCol())
4126 no = (fRecEvent_1->getMucTrackCol())->GetEntries();
4127 //if (no>20) no=20;
4128 muctrk = new TRecMucTrack[no]; //Long Peixun's update: Remove limit of Muc tracks number
4129 for (int i = 0; i < no; i++){
4130 const TRecMucTrack* mucTrack1 = fRecEvent_1->getMucTrack(i);
4131 muctrk[i].setTRecMucTrack(mucTrack1); //Long Peixun's update: "(pointer+i)->" -> "pointer[i].", more clear
4132 fRecEvent->addMucTrack(muctrk + i);
4133 }
4134
4135 //Emc shower
4136 //Long Peixun's update: Remove "if"
4137 delete [] emcshower;
4138 //emcshower = new TRecEmcShower[20];
4139 no = 0;
4140 if (fRecEvent_1->getEmcShowerCol())
4141 no = (fRecEvent_1->getEmcShowerCol())->GetEntries();
4142 //if (no>20) no=20;
4143 emcshower = new TRecEmcShower[no]; //Long Peixun's update: Remove limit of Emc shower number
4144 for (int i = 0; i < no; i++){
4145 const TRecEmcShower* rec_emc = fRecEvent_1->getEmcShower(i);
4146 emcshower[i].setTRecEmcShower(rec_emc); //Long Peixun's update: "(pointer+i)->" -> "pointer[i].", more clear
4147 fRecEvent->addEmcShower(emcshower + i);
4148 }
4149
4150 //Long Peixun's update: for CGEM clusters
4151 NCluster = 0;
4152 delete[] cgemCluster;
4153 cgemCluster = 0;
4154 if (fDisplay->GetBesGeometry()->GetCgemROOTGeo())
4155 {
4156 if (fRecEvent_1->getRecCgemClusterCol())
4157 NCluster = fRecEvent_1->getRecCgemClusterCol()->GetEntries();
4158 cgemCluster = new TRecCgemCluster[NCluster];
4159 for (int i = 0; i < NCluster; ++i)
4160 {
4161 const TRecCgemCluster* cluster = fRecEvent_1->getRecCgemCluster(i);
4162 if (!cluster) continue;
4163
4164 cout << "Cluster ID: " << cluster->getclusterid();
4165 switch (cluster->getflag())
4166 {
4167 case 0: //X-cluster
4168 cout << "\tTYPE: X-cluster" << endl;
4169 break;
4170 case 1: //V-cluster
4171 cout << "\tTYPE: V-cluster" << endl;
4172 break;
4173 case 2: //XV-cluster
4174 cout << "\tTYPE XV-cluster" << endl;
4175 break;
4176 default: //Error
4177 continue;
4178 }
4179 cout << "\t(Layer, Sheet): " << cluster->getlayerid() << " " << cluster->getsheetid() << endl;
4180 cout << "\tPhi: " << cluster->getrecphi() << endl;
4181 cout << "\tV: " << cluster->getrecv() << endl;
4182
4183 cgemCluster[i].setTRecCgemCluster(cluster);
4184 }
4185 //Long Peixun's update: Set CGEM clusters
4186 fEvent->SetCgemClusters(cgemCluster, NCluster);
4187 }
4188 }
4189 //Long Peixun's update: For dst file, convert dst tracks to rec tracks
4190 else if (fDstEvent)
4191 {
4192 cout << "BesClient Construct DST tracks" << endl;
4193 //Mdc dst tracks
4194 no = 0;
4195 delete [] recTrack1;
4196 if (fDstEvent->getMdcTrackCol())
4197 no = (fDstEvent->getMdcTrackCol())->GetEntries();
4198 recTrack1 = new TRecMdcTrack[no];
4199 for (int i = 0; i < no; i++)
4200 {
4201 cvtMdcDst2MdcRec(recTrack1 + i, fDstEvent->getMdcTrack(i)); //Convert dst tracks to rec tracks
4202 fRecEvent->addRecMdcTrack(recTrack1 + i);
4203 }
4204
4205 //Tof dst tracks
4206 no = 0;
4207 delete [] tofTrack;
4208 if (fDstEvent->getTofTrackCol())
4209 no = (fDstEvent->getTofTrackCol())->GetEntries();
4210 tofTrack = new TRecTofTrack[no];
4211 for (int i = 0; i < no; i++)
4212 {
4213 cvtTofDst2TofRec(tofTrack + i, fDstEvent->getTofTrack(i)); //Convert dst tracks to rec tracks
4214 fRecEvent->addTofTrack(tofTrack + i);
4215 }
4216
4217 //Emc dst tracks
4218 no = 0;
4219 delete [] emcshower;
4220 if (fDstEvent->getEmcTrackCol())
4221 no = (fDstEvent->getEmcTrackCol())->GetEntries();
4222 emcshower = new TRecEmcShower[no];
4223 for (int i = 0; i < no; i++)
4224 {
4225 cvtEmcDst2EmcRec(emcshower + i, fDstEvent->getEmcTrack(i)); //Convert dst tracks to rec tracks
4226 fRecEvent->addEmcShower(emcshower + i);
4227 }
4228
4229 //Muc dst tracks
4230 no = 0;
4231 delete [] muctrk;
4232 if (fDstEvent->getMucTrackCol())
4233 no = (fDstEvent->getMucTrackCol())->GetEntries();
4234 muctrk = new TRecMucTrack[no];
4235 for (int i = 0; i < no; i++)
4236 {
4237 cvtMucDst2MucRec(muctrk + i, fDstEvent->getMucTrack(i)); //Convert dst tracks to rec tracks
4238 fRecEvent->addMucTrack(muctrk + i);
4239 }
4240 }
4241 }
4242
4243 //Long Peixun's update: Reset detector 3D color
4245 //fEvent->SetEvent(fDigiEvent, fRecEvent, fEvtHeader, fTrigEvent);
4246 fEvent->SetEvent(fDigiEvent, fRecEvent, fEvtHeader, fRecEvTime, isRecEvent, fMcEvent);
4247
4248 //delete fRecEvent;
4249 UpdateAllView();
4250 UpdateStatus();
4251 return true;
4252 }
4253 else {
4254 fAutoDisplayEvent = kFALSE;
4255 if (fAutoDisplayEventTimer) {
4256 fAutoDisplayEventTimer->TurnOff();
4257 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventPlay.gif"));
4258 }
4259
4260 ostringstream s;
4261 s << "Request event entry " << i
4262 << " does not exist ! \n valid ("
4263 << 0 << "~" << nEvents - 1 << ")";
4264 this->HandleError(s.str().c_str());
4265 return false;
4266 }
4267 }
4268 else {
4269 fAutoDisplayEvent = kFALSE;
4270 if (fAutoDisplayEventTimer) fAutoDisplayEventTimer->TurnOff();
4271 this->HandleError("Event Tree does not exist !");
4272 return false;
4273 }
4274}
4275
4277 int semid, shmid, n, runNo;
4278 int *shmptr;
4279 int sem_value_F, sem_value_O;
4280
4281 // set autodisplay on
4282 if (fAutoDisplayEvent){
4283 if (fAutoDisplayEventTimer)
4284 fAutoDisplayEventTimer->TurnOn();
4285 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventStop.gif"));
4286 }
4287
4288 // access semaphore
4289 if ((semid = semget(f_pid, 2, 0)) == -1){
4290 perror("concumer -- access -- semget");
4291 exit(0);
4292 }
4293 else {
4294 acquire.sem_num = OUTPUT_STORE;
4295 //*******************************
4296 // Debug information
4297 //*******************************
4298 //std::cout << "acquire.sem_num: " << OUTPUT_STORE << std::endl;
4299 //std::cout << "acquire.sem_num: " << acquire.sem_num << std::endl;
4300 //std::cout << "acquire.sem_op: " << acquire.sem_op << std::endl;
4301 //
4302 //std::cout << "Current Event No. : " << fCurrentEvent << std::endl;
4303 //std::cout << "besvis has gotten semid: " << semid << std::endl;
4304 //std::cout << "before change OUTPUT_STORE" << std::endl;
4305
4306 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
4307 // perror("Can not get FREE_SPACE");
4308 //}
4309 ////if (sem_value_F == 1) return true;
4310 //std::cout << "Semaphore FREE_SPACE has value of(refer 0) " << sem_value_F << std::endl;
4311
4312
4313 //std::cout << "OUTPUT_STORE will decrease from 1 to 0" << std::endl;
4314 //*******************************
4315 // operate semaphore:OUTPUT_STORE
4316 //*******************************
4317 if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
4318 perror("Can not get OUTPUT_STORE");
4319 }
4320 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 1) " << sem_value_O << std::endl;
4321 if (sem_value_O == 0) return true;
4322 if (f_runStatus == RUN_ERROR){
4323 release.sem_num = FREE_SPACE;
4324 if (semop(semid, &release, 1) == -1){
4325 perror("consumer -- increase -- freeSpace");
4326 exit(0);
4327 }
4328 std::cout << "read data error " << std::endl;
4329 f_runStatus = RUN_SMOOTH;
4330 return true;
4331 }
4332 f_runStatus = RUN_ERROR;
4333
4334 if (semop(semid, &acquire, 1) == -1){
4335 perror("consumer -- decrease -- storage");
4336 exit(0);
4337 }
4338
4339 //*******************************
4340 // Debug information
4341 //*******************************
4342 //std::cout << "Current Event No. : " << fCurrentEvent << std::endl;
4343 //std::cout << "besvis has gotten semid: " << semid << std::endl;
4344 //std::cout << "besvis will read data" << std::endl;
4345 //std::cout << "OUTPUT_STORE must decrease from 1 to 0" << std::endl;
4346
4347 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
4348 // perror("Can not get FREE_SPACE");
4349 //}
4350 //std::cout << "Semaphore FREE_SPACE has value of(refer 0) " << sem_value_F << std::endl;
4351 //
4352 //if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
4353 // perror("Can not get OUTPUT_STORE");
4354 //}
4355 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 0) " << sem_value_O << std::endl;
4356 //*******************************
4357 if (fCurrentEvent >= 1){
4358 if (fDigiEvent){
4359 //fDigiEvent->Clear();
4360 delete fDigiEvent;
4361 fDigiEvent=0;
4362 }
4363 if (fEvtHeader){
4364 fEvtHeader->Clear();
4365 delete fEvtHeader;
4366 fEvtHeader=0;
4367 }
4368 //if (fTrigEvent){
4369 // //fTrigEvent->Clear();
4370 // delete fTrigEvent;
4371 // fTrigEvent=0;
4372 //}
4373 if (fEvent){
4374 delete fEvent;
4375 fEvent = NULL;
4376 }
4377 }
4378
4379
4380 //*******************************
4381 // read from share file
4382 //*******************************
4383 OpenEventFile(f_evtFile);
4384 if (fEventFile == NULL){
4385 return true;
4386 }
4387 if (fEventTree)
4388 delete fEventTree;
4389 fEventFile->Close();
4390 delete fEventFile;
4391 //*******************************
4392
4393 release.sem_num = FREE_SPACE;
4394 //*******************************
4395 // Debug information
4396 //*******************************
4397 //std::cout << "release.sem_num: " << FREE_SPACE << std::endl;
4398 //std::cout << "release.sem_num: " << release.sem_num << std::endl;
4399 //std::cout << "release.sem_op: " << release.sem_op << std::endl;
4400 //
4401 //std::cout << "Current Event No. : " << fCurrentEvent << std::endl;
4402 //std::cout << "besvis has gotten semid: " << semid << std::endl;
4403 //std::cout << "besvis has read data" << std::endl;
4404 //std::cout << "before change FREE_SPACE" << std::endl;
4405
4406 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
4407 // perror("Can not get FREE_SPACE");
4408 //}
4409 //std::cout << "Semaphore FREE_SPACE has value of(refer 0) " << sem_value_F << std::endl;
4410 //
4411 //if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
4412 // perror("Can not get OUTPUT_STORE");
4413 //}
4414 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 0) " << sem_value_O << std::endl;
4415 //
4416 //std::cout << "FREE_SPACE will increase from 0 to 1" << std::endl;
4417 //*******************************
4418 // operate semaphore:FREE_SPACE
4419 //*******************************
4420 if (semop(semid, &release, 1) == -1){
4421 perror("consumer -- increase -- freeSpace");
4422 exit(0);
4423 }
4424 std::cout << "Current Event No. : " << fCurrentEvent++ << std::endl;
4425 //*******************************
4426 // Debug information
4427 //*******************************
4428 //std::cout << "besvis has gotten semid: " << semid << std::endl;
4429 //std::cout << "besvis has read data" << std::endl;
4430 //std::cout << "FREE_SPACE must increase from 0 to 1" << std::endl;
4431
4432 //if ((sem_value_F = semctl(semid, FREE_SPACE, GETVAL, 0)) == -1){
4433 // perror("Can not get FREE_SPACE");
4434 //}
4435 //std::cout << "Semaphore FREE_SPACE has value of(refer 1) " << sem_value_F << std::endl;
4436 //
4437 //if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
4438 // perror("Can not get OUTPUT_STORE");
4439 //}
4440 //std::cout << "Semaphore OUTPUT_STORE has value of(refer 0) " << sem_value_O << std::endl;
4441 //*******************************
4442 }
4443 f_runStatus = RUN_SMOOTH;
4444 return true;
4445}
4446//_____________________________________________________
4447
4449{
4450 //Long Peixun's update: Check range before shift
4451 if (!fEventTree) return false;
4452 if (fBesEventNo + 1 >= fEventTree->GetEntries()) return false;
4453
4454 Bool_t status;
4455 fBesEventNo++;
4456 if ( f_bossMode == false) {
4457 status = GetEvent(fBesEventNo);
4458 }
4459 else if ( f_bossMode == true) {
4460 std::cout << "In Boss Mode, execute NextEvent()" << std::endl;
4461 status = GetRecEvent();
4462 }
4463 if (!status) fBesEventNo--;
4464 return status;
4465}
4466
4467//_____________________________________________________
4468
4470{
4471 //Long Peixun's update: Check range before shift
4472 if (!fEventTree) return false;
4473 if (fBesEventNo <= 0) return false;
4474
4475 Bool_t status;
4476 fBesEventNo--;
4477 if ( f_bossMode == false){
4478 status = GetEvent(fBesEventNo);
4479 }
4480 else if ( f_bossMode == true){
4481 // add error box
4482 this->HandleError("Boss Mode can not get previous event!");
4483 }
4484 if (!status) fBesEventNo++;
4485 return status;
4486}
4487
4488//_____________________________________________________
4489
4491{
4492 Bool_t status;
4493 if ( f_bossMode == false){
4494 fBesEventNo = 0;
4495 status = GetEvent(fBesEventNo);
4496 }
4497 else if ( f_bossMode == true){
4498 // add error box
4499 this->HandleError("Boss Mode can not get first event!");
4500 }
4501 return status;
4502}
4503
4504//_____________________________________________________
4505//Long Peixun's update: Get last event
4507{
4508 Bool_t status;
4509 if ( f_bossMode == false){
4510 fBesEventNo = fEventTree->GetEntries() - 1;
4511 status = GetEvent(fBesEventNo);
4512 }
4513 else if ( f_bossMode == true){
4514 // add error box
4515 this->HandleError("Boss Mode can not get last event!");
4516 }
4517 return status;
4518}
4519
4520//_____________________________________________________
4521
4523{
4524 //if (fEventTree) {
4525 fAutoDisplayEvent = !fAutoDisplayEvent;
4526 std::cout << "(AutoDisplayEvent)fAutoDisplayEvent: " << fAutoDisplayEvent << std::endl;
4527 if (fAutoDisplayEventTimer) {
4528 if (fAutoDisplayEvent) {
4529 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventStop.gif"));
4530 fAutoDisplayEventTimer->TurnOn();
4531 }
4532 else {
4533 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventPlay.gif"));
4534 fAutoDisplayEventTimer->TurnOff();
4535 }
4536 }
4537 //}
4538
4539 /*
4540 fAutoDisplayEvent = kTRUE;
4541 if (gDebug) cout << "Into AutoDisplayEvent(), fAutoDisplayEvent = " << fAutoDisplayEvent << " fEventPlaySpeed " << fEventPlaySpeed << endl;
4542
4543 if (fAutoDisplayEventTimer) fAutoDisplayEventTimer->TurnOn();
4544 */
4545}
4546
4547//_____________________________________________________
4548
4554
4555//_____________________________________________________
4556
4558{
4559 fAutoRotate = !fAutoRotate;
4560
4561 if (!fAutoRotate) {
4562 fAutoRotateClockWise = 0;
4563 fAutoRotateTheta = 0;
4564 fAutoRotatePhi = 0;
4565 fAutoRotatePsi = 0;
4566 }
4567
4568 if (fAutoRotateTimer) {
4569 if (fAutoRotate) fAutoRotateTimer->TurnOn();
4570 else fAutoRotateTimer->TurnOff();
4571 }
4572}
4573
4574//_____________________________________________________
4575
4577{
4578 if (fAutoRotateClockWise != 0) {
4579 RotateClockWise(fAutoRotateClockWise);
4580 }
4581
4582 if (fAutoRotateTheta != 0) {
4583 RotateTheta(fAutoRotateTheta);
4584 }
4585
4586 if (fAutoRotatePhi != 0) {
4587 RotatePhi(fAutoRotatePhi);
4588 }
4589
4590 if (fAutoRotatePsi != 0) {
4591 RotatePsi(fAutoRotatePsi);
4592 }
4593
4594 /*
4595 Int_t iret;
4596 if (fDisplay->GetPadXY()->GetView()) {
4597 fDisplay->GetPadXY()->GetView()->SetView(fDisplay->GetPadXY()->GetView()->GetLongitude()+fRotateStep,
4598 fDisplay->GetPadXY()->GetView()->GetLatitude(),
4599 fDisplay->GetPadXY()->GetView()->GetPsi(), iret);
4600 fDisplay->GetPadXY()->Modified();
4601 fDisplay->GetPadXY()->Update();
4602 }
4603 if (fDisplay->GetPadZR()->GetView()) {
4604 fDisplay->GetPadZR()->GetView()->SetView(fDisplay->GetPadZR()->GetView()->GetLongitude()+fRotateStep,
4605 fDisplay->GetPadZR()->GetView()->GetLatitude(),
4606 fDisplay->GetPadZR()->GetView()->GetPsi(), iret);
4607 fDisplay->GetPadZR()->Modified();
4608 fDisplay->GetPadZR()->Update();
4609 }
4610 */
4611
4614}
4615
4616//_____________________________________________________
4617
4618void BesClient::RotateClockWise(int clockwise) // -1 = counterclockwise
4619{
4620 Double_t phi = 0.0;
4621 Int_t iret;
4622 if (fDisplay->GetPadXY()->GetView()) {
4623 phi = fDisplay->GetPadXY()->GetView()->GetLongitude();
4624 phi += clockwise * fRotateStep;
4625 fDisplay->GetPadXY()->GetView()->SetView(phi,
4626 fDisplay->GetPadXY()->GetView()->GetLatitude(),
4627 fDisplay->GetPadXY()->GetView()->GetPsi(), iret);
4628 fDisplay->GetPadXY()->Modified();
4629 fDisplay->GetPadXY()->Update();
4630 }
4631 if (fDisplay->GetPadZR()->GetView()) {
4632 //phi = fDisplay->GetPadZR()->GetView()->GetLongitude();
4633 //phi += clockwise * fRotateStep;
4634 phi += 180.0;
4635 fDisplay->GetPadZR()->GetView()->SetView(phi,
4636 fDisplay->GetPadZR()->GetView()->GetLatitude(),
4637 fDisplay->GetPadZR()->GetView()->GetPsi(), iret);
4638 fDisplay->GetPadZR()->Modified();
4639 fDisplay->GetPadZR()->Update();
4640 }
4641}
4642
4643//_____________________________________________________
4644
4645void BesClient::RotateTheta(int pn) // 1 plus, -1 minus
4646{
4647 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
4648
4649 if (view) {
4650 Double_t theta = view->GetLatitude() + pn*fRotateStep;
4651 Int_t iret;
4652 SetRange(theta, 0.0, 180.0);
4653 view->SetView(view->GetLongitude(), theta, view->GetPsi(), iret);
4654 //gPad->Modified();
4655 //gPad->Update();
4656 }
4657}
4658
4659//_____________________________________________________
4660
4661void BesClient::RotatePhi(int pn) // 1 plus, -1 minus
4662{
4663 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
4664
4665 if (view) {
4666 Double_t phi = view->GetLongitude() + pn*fRotateStep;
4667 Int_t iret;
4668 SetRange(phi, 0.0, 360.0);
4669 view->SetView(phi, view->GetLatitude(), view->GetPsi(), iret);
4670 //gPad->Modified();
4671 //gPad->Update();
4672 }
4673}
4674
4675//_____________________________________________________
4676
4677void BesClient::RotatePsi(int pn) // 1 plus, -1 minus
4678{
4679 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
4680
4681 if (view) {
4682 Double_t psi = view->GetPsi() + pn*fRotateStep;
4683 Int_t iret;
4684 SetRange(psi, 0.0, 360.0);
4685 view->SetView(view->GetLongitude(), view->GetLatitude(), psi, iret);
4686 //gPad->Modified();
4687 //gPad->Update();
4688 }
4689}
4690
4691//__________________________________________________________________
4692
4693void BesClient::HandleEventList(TGListTreeItem *entry, Int_t btn) {
4694 //
4695 // Event list handling for buttons
4696
4697 if ( entry->GetFirstChild() != 0 ) {
4698 // Run folder
4699 if ( entry->IsOpen() ) {
4700 fEventListTree->CloseItem(entry);
4701 } else {
4702 fEventListTree->OpenItem(entry);
4703 }
4704 } else {
4705 fEventListTree->HighlightItem(entry);
4706 gClient->NeedRedraw(fEventListTree);
4707
4708 // Event item
4709 fItem = entry;
4710 fRunItem = entry->GetParent();
4711 TString msg1("Displaying Run ");
4712 HandleStatusBar(msg1.Data());
4713
4714 SetState(); // includes canvas update
4715
4716 TString msg2("Run ");
4717 HandleStatusBar(msg2.Data());
4718 }
4719
4720 // Redraw canvas
4721 TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
4722 canvas->Modified();
4723 canvas->Update();
4724}
4725
4726//__________________________________________________________________
4727
4728void BesClient::ExecuteEvent(Int_t event, Int_t px, Int_t py, TObject *sel) {
4729 //
4730 // Actions in reponse to mouse button events
4731
4732 // Get view from current pad
4733 if ( !gBesGeometry ) {
4734 //cout << "there is not BesGeometry" << endl; // added by tianhl to debug event
4735 return;
4736 }
4737
4738
4739 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
4740 TString viewInfo;
4741 if (view) viewInfo = TString(view->GetObjectInfo(px, py));
4742
4743 switch (event)
4744 {
4745 case kKeyPress:
4746 // px = char code of pressed key
4747 // py = counter
4748 if ( py <= 0 ) py = 1; // Reset counter
4749
4750 //Long Peixun's update: Modify the easy key
4751 switch (Char_t(px))
4752 {
4753 case '.': //Long Peixun modify: Next event: nN -> .>
4754 case '>':
4755 NextEvent();
4756 break;
4757 case ',': //Long Peixun modify: Prev event: pP -> ,<
4758 case '<':
4759 PrevEvent();
4760 break;
4761 case 'm': //Long Peixun add: First event: mM
4762 case 'M':
4763 FirstEvent();
4764 break;
4765 case '/': //Long Peixun add: Last event: /?
4766 case '?':
4767 LastEvent();
4768 break;
4769 case 'g': //Save picture as
4770 case 'G':
4771 SavePicAs();
4772 break;
4773 }
4774
4775 if (!view) break; //Long Peixun's update: check view pointer before execute keys which need view
4776
4777 //Long Peixun's update: Modify the easy key
4778 switch (Char_t(px))
4779 {
4780 case '-': //Long Peixun modify: Zoom out: -_qQ
4781 case '_':
4782 case 'q':
4783 case 'Q':
4784 view->ZoomOut();
4785 fEmbeddedCanvas->GetCanvas()->Update();
4786 break;
4787 case '+': //Long Peixun modify: Zoom in: +=eE
4788 case '=':
4789 case 'e':
4790 case 'E':
4791 view->ZoomIn();
4792 fEmbeddedCanvas->GetCanvas()->Update();
4793 break;
4794 case 'a': //Long Peixun modify: Move left: aD
4795 case 'D':
4796 view->Move(-10,0);
4797 fEmbeddedCanvas->GetCanvas()->Update();
4798 break;
4799 case 'd': //Long Peixun modify: Move right: dA
4800 case 'A':
4801 view->Move(10,0);
4802 fEmbeddedCanvas->GetCanvas()->Update();
4803 break;
4804 case 'w': //Long Peixun modify: Move up: wS
4805 case 'S':
4806 view->Move(0,-10);
4807 fEmbeddedCanvas->GetCanvas()->Update();
4808 break;
4809 case 's': //Long Peixun modify: Move down: sW
4810 case 'W':
4811 view->Move(0,10);
4812 fEmbeddedCanvas->GetCanvas()->Update();
4813 break;
4814 case 'o': //Long Peixun add: Move center: oO
4815 case 'O':
4816 view->Center();
4817 fEmbeddedCanvas->GetCanvas()->Update();
4818 break;
4819 }
4820 break;
4821
4822 default:
4823 if ( sel != 0 ) {
4824 //if ( !gPad->InheritsFrom("BesCanvas") ) {
4825 if ( gPad->GetName() != TString("PadHeader")) {
4826 TString info(sel->GetTitle());
4827 info.Append(": ");
4828 info.Append(sel->GetObjectInfo(px, py));
4829 //info.Append(viewInfo);
4830 HandleInfoBar(info.Data());
4831 }
4832 }
4833 break;
4834 }
4835
4837}
4838
4839 //__________________________________________________________________
4840
4841 void BesClient::SetState(Int_t id) {
4842 //
4843 // set geometry state and update Canvas
4844 if (id == -1) {
4845 TGButton *btn = (TGButton *) gTQSender;
4846 id = btn->WidgetId();
4847 }
4848
4849 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
4850 if ( view ) {
4851 switch (id) {
4852
4853 case kM_Header_Global:
4854 //Long Peixun's update: Add Header control code
4855 fDisplay->SetVisHeader(fChkBtnHeaderGlobal->GetState());
4856 break;
4857
4858 //Long Peixun's update: Add CGEM control code
4859 case kM_Cgem_Global:
4860 view->SetVisCgemGlobal(fChkBtnCgemGlobal->GetState());
4861 break;
4862 case kM_Cgem_Layers:
4863 view->SetVisCgemLayers(fChkBtnCgemLayers->GetState());
4864 break;
4865 case kM_Cgem_XStrips:
4866 view->SetVisCgemXStrips(fChkBtnCgemXStrips->GetState());
4867 break;
4868 case kM_Cgem_VStrips:
4869 view->SetVisCgemVStrips(fChkBtnCgemVStrips->GetState());
4870 break;
4871
4872 case kM_Mdc_Global:
4873 view->SetVisMdcGlobal(fChkBtnMdcGlobal->GetState());
4874 //gBesGeometry->GetMdcROOTGeo()->SetDetectorOn();
4875 //cout << "Mdc Global vis " << endl;
4876 break;
4877
4878 case kM_Mdc_Tubes:
4879 view->SetVisMdcTubes(fChkBtnMdcTubes->GetState());
4880 //HandleViewOptionMenu(kM_Mdc_Tubes);
4881 break;
4882
4883 case kM_Mdc_Wires:
4884 view->SetVisMdcWires(fChkBtnMdcWires->GetState());
4885 //HandleViewOptionMenu(kM_Mdc_Wires);
4886 break;
4887
4888 case kM_Tof_Global:
4889 view->SetVisTofGlobal(fChkBtnTofGlobal->GetState());
4890 //cout << "Tof Global vis " << endl;
4891 break;
4892
4893 case kM_Tof_East:
4894 view->SetVisTofEast(fChkBtnTofEast->GetState());
4895 break;
4896
4897 case kM_Tof_Barrel:
4898 view->SetVisTofBarrel(fChkBtnTofBarrel->GetState());
4899 break;
4900
4901 case kM_Tof_West:
4902 view->SetVisTofWest(fChkBtnTofWest->GetState());
4903 break;
4904
4905 case kM_Emc_Global:
4906 view->SetVisEmcGlobal(fChkBtnEmcGlobal->GetState());
4907 //cout << "Emc Global vis " << endl;
4908 break;
4909
4910 case kM_Emc_East:
4911 view->SetVisEmcEast(fChkBtnEmcEast->GetState());
4912 break;
4913
4914 case kM_Emc_Barrel:
4915 view->SetVisEmcBarrel(fChkBtnEmcBarrel->GetState());
4916 break;
4917
4918 case kM_Emc_West:
4919 view->SetVisEmcWest(fChkBtnEmcWest->GetState());
4920 break;
4921
4922 case kM_Emc_Side:
4923 view->SetVisEmcSide(fChkBtnEmcSide->GetState());
4924 break;
4925
4926 case kM_Muc_Global:
4927 view->SetVisMucGlobal(fChkBtnMucGlobal->GetState());
4928 //cout << "Muc Global vis " << endl;
4929 break;
4930
4931 case kM_Muc_East:
4932 view->SetVisMucEast(fChkBtnMucEast->GetState());
4933 break;
4934
4935 case kM_Muc_Barrel:
4936 view->SetVisMucBarrel(fChkBtnMucBarrel->GetState());
4937 break;
4938
4939 case kM_Muc_West:
4940 view->SetVisMucWest(fChkBtnMucWest->GetState());
4941 break;
4942
4943 case kM_Muc_Strips:
4944 view->SetVisMucStrips(fChkBtnMucStrips->GetState());
4945 break;
4946
4947 case kM_BeamPipe:
4948 view->SetVisBeamPipe(fChkBtnBeamPipe->GetState());
4949 break;
4950
4951 case kM_ZRPlaneOnXY:
4952 view->SetVisZRPlaneOnXY(fChkBtnZRPlaneOnXY->GetState());
4953 break;
4954
4955 case kM_Axis:
4956 view->SetVisAxis(fChkBtnAxis->GetState());
4957 break;
4958
4959 //Long Peixun's update: for CGEM hits
4960 case kM_CgemHits_Global:
4961 view->SetVisCgemHitsGlobal(fChkBtnCgemHitsGlobal->GetState());
4962 break;
4963 case kM_CgemHits_XStrip:
4964 view->SetVisCgemHitsXStrip(fChkBtnCgemHitsXStrip->GetState());
4965 break;
4966 case kM_CgemHits_VStrip:
4967 view->SetVisCgemHitsVStrip(fChkBtnCgemHitsVStrip->GetState());
4968 break;
4970 view->SetVisCgemHitsClusters(fChkBtnCgemHitsClusters->GetState());
4971 break;
4973 view->SetVisCgemHitsFiredHL(fChkBtnCgemHitsFiredHL->GetState());
4974 break;
4975
4976 case kM_MdcHits_Global:
4977 view->SetVisMdcHitsGlobal(fChkBtnMdcHitsGlobal->GetState());
4978 break;
4979
4980 case kM_TofHits_Global:
4981 view->SetVisTofHitsGlobal(fChkBtnTofHitsGlobal->GetState());
4982 break;
4983
4984 case kM_TofHits_East:
4985 view->SetVisTofHitsEast(fChkBtnTofHitsEast->GetState());
4986 break;
4987
4988 case kM_TofHits_Barrel:
4989 view->SetVisTofHitsBarrel(fChkBtnTofHitsBarrel->GetState());
4990 break;
4991
4992 case kM_TofHits_West:
4993 view->SetVisTofHitsWest(fChkBtnTofHitsWest->GetState());
4994 break;
4995
4996 case kM_EmcHits_Global:
4997 view->SetVisEmcHitsGlobal(fChkBtnEmcHitsGlobal->GetState());
4998 break;
4999
5000 case kM_EmcHits_East:
5001 view->SetVisEmcHitsEast(fChkBtnEmcHitsEast->GetState());
5002 break;
5003
5004 case kM_EmcHits_Barrel:
5005 view->SetVisEmcHitsBarrel(fChkBtnEmcHitsBarrel->GetState());
5006 break;
5007
5008 case kM_EmcHits_West:
5009 view->SetVisEmcHitsWest(fChkBtnEmcHitsWest->GetState());
5010 break;
5011
5012 case kM_EmcHits_Side:
5013 view->SetVisEmcHitsSide(fChkBtnEmcHitsSide->GetState());
5014 break;
5015
5016 case kM_MucHits_Global:
5017 view->SetVisMucHitsGlobal(fChkBtnMucHitsGlobal->GetState());
5018 break;
5019
5020 case kM_MucHits_East:
5021 view->SetVisMucHitsEast(fChkBtnMucHitsEast->GetState());
5022 break;
5023
5024 case kM_MucHits_Barrel:
5025 view->SetVisMucHitsBarrel(fChkBtnMucHitsBarrel->GetState());
5026 break;
5027
5028 case kM_MucHits_West:
5029 view->SetVisMucHitsWest(fChkBtnMucHitsWest->GetState());
5030 break;
5031
5032 case kM_Tracks_Global:
5033 view->SetVisTracksGlobal(fChkBtnTracksGlobal->GetState());
5034 break;
5035
5036 case kM_Tracks_Mdc:
5037 view->SetVisTracksMdc(fChkBtnTracksMdc->GetState());
5038 break;
5039
5040 case kM_Tracks_Ideal:
5041 view->SetVisTracksIdeal(fChkBtnTracksIdeal->GetState());
5042 break;
5043
5044 case kM_Tracks_Tof:
5045 view->SetVisTracksTof(fChkBtnTracksTof->GetState());
5046 break;
5047
5048 case kM_Tracks_Emc:
5049 view->SetVisTracksEmc(fChkBtnTracksEmc->GetState());
5050 break;
5051
5052 case kM_Tracks_Muc:
5053 view->SetVisTracksMuc(fChkBtnTracksMuc->GetState());
5054 break;
5055
5056 case kM_Tracks_Ext:
5057 view->SetVisTracksExt(fChkBtnTracksExt->GetState());
5058 break;
5059
5061 this->SetMdcTFire(fChkBtnMdcTMatchGlobal->GetState());
5062 break;
5063
5065 this->SetMdcQFire(fChkBtnMdcQMatchGlobal->GetState());
5066 break;
5067
5068 //case kM_Mdc_TOverflow_Global:
5069 // this->SetMdcTOverflow(fChkBtnMdcTOverflowGlobal->GetState());
5070 // break;
5071
5073 this->SetMdcQNotOverflow(fChkBtnMdcQOverflowGlobal->GetState());
5074 break;
5075
5077 this->SetMdcColorfulWire(fChkBtnMdcColorfulWireGlobal->GetState());
5078 break;
5079
5081 this->SetMdcTimeSubEvTime(fChkBtnMdcTimeSubEvTimeGlobal->GetState());
5082 break;
5083
5085 this->SetTofTMatch(fChkBtnTofTMatchGlobal->GetState());
5086 break;
5087
5089 this->SetTofQMatch(fChkBtnTofQMatchGlobal->GetState());
5090 break;
5091
5092 case kM_MC_TruthTrack:
5093 view->SetVisMCTruthTrack(fChkBtnMCTruthTrack->GetState());
5094 break;
5095
5096 }
5097
5098
5099
5100 view->UpdateView(0);
5101
5102 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Modified();
5103 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Update();
5104 }
5105
5106 UpdateStatus();
5107 }
5108
5109 //_____________________________________________________
5110
5112 //
5113 // get status from active BesView instance
5114 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
5115
5116 if ( view ) {
5117 fZoomRatioNumber->SetNumber(view->GetStatusCurrent()->fZoom*100.0);//yzhang
5118 view->SetZoomRatio(view->GetStatusCurrent()->fZoom);//yzhang
5119
5120 // fish eye tick in zview menu
5121 view->SetFishEye(view->GetFishEyeStatus());
5122
5123 //Long Peixun's update: for CGEM
5124 fChkBtnCgemGlobal->SetOn(view->GetVisCgemGlobal());
5125 fChkBtnCgemLayers->SetOn(view->GetVisCgemLayers());
5126 fChkBtnCgemXStrips->SetOn(view->GetVisCgemXStrips());
5127 fChkBtnCgemVStrips->SetOn(view->GetVisCgemVStrips());
5128
5129 // Mdc global
5130 fChkBtnMdcGlobal->SetOn(view->GetVisMdcGlobal());
5131
5132 // Mdc Tubes
5133 fChkBtnMdcTubes->SetOn(view->GetVisMdcTubes());
5134
5135 // Mdc Wires
5136 fChkBtnMdcWires->SetOn(view->GetVisMdcWires());
5137
5138 // Tof global
5139 fChkBtnTofGlobal->SetOn(view->GetVisTofGlobal());
5140
5141 // Tof east
5142 fChkBtnTofEast->SetOn(view->GetVisTofEast());
5143
5144 // Tof barrel
5145 fChkBtnTofBarrel->SetOn(view->GetVisTofBarrel());
5146
5147 // Tof west
5148 fChkBtnTofWest->SetOn(view->GetVisTofWest());
5149
5150 // Emc global
5151 fChkBtnEmcGlobal->SetOn(view->GetVisEmcGlobal());
5152
5153 // Emc east
5154 fChkBtnEmcEast->SetOn(view->GetVisEmcEast());
5155
5156 // Emc barrel
5157 fChkBtnEmcBarrel->SetOn(view->GetVisEmcBarrel());
5158
5159 // Emc west
5160 fChkBtnEmcWest->SetOn(view->GetVisEmcWest());
5161
5162 // Emc side
5163 fChkBtnEmcSide->SetOn(view->GetVisEmcSide());
5164
5165 // Muc global
5166 fChkBtnMucGlobal->SetOn(view->GetVisMucGlobal());
5167
5168 // Muc east
5169 fChkBtnMucEast->SetOn(view->GetVisMucEast());
5170
5171 // Muc barrel
5172 fChkBtnMucBarrel->SetOn(view->GetVisMucBarrel());
5173
5174 // Muc west
5175 fChkBtnMucWest->SetOn(view->GetVisMucWest());
5176
5177 // Muc strips
5178 fChkBtnMucStrips->SetOn(view->GetVisMucStrips());
5179
5180 // BeamPipe
5181 fChkBtnBeamPipe->SetOn(view->GetVisBeamPipe());
5182
5183 // ZRPlaneOnXY
5184 fChkBtnZRPlaneOnXY->SetOn(view->GetVisZRPlaneOnXY());
5185
5186 // Axis
5187 fChkBtnAxis->SetOn(view->GetVisAxis());
5188
5189 //Long Peixun's update: for Header
5190 fChkBtnHeaderGlobal->SetOn(fDisplay->GetVisHeader());
5191
5192 //Long Peixun's update: for CGEM hits
5193 fChkBtnCgemHitsGlobal->SetOn(view->GetVisCgemHitsGlobal());
5194 fChkBtnCgemHitsXStrip->SetOn(view->GetVisCgemHitsXStrip());
5195 fChkBtnCgemHitsVStrip->SetOn(view->GetVisCgemHitsVStrip());
5196 fChkBtnCgemHitsClusters->SetOn(view->GetVisCgemHitsClusters());
5197 fChkBtnCgemHitsFiredHL->SetOn(view->GetVisCgemHitsFiredHL());
5198
5199 // Mdc Hits global
5200 fChkBtnMdcHitsGlobal->SetOn(view->GetVisMdcHitsGlobal());
5201
5202 // Tof Hits global
5203 fChkBtnTofHitsGlobal->SetOn(view->GetVisTofHitsGlobal());
5204
5205 // Tof Hits east
5206 fChkBtnTofHitsEast->SetOn(view->GetVisTofHitsEast());
5207
5208 // Tof Hits barrel
5209 fChkBtnTofHitsBarrel->SetOn(view->GetVisTofHitsBarrel());
5210
5211 // Tof Hits west
5212 fChkBtnTofHitsWest->SetOn(view->GetVisTofHitsWest());
5213
5214 // Emc Hits global
5215 fChkBtnEmcHitsGlobal->SetOn(view->GetVisEmcHitsGlobal());
5216
5217 // Emc Hits east
5218 fChkBtnEmcHitsEast->SetOn(view->GetVisEmcHitsEast());
5219
5220 // Emc Hits barrel
5221 fChkBtnEmcHitsBarrel->SetOn(view->GetVisEmcHitsBarrel());
5222
5223 // Emc Hits west
5224 fChkBtnEmcHitsWest->SetOn(view->GetVisEmcHitsWest());
5225
5226 // Emc Hits side
5227 fChkBtnEmcHitsSide->SetOn(view->GetVisEmcHitsSide());
5228
5229 // Muc Hits global
5230 fChkBtnMucHitsGlobal->SetOn(view->GetVisMucHitsGlobal());
5231
5232 // Muc Hits east
5233 fChkBtnMucHitsEast->SetOn(view->GetVisMucHitsEast());
5234
5235 // Muc Hits barrel
5236 fChkBtnMucHitsBarrel->SetOn(view->GetVisMucHitsBarrel());
5237
5238 // Muc Hits west
5239 fChkBtnMucHitsWest->SetOn(view->GetVisMucHitsWest());
5240
5241 // Tracks global
5242 fChkBtnTracksGlobal->SetOn(view->GetVisTracksGlobal());
5243
5244 // Tracks mdc
5245 fChkBtnTracksMdc->SetOn(view->GetVisTracksMdc());
5246
5247 // Tracks tof
5248 fChkBtnTracksTof->SetOn(view->GetVisTracksTof());
5249
5250 // Tracks emc
5251 fChkBtnTracksEmc->SetOn(view->GetVisTracksEmc());
5252
5253 // Tracks muc
5254 fChkBtnTracksMuc->SetOn(view->GetVisTracksMuc());
5255
5256 // Tracks ext
5257 fChkBtnTracksExt->SetOn(view->GetVisTracksExt());
5258
5259 // MC global
5260 fChkBtnMCTruthTrack->SetOn(view->GetVisMCTruthTrack());
5261
5262 // ideal track
5263 fChkBtnTracksIdeal->SetOn(view->GetVisTracksIdeal());
5264
5265 //Long Peixun's update: Header
5266 if (fDisplay->GetVisHeader())
5267 fMenuViewOptionHeader->CheckEntry(kM_Header_Global);
5268 else
5269 fMenuViewOptionHeader->UnCheckEntry(kM_Header_Global);
5270
5271 //Long Peixun's update: Cgem Global
5272 if (view->GetVisCgemGlobal())
5273 fMenuViewOptionCgem->CheckEntry(kM_Cgem_Global);
5274 else
5275 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_Global);
5276
5277 //Long Peixun's update: Cgem Layers
5278 if (view->GetVisCgemLayers())
5279 fMenuViewOptionCgem->CheckEntry(kM_Cgem_Layers);
5280 else
5281 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_Layers);
5282
5283 //Long Peixun's update: Cgem X-strips
5284 if (view->GetVisCgemXStrips())
5285 fMenuViewOptionCgem->CheckEntry(kM_Cgem_XStrips);
5286 else
5287 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_XStrips);
5288
5289 //Long Peixun's update: Cgem V-strips
5290 if (view->GetVisCgemVStrips())
5291 fMenuViewOptionCgem->CheckEntry(kM_Cgem_VStrips);
5292 else
5293 fMenuViewOptionCgem->UnCheckEntry(kM_Cgem_VStrips);
5294
5295 // Mdc Global
5296 if ( view->GetVisMdcGlobal() )
5297 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Global);
5298 else
5299 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Global);
5300
5301 // Mdc Tubes
5302 if ( view->GetVisMdcTubes() )
5303 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Tubes);
5304 else
5305 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Tubes);
5306
5307 // Mdc Wires
5308 if ( view->GetVisMdcWires() )
5309 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Wires);
5310 else
5311 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Wires);
5312
5313 // Tof Global
5314 if ( view->GetVisTofGlobal() )
5315 fMenuViewOptionTof->CheckEntry(kM_Tof_Global);
5316 else
5317 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Global);
5318
5319 // Tof East
5320 if ( view->GetVisTofEast() )
5321 fMenuViewOptionTof->CheckEntry(kM_Tof_East);
5322 else
5323 fMenuViewOptionTof->UnCheckEntry(kM_Tof_East);
5324
5325 // Tof Barrel
5326 if ( view->GetVisTofBarrel() )
5327 fMenuViewOptionTof->CheckEntry(kM_Tof_Barrel);
5328 else
5329 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Barrel);
5330
5331 // Tof West
5332 if ( view->GetVisTofWest() )
5333 fMenuViewOptionTof->CheckEntry(kM_Tof_West);
5334 else
5335 fMenuViewOptionTof->UnCheckEntry(kM_Tof_West);
5336
5337 // Emc Global
5338 if ( view->GetVisEmcGlobal() )
5339 fMenuViewOptionEmc->CheckEntry(kM_Emc_Global);
5340 else
5341 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Global);
5342
5343 // Emc East
5344 if ( view->GetVisEmcEast() )
5345 fMenuViewOptionEmc->CheckEntry(kM_Emc_East);
5346 else
5347 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_East);
5348
5349 // Emc Barrel
5350 if ( view->GetVisEmcBarrel() )
5351 fMenuViewOptionEmc->CheckEntry(kM_Emc_Barrel);
5352 else
5353 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Barrel);
5354
5355 // Emc West
5356 if ( view->GetVisEmcWest() )
5357 fMenuViewOptionEmc->CheckEntry(kM_Emc_West);
5358 else
5359 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_West);
5360
5361 // Emc Side
5362 if ( view->GetVisEmcSide() )
5363 fMenuViewOptionEmc->CheckEntry(kM_Emc_Side);
5364 else
5365 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Side);
5366
5367 // Muc Global
5368 if ( view->GetVisMucGlobal() )
5369 fMenuViewOptionMuc->CheckEntry(kM_Muc_Global);
5370 else
5371 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Global);
5372
5373 // Muc East
5374 if ( view->GetVisMucEast() )
5375 fMenuViewOptionMuc->CheckEntry(kM_Muc_East);
5376 else
5377 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_East);
5378
5379 // Muc Barrel
5380 if ( view->GetVisMucBarrel() )
5381 fMenuViewOptionMuc->CheckEntry(kM_Muc_Barrel);
5382 else
5383 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Barrel);
5384
5385 // Muc West
5386 if ( view->GetVisMucWest() )
5387 fMenuViewOptionMuc->CheckEntry(kM_Muc_West);
5388 else
5389 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_West);
5390
5391 // Muc Strips
5392 if ( view->GetVisMucStrips() )
5393 fMenuViewOptionMuc->CheckEntry(kM_Muc_Strips);
5394 else
5395 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Strips);
5396
5397 // Full3D Mdc
5398 if ( view->GetVisFull3DMdc() )
5399 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Mdc);
5400 else
5401 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Mdc);
5402
5403 // Full3D Tof
5404 if ( view->GetVisFull3DTof() )
5405 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Tof);
5406 else
5407 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Tof);
5408
5409 // Full3D Emc
5410 if ( view->GetVisFull3DEmc() )
5411 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Emc);
5412 else
5413 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Emc);
5414
5415 // Full3D Muc
5416 if ( view->GetVisFull3DMuc() )
5417 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Muc);
5418 else
5419 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Muc);
5420
5421 // BeamPipe
5422 if ( view->GetVisBeamPipe() )
5423 fMenuViewOptionOthers->CheckEntry(kM_BeamPipe);
5424 else
5425 fMenuViewOptionOthers->UnCheckEntry(kM_BeamPipe);
5426
5427 // ZRPlaneOnXY
5428 if ( view->GetVisZRPlaneOnXY() )
5429 fMenuViewOptionOthers->CheckEntry(kM_ZRPlaneOnXY);
5430 else
5431 fMenuViewOptionOthers->UnCheckEntry(kM_ZRPlaneOnXY);
5432
5433 // Axis
5434 if ( view->GetVisAxis() ) {
5435 fMenuViewOptionOthers->CheckEntry(kM_Axis);
5436 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxisST.gif"));
5437 fShowAxisButton->SetState(true);
5438 }
5439 else {
5440 fMenuViewOptionOthers->UnCheckEntry(kM_Axis);
5441 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxis.gif"));
5442 fShowAxisButton->SetState(false);
5443 }
5444
5445 //Long Peixun's update: for CGEM hits
5446 // CGEM hits Global
5447 if ( view->GetVisCgemHitsGlobal() )
5448 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_Global);
5449 else
5450 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_Global);
5451 // CGEM hits X-strip
5452 if ( view->GetVisCgemHitsXStrip() )
5453 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_XStrip);
5454 else
5455 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_XStrip);
5456 // CGEM hits V-strip
5457 if ( view->GetVisCgemHitsVStrip() )
5458 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_VStrip);
5459 else
5460 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_VStrip);
5461 // CGEM hits Clusters
5462 if ( view->GetVisCgemHitsClusters() )
5463 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_Clusters);
5464 else
5465 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_Clusters);
5466 // CGEM Highlight fired strips
5467 if ( view->GetVisCgemHitsFiredHL() )
5468 fMenuViewOptionCgemHits->CheckEntry(kM_CgemHits_FiredHL);
5469 else
5470 fMenuViewOptionCgemHits->UnCheckEntry(kM_CgemHits_FiredHL);
5471
5472 // Mdc Hits
5473 if ( view->GetVisMdcHits() )
5474 fMenuViewOptionMdcHits->CheckEntry(kM_MdcHits_Hits);
5475 else
5476 fMenuViewOptionMdcHits->UnCheckEntry(kM_MdcHits_Hits);
5477
5478 // Tof hits Global
5479 if ( view->GetVisTofHitsGlobal() )
5480 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Global);
5481 else
5482 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Global);
5483
5484 // Tof hits East
5485 if ( view->GetVisTofHitsEast() )
5486 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_East);
5487 else
5488 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_East);
5489
5490 // Tof hits Barrel
5491 if ( view->GetVisTofHitsBarrel() )
5492 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Barrel);
5493 else
5494 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Barrel);
5495
5496 // Tof hits West
5497 if ( view->GetVisTofHitsWest() )
5498 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_West);
5499 else
5500 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_West);
5501
5502 // Emc hits Global
5503 if ( view->GetVisEmcHitsGlobal() )
5504 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Global);
5505 else
5506 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Global);
5507
5508 // Emc hits East
5509 if ( view->GetVisEmcHitsEast() )
5510 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_East);
5511 else
5512 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_East);
5513
5514 // Emc hits Barrel
5515 if ( view->GetVisEmcHitsBarrel() )
5516 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Barrel);
5517 else
5518 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Barrel);
5519
5520 // Emc hits West
5521 if ( view->GetVisEmcHitsWest() )
5522 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_West);
5523 else
5524 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_West);
5525
5526 // Emc hits Side
5527 if ( view->GetVisEmcHitsSide() )
5528 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Side);
5529 else
5530 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Side);
5531
5532 // Muc hits Global
5533 if ( view->GetVisMucHitsGlobal() )
5534 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Global);
5535 else
5536 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Global);
5537
5538 // Muc hits East
5539 if ( view->GetVisMucHitsEast() )
5540 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_East);
5541 else
5542 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_East);
5543
5544 // Muc hits Barrel
5545 if ( view->GetVisMucHitsBarrel() )
5546 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Barrel);
5547 else
5548 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Barrel);
5549
5550 // Muc hits West
5551 if ( view->GetVisMucHitsWest() )
5552 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_West);
5553 else
5554 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_West);
5555
5556 // Tracks Global
5557 if ( view->GetVisTracksGlobal() )
5558 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Global);
5559 else
5560 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Global);
5561
5562 // Tracks Mdc
5563 if ( view->GetVisTracksMdc() )
5564 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Mdc);
5565 else
5566 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Mdc);
5567
5568 // Tracks Tof
5569 if ( view->GetVisTracksTof() )
5570 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Tof);
5571 else
5572 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Tof);
5573
5574 // Tracks Emc
5575 if ( view->GetVisTracksEmc() )
5576 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Emc);
5577 else
5578 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Emc);
5579
5580 // Tracks Muc
5581 if ( view->GetVisTracksMuc() )
5582 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Muc);
5583 else
5584 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Muc);
5585
5586 // Tracks Ext
5587 if ( view->GetVisTracksExt() )
5588 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Ext);
5589 else
5590 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Ext);
5591
5592 if ( view->GetVisMCTruthTrack() )
5593 fMenuViewOptionMC->CheckEntry(kM_MC_TruthTrack);
5594 else
5595 fMenuViewOptionMC->UnCheckEntry(kM_MC_TruthTrack);
5596
5597 // Fish Eye View
5598 if ( view->GetFishEye() ) {
5599 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeViewST.gif"));
5600 }
5601 else {
5602 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeView.gif"));
5603 }
5604
5605 // Parallel or Perspective View
5606 if ( view->IsPerspective() ) {
5607 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelView.gif"));
5608 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveViewST.gif"));
5609 }
5610 else {
5611 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelViewST.gif"));
5612 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveView.gif"));
5613 }
5614 }
5616}
5617
5618//__________________________________________________________________
5619
5621 //
5622 // Handle different buttons
5623 if (id == -1) {
5624 TGButton *btn = (TGButton *) gTQSender;
5625 id = btn->WidgetId();
5626 }
5627
5628 //TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
5629 TString query = "";
5630 Int_t displayMode = 0;
5631
5632 Double_t xmin=0.0, ymin=0.0, xmax=0.0, ymax=0.0;
5633 if (gPad) {
5634 xmin = gPad->GetX1();
5635 ymin = gPad->GetY1();
5636 xmax = gPad->GetX2();
5637 ymax = gPad->GetY2();
5638 }
5639
5640 BesView *view = 0;
5641 if (gPad) view = dynamic_cast<BesView*>(gPad->GetView());
5642 Int_t iret;
5643 //Double_t theta, phi, psi;
5644
5645 switch ( id ) {
5646
5647 case kM_Button_LoadGeoFile: // Load geometry file
5648 LoadGeoFile();
5649 fLoadGeoFileButton->SetPicture(gClient->GetPicture("ButtonLoadGeoFile.gif"));
5650 break;
5651
5652 case kM_Button_OpenEventFile: // Load event file
5653 OpenEventFile();
5654 fOpenEventFileButton->SetPicture(gClient->GetPicture("ButtonOpenEventFile.gif"));
5655 break;
5656
5657 case kM_Button_SavePicAs: // Save picture as
5658 SavePicAs();
5659 fSavePicAsButton->SetPicture(gClient->GetPicture("ButtonSavePicAs.gif"));
5660 break;
5661
5662 case kM_Button_SavePicAsPS: // Save picture as *.ps
5663 fSavePicAsPSButton->SetPicture(gClient->GetPicture("ButtonSavePicAsPSHL.gif"));
5664 //SavePicAsPS();
5665 fEmbeddedCanvas->GetCanvas()->Print("besvis.ps", "ps");
5666 fSavePicAsPSButton->SetPicture(gClient->GetPicture("ButtonSavePicAsPS.gif"));
5667 break;
5668
5669 case kM_Button_Refresh: // Refresh all pads
5670 //fDisplay->SwitchDisplayMode(fDisplay->GetDisplayMode());
5671 if (view) fDisplay->Refresh(); //Long Peixun's update: Refresh all view
5672 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5673 //if (view) view->UpdateView(0);
5674 break;
5675
5676 case kM_Button_ResetCurrent: // reset active pad to default
5677 if (view) view->Reset();
5678 break;
5679
5680 case kM_Button_ResetAll: // Reset all pads to Default
5681 if (view) fDisplay->Reset();
5682 break;
5683
5684 case kM_Button_CursorPick: // Cursor Pick
5686 fCursorButton[0]->SetPicture(gClient->GetPicture("ButtonCursorPickST.gif"));
5687 fCursorButton[0]->SetState(true);
5688 fCursorButton[1]->SetPicture(gClient->GetPicture("ButtonCursorHand.gif"));
5689 fCursorButton[1]->SetState(false);
5690 //fCursorButton[0]->SetState(kButtonEngaged);
5691 //fCursorButton[1]->SetState(kButtonUp);
5692 break;
5693
5694 case kM_Button_CursorHand: // Cursor Hand
5696 fCursorButton[0]->SetPicture(gClient->GetPicture("ButtonCursorPick.gif"));
5697 fCursorButton[0]->SetState(false);
5698 fCursorButton[1]->SetPicture(gClient->GetPicture("ButtonCursorHandST.gif"));
5699 fCursorButton[1]->SetState(true);
5700 break;
5701
5702 case kM_Button_ZoomOut: // Zoom out
5703 if (view) view->ZoomOut();
5704 break;
5705
5706 case kM_Button_ZoomIn: // Zoom in
5707 if (view) view->ZoomIn();
5708 break;
5709
5710 case kM_Button_SetHome: // Set Home position
5711 SetHome();
5712 break;
5713
5714 case kM_Button_GoHome: // Go Home position
5715 GoHome();
5716 break;
5717
5719 SaveMyConfig();
5720 fSaveMyConfigButton->SetPicture(gClient->GetPicture("ButtonSaveMyConfig.gif"));
5721 break;
5722
5724 LoadMyConfig();
5725 fLoadMyConfigButton->SetPicture(gClient->GetPicture("ButtonLoadMyConfig.gif"));
5726 break;
5727
5728 case kM_Button_Palette:
5730 fPaletteButton->SetPicture(gClient->GetPicture("ButtonPalette.gif"));
5731 break;
5732
5733 case kM_Button_Help:
5734 Help();
5735 break;
5736
5737 case kM_Button_ShowInfo: // Show Info
5739 if (gBesCursor->GetShowInfo()) {
5740 fShowInfoButton->SetState(true);
5741 fShowInfoButton->SetPicture(gClient->GetPicture("ButtonShowInfoST.gif"));
5742 }
5743 else {
5744 fShowInfoButton->SetState(false);
5745 fShowInfoButton->SetPicture(gClient->GetPicture("ButtonShowInfo.gif"));
5746 }
5747 break;
5748
5749 case kM_Button_ShowAxis: // Show Axis
5750 if (view) {
5751 view->SetVisAxis(!view->GetVisAxis());
5752 if (view->GetVisAxis()) {
5753 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxisST.gif"));
5754 fShowAxisButton->SetState(true);
5755 }
5756 else {
5757 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxis.gif"));
5758 fShowAxisButton->SetState(false);
5759 }
5760 view->UpdateView(0);
5761 }
5762 break;
5763
5764 case kM_Button_FishEyeView: // FishEye View
5765 if (view) {
5766 view->SetFishEye(!view->GetFishEye());
5767 if (view->GetFishEye()) {
5768 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeViewST.gif"));
5769 fFishEyeViewButton->SetState(true);
5770 }
5771 else {
5772 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeView.gif"));
5773 fFishEyeViewButton->SetState(false);
5774 }
5775 }
5776 break;
5777
5778 case kM_Button_ParallelView: // Parallel View
5779 if (view && view->IsPerspective()) {
5780 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelViewST.gif"));
5781 fParallelViewButton->SetState(true);
5782 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveView.gif"));
5783 fPerspectiveViewButton->SetState(false);
5784 //view->SetParralel();
5785 view->SetParallel();
5786 // use SetParallel() instead of depreciated function SetParralel()
5787 // changed by tianhl at Mon Aug 20 2007
5788 view->UpdateView(0);
5789 }
5790 break;
5791
5792 case kM_Button_PerspectiveView: // Perspective View
5793 if (view && !view->IsPerspective()) {
5794 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelView.gif"));
5795 fParallelViewButton->SetState(false);
5796 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveViewST.gif"));
5797 fPerspectiveViewButton->SetState(true);
5798 view->SetPerspective();
5799 view->UpdateView(0);
5800 }
5801 break;
5802
5803 case kM_Button_X3D: // X3D
5804 X3D();
5805 fX3DButton->SetPicture(gClient->GetPicture("ButtonX3D.gif"));
5806 break;
5807
5808 case kM_Button_OpenGL: // OpenGL
5809 OpenGL();
5810 fOpenGLButton->SetPicture(gClient->GetPicture("ButtonOpenGL.gif"));
5811 break;
5812
5814 NextEvent();
5815 break;
5816
5818 PrevEvent();
5819 break;
5820
5823 break;
5824
5826 FirstEvent();
5827 break;
5828
5830 if (view)
5831 { //Long Peixun's update: Consider view == NULL
5832 if (view->GetViewType() == k3DView) view->Front();
5833 if (view->GetViewType() == kXYView) view->SetView( 0, 0, 270, iret);
5834 if (view->GetViewType() == kZRView) view->SetView(180, 90, 90, iret);
5835 }
5836 break;
5837
5839 RotateClockWise(-1);
5840 if (fAutoRotate) {
5841 if (fAutoRotateClockWise != -1) {
5842 fAutoRotateClockWise = -1;
5843 fAutoRotatePhi = 0;
5844 }
5845 else fAutoRotateClockWise = 0;
5846 }
5847 break;
5848
5850 RotateClockWise(1);
5851 if (fAutoRotate) {
5852 if (fAutoRotateClockWise != 1) {
5853 fAutoRotateClockWise = 1;
5854 fAutoRotatePhi = 0;
5855 }
5856 else fAutoRotateClockWise = 0;
5857 }
5858 break;
5859
5861 //Long Peixun's update: Consider view == NULL
5862 if (view) view->Move(0,-10); //Long Peixun's update: Fix up and down direction
5863 //if (gPad) gPad->Range(xmin, ymin+fMoveFactor*(ymax-ymin), xmax, ymax+fMoveFactor*(ymax-ymin));
5864 break;
5865
5867 //Long Peixun's update: Consider view == NULL
5868 if (view) view->Move(0,10); //Long Peixun's update: Fix up and down direction
5869 break;
5870
5872 if (view) view->Move(-10,0);
5873 break;
5874
5876 if (view) view->Move(10,0);
5877 break;
5878
5880 if (view) view->Center();
5881 break;
5882
5884 RotateTheta(1);
5885 if (fAutoRotate) {
5886 if (fAutoRotateTheta != 1) fAutoRotateTheta = 1;
5887 else fAutoRotateTheta = 0;
5888 }
5889 break;
5890
5892 RotateTheta(-1);
5893 if (fAutoRotate) {
5894 if (fAutoRotateTheta != -1) fAutoRotateTheta = -1;
5895 else fAutoRotateTheta = 0;
5896 }
5897 break;
5898
5900 RotatePhi(1);
5901 if (fAutoRotate) {
5902 if (fAutoRotatePhi != 1) {
5903 fAutoRotatePhi = 1;
5904 fAutoRotateClockWise = 0;
5905 }
5906 else fAutoRotatePhi = 0;
5907 }
5908 break;
5909
5911 RotatePhi(-1);
5912 if (fAutoRotate) {
5913 if (fAutoRotatePhi != -1) {
5914 fAutoRotatePhi = -1;
5915 fAutoRotateClockWise = 0;
5916 }
5917 else fAutoRotatePhi = 0;
5918 }
5919 break;
5920
5922 if (view && view->GetViewType() == k3DView) //Long Peixun's update: Consider view == NULL
5923 {
5924 RotatePsi(1);
5925 if (fAutoRotate) {
5926 if (fAutoRotatePsi != 1) fAutoRotatePsi = 1;
5927 else fAutoRotatePsi = 0;
5928 }
5929 }
5930 break;
5931
5933 if (view && view->GetViewType() == k3DView) //Long Peixun's update: Consider view == NULL
5934 {
5935 RotatePsi(-1);
5936 if (fAutoRotate) {
5937 if (fAutoRotatePsi != -1) fAutoRotatePsi = -1;
5938 else fAutoRotatePsi = 0;
5939 }
5940 }
5941 break;
5942
5944 AutoRotate();
5945 break;
5946
5949 fDisplayModeButton[0]->SetState(true);
5950 fDisplayModeButton[0]->SetPicture(gClient->GetPicture("DisplayMode2DST.gif"));
5951 fDisplay->SwitchDisplayMode(0);
5952 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5953 break;
5954
5957 fDisplayModeButton[1]->SetState(true);
5958 fDisplayModeButton[1]->SetPicture(gClient->GetPicture("DisplayModeXYST.gif"));
5959 fDisplay->SwitchDisplayMode(1);
5960 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5961 break;
5962
5965 fDisplayModeButton[2]->SetState(true);
5966 fDisplayModeButton[2]->SetPicture(gClient->GetPicture("DisplayModeZRST.gif"));
5967 fDisplay->SwitchDisplayMode(2);
5968 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5969 break;
5970
5973 fDisplayModeButton[3]->SetState(true);
5974 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
5975 fDisplay->SwitchDisplayMode(3);
5976 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5977 break;
5978
5981 fDisplayModeButton[4]->SetState(true);
5982 fDisplayModeButton[4]->SetPicture(gClient->GetPicture("DisplayModeAllST.gif"));
5983 fDisplay->SwitchDisplayMode(4);
5984 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5985 break;
5986
5987 //Long Peixun's update: for Cgem unfolded view
5990 fDisplayModeButton[5]->SetState(true);
5991 fDisplayModeButton[5]->SetPicture(gClient->GetPicture("DisplayModeCgemUFST.gif"));
5992 fDisplay->SwitchDisplayMode(5); //Cgem UF view: 5
5993 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
5994 break;
5995
5996 //Long Peixun's update: for Cgem unfolded all view
5999 fDisplayModeButton[6]->SetState(true);
6000 fDisplayModeButton[6]->SetPicture(gClient->GetPicture("DisplayModeCgemUFAllST.gif"));
6001 fDisplay->SwitchDisplayMode(6); //Cgem UF all view: 6
6002 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
6003 break;
6004
6006 displayMode = fDisplay->GetDisplayMode();
6007 displayMode++;
6008 if (displayMode >= kNDisplayMode) displayMode = 0; //Long Peixun's update: Adjust display mode
6009 fDisplay->SwitchDisplayMode(displayMode);
6010 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
6011
6013 switch (displayMode)
6014 {
6015 case 0 :
6016 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayMode2DST.gif"));
6017 break;
6018 case 1 :
6019 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeXYST.gif"));
6020 break;
6021 case 2 :
6022 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeZRST.gif"));
6023 break;
6024 case 3 :
6025 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
6026 break;
6027 case 4 :
6028 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeAllST.gif"));
6029 break;
6030 case 5:
6031 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeCgemUFST.gif"));
6032 break;
6033 case 6:
6034 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeCgemUFAllST.gif"));
6035 break;
6036 default:
6037 break;
6038 }
6039 break;
6040
6042 fDisplay->SwitchPad();
6043 HandleStatusBar(GetCurrentPadString()); //Long Peixun's update: Update status bar
6044 break;
6045 }
6046
6047 UpdateStatus();
6050}
6051
6052 //__________________________________________________________________
6053
6054 void BesClient::HandleSliders(Int_t slider)
6055 {
6056 //
6057 // Handle slider events
6058 if (gDebug) cout << "BesClient::DoSlider called!" << endl;
6059
6060 TGButton *btn = (TGButton *) gTQSender;
6061 Int_t id = btn->WidgetId();
6062
6063 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
6064 Int_t iret;
6065
6066 switch (id) {
6067
6069 fEventPlaySlider->SetPosition(slider);
6070 if (fEventTree) {
6071 fBesEventNo = slider;
6072 this->GetEvent(fBesEventNo);
6073 }
6074 break;
6075
6077 if (view) {
6078 view->SetView(view->GetLongitude(), slider, view->GetPsi(), iret);
6079 }
6080 break;
6081
6083 if (view) {
6084 view->SetView(slider, view->GetLatitude(), view->GetPsi(), iret);
6085 }
6086 break;
6087
6089 if (view && view->GetViewType() == k3DView) {
6090 view->SetView(view->GetLongitude(), view->GetLatitude(), slider, iret);
6091 }
6092 break;
6093 }
6094
6097 }
6098
6099 //_________________________________________________________________
6100
6102 {
6103 TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
6104 TPad *curPad = (TPad*)gPad;//canvas->GetSelectedPad();
6105
6106 fDisplay->GetPadXY()->cd();
6107 BesView *view = dynamic_cast<BesView*>(fDisplay->GetPadXY()->GetView());
6108 if (view) {
6109 view->UpdateView(0);
6110 cout << "update xy view" << endl;
6111 }
6112 else cout << "no xy view" << endl;
6113
6114 fDisplay->GetPadZR()->cd();
6115 view = dynamic_cast<BesView*>(fDisplay->GetPadZR()->GetView());
6116 if (view) {
6117 view->UpdateView(0);
6118 cout << "update zr view" << endl;
6119 }
6120 else cout << "no zr view" << endl;
6121
6122 fDisplay->GetPad3D()->cd();
6123 view = dynamic_cast<BesView*>(fDisplay->GetPad3D()->GetView());
6124 if (view) {
6125 view->UpdateView(0);
6126 cout << "update 3d view" << endl;
6127 }
6128 else cout << "no 3d view" << endl;
6129
6130 //Long Peixun's update: Update CGEM unfolded view
6131 for (int i = 0; i < 3; ++i)
6132 {
6133 fDisplay->GetPadCgemUF(i)->cd();
6134 view = dynamic_cast<BesView*>(fDisplay->GetPadCgemUF(i)->GetView());
6135 if (view) {
6136 view->UpdateView(0);
6137 cout << "update CGEM unfolded view, Layer" << i << endl;
6138 }
6139 else cout << "no CGEM unfolded Layer" << i << endl;
6140 }
6141
6142 // Header show be drawn last, as it will update all pads and makes tracks in pad drawn first
6143 fDisplay->DrawHeader();
6144 fDisplay->Refresh(); //Long Peixun's update: Refresh all views
6145
6146 curPad->cd();
6147
6149
6150 // Redraw canvas
6151 canvas->Modified();
6152 canvas->Update();
6153 }
6154
6155 //_________________________________________________________________
6156
6158 {
6159 if (gPad) {
6160 gPad->Modified();
6161 gPad->Update();
6162 }
6163
6164 //BesView *view = dynamic_cast<BesView*>(gPad->GetView());
6165
6166 //TViewerX3D *x3d = 0;
6167 //x3d = (TViewerX3D*)gPad->GetViewer3D();
6168 //if (fViewer3DMode == 1 && view && x3d) {
6169 // x3d->ExecCommand(Int_t(2*view->GetLatitude()), Int_t(2*view->GetLongitude()), 0); //rotate
6170 //}
6171
6172 ////TViewerOpenGL *ogl = 0;
6173 ////ogl = (TViewerOpenGL*)gPad->GetViewer3D();
6174 //// update from 4.04 to 5.14
6175 //TVirtualViewer3D *ogl = 0;
6176 //ogl = (TVirtualViewer3D*)gPad->GetViewer3D("ogl");
6177 //if (fViewer3DMode == 2 && view && ogl) {
6178 // gVirtualGL->ClearGLColor(0.0,0.0,0.0,0.0); // set GL background color
6179 // gVirtualGL->SetGLLineWidth(5);
6180
6181 // Double_t deltaTheta = view->GetLatitude() - fViewThetaPreStep;
6182 // Double_t deltaPhi = view->GetLongitude() - fViewPhiPreStep;
6183 // if (deltaTheta > 90.0) deltaTheta -= 180.0;
6184 // if (deltaTheta < -90.0) deltaTheta += 180.0;
6185 // if (deltaPhi > 180.0) deltaPhi -= 360.0;
6186 // if (deltaPhi < -180.0) deltaPhi += 360.0;
6187
6188 // // update from 4.04 to 5.14, TViewerOpenGL has been removed,
6189 // // TVirtualViewer3D has none those memthods
6190 // //UInt_t width = ogl->GetWidth();
6191 // //UInt_t height = ogl->GetHeight();
6192 // //UInt_t xPos = width/2, yPos = height/2;
6193
6194 // //Event_t *event1 = new Event_t;
6195 // //event1->fType = kButtonPress;
6196 // //event1->fX = xPos; //(Int_t)view->GetLatitude();
6197 // //event1->fY = yPos; //(Int_t)view->GetLongitude();
6198 // //event1->fCode = kButton1;
6199 // //ogl->HandleContainerButton(event1);
6200
6201
6202 // //Event_t *event2 = new Event_t;
6203 // //event2->fType = kMotionNotify;
6204 // //event2->fX = (Int_t)(xPos + deltaTheta);
6205 // //event2->fY = (Int_t)(yPos + deltaPhi);
6206 // //ogl->HandleContainerMotion(event2);
6207
6208 // //Event_t *event3 = new Event_t;
6209 // //event3->fType = kButtonRelease;
6210 // //event3->fX = (Int_t)(xPos + deltaTheta); //(view->GetLatitude() + deltaPhi);
6211 // //event3->fY = (Int_t)(yPos + deltaPhi); //(view->GetLongitude() + deltaTheta);
6212 // //event3->fCode = kButton1;
6213 // //ogl->HandleContainerButton(event3);
6214
6215 // //fViewThetaPreStep = view->GetLatitude();
6216 // //fViewPhiPreStep = view->GetLongitude();
6217
6218 // //delete event1;
6219 // //delete event2;
6220 // //delete event3;
6221 //}
6222 }
6223
6224 //_________________________________________________________________
6225
6227 {
6228 fNumEntryRunNo->SetNumber(GetBesRunNo());
6229 fNumEntryEventNo->SetIntNumber(GetBesEventNo());
6230 fNumEntryEventPlaySpeed->SetNumber(Double_t(GetEventPlaySpeed()) / 1000.0);
6231 fEventPlaySlider->SetPosition(GetBesEventNo());
6232
6233 fNumEntryRotateStep->SetNumber(GetRotateStep());
6234 fNumEntryRotateSpeed->SetNumber(GetRotateSpeed());
6235 fNumEntryRotateFPS->SetIntNumber(GetRotateFPS());
6236
6237 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
6238 if (view) {
6239 fZoomRatioNumber->SetNumber(view->GetZoomRatio()*100.0);
6240
6241 Double_t theta = view->GetLatitude();
6242 Double_t phi = view->GetLongitude();
6243 Double_t psi = view->GetPsi();
6244 SetRange(theta, 0.0, 180.0);
6245 SetRange(phi, 0.0, 360.0);
6246 SetRange(psi, 0.0, 360.0);
6247 fViewAngleThetaNumber->SetNumber(theta);
6248 fViewAnglePhiNumber->SetNumber(phi);
6249 fViewAnglePsiNumber->SetNumber(psi);
6250 }
6251 fViewAngleThetaSlider->SetPosition((Int_t)fViewAngleThetaNumber->GetNumber());
6252 fViewAnglePhiSlider->SetPosition((Int_t)fViewAnglePhiNumber->GetNumber());
6253 fViewAnglePsiSlider->SetPosition((Int_t)fViewAnglePsiNumber->GetNumber());
6254
6255 fChkBtnAutoRotate->SetOn(fAutoRotate);
6256 }
6257
6258 //_____________________________________________________
6259
6261 //
6262 // change focus on pressed tab
6263 if (gDebug) cout << "BesClient::ChangeFocus called!" << endl;
6264
6265 if ( gTQSender == fNumEntryRunNo->GetNumberEntry() ) {
6266 fNumEntryEventNo->GetNumberEntry()->SelectAll();
6267 fNumEntryEventNo->GetNumberEntry()->SetFocus();
6268 }
6269 else if ( gTQSender == fNumEntryEventPlaySpeed->GetNumberEntry() ) {
6270 fNumEntryEventPlaySpeed->GetNumberEntry()->SelectAll();
6271 fNumEntryEventPlaySpeed->GetNumberEntry()->SetFocus();
6272 }
6273 else if ( gTQSender == fNumEntryMagnetic->GetNumberEntry() ) {
6274 fNumEntryMagnetic->GetNumberEntry()->SelectAll();
6275 fNumEntryMagnetic->GetNumberEntry()->SetFocus();
6276 }
6277 }
6278
6279 //_____________________________________________________
6280
6282 //
6283 // execute if return was pressed
6284 if (gDebug) cout << "BesClient::ExecuteReturn called!" << endl;
6285
6286 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
6287 //Double_t theta, phi, psi;
6288 Int_t iret;
6289
6290 if ( gTQSender == fZoomRatioNumber ) {
6291 if (view) view->SetZoomRatio(fZoomRatioNumber->GetNumber()/100.0);
6292 }
6293
6294 if ( gTQSender == fNumEntryEventNo->GetNumberEntry() ) {
6295 //fBesEventNo = fNumEntryEventNo->GetIntNumber();
6296 //this->GetEvent(fBesEventNo);
6297
6298 //Long Peixun's update: If event doesn't exist, don't change fBesEventNo
6299 Long64_t tempno = fBesEventNo;
6300 fBesEventNo = fNumEntryEventNo->GetIntNumber();
6301 if (!this->GetEvent(fBesEventNo)) fBesEventNo = tempno;
6302 }
6303
6304 else if ( gTQSender == fNumEntryEventPlaySpeed->GetNumberEntry() ) {
6305 fEventPlaySpeed = Int_t(fNumEntryEventPlaySpeed->GetNumber() * 1000);
6306 fAutoDisplayEventTimer->SetTime(fEventPlaySpeed);
6307 }
6308
6309 else if ( gTQSender == fNumEntryRotateSpeed ) {
6310 fRotateSpeed = fNumEntryRotateSpeed->GetNumber();
6311 this->SetRotateStep();
6312 cout << "fRotateSpeed " << fRotateSpeed << " fRotateStep " << fRotateStep << endl;
6313 //fAutoRotateTimer->SetTime((Int_t)1000/this->GetRotateFPS());
6314 }
6315
6316 else if ( gTQSender == fNumEntryRotateFPS->GetNumberEntry() ) {
6317 fRotateFPS = fNumEntryRotateFPS->GetIntNumber();
6318 this->SetRotateSpeed();
6319 fAutoRotateTimer->SetTime((Int_t)1000/fRotateFPS);
6320 cout << "fRotateFPS " << fRotateFPS << " fRotateStep " << fRotateStep << endl;
6321 }
6322
6323 else if ( gTQSender == fNumEntryMagnetic->GetNumberEntry() ) {
6324 if (gEvent){
6325 gEvent->SetMagnetic(fNumEntryMagnetic->GetNumber());
6326 GetEvent(fBesEventNo, false, false); //Long Peixun's update: Update display when change the magnetic field
6327 }
6328 }
6329
6330 else if ( gTQSender == fNumEntryRotateStep ) {
6331 fRotateStep = fNumEntryRotateStep->GetNumber();
6332 fRotateSpeed = fRotateStep * fRotateFPS;
6333 cout << "fRotateSpeed " << fRotateSpeed << " fRotateStep " << fRotateStep << endl;
6334 }
6335
6336 else if ( gTQSender == fViewAngleThetaNumber ) {
6337 if (view) {
6338 view->SetView(view->GetLongitude(), fViewAngleThetaNumber->GetNumber(), view->GetPsi(), iret);
6339 }
6340 }
6341
6342 else if ( gTQSender == fViewAnglePhiNumber ) {
6343 if (view) {
6344 view->SetView(fViewAnglePhiNumber->GetNumber(), view->GetLatitude(), view->GetPsi(), iret);
6345 }
6346 }
6347
6348 else if ( gTQSender == fViewAnglePsiNumber ) {
6349 if (view && view->GetViewType() == k3DView) {
6350 view->SetView(view->GetLongitude(), view->GetLatitude(), fViewAnglePsiNumber->GetNumber(), iret);
6351 }
6352 }
6353
6354 fEmbeddedCanvas->RequestFocus(); // RequestFocus to let Hot Key "QWEASD.." work in ExecuteEvent, or it doesnt work after input
6357 }
6358
6359 Pixmap_t BesClient::GetPic(const char *file)
6360 {
6361 TString filePath = fBesVisPath;
6362 filePath += "/icons/";
6363 filePath += file;
6364
6365 TASImage asImage(filePath);
6366 Pixmap_t pic = asImage.GetPixmap();
6367 //asImage->Draw();
6368 return pic;
6369 }
6370
6371 Bool_t BesClient::FileExists(TString fname)
6372 {
6373 // gSystem return 0 if exist, 1 for not exist
6374 return (!gSystem->AccessPathName(fname, kFileExists));
6375 }
6376
6377 // makes min <= input < max
6378 void BesClient::SetRange(Double_t &input, Double_t min, Double_t max)
6379 {
6380 Double_t range = max - min;
6381 if (input < min) {
6382 do {
6383 input += range;
6384 }
6385 while (input < min);
6386 }
6387
6388 if (input >= max) {
6389 do {
6390 input -= range;
6391 }
6392 while (input >= max);
6393 }
6394 }
6395
6396//Long Peixun's update: Return current pad hint string
6398{
6399 if ((TPad*)gPad == fDisplay->GetPadXY()) return "XY view";
6400 else if ((TPad*)gPad == fDisplay->GetPadZR()) return "ZR view";
6401 else if ((TPad*)gPad == fDisplay->GetPad3D()) return "3D view";
6402 else if ((TPad*)gPad == fDisplay->GetPadCgemUF(0)) return "CGEM unfolded layer 0";
6403 else if ((TPad*)gPad == fDisplay->GetPadCgemUF(1)) return "CGEM unfolded layer 1";
6404 else if ((TPad*)gPad == fDisplay->GetPadCgemUF(2)) return "CGEM unfolded layer 2";
6405 else return "Ready";
6406}
struct sembuf release
const char * SavePicPS[]
const char * OpenEventTypes[]
ClassImp(BesClient) const char *OpenGeoTypes[]
const char * StyleTypes[]
const char * SavePicTypes[]
int optint
struct sembuf acquire
const char * SaveGeoTypes[]
Definition BesClient.cxx:93
char * optarg
int opterr
@ kM_Tof_Barrel
Definition BesClient.h:200
@ kM_Mdc_Tubes
Definition BesClient.h:196
@ kM_Tracks_Tof
Definition BesClient.h:242
@ kM_Muc_Barrel
Definition BesClient.h:209
@ kM_TofHits_East
Definition BesClient.h:228
@ kM_Header_Global
Definition BesClient.h:189
@ kM_Muc_East
Definition BesClient.h:208
@ kM_EmcHits_East
Definition BesClient.h:232
@ kM_Emc_Side
Definition BesClient.h:206
@ kM_Muc_Strips
Definition BesClient.h:211
@ kM_Tracks_Mdc
Definition BesClient.h:241
@ kM_Mdc_QNotOverflow_Global
Definition BesClient.h:253
@ kM_Full3D_Tof
Definition BesClient.h:214
@ kM_TofHits_Global
Definition BesClient.h:227
@ kM_MucHits_East
Definition BesClient.h:237
@ kM_Tof_QMatch_Global
Definition BesClient.h:259
@ kM_Tracks_Emc
Definition BesClient.h:243
@ kM_Emc_East
Definition BesClient.h:203
@ kM_MucHits_Barrel
Definition BesClient.h:238
@ kM_Muc_West
Definition BesClient.h:210
@ kM_Emc_Global
Definition BesClient.h:202
@ kM_Full3D_Cgem
Definition BesClient.h:212
@ kM_TofHits_Barrel
Definition BesClient.h:229
@ kM_Cgem_VStrips
Definition BesClient.h:194
@ kM_Mdc_QMatch_Global
Definition BesClient.h:257
@ kM_Tracks_Ideal
Definition BesClient.h:247
@ kM_Tof_East
Definition BesClient.h:199
@ kM_CgemHits_Global
Definition BesClient.h:220
@ kM_Mdc_Global
Definition BesClient.h:195
@ kM_MucHits_West
Definition BesClient.h:239
@ kM_MdcHits_Hits
Definition BesClient.h:226
@ kM_Mdc_Wires
Definition BesClient.h:197
@ kM_Mdc_ColorfulWire_Global
Definition BesClient.h:254
@ kM_Full3D_Muc
Definition BesClient.h:216
@ kM_EmcHits_Barrel
Definition BesClient.h:233
@ kM_Cgem_XStrips
Definition BesClient.h:193
@ kM_Tracks_Muc
Definition BesClient.h:244
@ kM_Mdc_TMatch_Global
Definition BesClient.h:256
@ kM_BeamPipe
Definition BesClient.h:217
@ kM_ZRPlaneOnXY
Definition BesClient.h:218
@ kM_MucHits_Global
Definition BesClient.h:236
@ kM_Emc_West
Definition BesClient.h:205
@ kM_EmcHits_West
Definition BesClient.h:234
@ kM_Emc_Barrel
Definition BesClient.h:204
@ kM_Cgem_Layers
Definition BesClient.h:192
@ kM_CgemHits_VStrip
Definition BesClient.h:222
@ kM_CgemHits_XStrip
Definition BesClient.h:221
@ kM_Tof_TMatch_Global
Definition BesClient.h:258
@ kM_View_OpenGL
Definition BesClient.h:249
@ kM_View_X3D
Definition BesClient.h:248
@ kM_EmcHits_Global
Definition BesClient.h:231
@ kM_Tof_Global
Definition BesClient.h:198
@ kM_EmcHits_Side
Definition BesClient.h:235
@ kM_Tracks_Ext
Definition BesClient.h:245
@ kM_Tracks_Global
Definition BesClient.h:240
@ kM_CgemHits_FiredHL
Definition BesClient.h:224
@ kM_Muc_Global
Definition BesClient.h:207
@ kM_Tof_West
Definition BesClient.h:201
@ kM_Axis
Definition BesClient.h:219
@ kM_CgemHits_Clusters
Definition BesClient.h:223
@ kM_Mdc_MdcTimeSubEvTime_Global
Definition BesClient.h:255
@ kM_TofHits_West
Definition BesClient.h:230
@ kM_MdcHits_Global
Definition BesClient.h:225
@ kM_Full3D_Emc
Definition BesClient.h:215
@ kM_Full3D_Mdc
Definition BesClient.h:213
@ kM_MC_TruthTrack
Definition BesClient.h:246
@ kM_Cgem_Global
Definition BesClient.h:191
@ FREE_SPACE
Definition BesClient.h:51
@ OUTPUT_STORE
Definition BesClient.h:51
@ kM_Help_About
Definition BesClient.h:69
@ kM_File_SaveGeoAs
Definition BesClient.h:60
@ kM_Edit_Editor
Definition BesClient.h:65
@ kM_File_Exit
Definition BesClient.h:64
@ kM_File_SavePicAs
Definition BesClient.h:62
@ kM_File_OpenEvent
Definition BesClient.h:61
@ kM_Help_Content
Definition BesClient.h:68
@ kM_File_Close
Definition BesClient.h:63
@ kM_File_LoadGeo
Definition BesClient.h:59
@ kM_Button_SwitchDisplayMode
Definition BesClient.h:90
@ kM_Button_BesRun
Definition BesClient.h:145
@ kM_Button_ShowAxis
Definition BesClient.h:106
@ kM_Button_PrevEvent
Definition BesClient.h:117
@ kM_Button_RotateStep
Definition BesClient.h:141
@ kM_Button_NextEvent
Definition BesClient.h:118
@ kM_Button_ViewAnglePhiMinus
Definition BesClient.h:135
@ kM_Button_Refresh
Definition BesClient.h:82
@ kM_Button_LoadGeoFile
Definition BesClient.h:77
@ kM_Button_ViewAnglePsiNumber
Definition BesClient.h:140
@ kM_Button_ResetCurrent
Definition BesClient.h:83
@ kM_Button_ViewAnglePhiNumber
Definition BesClient.h:136
@ kM_Button_SaveMyConfig
Definition BesClient.h:93
@ kM_Button_ViewResetAngle
Definition BesClient.h:121
@ kM_Button_SavePicAs
Definition BesClient.h:80
@ kM_Button_CursorPick
Definition BesClient.h:85
@ kM_Button_ZoomIn
Definition BesClient.h:87
@ kM_Slider_ViewAngleTheta
Definition BesClient.h:129
@ kM_Button_OpenEventFile
Definition BesClient.h:79
@ kM_Button_ViewAnglePhiPlus
Definition BesClient.h:134
@ kM_Button_RotateFPS
Definition BesClient.h:144
@ kM_Button_DisplayMode2D
Definition BesClient.h:97
@ kM_Button_Help
Definition BesClient.h:96
@ kM_Button_ViewMoveLeft
Definition BesClient.h:125
@ kM_Button_DisplayModeZR
Definition BesClient.h:99
@ kM_Button_PlayEvent
Definition BesClient.h:119
@ kM_Button_ZoomRatioNumber
Definition BesClient.h:89
@ kM_Button_SavePicAsPS
Definition BesClient.h:81
@ kM_Button_DisplayModeCgemUF
Definition BesClient.h:102
@ kM_Slider_ViewAnglePsi
Definition BesClient.h:137
@ kM_Button_AutoRotate
Definition BesClient.h:142
@ kM_Button_ViewMoveRight
Definition BesClient.h:126
@ kM_Button_DisplayMode3D
Definition BesClient.h:100
@ kM_Button_ViewMoveCenter
Definition BesClient.h:128
@ kM_Button_DisplayModeCgemUFAll
Definition BesClient.h:103
@ kM_Button_EventPlaySpeed
Definition BesClient.h:147
@ kM_Button_ViewClockWise
Definition BesClient.h:123
@ kM_Button_FirstEvent
Definition BesClient.h:120
@ kM_Button_ParallelView
Definition BesClient.h:108
@ kM_Button_ViewAngleThetaMinus
Definition BesClient.h:131
@ kM_Button_ViewAnglePsiMinus
Definition BesClient.h:139
@ kM_Button_RotateSpeed
Definition BesClient.h:143
@ kM_Button_GoHome
Definition BesClient.h:92
@ kM_Button_SetHome
Definition BesClient.h:91
@ kM_Button_ViewAnglePsiPlus
Definition BesClient.h:138
@ kM_Slider_EventPlay
Definition BesClient.h:116
@ kM_Button_ShowInfo
Definition BesClient.h:105
@ kM_Button_DisplayModeXY
Definition BesClient.h:98
@ kM_Button_ZoomOut
Definition BesClient.h:88
@ kM_Button_PerspectiveView
Definition BesClient.h:109
@ kM_Button_DisplayModeAll
Definition BesClient.h:101
@ kM_Button_ResetAll
Definition BesClient.h:84
@ kM_Button_ViewCounterClockWise
Definition BesClient.h:122
@ kM_Button_ViewAngleThetaPlus
Definition BesClient.h:130
@ kM_Button_CursorHand
Definition BesClient.h:86
@ kM_Button_BesEvent
Definition BesClient.h:146
@ kM_Button_ViewMoveDown
Definition BesClient.h:127
@ kM_Button_Magnetic
Definition BesClient.h:169
@ kM_Button_SwitchPad
Definition BesClient.h:104
@ kM_Button_X3D
Definition BesClient.h:110
@ kM_Button_ViewAngleThetaNumber
Definition BesClient.h:132
@ kM_Slider_ViewAnglePhi
Definition BesClient.h:133
@ kM_Button_FishEyeView
Definition BesClient.h:107
@ kM_Button_LoadMyConfig
Definition BesClient.h:94
@ kM_Button_Palette
Definition BesClient.h:95
@ kM_Button_ViewMoveUp
Definition BesClient.h:124
@ kM_Button_OpenGL
Definition BesClient.h:111
@ RUN_ERROR
Definition BesClient.h:52
@ RUN_SMOOTH
Definition BesClient.h:52
@ kBesHand
Definition BesCursor.h:15
@ kBesPick
Definition BesCursor.h:14
R__EXTERN BesCursor * gBesCursor
Definition BesCursor.h:40
R__EXTERN BesEvent * gEvent
Definition BesEvent.h:318
R__EXTERN BesGeometry * gBesGeometry
@ kXYView
Definition BesStatus.h:15
@ k3DView
Definition BesStatus.h:14
@ kZRView
Definition BesStatus.h:16
TChain ch("t1")
const Int_t n
int runNo
void cvtMucDst2MucRec(TRecMucTrack *dist, const TMucTrack *src)
Definition DstConvert.h:101
void cvtMdcDst2MdcRec(TRecMdcTrack *dist, const TMdcTrack *src)
Definition DstConvert.h:19
void cvtEmcDst2EmcRec(TRecEmcShower *dist, const TEmcTrack *src)
Definition DstConvert.h:70
void cvtTofDst2TofRec(TRecTofTrack *dist, const TTofTrack *src)
Definition DstConvert.h:37
string::const_iterator ptype
Definition EvtMTree.hh:19
XmlRpcServer s
Int_t GetEventPlaySpeed()
Definition BesClient.h:757
virtual void X3D()
virtual void GoHome()
virtual void CreateMainFrame()
virtual void CreateTitleBar()
virtual void UpdateAllView()
virtual void HandleMenu(Int_t id)
virtual void SetAllDisplayModeButtonUnHL()
virtual void CreateToolBar()
virtual Bool_t GetEvent(Long64_t i, bool openfile=false, bool sel_geom=false)
virtual void SavePicAsPS()
virtual void CreateDisplayModeBar()
virtual void HandleSliders(Int_t id)
virtual void CreateTabs()
virtual Bool_t LastEvent()
virtual void SaveMyConfig()
virtual void RotatePsi(int pn)
virtual void Show()
virtual void SetHome()
virtual void RotateClockWise(int clockwise)
Double_t GetRotateStep()
Definition BesClient.h:761
virtual void CreateMenuBar()
BesClient(const TGWindow *p, const char *title, UInt_t width, UInt_t height, Option_t *option="", Int_t argc=0, char **argv=0)
virtual void RotateTheta(int pn)
virtual ~BesClient()
Long64_t GetBesRunNo()
Definition BesClient.h:755
virtual void RotatePhi(int pn)
virtual void HandleViewOptionMenu(Int_t id)
virtual void OpenGL()
virtual void HandleEventList(TGListTreeItem *entry, Int_t btn)
virtual void OpenEventFile()
virtual void SavePicAs()
virtual void HandleStatusBar(const char *msg)
virtual Pixmap_t GetPic(const char *file)
virtual void AutoRotateCommand()
virtual void UpdateStatus()
virtual void CreateWidget(const char *title, UInt_t width, UInt_t height)
virtual void CloseWindow()
virtual void CreateHorizontalRuler()
virtual void InitGeoSelector(const char *geomsel_file)
virtual void InitConnections()
virtual void UpdateCurrentPad()
virtual void HandleError(const char *msg)
virtual void SaveGeoAs()
virtual void InitLocal()
virtual void CreateCanvas()
virtual void HandleInfoBar(const char *msg)
void SetRotateSpeed()
Definition BesClient.h:762
virtual Bool_t FirstEvent()
virtual void LoadMdcPalette()
virtual Bool_t GetRecEvent()
virtual void SetRange(Double_t &input, Double_t min, Double_t max)
virtual void AutoDisplayEvent()
virtual Bool_t NextEvent()
virtual void CreateStatusBar()
virtual void CreateUpButtonBar()
virtual void AutoDisplayEventCommand()
Long64_t GetBesEventNo()
Definition BesClient.h:756
void SetRotateStep()
Definition BesClient.h:763
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py, TObject *sel)
virtual void Help()
virtual void ExecuteReturn()
virtual void LoadMyConfig()
virtual Bool_t PrevEvent()
virtual void HandleButtons(Int_t id=-1)
virtual Bool_t FileExists(TString fname)
Int_t GetRotateFPS()
Definition BesClient.h:759
virtual void SetState(Int_t id=-1)
virtual void AutoRotate()
virtual void OpenGeoFile(TString filename)
virtual void ChangeFocus()
virtual const char * GetCurrentPadString()
Double_t GetRotateSpeed()
Definition BesClient.h:760
virtual void InitParameter()
virtual void UpdateBesInputFields()
virtual void LoadGeoFile()
Bool_t GetShowInfo()
Definition BesCursor.h:35
void SetType(EBESCursorType cursorType)
Definition BesCursor.h:31
void SetShowInfo(Bool_t show)
Definition BesCursor.h:34
void SetMagnetic(Double_t input)
Definition BesEvent.h:83
virtual void SetCgemClusters(const TRecCgemCluster *recCluster, int ncluster)
Definition BesEvent.cxx:329
virtual void SetEvent(TDigiEvent *digiEvent, TDisTrack *recEvent, TEvtHeader *evtHeader, TRecEvTime *recEvTime, Bool_t isRec, TMcEvent *mcEvt=0)
Definition BesEvent.cxx:158
BesGMenuTitle * GetMenuTitle(Int_t i)
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
virtual void SetPicture(Pixmap_t pic)
virtual void SetPictureHL(Pixmap_t pic)
virtual void SetState(Bool_t state)
virtual void SetPictureHL(const TGPicture *hl_pic)
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)
CgemROOTGeo * GetCgemROOTGeo()
Definition BesGeometry.h:47
TGeoVolume * GetVolBes()
Definition BesGeometry.h:44
EmcROOTGeo * GetEmcROOTGeo()
Definition BesGeometry.h:50
MdcROOTGeo * GetMdcROOTGeo()
Definition BesGeometry.h:48
virtual void SetPhysicalDefaultVis()
MucROOTGeo * GetMucROOTGeo()
Definition BesGeometry.h:51
TofROOTGeo * GetTofROOTGeo()
Definition BesGeometry.h:49
Float_t fZoom
Definition BesStatus.h:140
void Transfer(BesStatus *right, Bool_t set)
Double_t GetLatitude()
Definition BesTView.h:94
Bool_t IsPerspective() const
Definition BesTView.h:113
Double_t GetPsi()
Definition BesTView.h:96
virtual void SetParallel()
Double_t GetLongitude()
Definition BesTView.h:95
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
virtual void SetPerspective()
Bool_t GetVisAxis()
Definition BesView.h:194
void SetVisEmcGlobal(Bool_t input)
Definition BesView.h:159
void SetVisMucHitsBarrel(Bool_t input)
Definition BesView.h:252
Bool_t GetVisMucHitsWest()
Definition BesView.h:248
void SetVisTofWest(Bool_t input)
Definition BesView.h:149
BesStatus * GetStatusCurrent()
Definition BesView.h:311
void SetVisEmcSide(Bool_t input)
Definition BesView.h:163
void SetVisEmcHitsWest(Bool_t input)
Definition BesView.h:241
Bool_t GetVisMucHitsGlobal()
Definition BesView.h:245
void SetVisTofHitsBarrel(Bool_t input)
Definition BesView.h:228
Bool_t GetVisCgemXStrips()
Definition BesView.h:122
void SetVisEmcHitsGlobal(Bool_t input)
Definition BesView.h:238
Bool_t GetVisBeamPipe()
Definition BesView.h:192
void SetVisEmcEast(Bool_t input)
Definition BesView.h:160
Bool_t GetVisMucHitsEast()
Definition BesView.h:246
Bool_t GetVisFull3DTof()
Definition BesView.h:181
void SetVisCgemVStrips(Bool_t input)
Definition BesView.h:128
void ZoomIn()
Definition BesView.cxx:611
Bool_t GetVisCgemVStrips()
Definition BesView.h:123
void SetVisTracksExt(Bool_t input)
Definition BesView.h:271
Bool_t GetVisTracksExt()
Definition BesView.h:262
void SetVisMdcHits(Bool_t input)
Definition BesView.h:218
void SetVisTracksTof(Bool_t input)
Definition BesView.h:268
void SetVisCgemHitsGlobal(Bool_t input)
Definition BesView.h:207
void SetVisMucWest(Bool_t input)
Definition BesView.h:175
Bool_t GetVisTracksGlobal()
Definition BesView.h:256
Bool_t GetVisEmcBarrel()
Definition BesView.h:155
void SetVisTracksMdc(Bool_t input)
Definition BesView.h:266
Bool_t GetVisMdcHitsGlobal()
Definition BesView.h:214
void SetVisMdcGlobal(Bool_t input)
Definition BesView.h:135
void SetVisTofBarrel(Bool_t input)
Definition BesView.h:148
BesStatus * GetStatus3D()
Definition BesView.h:312
Bool_t GetVisCgemHitsXStrip()
Definition BesView.h:202
void SetVisTofHitsWest(Bool_t input)
Definition BesView.h:229
Bool_t GetVisEmcHitsBarrel()
Definition BesView.h:234
Bool_t GetVisEmcHitsGlobal()
Definition BesView.h:232
Bool_t GetVisMdcTubes()
Definition BesView.h:132
void Move(Int_t px, Int_t py)
Definition BesView.cxx:513
Bool_t GetVisTracksIdeal()
Definition BesView.h:258
virtual void Front()
Definition BesView.h:291
Bool_t GetVisEmcGlobal()
Definition BesView.h:153
void SetVisMucHitsEast(Bool_t input)
Definition BesView.h:251
Bool_t GetVisMucWest()
Definition BesView.h:169
void SetVisMucEast(Bool_t input)
Definition BesView.h:173
void SetVisTofHitsGlobal(Bool_t input)
Definition BesView.h:226
Bool_t GetVisTofBarrel()
Definition BesView.h:142
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition BesView.cxx:753
void SetVisCgemXStrips(Bool_t input)
Definition BesView.h:127
Bool_t GetVisCgemGlobal()
Definition BesView.h:120
Bool_t GetVisTracksMuc()
Definition BesView.h:261
void SetVisCgemGlobal(Bool_t input)
Definition BesView.h:125
Bool_t GetVisMdcWires()
Definition BesView.h:133
void SetVisFull3DTof(Bool_t input)
Definition BesView.h:187
Bool_t GetVisCgemHitsFiredHL()
Definition BesView.h:205
Bool_t GetVisEmcHitsSide()
Definition BesView.h:236
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition BesView.cxx:965
void SetVisMdcTubes(Bool_t input)
Definition BesView.h:136
BesStatus * GetStatusZR()
Definition BesView.h:314
Bool_t GetVisMucHitsBarrel()
Definition BesView.h:247
void SetVisMucStrips(Bool_t input)
Definition BesView.h:176
void Center()
Definition BesView.cxx:559
Bool_t GetFishEyeStatus()
Definition BesView.h:275
Bool_t GetVisEmcWest()
Definition BesView.h:156
void SetFishEye(Bool_t input=0)
Definition BesView.h:277
Bool_t GetFishEye()
Definition BesView.h:276
Bool_t GetVisTofEast()
Definition BesView.h:141
Bool_t GetVisTofGlobal()
Definition BesView.h:140
Bool_t GetVisMdcGlobal()
Definition BesView.h:131
Bool_t GetVisMdcHits()
Definition BesView.h:215
void SetVisFull3DEmc(Bool_t input)
Definition BesView.h:188
void SetVisTracksGlobal(Bool_t input)
Definition BesView.h:265
void SetVisEmcHitsEast(Bool_t input)
Definition BesView.h:239
Bool_t GetVisFull3DMuc()
Definition BesView.h:183
BesStatus * GetStatusCgemUF(int layer)
Definition BesView.h:317
Bool_t GetVisMucEast()
Definition BesView.h:167
Bool_t GetVisCgemHitsVStrip()
Definition BesView.h:203
void SetVisTofGlobal(Bool_t input)
Definition BesView.h:146
Bool_t GetVisEmcHitsWest()
Definition BesView.h:235
Bool_t GetVisFull3DEmc()
Definition BesView.h:182
Bool_t GetVisEmcEast()
Definition BesView.h:154
Bool_t GetVisFull3DMdc()
Definition BesView.h:180
void SetVisEmcHitsSide(Bool_t input)
Definition BesView.h:242
EBESViewType GetViewType()
Definition BesView.h:74
void SetVisMucHitsGlobal(Bool_t input)
Definition BesView.h:250
void SetVisEmcBarrel(Bool_t input)
Definition BesView.h:161
void SetVisTracksEmc(Bool_t input)
Definition BesView.h:269
void SetVisCgemHitsXStrip(Bool_t input)
Definition BesView.h:208
void SetVisFull3DCgem(Bool_t input)
Definition BesView.h:185
void SetVisTofHitsEast(Bool_t input)
Definition BesView.h:227
void SetVisZRPlaneOnXY(Bool_t input)
Definition BesView.h:197
void SetVisTracksMuc(Bool_t input)
Definition BesView.h:270
void SetVisAxis(Bool_t input)
Definition BesView.h:198
void SetVisMdcWires(Bool_t input)
Definition BesView.h:137
void SetVisCgemHitsClusters(Bool_t input)
Definition BesView.h:210
void SetVisEmcHitsBarrel(Bool_t input)
Definition BesView.h:240
BesStatus * GetStatusXY()
Definition BesView.h:313
void ZoomOut()
Definition BesView.cxx:667
void SetVisCgemHitsVStrip(Bool_t input)
Definition BesView.h:209
void SetVisTracksIdeal(Bool_t input)
Definition BesView.h:267
Bool_t GetVisMucGlobal()
Definition BesView.h:166
Bool_t GetVisTofHitsWest()
Definition BesView.h:224
void SetVisCgemLayers(Bool_t input)
Definition BesView.h:126
Bool_t GetVisTofHitsGlobal()
Definition BesView.h:221
void SetVisFull3DMuc(Bool_t input)
Definition BesView.h:189
Bool_t GetVisZRPlaneOnXY()
Definition BesView.h:193
Bool_t GetVisCgemHitsClusters()
Definition BesView.h:204
Bool_t GetVisTracksTof()
Definition BesView.h:259
void SetVisFull3DMdc(Bool_t input)
Definition BesView.h:186
void SetZoomRatio(Double_t ratio)
Definition BesView.cxx:578
void Reset()
Definition BesView.cxx:990
Bool_t GetVisTracksEmc()
Definition BesView.h:260
Bool_t GetVisTofWest()
Definition BesView.h:143
Bool_t GetVisMucStrips()
Definition BesView.h:170
void SetVisBeamPipe(Bool_t input)
Definition BesView.h:196
void SetVisTofEast(Bool_t input)
Definition BesView.h:147
void SetVisCgemHitsFiredHL(Bool_t input)
Definition BesView.h:211
Double_t GetZoomRatio()
Definition BesView.h:73
void SetVisMCTruthTrack(Bool_t input)
Definition BesView.h:272
Bool_t GetVisEmcHitsEast()
Definition BesView.h:233
Bool_t GetVisCgemLayers()
Definition BesView.h:121
void SetVisMdcHitsGlobal(Bool_t input)
Definition BesView.h:217
void SetVisMucHitsWest(Bool_t input)
Definition BesView.h:253
Bool_t GetVisTracksMdc()
Definition BesView.h:257
Bool_t GetVisMucBarrel()
Definition BesView.h:168
void SetVisMucBarrel(Bool_t input)
Definition BesView.h:174
Bool_t GetVisCgemHitsGlobal()
Definition BesView.h:201
void SetVisMucGlobal(Bool_t input)
Definition BesView.h:172
Bool_t GetVisTofHitsBarrel()
Definition BesView.h:223
void SetVisEmcWest(Bool_t input)
Definition BesView.h:162
Bool_t GetVisEmcSide()
Definition BesView.h:157
Bool_t GetVisMCTruthTrack()
Definition BesView.h:263
Bool_t GetVisTofHitsEast()
Definition BesView.h:222
Int_t GetDisplayMode()
virtual void Reset()
virtual void SwitchPad()
BesGeometry * GetBesGeometry()
Bool_t GetVisHeader() const
TPad * GetPadZR()
virtual void InitGeometryFromGDML(const TString fPath, bool mrpc=false, bool cgem=false)
TPad * GetPad3D()
TPad * GetPadXY()
virtual void DrawHeader()
virtual void Draw(Option_t *option="")
TPad * GetPadCgemUF(int layer)
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
Definition TDstEvent.h:76
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
Definition TDstEvent.h:100
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
Definition TDstEvent.h:88
const TObjArray * getMdcTrackCol() const
retrieve the whole TObjArray of MdcTrack Data
Definition TDstEvent.h:40
Int_t getRunId()
Access the run number.
Definition TEvtHeader.h:26
void Clear(Option_t *option="")
void setTRecCgemCluster(const TRecCgemCluster *cgemcluster)
Int_t getsheetid(void) const
Int_t getlayerid(void) const
Double_t getrecphi(void) const
Int_t getflag(void) const
Double_t getrecv(void) const
Int_t getclusterid(void) const
void setTRecEmcShower(const TRecEmcShower *emcshower)
void setTRecMdcHit(const TRecMdcHit *mdchit)
Definition TRecMdcHit.h:57
void setTRecMdcTrack(const TRecMdcTrack *mdcTrk)
void setTRecMucTrack(const TRecMucTrack *muctrk)
void setTRecTofTrack(const TRecTofTrack *toftrk)
const TObjArray * getTofTrackCol() const
retrieve the whole TObjArray of TofTrack Data
const TObjArray * getEvTimeCol() const
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;.