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