00001
00002
00003
00004
00005
00006 #include "BesVisClient/BesClient.h"
00007 #include "BesVisClient/BesAboutHelp.h"
00008 #include "BesVisClient/BesMdcPalette.h"
00009 #include "BesVisLib/BesVisDisplay.h"
00010 #include "BesVisLib/BesCursor.h"
00011 #include <iostream>
00012 #include <sstream>
00013 #include <fstream>
00014
00015 #include <TList.h>
00016 #include <TRootEmbeddedCanvas.h>
00017 #include <TTimer.h>
00018 #include <TApplication.h>
00019 #include <TInterpreter.h>
00020 #include <TBranch.h>
00021 #include <TFile.h>
00022 #include <TTree.h>
00023 #include <TSystem.h>
00024 #include <TGeoManager.h>
00025 #include <TGButton.h>
00026 #include <TGMenu.h>
00027 #include <TGLayout.h>
00028 #include <TGStatusBar.h>
00029 #include <TGFileDialog.h>
00030 #include <TGNumberEntry.h>
00031 #include <TGMsgBox.h>
00032 #include <TGProgressBar.h>
00033 #include <TGTab.h>
00034 #include <TGSplitter.h>
00035 #include <TGCanvas.h>
00036 #include <TSystem.h>
00037 #include <TGListTree.h>
00038 #include <TGLabel.h>
00039 #include <TGButtonGroup.h>
00040 #include <TGTextEntry.h>
00041 #include <TGTextBuffer.h>
00042 #include <TG3DLine.h>
00043 #include <TGSlider.h>
00044 #include <TCanvas.h>
00045 #include <TView.h>
00046 #include <TGeometry.h>
00047 #include <TASImage.h>
00048 #include <TColor.h>
00049 #include <TViewerX3D.h>
00050
00051
00052 #include <TVirtualViewer3D.h>
00053
00054 #include <TVirtualGL.h>
00055 #include <TVirtualGeoPainter.h>
00056 #include <TRootHelpDialog.h>
00057 #include <TRootDialog.h>
00058
00059 #include "RootEventData/TRecTrackEvent.h"
00060 #include "RootEventData/TDigiEvent.h"
00061 #include "RootEventData/TDisTrack.h"
00062 #include "RootEventData/TRecEvTime.h"
00063 using namespace std;
00064
00065
00066 ClassImp(BesClient)
00067
00068
00069 const char gHelpBesVis[] = "\
00070 PRESS \n\
00071 \tg\t--- save graph\n\
00072 \tn\t--- next event\n\
00073 \tp\t--- previous event\n\n\
00074 \tw\t--- move up\n\
00075 \ta\t--- move left\n\
00076 \ts\t--- move down\n\
00077 \td\t--- move right\n\n\
00078 \tq\t--- zoom out\n\
00079 \te\t--- zoom in\n\n"
00080 "\n\
00081 Add more...";
00082
00083 const char *OpenGeoTypes[] = {"ROOT files", "*.root",
00084 "GDML files", "*.gdml",
00085 0, 0
00086 };
00087
00088 const char *SaveGeoTypes[] = {"REC files", "*.rec",
00089 "ROOT files", "*.root",
00090 0, 0
00091 };
00092
00093 const char *OpenEventTypes[] = {"ROOT files", "*.root",
00094 "rec files", "*.rec",
00095 "raw files", "*.rtraw",
00096
00097 "Generic Adamo files", "*.cz",
00098
00099 0, 0
00100 };
00101
00102 const char *SavePicTypes[] = {"GIF", "*.gif",
00103 "JPG", "*.jpg",
00104 "PS", "*.ps",
00105 "EPS", "*.eps",
00106 "XPM", "*.xpm",
00107 "PNG", "*.png",
00108 "TIFF", "*.tiff",
00109 0, 0
00110 };
00111
00112 const char *SavePicPS[] = {"PS", "*.ps",
00113 0, 0
00114 };
00115
00116 extern char *optarg;
00117 extern int optint, opterr;
00118
00119 struct sembuf acquire = {
00120 0, -1, SEM_UNDO
00121 };
00122 struct sembuf release = {
00123 0, 1, SEM_UNDO
00124 };
00125
00126
00127
00128
00129
00130
00131
00132 BesClient::BesClient(const TGWindow *p, const char* title,
00133 UInt_t width, UInt_t height, Option_t *option, Int_t argc, char **argv) :
00134 TGMainFrame(p, width, height) {
00135
00136
00137
00138 if ( gDebug ) cout << "BesClient ctor called" << endl;
00139
00141
00142
00143
00144
00146
00147
00148
00149
00150 recTrack1 = NULL;
00151 mdchit = NULL;
00152
00153 tofTrack = NULL;
00154 muctrk = NULL;
00155 emcshower = NULL;
00156
00157
00158
00159 fEventTree = 0;
00160
00161
00162 this->InitParameter();
00163
00164
00165 this->InitLocal();
00166
00167
00168 this->CreateWidget(title, fWindowWidth, fWindowHeight);
00169
00170
00171 this->InitConnections();
00172
00173 this->SetBackgroundPixmap(GetPic("background.gif"));
00174
00175 f_bossMode = false;
00176 int optchar;
00177 static char optstring[] = "g:e:B:";
00178 opterr = 0;
00179 fEventFile = NULL;
00180
00181
00182 while ((optchar = getopt(argc, argv, optstring)) != -1)
00183 switch (optchar) {
00184 case 'g':
00185 f_geoFile = optarg;
00186 cout << "Load Geometry file with arguments" << endl;
00187 cout << "Geofile: " << f_geoFile << endl;
00188 break;
00189 case 'e':
00190 f_evtFile = optarg;
00191 cout << "Load Event file with argments" << endl;
00192 cout << "Evtfile: " << f_evtFile << endl;
00193 break;
00194 case 'B':
00195 f_bossMode = true;
00196 f_pid = atoi(optarg);
00197 cout << "Run in the Boss Framework: " << f_bossMode << endl;
00198 cout << "parent pid: " << f_pid << endl;
00199 break;
00200 case '?':
00201 cout << "Found an option that was not in optstring!" << endl;
00202 }
00203 if (optind < argc)
00204 cout << "Left off at: " << argv[optind] << endl;
00205
00206 this->LoadGeoFile();
00207
00208 if ( f_bossMode == false){
00209 if ( f_evtFile.Length() != 0){
00210 this->OpenEventFile(f_evtFile);
00211
00212 }
00213 }
00214 else if (f_bossMode == true){
00215 fAutoDisplayEvent = kTRUE;
00216 f_runStatus = RUN_SMOOTH;
00217 cout << "Load event file: " << f_evtFile << endl;
00218 fCurrentEvent = 0;
00219 this->GetRecEvent();
00220 }
00221
00222 this->UpdateStatus();
00223 }
00224
00225
00226
00227 BesClient::~BesClient() {
00228
00229
00230 if ( gDebug ) {
00231 cout << "BesClient dtor called" << endl;
00232 }
00233
00234 fWidgets->Delete();
00235 delete fWidgets;
00236 }
00237
00238
00239
00240 void BesClient::CreateWidget(const char* title, UInt_t width, UInt_t height) {
00241
00242
00243
00244
00245
00246
00247 CreateMenuBar();
00248
00249 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 0);
00250 fWidgets->Add(fLayout);
00251 this->AddFrame(fMenuBar, fLayout);
00252
00253
00254
00255
00256 CreateUpButtonBar();
00257 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 0, 0, 1);
00258 fWidgets->Add(fLayout);
00259 this->AddFrame(fUpButtonBarFrame, fLayout);
00260
00261
00262
00263
00264 CreateTitleBar();
00265 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 5, 5, 0, 0);
00266 fWidgets->Add(fLayout);
00267 this->AddFrame(fTitleFrame, fLayout);
00268
00269
00270
00271
00272 CreateMainFrame();
00273 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0);
00274 fWidgets->Add(fLayout);
00275 this->AddFrame(fMainFrame, fLayout);
00276
00277
00278 CreateDisplayModeBar();
00279 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0);
00280 fWidgets->Add(fLayout);
00281 this->AddFrame(fDisplayModeBarFrame, fLayout);
00282
00283
00284 CreateToolBar();
00285 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 3, 0, 1, 0);
00286 fWidgets->Add(fLayout);
00287 this->AddFrame(fToolBarFrame, fLayout);
00288
00289
00290 CreateStatusBar();
00291 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0);
00292 fWidgets->Add(fLayout);
00293 this->AddFrame(fStatusBar, fLayout);
00294
00295
00296 TString ttitle(title);
00297 ttitle.Append("@");
00298 ttitle.Append(gSystem->HostName());
00299 SetWindowName(ttitle);
00300 SetIconName(title);
00301 SetIconPixmap( (fBesVisPath + TString("/icons/LogoBesVisMini.gif")).Data() );
00302 SetClassHints("BesVis", "Bes Event Visualisation");
00303
00304 SetWMPosition(10, 10);
00305 SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless);
00306 MapSubwindows();
00307 Resize(GetDefaultSize());
00308 Resize(width, height);
00309 MapWindow();
00310 }
00311
00312 void BesClient::CreateHorizontalRuler() {
00313
00314
00315
00316 fLayout = new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0);
00317 fWidgets->Add(fLayout);
00318 this->AddFrame(new TGHorizontal3DLine(this), fLayout);
00319 }
00320
00321
00322
00323 void BesClient::CreateMenuBar() {
00324
00325
00326
00327
00328 fMenuBarFirstItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft,
00329 30, 0, 1, 2);
00330 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft,
00331 20, 0, 1, 2);
00332 fMenuBarLastItemLayout = new TGLayoutHints(kLHintsTop | kLHintsRight,
00333 20, 20, 1, 2);
00334
00335
00336 const TGPicture *viewGeometryIcon = gClient->GetPicture("viewGeometry.gif");
00337
00338
00339
00340
00341
00342 fMenuFile = new TGPopupMenu(gClient->GetRoot());
00343
00344 fMenuFile->AddEntry("Load &Geometry File...", kM_File_LoadGeo);
00345 fMenuFile->AddEntry("&Save Geometry as...", kM_File_SaveGeoAs);
00346 fMenuFile->AddEntry("Load &Event File...", kM_File_OpenEvent);
00347 fMenuFile->AddEntry("Save &Picture as...", kM_File_SavePicAs);
00348 fMenuFile->AddSeparator();
00349 fMenuFile->AddEntry("&Quit BesVis", kM_File_Exit);
00350
00351
00352
00353
00354 fMenuEdit = new TGPopupMenu(gClient->GetRoot());
00355
00356 fMenuEdit->AddEntry("&Editor", kM_Edit_Editor);
00357
00358
00359
00360
00361 fMenuViewOptionHeader = new TGPopupMenu(gClient->GetRoot());
00362 fMenuViewOptionHeader->AddEntry("Show Header",kM_Header_On);
00363
00364
00365
00366
00367 fMenuViewOptionMdc = new TGPopupMenu(gClient->GetRoot());
00368 fMenuViewOptionMdc->AddEntry("Global", kM_Mdc_Global);
00369 fMenuViewOptionMdc->AddEntry("Tube", kM_Mdc_Tubes);
00370 fMenuViewOptionMdc->AddEntry("Wires", kM_Mdc_Wires);
00371
00372
00373
00374 fMenuViewOptionTof = new TGPopupMenu(gClient->GetRoot());
00375 fMenuViewOptionTof->AddEntry("Global", kM_Tof_Global);
00376 fMenuViewOptionTof->AddEntry("East", kM_Tof_East);
00377 fMenuViewOptionTof->AddEntry("Barrel", kM_Tof_Barrel);
00378 fMenuViewOptionTof->AddEntry("West", kM_Tof_West);
00379
00380
00381
00382 fMenuViewOptionEmc = new TGPopupMenu(gClient->GetRoot());
00383 fMenuViewOptionEmc->AddEntry("Global", kM_Emc_Global);
00384 fMenuViewOptionEmc->AddEntry("East", kM_Emc_East);
00385 fMenuViewOptionEmc->AddEntry("Barrel", kM_Emc_Barrel);
00386 fMenuViewOptionEmc->AddEntry("West", kM_Emc_West);
00387 fMenuViewOptionEmc->AddEntry("Side", kM_Emc_Side);
00388
00389
00390
00391 fMenuViewOptionMuc = new TGPopupMenu(gClient->GetRoot());
00392 fMenuViewOptionMuc->AddEntry("Global", kM_Muc_Global);
00393 fMenuViewOptionMuc->AddEntry("East", kM_Muc_East);
00394 fMenuViewOptionMuc->AddEntry("Barrel", kM_Muc_Barrel);
00395 fMenuViewOptionMuc->AddEntry("West", kM_Muc_West);
00396 fMenuViewOptionMuc->AddEntry("Strips", kM_Muc_Strips);
00397
00398
00399
00400 fMenuViewOptionFull3D = new TGPopupMenu(gClient->GetRoot());
00401 fMenuViewOptionFull3D->AddEntry("Mdc", kM_Full3D_Mdc);
00402 fMenuViewOptionFull3D->AddEntry("Tof", kM_Full3D_Tof);
00403 fMenuViewOptionFull3D->AddEntry("Emc", kM_Full3D_Emc);
00404 fMenuViewOptionFull3D->AddEntry("Muc", kM_Full3D_Muc);
00405
00406
00407
00408 fMenuViewOptionOthers = new TGPopupMenu(gClient->GetRoot());
00409 fMenuViewOptionOthers->AddEntry("BeamPipe", kM_BeamPipe);
00410 fMenuViewOptionOthers->AddEntry("ZRPlaneOnXY", kM_ZRPlaneOnXY);
00411 fMenuViewOptionOthers->AddEntry("Axis", kM_Axis);
00412
00413
00414
00415
00416 fMenuViewOptionMdcHits = new TGPopupMenu(gClient->GetRoot());
00417 fMenuViewOptionMdcHits->AddEntry("Hits",kM_MdcHits_Hits);
00418
00419
00420
00421 fMenuViewOptionTofHits = new TGPopupMenu(gClient->GetRoot());
00422 fMenuViewOptionTofHits->AddEntry("Global Hits", kM_TofHits_Global);
00423 fMenuViewOptionTofHits->AddEntry("East Hits", kM_TofHits_East);
00424 fMenuViewOptionTofHits->AddEntry("Barrel Hits", kM_TofHits_Barrel);
00425 fMenuViewOptionTofHits->AddEntry("West Hits", kM_TofHits_West);
00426
00427
00428
00429 fMenuViewOptionEmcHits = new TGPopupMenu(gClient->GetRoot());
00430 fMenuViewOptionEmcHits->AddEntry("Global Hits", kM_EmcHits_Global);
00431 fMenuViewOptionEmcHits->AddEntry("East Hits", kM_EmcHits_East);
00432 fMenuViewOptionEmcHits->AddEntry("Barrel Hits", kM_EmcHits_Barrel);
00433 fMenuViewOptionEmcHits->AddEntry("West Hits", kM_EmcHits_West);
00434 fMenuViewOptionEmcHits->AddEntry("Side Hits", kM_EmcHits_Side);
00435
00436
00437
00438 fMenuViewOptionMucHits = new TGPopupMenu(gClient->GetRoot());
00439 fMenuViewOptionMucHits->AddEntry("Global Hits", kM_MucHits_Global);
00440 fMenuViewOptionMucHits->AddEntry("East Hits", kM_MucHits_East);
00441 fMenuViewOptionMucHits->AddEntry("Barrel Hits", kM_MucHits_Barrel);
00442 fMenuViewOptionMucHits->AddEntry("West Hits", kM_MucHits_West);
00443
00444
00445
00446 fMenuViewOptionTracks = new TGPopupMenu(gClient->GetRoot());
00447 fMenuViewOptionTracks->AddEntry("Global ", kM_Tracks_Global);
00448 fMenuViewOptionTracks->AddEntry("Mdc ", kM_Tracks_Mdc);
00449 fMenuViewOptionTracks->AddEntry("Tof ", kM_Tracks_Tof);
00450 fMenuViewOptionTracks->AddEntry("Emc ", kM_Tracks_Emc);
00451 fMenuViewOptionTracks->AddEntry("Muc ", kM_Tracks_Muc);
00452 fMenuViewOptionTracks->AddEntry("Ext ", kM_Tracks_Ext);
00453
00454
00455
00456
00457 fMenuView = new TGPopupMenu(gClient->GetRoot());
00458
00459 fMenuView->AddLabel("General");
00460 fMenuView->AddSeparator();
00461 fMenuView->AddPopup("Header",fMenuViewOptionHeader);
00462 fMenuView->AddSeparator();
00463 fMenuView->AddLabel("Detector", viewGeometryIcon);
00464 fMenuView->AddSeparator();
00465 fMenuView->AddPopup("Mdc",fMenuViewOptionMdc);
00466 fMenuView->AddPopup("Tof",fMenuViewOptionTof);
00467 fMenuView->AddPopup("Emc",fMenuViewOptionEmc);
00468 fMenuView->AddPopup("Muc",fMenuViewOptionMuc);
00469 fMenuView->AddPopup("Full3D",fMenuViewOptionFull3D);
00470 fMenuView->AddPopup("Others",fMenuViewOptionOthers);
00471 fMenuView->AddSeparator();
00472
00473 fMenuView->AddLabel("REC");
00474 fMenuView->AddSeparator();
00475 fMenuView->AddPopup("Mdc Hits",fMenuViewOptionMdcHits);
00476 fMenuView->AddPopup("Tof Hits",fMenuViewOptionTofHits);
00477 fMenuView->AddPopup("Emc Hits",fMenuViewOptionEmcHits);
00478 fMenuView->AddPopup("Muc Hits",fMenuViewOptionMucHits);
00479 fMenuView->AddPopup("Tracks",fMenuViewOptionTracks);
00480 fMenuView->AddSeparator();
00481 fMenuView->AddLabel("Special Views");
00482 fMenuView->AddSeparator();
00483
00484 fMenuView->AddEntry("View with X3D", kM_View_X3D);
00485 fMenuView->AddEntry("View with OpenGL", kM_View_OpenGL);
00486
00487
00488
00489
00490 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
00491
00492 fMenuHelp->AddEntry("Help &Content", kM_Help_Content);
00493 fMenuHelp->AddSeparator();
00494 fMenuHelp->AddEntry("About", kM_Help_About);
00495
00496
00497 fMenuBar = new BesGMenuBar(this, 1, 1, kHorizontalFrame);
00498 fMenuBar->SetBackgroundPixmap(GetPic("MenuBarBckgnd.gif"));
00499
00500 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarFirstItemLayout);
00501
00502 fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
00503 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarLastItemLayout);
00504
00505 fMenuBar->GetMenuTitle(0)->SetPicture(GetPic("MenuFile.gif"));
00506 fMenuBar->GetMenuTitle(0)->SetPictureHL(GetPic("MenuFileHL.gif"));
00507 fMenuBar->GetMenuTitle(1)->SetPicture(GetPic("MenuView.gif"));
00508 fMenuBar->GetMenuTitle(1)->SetPictureHL(GetPic("MenuViewHL.gif"));
00509 fMenuBar->GetMenuTitle(2)->SetPicture(GetPic("MenuHelp.gif"));
00510 fMenuBar->GetMenuTitle(2)->SetPictureHL(GetPic("MenuHelpHL.gif"));
00511
00512
00513
00514
00515 fMenuFile->Connect("Activated(Int_t)","BesClient",this,"HandleMenu(Int_t)");
00516 fMenuEdit->Connect("Activated(Int_t)","BesClient",this,"HandleMenu(Int_t)");
00517 fMenuHelp->Connect("Activated(Int_t)","BesClient",this,"HandleMenu(Int_t)");
00518 fMenuView->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00519 fMenuViewOptionHeader->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00520 fMenuViewOptionMdc->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00521 fMenuViewOptionTof->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00522 fMenuViewOptionEmc->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00523 fMenuViewOptionMuc->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00524 fMenuViewOptionFull3D->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00525 fMenuViewOptionOthers->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00526 fMenuViewOptionMdcHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00527 fMenuViewOptionTofHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00528 fMenuViewOptionEmcHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00529 fMenuViewOptionMucHits->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00530 fMenuViewOptionTracks->Connect("Activated(Int_t)","BesClient",this,"HandleViewOptionMenu(Int_t)");
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558 }
00559
00560
00561
00562 void BesClient::CreateUpButtonBar() {
00563
00564 fUpButtonBarFrame = new TGCompositeFrame(this, 300, 25, kHorizontalFrame);
00565 fUpButtonBarFrame->SetBackgroundPixmap(GetPic("UpButtonBarBckgnd.gif"));
00566
00567 fUpButtonBarFirstItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 15, 0, 1, 2);
00568 fUpButtonBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 2);
00569 fUpButtonBarLastItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 13, 1, 2);
00570
00571 Int_t width = 23, height = 22;
00572 Int_t h, charw, w;
00573 Int_t nUpSplitter = 0;
00574
00575
00576 for (Int_t i = 0; i < kNUpSplitter; i++) {
00577 fUpButtonSplitter[i] = new BesGPictureButton(fUpButtonBarFrame,
00578 gClient->GetPicture("UpButtonSplitter.gif"));
00579 fUpButtonSplitter[i]->SetHeight(20);
00580 fUpButtonSplitter[i]->SetWidth(5);
00581 fUpButtonSplitter[i]->SetState(kButtonDisabled);
00582 }
00583
00584
00585 fLoadGeoFileButton = new BesGPictureButton(fUpButtonBarFrame,
00586 gClient->GetPicture("ButtonLoadGeoFile.gif"),
00587 kM_Button_LoadGeoFile);
00588 fLoadGeoFileButton->SetPictureHL(gClient->GetPicture("ButtonLoadGeoFileHL.gif"));
00589 fLoadGeoFileButton->SetToolTipText("Load Geometry File");
00590 fLoadGeoFileButton->SetHeight(height);
00591 fLoadGeoFileButton->SetWidth(width);
00592 fLoadGeoFileButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00593 fUpButtonBarFrame->AddFrame(fLoadGeoFileButton, fUpButtonBarFirstItemLayout);
00594
00595
00596 fOpenEventFileButton = new BesGPictureButton(fUpButtonBarFrame,
00597 gClient->GetPicture("ButtonOpenEventFile.gif"),
00598 kM_Button_OpenEventFile);
00599 fOpenEventFileButton->SetPictureHL(gClient->GetPicture("ButtonOpenEventFileHL.gif"));
00600 fOpenEventFileButton->SetToolTipText("Open Event File");
00601 fOpenEventFileButton->SetHeight(height);
00602 fOpenEventFileButton->SetWidth(width);
00603 fOpenEventFileButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00604 fUpButtonBarFrame->AddFrame(fOpenEventFileButton, fUpButtonBarItemLayout);
00605
00606
00607 fSavePicAsButton = new BesGPictureButton(fUpButtonBarFrame,
00608 gClient->GetPicture("ButtonSavePicAs.gif"),
00609 kM_Button_SavePicAs);
00610 fSavePicAsButton->SetPictureHL(gClient->GetPicture("ButtonSavePicAsHL.gif"));
00611 fSavePicAsButton->SetToolTipText("Save Picture as");
00612 fSavePicAsButton->SetHeight(height);
00613 fSavePicAsButton->SetWidth(width);
00614 fSavePicAsButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00615 fUpButtonBarFrame->AddFrame(fSavePicAsButton, fUpButtonBarItemLayout);
00616
00617
00618 fSavePicAsPSButton = new BesGPictureButton(fUpButtonBarFrame,
00619 gClient->GetPicture("ButtonSavePicAsPS.gif"),
00620 kM_Button_SavePicAsPS);
00621 fSavePicAsPSButton->SetPictureHL(gClient->GetPicture("ButtonSavePicAsPSHL.gif"));
00622 fSavePicAsPSButton->SetToolTipText("Save Picture as besvis.ps");
00623 fSavePicAsPSButton->SetHeight(height);
00624 fSavePicAsPSButton->SetWidth(width);
00625 fSavePicAsPSButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00626 fUpButtonBarFrame->AddFrame(fSavePicAsPSButton, fUpButtonBarItemLayout);
00627
00628
00629 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
00630 nUpSplitter++;
00631
00632
00633 fRefreshButton = new BesGPictureButton(fUpButtonBarFrame,
00634 gClient->GetPicture("ButtonRefresh.gif"),
00635 kM_Button_Refresh);
00636 fRefreshButton->SetPictureHL(gClient->GetPicture("ButtonRefreshHL.gif"));
00637 fRefreshButton->SetToolTipText("Refresh");
00638 fRefreshButton->SetHeight(height);
00639 fRefreshButton->SetWidth(width);
00640 fRefreshButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00641 fUpButtonBarFrame->AddFrame(fRefreshButton, fUpButtonBarItemLayout);
00642
00643
00644 fResetCurrentButton = new BesGPictureButton(fUpButtonBarFrame,
00645 gClient->GetPicture("ButtonResetCurrent.gif"),
00646 kM_Button_ResetCurrent);
00647 fResetCurrentButton->SetPictureHL(gClient->GetPicture("ButtonResetCurrentHL.gif"));
00648 fResetCurrentButton->SetToolTipText("Reset Current Pad");
00649 fResetCurrentButton->SetHeight(height);
00650 fResetCurrentButton->SetWidth(width);
00651 fResetCurrentButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00652 fUpButtonBarFrame->AddFrame(fResetCurrentButton, fUpButtonBarItemLayout);
00653
00654
00655 fResetAllButton = new BesGPictureButton(fUpButtonBarFrame,
00656 gClient->GetPicture("ButtonResetAll.gif"),
00657 kM_Button_ResetAll);
00658 fResetAllButton->SetPictureHL(gClient->GetPicture("ButtonResetAllHL.gif"));
00659 fResetAllButton->SetToolTipText("Reset All Pads");
00660 fResetAllButton->SetHeight(height);
00661 fResetAllButton->SetWidth(width);
00662 fResetAllButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00663 fUpButtonBarFrame->AddFrame(fResetAllButton, fUpButtonBarItemLayout);
00664
00665
00666 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
00667 nUpSplitter++;
00668
00669
00670 fZoomOutButton = new BesGPictureButton(fUpButtonBarFrame,
00671 gClient->GetPicture("ButtonZoomOut.gif"),
00672 kM_Button_ZoomOut);
00673 fZoomOutButton->SetPictureHL(gClient->GetPicture("ButtonZoomOutHL.gif"));
00674 fZoomOutButton->SetToolTipText("Zoom Out");
00675 fZoomOutButton->SetHeight(height);
00676 fZoomOutButton->SetWidth(width);
00677 fZoomOutButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00678 fUpButtonBarFrame->AddFrame(fZoomOutButton, fUpButtonBarItemLayout);
00679
00680
00681 fZoomRatioNumber = new TGNumberEntryField( fUpButtonBarFrame, kM_Button_ZoomRatioNumber,
00682 100.0,
00683 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
00684 fZoomRatioNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
00685 h = Int_t(fZoomRatioNumber->GetDefaultHeight()/1.2);
00686 charw = fZoomRatioNumber->GetCharWidth("0123456");
00687 w = charw * TMath::Abs(5) / 10 + 8 + 2 * h / 3 + 2;
00688
00689 fZoomRatioNumber->Resize(w, h);
00690
00691 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
00692 fWidgets->Add(fLayout);
00693 fUpButtonBarFrame->AddFrame(fZoomRatioNumber, fLayout);
00694
00695
00696 fZoomRatioPercentButton = new BesGPictureButton(fUpButtonBarFrame,
00697 gClient->GetPicture("ButtonZoomRatioPercent.gif"));
00698 fZoomRatioPercentButton->SetHeight(20);
00699 fZoomRatioPercentButton->SetWidth(10);
00700 fZoomRatioPercentButton->SetState(kButtonDisabled);
00701 fUpButtonBarFrame->AddFrame(fZoomRatioPercentButton, fUpButtonBarItemLayout);
00702
00703
00704 fZoomInButton = new BesGPictureButton(fUpButtonBarFrame,
00705 gClient->GetPicture("ButtonZoomIn.gif"),
00706 kM_Button_ZoomIn);
00707 fZoomInButton->SetPictureHL(gClient->GetPicture("ButtonZoomInHL.gif"));
00708 fZoomInButton->SetToolTipText("Zoom In");
00709 fZoomInButton->SetHeight(height);
00710 fZoomInButton->SetWidth(width);
00711 fZoomInButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00712 fUpButtonBarFrame->AddFrame(fZoomInButton, fUpButtonBarItemLayout);
00713
00714
00715 fCursorButton[0] = new BesGPictureButton(fUpButtonBarFrame,
00716 gClient->GetPicture("ButtonCursorPickST.gif"),
00717 kM_Button_CursorPick);
00718 fCursorButton[0]->SetState(true);
00719 fCursorButton[0]->SetPictureHL(gClient->GetPicture("ButtonCursorPickHL.gif"));
00720 fCursorButton[0]->SetToolTipText("Select Tool");
00721
00722
00723
00724 fCursorButton[1] = new BesGPictureButton(fUpButtonBarFrame,
00725 gClient->GetPicture("ButtonCursorHand.gif"),
00726 kM_Button_CursorHand);
00727 fCursorButton[1]->SetPictureHL(gClient->GetPicture("ButtonCursorHandHL.gif"));
00728 fCursorButton[1]->SetToolTipText("Hand Tool");
00729
00730 for (int i = 0; i < kNCursorState; i++) {
00731 fCursorButton[i]->SetHeight(height);
00732 fCursorButton[i]->SetWidth(width);
00733 fCursorButton[i]->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00734 fUpButtonBarFrame->AddFrame(fCursorButton[i], fUpButtonBarItemLayout);
00735 }
00736
00737
00738 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
00739 nUpSplitter++;
00740
00741
00742 fSwitchDisplayModeButton = new BesGPictureButton(fUpButtonBarFrame,
00743 gClient->GetPicture("ButtonSwitchDisplayMode.gif"),
00744 kM_Button_SwitchDisplayMode);
00745 fSwitchDisplayModeButton->SetPictureHL(gClient->GetPicture("ButtonSwitchDisplayModeHL.gif"));
00746 fSwitchDisplayModeButton->SetToolTipText("Switch Display Mode");
00747 fSwitchDisplayModeButton->SetHeight(height);
00748 fSwitchDisplayModeButton->SetWidth(width);
00749 fSwitchDisplayModeButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00750 fUpButtonBarFrame->AddFrame(fSwitchDisplayModeButton, fUpButtonBarItemLayout);
00751
00752
00753 fSetHomeButton = new BesGPictureButton(fUpButtonBarFrame,
00754 gClient->GetPicture("ButtonSetHome.gif"),
00755 kM_Button_SetHome);
00756 fSetHomeButton->SetPictureHL(gClient->GetPicture("ButtonSetHomeHL.gif"));
00757 fSetHomeButton->SetToolTipText("Set home position");
00758 fSetHomeButton->SetHeight(height);
00759 fSetHomeButton->SetWidth(width);
00760 fSetHomeButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00761 fUpButtonBarFrame->AddFrame(fSetHomeButton, fUpButtonBarItemLayout);
00762
00763
00764 fGoHomeButton = new BesGPictureButton(fUpButtonBarFrame,
00765 gClient->GetPicture("ButtonGoHome.gif"),
00766 kM_Button_GoHome);
00767 fGoHomeButton->SetPictureHL(gClient->GetPicture("ButtonGoHomeHL.gif"));
00768 fGoHomeButton->SetToolTipText("Go to home position");
00769 fGoHomeButton->SetHeight(height);
00770 fGoHomeButton->SetWidth(width);
00771 fGoHomeButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00772 fUpButtonBarFrame->AddFrame(fGoHomeButton, fUpButtonBarItemLayout);
00773
00774
00775 fSaveMyConfigButton = new BesGPictureButton(fUpButtonBarFrame,
00776 gClient->GetPicture("ButtonSaveMyConfig.gif"),
00777 kM_Button_SaveMyConfig);
00778 fSaveMyConfigButton->SetPictureHL(gClient->GetPicture("ButtonSaveMyConfigHL.gif"));
00779 fSaveMyConfigButton->SetToolTipText("Save My Style");
00780 fSaveMyConfigButton->SetHeight(height);
00781 fSaveMyConfigButton->SetWidth(width);
00782 fSaveMyConfigButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00783 fUpButtonBarFrame->AddFrame(fSaveMyConfigButton, fUpButtonBarItemLayout);
00784
00785
00786 fLoadMyConfigButton = new BesGPictureButton(fUpButtonBarFrame,
00787 gClient->GetPicture("ButtonLoadMyConfig.gif"),
00788 kM_Button_LoadMyConfig);
00789 fLoadMyConfigButton->SetPictureHL(gClient->GetPicture("ButtonLoadMyConfigHL.gif"));
00790 fLoadMyConfigButton->SetToolTipText("Load My Style");
00791 fLoadMyConfigButton->SetHeight(height);
00792 fLoadMyConfigButton->SetWidth(width);
00793 fLoadMyConfigButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00794 fUpButtonBarFrame->AddFrame(fLoadMyConfigButton, fUpButtonBarItemLayout);
00795
00796
00797 fPaletteButton = new BesGPictureButton(fUpButtonBarFrame,
00798 gClient->GetPicture("ButtonPalette.gif"),
00799 kM_Button_Palette);
00800 fPaletteButton->SetPictureHL(gClient->GetPicture("ButtonPaletteHL.gif"));
00801 fPaletteButton->SetToolTipText("Palette");
00802 fPaletteButton->SetHeight(height);
00803 fPaletteButton->SetWidth(width);
00804 fPaletteButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00805 fUpButtonBarFrame->AddFrame(fPaletteButton, fUpButtonBarItemLayout);
00806
00807
00808 fUpButtonBarFrame->AddFrame(fUpButtonSplitter[nUpSplitter], fUpButtonBarItemLayout);
00809 nUpSplitter++;
00810
00811
00812 fHelpButton = new BesGPictureButton(fUpButtonBarFrame,
00813 gClient->GetPicture("ButtonHelp.gif"),
00814 kM_Button_Help);
00815 fHelpButton->SetPictureHL(gClient->GetPicture("ButtonHelpHL.gif"));
00816 fHelpButton->SetToolTipText("Help");
00817 fHelpButton->SetHeight(height);
00818 fHelpButton->SetWidth(width);
00819 fHelpButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00820 fUpButtonBarFrame->AddFrame(fHelpButton, fUpButtonBarLastItemLayout);
00821 }
00822
00823
00824
00825 void BesClient::CreateDisplayModeBar() {
00826
00827 fDisplayModeBarFrame = new TGCompositeFrame(this, 300, 16, kHorizontalFrame);
00828 fDisplayModeBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0);
00829
00830 fDisplayModeButton[0] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayMode2DST.gif"), kM_Button_DisplayMode2D);
00831 fDisplayModeButton[1] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayModeXY.gif"), kM_Button_DisplayModeXY);
00832 fDisplayModeButton[2] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayModeZR.gif"), kM_Button_DisplayModeZR);
00833 fDisplayModeButton[3] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayMode3D.gif"), kM_Button_DisplayMode3D);
00834 fDisplayModeButton[4] = new BesGPictureButton(fDisplayModeBarFrame, gClient->GetPicture("DisplayModeAll.gif"), kM_Button_DisplayModeAll);
00835
00836 fDisplayModeButton[0]->SetState(true);
00837 fDisplayModeButton[1]->SetState(false);
00838 fDisplayModeButton[2]->SetState(false);
00839 fDisplayModeButton[3]->SetState(false);
00840 fDisplayModeButton[4]->SetState(false);
00841
00842 fDisplayModeButton[0]->SetPictureHL(gClient->GetPicture("DisplayMode2DHL.gif"));
00843 fDisplayModeButton[1]->SetPictureHL(gClient->GetPicture("DisplayModeXYHL.gif"));
00844 fDisplayModeButton[2]->SetPictureHL(gClient->GetPicture("DisplayModeZRHL.gif"));
00845 fDisplayModeButton[3]->SetPictureHL(gClient->GetPicture("DisplayMode3DHL.gif"));
00846 fDisplayModeButton[4]->SetPictureHL(gClient->GetPicture("DisplayModeAllHL.gif"));
00847
00848 fDisplayModeButton[0]->SetToolTipText("XY+ZR view");
00849 fDisplayModeButton[1]->SetToolTipText("XY view");
00850 fDisplayModeButton[2]->SetToolTipText("ZR view");
00851 fDisplayModeButton[3]->SetToolTipText("3D view");
00852 fDisplayModeButton[4]->SetToolTipText("All view");
00853
00854 Int_t width = 16, height = 16;
00855 for (Int_t i = 0; i < kNDisplayMode; i++) {
00856 fDisplayModeButton[i]->SetState(kButtonUp);
00857 fDisplayModeButton[i]->SetHeight(height);
00858 fDisplayModeButton[i]->SetWidth(width);
00859 fDisplayModeButton[i]->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00860 fDisplayModeBarFrame->AddFrame(fDisplayModeButton[i], fDisplayModeBarItemLayout);
00861 }
00862 }
00863
00864
00865
00866 void BesClient::CreateToolBar() {
00867
00868 fToolBarFrame = new TGCompositeFrame(this, 300, 25, kHorizontalFrame);
00869 fToolBarFrame->SetBackgroundPixmap(GetPic("ToolButtonBarBckgnd.gif"));
00870
00871 fToolBarFirstItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 0, 1, 2);
00872 fToolBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 2);
00873 fToolBarLastItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 14, 1, 2);
00874
00875 Int_t width = 23, height = 22;
00876 Int_t nToolSplitter = 0;
00877
00878
00879 for (Int_t i = 0; i < kNToolSplitter; i++) {
00880 fToolButtonSplitter[i] = new BesGPictureButton(fToolBarFrame,
00881 gClient->GetPicture("ToolButtonSplitter.gif"));
00882 fToolButtonSplitter[i]->SetHeight(20);
00883 fToolButtonSplitter[i]->SetWidth(5);
00884 fToolButtonSplitter[i]->SetState(kButtonDisabled);
00885 }
00886
00887
00888 fSwitchPadButton = new BesGPictureButton(fToolBarFrame,
00889 gClient->GetPicture("ButtonSwitchPad.gif"),
00890 kM_Button_SwitchPad);
00891 fSwitchPadButton->SetPictureHL(gClient->GetPicture("ButtonSwitchPadHL.gif"));
00892 fSwitchPadButton->SetToolTipText("Switch Among Pads");
00893 fSwitchPadButton->SetHeight(height);
00894 fSwitchPadButton->SetWidth(width);
00895 fSwitchPadButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00896 fToolBarFrame->AddFrame(fSwitchPadButton, fToolBarFirstItemLayout);
00897
00898
00899 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarItemLayout);
00900 nToolSplitter++;
00901
00902
00903 fShowInfoButton = new BesGPictureButton(fToolBarFrame,
00904 gClient->GetPicture("ButtonShowInfoST.gif"),
00905 kM_Button_ShowInfo);
00906 fShowInfoButton->SetState(true);
00907 fShowInfoButton->SetPictureHL(gClient->GetPicture("ButtonShowInfoHL.gif"));
00908 fShowInfoButton->SetToolTipText("Show Info");
00909 fShowInfoButton->SetHeight(height);
00910 fShowInfoButton->SetWidth(width);
00911 fShowInfoButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00912 fToolBarFrame->AddFrame(fShowInfoButton, fToolBarItemLayout);
00913
00914
00915 fShowAxisButton = new BesGPictureButton(fToolBarFrame,
00916 gClient->GetPicture("ButtonShowAxis.gif"),
00917 kM_Button_ShowAxis);
00918 fShowAxisButton->SetPictureHL(gClient->GetPicture("ButtonShowAxisHL.gif"));
00919 fShowAxisButton->SetToolTipText("Show Axis");
00920 fShowAxisButton->SetHeight(height);
00921 fShowAxisButton->SetWidth(width);
00922 fShowAxisButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00923 fToolBarFrame->AddFrame(fShowAxisButton, fToolBarItemLayout);
00924
00925
00926 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarItemLayout);
00927 nToolSplitter++;
00928
00929
00930 fFishEyeViewButton = new BesGPictureButton(fToolBarFrame,
00931 gClient->GetPicture("ButtonFishEyeView.gif"),
00932 kM_Button_FishEyeView);
00933 fFishEyeViewButton->SetPictureHL(gClient->GetPicture("ButtonFishEyeViewHL.gif"));
00934 fFishEyeViewButton->SetToolTipText("FishEye View");
00935 fFishEyeViewButton->SetHeight(height);
00936 fFishEyeViewButton->SetWidth(width);
00937 fFishEyeViewButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00938 fToolBarFrame->AddFrame(fFishEyeViewButton, fToolBarItemLayout);
00939
00940
00941 fParallelViewButton = new BesGPictureButton(fToolBarFrame,
00942 gClient->GetPicture("ButtonParallelViewST.gif"),
00943 kM_Button_ParallelView);
00944 fParallelViewButton->SetState(true);
00945 fParallelViewButton->SetPictureHL(gClient->GetPicture("ButtonParallelViewHL.gif"));
00946 fParallelViewButton->SetToolTipText("Parallel View");
00947 fParallelViewButton->SetHeight(height);
00948 fParallelViewButton->SetWidth(width);
00949 fParallelViewButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00950 fToolBarFrame->AddFrame(fParallelViewButton, fToolBarItemLayout);
00951
00952
00953 fPerspectiveViewButton = new BesGPictureButton(fToolBarFrame,
00954 gClient->GetPicture("ButtonPerspectiveView.gif"),
00955 kM_Button_PerspectiveView);
00956 fPerspectiveViewButton->SetPictureHL(gClient->GetPicture("ButtonPerspectiveViewHL.gif"));
00957 fPerspectiveViewButton->SetToolTipText("Perspective View");
00958 fPerspectiveViewButton->SetHeight(height);
00959 fPerspectiveViewButton->SetWidth(width);
00960 fPerspectiveViewButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00961 fToolBarFrame->AddFrame(fPerspectiveViewButton, fToolBarItemLayout);
00962
00963
00964 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarItemLayout);
00965 nToolSplitter++;
00966
00967
00968 fOpenGLButton = new BesGPictureButton(fToolBarFrame,
00969 gClient->GetPicture("ButtonOpenGL.gif"),
00970 kM_Button_OpenGL);
00971 fOpenGLButton->SetPictureHL(gClient->GetPicture("ButtonOpenGLHL.gif"));
00972 fOpenGLButton->SetToolTipText("OpenGL View");
00973 fOpenGLButton->SetHeight(height);
00974 fOpenGLButton->SetWidth(width);
00975 fOpenGLButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00976 fToolBarFrame->AddFrame(fOpenGLButton, fToolBarItemLayout);
00977
00978
00979 fX3DButton = new BesGPictureButton(fToolBarFrame,
00980 gClient->GetPicture("ButtonX3D.gif"),
00981 kM_Button_X3D);
00982 fX3DButton->SetPictureHL(gClient->GetPicture("ButtonX3DHL.gif"));
00983 fX3DButton->SetToolTipText("X3D View");
00984 fX3DButton->SetHeight(height);
00985 fX3DButton->SetWidth(width);
00986 fX3DButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
00987 fToolBarFrame->AddFrame(fX3DButton, fToolBarItemLayout);
00988
00989
00990 fToolBarFrame->AddFrame(fToolButtonSplitter[nToolSplitter], fToolBarLastItemLayout);
00991 nToolSplitter++;
00992 }
00993
00994
00995
00996 void BesClient::CreateTitleBar() {
00997
00998
00999
01000
01001 fTitleFrame = new TGHorizontalFrame(this, this->GetWidth(), 10);
01002 }
01003
01004
01005
01006 void BesClient::CreateStatusBar() {
01007
01008
01009 Int_t nPart = 3;
01010 Int_t parts[] = {40, 50, 10};
01011 fStatusBar = new TGStatusBar(this, this->GetWidth(), 20, kHorizontalFrame);
01012 fStatusBar->SetParts(parts, nPart);
01013 fStatusBar->SetBackgroundPixmap(GetPic("StatusBarBckgnd.gif"));
01014 for (Int_t iPart = 0; iPart < nPart; iPart++) {
01015 fStatusBar->GetBarPart(iPart)->SetBackgroundPixmap(GetPic("StatusBarBckgnd.gif"));
01016 }
01017
01018
01019 fStatusBar->SetText("Ready", 0);
01020 }
01021
01022
01023
01024 void BesClient::CreateMainFrame() {
01025
01026
01027
01028 fMainFrame = new TGHorizontalFrame(this, this->GetWidth(), this->GetHeight()-26);
01029
01030
01031 fV1 = new TGVerticalFrame(fMainFrame, 250, fMainFrame->GetHeight(), kFixedWidth);
01032
01033
01034 CreateCanvas();
01035
01036
01037 CreateTabs();
01038
01039 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 0, 2, 0, 0);
01040 fWidgets->Add(fLayout);
01041 fV1->AddFrame(fTabs, fLayout);
01042
01043
01044
01045
01046 fMainFrame->AddFrame(fEmbeddedCanvas, fECLayout);
01047
01048 fLayout = new TGLayoutHints(kLHintsRight | kLHintsExpandY);
01049 fWidgets->Add(fLayout);
01050 fMainFrame->AddFrame(fV1, fLayout);
01051
01052 TGVSplitter *VSplitter = new TGVSplitter(fMainFrame);
01053 VSplitter->SetFrame(fV1, kFALSE);
01054 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandY);
01055 fWidgets->Add(fLayout);
01056 fMainFrame->AddFrame(VSplitter, fLayout);
01057 }
01058
01059
01060
01061
01062 void BesClient::CreateCanvas() {
01063
01064
01065
01066 fECLayout = new TGLayoutHints( kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0);
01067 fEmbeddedCanvas = new TRootEmbeddedCanvas(0, fMainFrame, fMainFrame->GetWidth()/4*3-12, fMainFrame->GetHeight()-46);
01068 Int_t wid = fEmbeddedCanvas->GetCanvasWindowId();
01069 fCanvas = new TCanvas("BesVis", fEmbeddedCanvas->GetWidth(), fEmbeddedCanvas->GetHeight()-10, wid);
01070 fEmbeddedCanvas->AdoptCanvas(fCanvas);
01071 fCanvas->cd();
01072
01073 fDisplay = new BesVisDisplay("BESIII Event Display");
01074 fDisplay->SetCanvas(fCanvas);
01075 fDisplay->Init();
01076
01077 }
01078
01079
01080
01081 void BesClient::CreateTabs() {
01082
01083
01084
01085 fTabs = new TGTab(fV1, fV1->GetWidth(), fV1->GetHeight());
01086
01087
01088
01089 TGCompositeFrame *tf = 0;
01090 Int_t h, charw, w;
01091
01092
01093
01094
01095 tf = fTabs->AddTab("View");
01096 tf->SetBackgroundPixmap(GetPic("8.gif"));
01097
01098
01099
01100
01101 fAutoFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
01102 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX , 15, 15, 15, 10);
01103 fWidgets->Add(fLayout);
01104 tf->AddFrame(fAutoFrame, fLayout);
01105 fAutoFrame->SetBackgroundPixmap(GetPic("AutoFrameBckgnd.gif"));
01106
01107
01108 fAutoTextFrame = new TGCompositeFrame(fAutoFrame, fAutoFrame->GetWidth(), 30, kHorizontalFrame);
01109 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
01110 fWidgets->Add(fLayout);
01111 fAutoFrame->AddFrame(fAutoTextFrame, fLayout);
01112 fAutoTextFrame->SetBackgroundPixmap(GetPic("AutoControlBckgnd.gif"));
01113
01114 fAutoTextLabel = new TGLabel(fAutoTextFrame,"Auto Control ");
01115 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 0);
01116 fWidgets->Add(fLayout);
01117 fAutoTextFrame->AddFrame(fAutoTextLabel, fLayout);
01118 fAutoTextLabel->SetBackgroundPixmap(GetPic("AutoControlBckgnd.gif"));
01119
01120
01121 fFrameAutoRotate = new TGGroupFrame(fAutoFrame, "");
01122 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0);
01123
01124 fWidgets->Add(fLayout);
01125 fAutoFrame->AddFrame(fFrameAutoRotate, fLayout);
01126
01127
01128 fChkBtnAutoRotate = new TGCheckButton(fFrameAutoRotate, "Auto", kM_Button_AutoRotate);
01129 fLayout = new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 2);
01130 fFrameAutoRotate->AddFrame(fChkBtnAutoRotate, fLayout);
01131 fChkBtnAutoRotate->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01132
01133
01134 fRotateSpeedFrame = new TGCompositeFrame(fFrameAutoRotate, fFrameAutoRotate->GetWidth()-20, 30, kHorizontalFrame);
01135 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 0, 2, 2);
01136 fWidgets->Add(fLayout);
01137 fFrameAutoRotate->AddFrame(fRotateSpeedFrame, fLayout);
01138
01139
01140 fNumEntryRotateSpeed = new TGNumberEntryField( fRotateSpeedFrame, kM_Button_RotateSpeed,
01141 this->GetRotateSpeed(),
01142 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 1 );
01143 h = fNumEntryRotateSpeed->GetDefaultHeight();
01144 charw = fNumEntryRotateSpeed->GetCharWidth("0123456");
01145 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3;
01146 fNumEntryRotateSpeed->Resize(w, h);
01147
01148
01149 fNumEntryRotateSpeed->SetHeight(20);
01150 fNumEntryRotateSpeed->SetNumber(this->GetRotateSpeed());
01151 fNumEntryRotateSpeed->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01152 fNumEntryRotateSpeed->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
01153 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 2, 2);
01154 fWidgets->Add(fLayout);
01155 fRotateSpeedFrame->AddFrame(fNumEntryRotateSpeed, fLayout);
01156
01157
01158 fRotateSpeedLabel = new TGLabel(fRotateSpeedFrame," deg/sec ");
01159 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 4, 2, 2);
01160 fWidgets->Add(fLayout);
01161 fRotateSpeedFrame->AddFrame(fRotateSpeedLabel, fLayout);
01162
01163
01164 fRotateFPSFrame = new TGCompositeFrame(fFrameAutoRotate, fFrameAutoRotate->GetWidth()-20, 30, kHorizontalFrame);
01165 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 0, 2, 2);
01166 fWidgets->Add(fLayout);
01167 fFrameAutoRotate->AddFrame(fRotateFPSFrame, fLayout);
01168
01169
01170 fNumEntryRotateFPS = new TGNumberEntry(fRotateFPSFrame,this->GetRotateFPS(), 3, kM_Button_RotateFPS,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1);
01171 fNumEntryRotateFPS->SetHeight(20);
01172 fNumEntryRotateFPS->SetNumber(this->GetRotateFPS());
01173 fNumEntryRotateFPS->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01174 fNumEntryRotateFPS->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
01175 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 2, 2);
01176 fWidgets->Add(fLayout);
01177 fRotateFPSFrame->AddFrame(fNumEntryRotateFPS, fLayout);
01178
01179
01180 fRotateFPSLabel = new TGLabel(fRotateFPSFrame," fps ");
01181 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 4, 2, 2);
01182 fWidgets->Add(fLayout);
01183 fRotateFPSFrame->AddFrame(fRotateFPSLabel, fLayout);
01184
01185
01186
01187
01188
01189 fViewFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
01190 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX , 15, 15, 15, 10);
01191 fWidgets->Add(fLayout);
01192 tf->AddFrame(fViewFrame, fLayout);
01193 fViewFrame->SetBackgroundPixmap(GetPic("ViewFrameBckgnd.gif"));
01194
01195
01196 fViewTextFrame = new TGCompositeFrame(fViewFrame, fViewFrame->GetWidth(), 30, kHorizontalFrame);
01197 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
01198 fWidgets->Add(fLayout);
01199 fViewFrame->AddFrame(fViewTextFrame, fLayout);
01200 fViewTextFrame->SetBackgroundPixmap(GetPic("ViewControlBckgnd.gif"));
01201
01202 fViewTextLabel = new TGLabel(fViewTextFrame,"View Control ");
01203 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 4);
01204 fWidgets->Add(fLayout);
01205 fViewTextFrame->AddFrame(fViewTextLabel, fLayout);
01206 fViewTextLabel->SetBackgroundPixmap(GetPic("ViewControlBckgnd.gif"));
01207
01208
01209
01210 fRotateStepFrame = new TGCompositeFrame(fViewFrame, fViewFrame->GetWidth()-20, 30, kHorizontalFrame);
01211 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 0, 8, 5);
01212 fWidgets->Add(fLayout);
01213 fViewFrame->AddFrame(fRotateStepFrame, fLayout);
01214
01215
01216 fRotateStepLabel = new TGLabel(fRotateStepFrame," Step:");
01217 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 10, 2, 0, 0);
01218 fWidgets->Add(fLayout);
01219 fRotateStepFrame->AddFrame(fRotateStepLabel, fLayout);
01220
01221
01222 fNumEntryRotateStep = new TGNumberEntryField( fRotateStepFrame, kM_Button_RotateStep,
01223 this->GetRotateStep(),
01224 (TGNumberFormat::EStyle) 2, (TGNumberFormat::EAttribute) 1 );
01225 h = fNumEntryRotateStep->GetDefaultHeight();
01226 charw = fNumEntryRotateStep->GetCharWidth("0123456");
01227 w = charw * TMath::Abs(5) / 10 + 8 + 2 * h / 3;
01228 fNumEntryRotateStep->Resize(w, h);
01229
01230 fNumEntryRotateStep->SetHeight(20);
01231 fNumEntryRotateStep->SetNumber(this->GetRotateStep());
01232 fNumEntryRotateStep->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01233 fNumEntryRotateStep->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
01234 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 0, 0, 0);
01235 fWidgets->Add(fLayout);
01236 fRotateStepFrame->AddFrame(fNumEntryRotateStep, fLayout);
01237
01238
01239 fRotateStepUnitLabel = new TGLabel(fRotateStepFrame," deg ");
01240 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 0, 4, 0, 0);
01241 fWidgets->Add(fLayout);
01242 fRotateStepFrame->AddFrame(fRotateStepUnitLabel, fLayout);
01243
01244
01245 fViewContentFrame = new TGCompositeFrame(fViewFrame, fViewFrame->GetWidth(), fViewFrame->GetHeight()-30, kVerticalFrame);
01246 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY , 0, 0, 0, 0);
01247 fWidgets->Add(fLayout);
01248 fViewFrame->AddFrame(fViewContentFrame, fLayout);
01249
01250
01251 fViewContent1Frame = new TGCompositeFrame(fViewContentFrame, fViewFrame->GetWidth(), 39, kHorizontalFrame);
01252 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 0, 0, 3, 0);
01253 fWidgets->Add(fLayout);
01254 fViewContent1Frame->SetBackgroundPixmap(GetPic("ViewContent1Bckgnd.gif"));
01255 fViewContentFrame->AddFrame(fViewContent1Frame, fLayout);
01256
01257
01258 fViewCounterClockWiseButton = new BesGPictureButton(fViewContent1Frame,
01259 gClient->GetPicture("ViewCounterClockwise.gif"),
01260 kM_Button_ViewCounterClockWise);
01261 fViewCounterClockWiseButton->SetToolTipText("Rotate Counter Clockwise");
01262 fViewCounterClockWiseButton->SetHeight(37);
01263 fViewCounterClockWiseButton->SetWidth(37);
01264 fViewCounterClockWiseButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01265
01266 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 22, 0, 0);
01267 fWidgets->Add(fLayout);
01268 fViewContent1Frame->AddFrame(fViewCounterClockWiseButton, fLayout);
01269
01270
01271 fViewMoveUpButton = new BesGPictureButton(fViewContent1Frame,
01272 gClient->GetPicture("ViewMoveUp.gif"),
01273 kM_Button_ViewMoveUp);
01274 fViewMoveUpButton->SetToolTipText("Move Up");
01275 fViewMoveUpButton->SetHeight(20);
01276 fViewMoveUpButton->SetWidth(23);
01277 fViewMoveUpButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01278
01279 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 5, 5, 0, 0);
01280 fWidgets->Add(fLayout);
01281 fViewContent1Frame->AddFrame(fViewMoveUpButton, fLayout);
01282
01283
01284 fViewClockWiseButton = new BesGPictureButton(fViewContent1Frame,
01285 gClient->GetPicture("ViewClockwise.gif"),
01286 kM_Button_ViewClockWise);
01287 fViewClockWiseButton->SetToolTipText("Rotate Clockwise");
01288 fViewClockWiseButton->SetHeight(37);
01289 fViewClockWiseButton->SetWidth(37);
01290 fViewClockWiseButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01291
01292 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 22, 5, 0, 0);
01293 fWidgets->Add(fLayout);
01294 fViewContent1Frame->AddFrame(fViewClockWiseButton, fLayout);
01295
01296
01297 fViewContent2Frame = new TGCompositeFrame(fViewContentFrame, fViewFrame->GetWidth(), 23, kHorizontalFrame);
01298 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 0, 0, 0, 0);
01299 fWidgets->Add(fLayout);
01300 fViewContent2Frame->SetBackgroundPixmap(GetPic("ViewContent2Bckgnd.gif"));
01301 fViewContentFrame->AddFrame(fViewContent2Frame, fLayout);
01302
01303
01304 fViewMoveLeftButton = new BesGPictureButton(fViewContent2Frame,
01305 gClient->GetPicture("ViewMoveLeft.gif"),
01306 kM_Button_ViewMoveLeft);
01307 fViewMoveLeftButton->SetToolTipText("Move Left");
01308 fViewMoveLeftButton->SetHeight(23);
01309 fViewMoveLeftButton->SetWidth(23);
01310 fViewMoveLeftButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01311
01312 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 49, 2, 0, 0);
01313 fWidgets->Add(fLayout);
01314 fViewContent2Frame->AddFrame(fViewMoveLeftButton, fLayout);
01315
01316
01317 fViewMoveCenterButton = new BesGPictureButton(fViewContent2Frame,
01318 gClient->GetPicture("ViewMoveCenter.gif"),
01319 kM_Button_ViewMoveCenter);
01320 fViewMoveCenterButton->SetToolTipText("Move Center");
01321 fViewMoveCenterButton->SetHeight(13);
01322 fViewMoveCenterButton->SetWidth(13);
01323 fViewMoveCenterButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01324
01325 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 0, 0, 0, 0);
01326 fWidgets->Add(fLayout);
01327 fViewContent2Frame->AddFrame(fViewMoveCenterButton, fLayout);
01328
01329
01330 fViewMoveRightButton = new BesGPictureButton(fViewContent2Frame,
01331 gClient->GetPicture("ViewMoveRight.gif"),
01332 kM_Button_ViewMoveRight);
01333 fViewMoveRightButton->SetToolTipText("Move Right");
01334 fViewMoveRightButton->SetHeight(23);
01335 fViewMoveRightButton->SetWidth(23);
01336 fViewMoveRightButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01337
01338 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 2, 49, 0, 0);
01339 fWidgets->Add(fLayout);
01340 fViewContent2Frame->AddFrame(fViewMoveRightButton, fLayout);
01341
01342
01343 fViewContent3Frame = new TGCompositeFrame(fViewContentFrame, fViewFrame->GetWidth(), 32, kHorizontalFrame);
01344 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 0, 0, 0, 3);
01345 fWidgets->Add(fLayout);
01346 fViewContent3Frame->SetBackgroundPixmap(GetPic("ViewContent3Bckgnd.gif"));
01347 fViewContentFrame->AddFrame(fViewContent3Frame, fLayout);
01348
01349
01350 fViewMoveDownButton = new BesGPictureButton(fViewContent3Frame,
01351 gClient->GetPicture("ViewMoveDown.gif"),
01352 kM_Button_ViewMoveDown);
01353 fViewMoveDownButton->SetToolTipText("Move Down");
01354 fViewMoveDownButton->SetHeight(32);
01355 fViewMoveDownButton->SetWidth(23);
01356 fViewMoveDownButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01357
01358
01359 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 69, 0, 0, 0);
01360 fWidgets->Add(fLayout);
01361 fViewContent3Frame->AddFrame(fViewMoveDownButton, fLayout);
01362
01363
01364 fViewResetAngleButton = new BesGPictureButton(fViewContent3Frame,
01365 gClient->GetPicture("ViewResetAngle.gif"),
01366 kM_Button_ViewResetAngle);
01367
01368 fViewResetAngleButton->SetToolTipText("Reset Angles");
01369 fViewResetAngleButton->SetHeight(27);
01370 fViewResetAngleButton->SetWidth(27);
01371 fViewResetAngleButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01372
01373 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 30, 0, 0, 0);
01374 fWidgets->Add(fLayout);
01375 fViewContent3Frame->AddFrame(fViewResetAngleButton, fLayout);
01376
01377
01378
01379 fViewAngleFrame = new TGCompositeFrame(fViewContentFrame, fViewContentFrame->GetWidth(), 50, kHorizontalFrame);
01380 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 4, 4, 0, 0);
01381 fWidgets->Add(fLayout);
01382 fViewContentFrame->AddFrame(fViewAngleFrame, fLayout);
01383
01384
01385 fViewAngleThetaFrame = new TGCompositeFrame(fViewAngleFrame, fViewAngleFrame->GetWidth(), 50, kVerticalFrame);
01386 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 3, 3, 3, 3);
01387 fWidgets->Add(fLayout);
01388 fViewAngleFrame->AddFrame(fViewAngleThetaFrame, fLayout);
01389
01390
01391 fViewAngleThetaMinusButton = new BesGPictureButton(fViewAngleThetaFrame,
01392 gClient->GetPicture("ViewAngleMinus.gif"),
01393 kM_Button_ViewAngleThetaMinus);
01394 fViewAngleThetaMinusButton->SetToolTipText("Theta -");
01395 fViewAngleThetaMinusButton->SetHeight(22);
01396 fViewAngleThetaMinusButton->SetWidth(22);
01397 fViewAngleThetaMinusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01398
01399 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
01400 fWidgets->Add(fLayout);
01401 fViewAngleThetaFrame->AddFrame(fViewAngleThetaMinusButton, fLayout);
01402
01403
01404 fViewAngleThetaSlider = new TGVSlider(fViewAngleThetaFrame, 120, kSlider2 | kScaleBoth, kM_Slider_ViewAngleTheta);
01405 fViewAngleThetaSlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
01406 fViewAngleThetaSlider->SetRange(0, 180);
01407 fViewAngleThetaSlider->SetPosition(0);
01408 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandY, 5, 5, 0, 0);
01409 fWidgets->Add(fLayout);
01410 fViewAngleThetaFrame->AddFrame(fViewAngleThetaSlider, fLayout);
01411
01412
01413 fViewAngleThetaPlusButton = new BesGPictureButton(fViewAngleThetaFrame,
01414 gClient->GetPicture("ViewAnglePlus.gif"),
01415 kM_Button_ViewAngleThetaPlus);
01416 fViewAngleThetaPlusButton->SetToolTipText("Theta +");
01417 fViewAngleThetaPlusButton->SetHeight(22);
01418 fViewAngleThetaPlusButton->SetWidth(22);
01419 fViewAngleThetaPlusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01420
01421 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
01422 fWidgets->Add(fLayout);
01423 fViewAngleThetaFrame->AddFrame(fViewAngleThetaPlusButton, fLayout);
01424
01425
01426
01427
01428 fViewAngleThetaNumber = new TGNumberEntryField( fViewAngleThetaFrame, kM_Button_ViewAngleThetaNumber,
01429 fViewAngleThetaSlider->GetPosition(),
01430 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
01431 fViewAngleThetaNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01432 h = fViewAngleThetaNumber->GetDefaultHeight();
01433 charw = fViewAngleThetaNumber->GetCharWidth("0123456");
01434 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3;
01435 fViewAngleThetaNumber->Resize(w, h);
01436
01437 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 0);
01438 fWidgets->Add(fLayout);
01439 fViewAngleThetaFrame->AddFrame(fViewAngleThetaNumber, fLayout);
01440
01441
01442 fViewAngleThetaLabel = new TGLabel(fViewAngleThetaFrame,"theta");
01443 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 2);
01444 fWidgets->Add(fLayout);
01445 fViewAngleThetaFrame->AddFrame(fViewAngleThetaLabel, fLayout);
01446
01447
01448 fViewAnglePhiFrame = new TGCompositeFrame(fViewAngleFrame, fViewAngleFrame->GetWidth(), 50, kVerticalFrame);
01449 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 3, 3, 3, 3);
01450 fWidgets->Add(fLayout);
01451 fViewAngleFrame->AddFrame(fViewAnglePhiFrame, fLayout);
01452
01453
01454 fViewAnglePhiMinusButton = new BesGPictureButton(fViewAnglePhiFrame,
01455 gClient->GetPicture("ViewAngleMinus.gif"),
01456 kM_Button_ViewAnglePhiMinus);
01457 fViewAnglePhiMinusButton->SetToolTipText("Phi -");
01458 fViewAnglePhiMinusButton->SetHeight(22);
01459 fViewAnglePhiMinusButton->SetWidth(22);
01460 fViewAnglePhiMinusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01461
01462 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
01463 fWidgets->Add(fLayout);
01464 fViewAnglePhiFrame->AddFrame(fViewAnglePhiMinusButton, fLayout);
01465
01466
01467 fViewAnglePhiSlider = new TGVSlider(fViewAnglePhiFrame, 120, kSlider2 | kScaleBoth, kM_Slider_ViewAnglePhi);
01468 fViewAnglePhiSlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
01469 fViewAnglePhiSlider->SetRange(0, 360);
01470 fViewAnglePhiSlider->SetPosition(0);
01471 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandY, 5, 5, 0, 0);
01472 fWidgets->Add(fLayout);
01473 fViewAnglePhiFrame->AddFrame(fViewAnglePhiSlider, fLayout);
01474
01475
01476 fViewAnglePhiPlusButton = new BesGPictureButton(fViewAnglePhiFrame,
01477 gClient->GetPicture("ViewAnglePlus.gif"),
01478 kM_Button_ViewAnglePhiPlus);
01479 fViewAnglePhiPlusButton->SetToolTipText("Phi +");
01480 fViewAnglePhiPlusButton->SetHeight(22);
01481 fViewAnglePhiPlusButton->SetWidth(22);
01482 fViewAnglePhiPlusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01483
01484 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
01485 fWidgets->Add(fLayout);
01486 fViewAnglePhiFrame->AddFrame(fViewAnglePhiPlusButton, fLayout);
01487
01488
01489
01490
01491 fViewAnglePhiNumber = new TGNumberEntryField( fViewAnglePhiFrame, kM_Button_ViewAnglePhiNumber,
01492 fViewAnglePhiSlider->GetPosition(),
01493 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
01494 fViewAnglePhiNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01495 h = fViewAnglePhiNumber->GetDefaultHeight();
01496 charw = fViewAnglePhiNumber->GetCharWidth("0123456");
01497 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3;
01498 fViewAnglePhiNumber->Resize(w, h);
01499
01500 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 0);
01501 fWidgets->Add(fLayout);
01502 fViewAnglePhiFrame->AddFrame(fViewAnglePhiNumber, fLayout);
01503
01504
01505 fViewAnglePhiLabel = new TGLabel(fViewAnglePhiFrame,"phi");
01506 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 2);
01507 fWidgets->Add(fLayout);
01508 fViewAnglePhiFrame->AddFrame(fViewAnglePhiLabel, fLayout);
01509
01510
01511 fViewAnglePsiFrame = new TGCompositeFrame(fViewAngleFrame, fViewAngleFrame->GetWidth(), 50, kVerticalFrame);
01512 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop , 3, 3, 3, 3);
01513 fWidgets->Add(fLayout);
01514 fViewAngleFrame->AddFrame(fViewAnglePsiFrame, fLayout);
01515
01516
01517 fViewAnglePsiMinusButton = new BesGPictureButton(fViewAnglePsiFrame,
01518 gClient->GetPicture("ViewAngleMinus.gif"),
01519 kM_Button_ViewAnglePsiMinus);
01520 fViewAnglePsiMinusButton->SetToolTipText("Psi -");
01521 fViewAnglePsiMinusButton->SetHeight(22);
01522 fViewAnglePsiMinusButton->SetWidth(22);
01523 fViewAnglePsiMinusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01524
01525 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
01526 fWidgets->Add(fLayout);
01527 fViewAnglePsiFrame->AddFrame(fViewAnglePsiMinusButton, fLayout);
01528
01529
01530 fViewAnglePsiSlider = new TGVSlider(fViewAnglePsiFrame, 120, kSlider2 | kScaleBoth, kM_Slider_ViewAnglePsi);
01531 fViewAnglePsiSlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
01532 fViewAnglePsiSlider->SetRange(0, 360);
01533 fViewAnglePsiSlider->SetPosition(270);
01534 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandY, 5, 5, 0, 0);
01535 fWidgets->Add(fLayout);
01536 fViewAnglePsiFrame->AddFrame(fViewAnglePsiSlider, fLayout);
01537
01538
01539 fViewAnglePsiPlusButton = new BesGPictureButton(fViewAnglePsiFrame,
01540 gClient->GetPicture("ViewAnglePlus.gif"),
01541 kM_Button_ViewAnglePsiPlus);
01542 fViewAnglePsiPlusButton->SetToolTipText("Psi +");
01543 fViewAnglePsiPlusButton->SetHeight(22);
01544 fViewAnglePsiPlusButton->SetWidth(22);
01545 fViewAnglePsiPlusButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01546
01547 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 0, 0);
01548 fWidgets->Add(fLayout);
01549 fViewAnglePsiFrame->AddFrame(fViewAnglePsiPlusButton, fLayout);
01550
01551
01552
01553
01554 fViewAnglePsiNumber = new TGNumberEntryField( fViewAnglePsiFrame, kM_Button_ViewAnglePsiNumber,
01555 fViewAnglePsiSlider->GetPosition(),
01556 (TGNumberFormat::EStyle) 1, (TGNumberFormat::EAttribute) 0 );
01557 fViewAnglePsiNumber->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01558 h = fViewAnglePsiNumber->GetDefaultHeight();
01559 charw = fViewAnglePsiNumber->GetCharWidth("0123456");
01560 w = charw * TMath::Abs(4) / 10 + 8 + 2 * h / 3;
01561 fViewAnglePsiNumber->Resize(w, h);
01562
01563 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 0);
01564 fWidgets->Add(fLayout);
01565 fViewAnglePsiFrame->AddFrame(fViewAnglePsiNumber, fLayout);
01566
01567
01568 fViewAnglePsiLabel = new TGLabel(fViewAnglePsiFrame,"psi");
01569 fLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 2, 2);
01570 fWidgets->Add(fLayout);
01571 fViewAnglePsiFrame->AddFrame(fViewAnglePsiLabel, fLayout);
01572
01573
01574
01575
01576 tf = fTabs->AddTab("Event");
01577 tf->SetBackgroundPixmap(GetPic("8.gif"));
01578
01579
01580
01581
01582 fEventControlFrame = new TGCompositeFrame(tf, tf->GetWidth(), tf->GetHeight(), kVerticalFrame);
01583 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX , 15, 15, 15, 10);
01584 fWidgets->Add(fLayout);
01585 tf->AddFrame(fEventControlFrame, fLayout);
01586 fEventControlFrame->SetBackgroundPixmap(GetPic("EventFrameBckgnd.gif"));
01587
01588
01589
01590 fEventControlTextFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
01591 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 0, 0, 0, 0);
01592 fWidgets->Add(fLayout);
01593 fEventControlFrame->AddFrame(fEventControlTextFrame, fLayout);
01594 fEventControlTextFrame->SetBackgroundPixmap(GetPic("EventControlBckgnd.gif"));
01595
01596 fEventControlTextLabel = new TGLabel(fEventControlTextFrame,"Event Control ");
01597 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX , 2, 73, 4, 4);
01598 fWidgets->Add(fLayout);
01599 fEventControlTextFrame->AddFrame(fEventControlTextLabel, fLayout);
01600 fEventControlTextLabel->SetBackgroundPixmap(GetPic("EventControlBckgnd.gif"));
01601
01602
01603 fBesRunFrame = new TGHorizontalFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 25);
01604 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 4, 4, 4, 4);
01605 fWidgets->Add(fLayout);
01606 fEventControlFrame->AddFrame(fBesRunFrame, fLayout);
01607 fBesRunFrame->SetBackgroundPixmap(GetPic("EventFrameBckgnd.gif"));
01608
01609 fBesLabelRun = new TGLabel(fBesRunFrame, "Run : ");
01610 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
01611 fWidgets->Add(fLayout);
01612 fBesRunFrame->AddFrame(fBesLabelRun, fLayout);
01613
01614 fNumEntryRunNo = new TGNumberEntry(fBesRunFrame,this->GetBesRunNo(),12,kM_Button_BesRun,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1);
01615 fNumEntryRunNo->SetHeight(20);
01616 fNumEntryRunNo->SetNumber(this->GetBesRunNo());
01617 fNumEntryRunNo->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01618 fNumEntryRunNo->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
01619 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 4, 4, 4, 4);
01620 fWidgets->Add(fLayout);
01621 fBesRunFrame->AddFrame(fNumEntryRunNo, fLayout);
01622
01623
01624 fBesEventFrame = new TGHorizontalFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 25);
01625 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 4, 4, 4, 4);
01626 fWidgets->Add(fLayout);
01627 fEventControlFrame->AddFrame(fBesEventFrame, fLayout);
01628
01629 fBesLabelEvent = new TGLabel(fBesEventFrame, "Event : ");
01630 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
01631 fWidgets->Add(fLayout);
01632 fBesEventFrame->AddFrame(fBesLabelEvent, fLayout);
01633
01634 fNumEntryEventNo = new TGNumberEntry(fBesEventFrame,this->GetBesEventNo(),12,kM_Button_BesEvent,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1);
01635 fNumEntryEventNo->SetHeight(20);
01636 fNumEntryEventNo->SetNumber(this->GetBesEventNo());
01637 fNumEntryEventNo->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01638 fNumEntryEventNo->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
01639 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 4, 4, 4, 4);
01640 fWidgets->Add(fLayout);
01641 fBesEventFrame->AddFrame(fNumEntryEventNo, fLayout);
01642
01643
01644
01645
01646
01647
01648 fEventPlaySlider = new TGHSlider(fEventControlFrame, 40, kSlider1 | kScaleNo, kM_Slider_EventPlay);
01649 fEventPlaySlider->Connect("PositionChanged(Int_t)", "BesClient", this, "HandleSliders(Int_t)");
01650 fEventPlaySlider->SetRange(0, 100);
01651 fEventPlaySlider->SetPosition(0);
01652 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 0);
01653 fWidgets->Add(fLayout);
01654 fEventControlFrame->AddFrame(fEventPlaySlider, fLayout);
01655
01656
01657 fEventPlayButtonFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
01658
01659 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 2, 2, 2, 2);
01660 fWidgets->Add(fLayout);
01661 fEventControlFrame->AddFrame(fEventPlayButtonFrame, fLayout);
01662
01663
01664 fPrevEventButton = new BesGPictureButton(fEventPlayButtonFrame,
01665 gClient->GetPicture("ButtonEventPrev.gif"),
01666 kM_Button_PrevEvent);
01667 fPrevEventButton->SetToolTipText("Previous Event");
01668 fPrevEventButton->SetHeight(26);
01669 fPrevEventButton->SetWidth(25);
01670 fPrevEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01671
01672 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 8, 0, 0, 4);
01673 fWidgets->Add(fLayout);
01674 fEventPlayButtonFrame->AddFrame(fPrevEventButton, fLayout);
01675
01676
01677 fNextEventButton = new BesGPictureButton(fEventPlayButtonFrame,
01678 gClient->GetPicture("ButtonEventNext.gif"), kM_Button_NextEvent);
01679 fNextEventButton->SetToolTipText("Next Event");
01680 fNextEventButton->SetHeight(26);
01681 fNextEventButton->SetWidth(26);
01682 fNextEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01683
01684 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 10, 0, 4);
01685 fWidgets->Add(fLayout);
01686 fEventPlayButtonFrame->AddFrame(fNextEventButton, fLayout);
01687
01688
01689 fPlayEventButton = new BesGPictureButton(fEventPlayButtonFrame,
01690 gClient->GetPicture("ButtonEventPlay.gif"),
01691 kM_Button_PlayEvent);
01692 fPlayEventButton->SetToolTipText("Play Event");
01693 fPlayEventButton->SetHeight(35);
01694 fPlayEventButton->SetWidth(34);
01695 fPlayEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01696
01697 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 0, 0, 4);
01698 fWidgets->Add(fLayout);
01699 fEventPlayButtonFrame->AddFrame(fPlayEventButton, fLayout);
01700
01701
01702 fFirstEventButton = new BesGPictureButton(fEventPlayButtonFrame,
01703 gClient->GetPicture("ButtonEventReturn.gif"),
01704 kM_Button_FirstEvent);
01705 fFirstEventButton->SetToolTipText("First Event");
01706 fFirstEventButton->SetHeight(35);
01707 fFirstEventButton->SetWidth(25);
01708 fFirstEventButton->Connect("Clicked()", "BesClient", this, "HandleButtons()");
01709
01710 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 0, 4);
01711 fWidgets->Add(fLayout);
01712 fEventPlayButtonFrame->AddFrame(fFirstEventButton, fLayout);
01713
01714
01715 fEventPlayTextFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
01716 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 2, 2, 2, 2);
01717 fWidgets->Add(fLayout);
01718 fEventControlFrame->AddFrame(fEventPlayTextFrame, fLayout);
01719
01720 fEventPlayTextLabel = new TGLabel(fEventPlayTextFrame,"Prev,Next,Play/Stop,Return");
01721 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 4, 2, 5);
01722 fWidgets->Add(fLayout);
01723 fEventPlayTextFrame->AddFrame(fEventPlayTextLabel, fLayout);
01724
01725
01726
01727 fEventPlaySpeedFrame = new TGCompositeFrame(fEventControlFrame, fEventControlFrame->GetWidth(), 30, kHorizontalFrame);
01728 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 4, 4, 4, 4);
01729 fWidgets->Add(fLayout);
01730 fEventControlFrame->AddFrame(fEventPlaySpeedFrame, fLayout);
01731
01732
01733 fNumEntryEventPlaySpeed = new TGNumberEntry(fEventPlaySpeedFrame,(Double_t)this->GetEventPlaySpeed()/1000.0,4,
01734 kM_Button_EventPlaySpeed,
01735 (TGNumberFormat::EStyle) 1,(TGNumberFormat::EAttribute) 1);
01736 fNumEntryEventPlaySpeed->SetHeight(20);
01737 fNumEntryEventPlaySpeed->SetNumber(this->GetEventPlaySpeed()/1000.0);
01738 fNumEntryEventPlaySpeed->GetNumberEntry()->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
01739 fNumEntryEventPlaySpeed->GetNumberEntry()->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
01740 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
01741 fWidgets->Add(fLayout);
01742 fEventPlaySpeedFrame->AddFrame(fNumEntryEventPlaySpeed, fLayout);
01743
01744
01745 fEventPlaySpeedLabel = new TGLabel(fEventPlaySpeedFrame," sec/event ");
01746 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 4, 4, 10);
01747 fWidgets->Add(fLayout);
01748 fEventPlaySpeedFrame->AddFrame(fEventPlaySpeedLabel, fLayout);
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803 tf = fTabs->AddTab("REC");
01804
01805 tf->SetBackgroundPixmap(GetPic("8.gif"));
01806
01807
01808 fFrameHeader =new TGGroupFrame(tf, "Header");
01809 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
01810 fWidgets->Add(fLayout);
01811 tf->AddFrame(fFrameHeader, fLayout);
01812 fChkBtnHeaderGlobal = new TGCheckButton(fFrameHeader, "Header", kM_Header_Global);
01813 fFrameHeader->AddFrame(fChkBtnHeaderGlobal);
01814 fChkBtnHeaderGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01815
01816
01817 fFrameHits = new TGGroupFrame(tf, "Hits");
01818 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
01819 fWidgets->Add(fLayout);
01820 tf->AddFrame(fFrameHits, fLayout);
01821
01822 fChkBtnMdcHitsGlobal = new TGCheckButton(fFrameHits, "Mdc hits", kM_MdcHits_Global);
01823 fFrameHits->AddFrame(fChkBtnMdcHitsGlobal);
01824
01825 fChkBtnTofHitsGlobal = new TGCheckButton(fFrameHits, "Tof hits", kM_TofHits_Global);
01826 fFrameHits->AddFrame(fChkBtnTofHitsGlobal);
01827
01828 fChkBtnTofHitsEast = new TGCheckButton(fFrameHits, " East ", kM_TofHits_East);
01829 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01830 fWidgets->Add(fLayout);
01831 fFrameHits->AddFrame(fChkBtnTofHitsEast, fLayout);
01832
01833 fChkBtnTofHitsBarrel = new TGCheckButton(fFrameHits, " Barrel ", kM_TofHits_Barrel);
01834 fFrameHits->AddFrame(fChkBtnTofHitsBarrel, fLayout);
01835
01836 fChkBtnTofHitsWest = new TGCheckButton(fFrameHits, " West ", kM_TofHits_West);
01837 fFrameHits->AddFrame(fChkBtnTofHitsWest, fLayout);
01838
01839 fChkBtnEmcHitsGlobal = new TGCheckButton(fFrameHits, "Emc hits", kM_EmcHits_Global);
01840 fFrameHits->AddFrame(fChkBtnEmcHitsGlobal);
01841
01842 fChkBtnEmcHitsEast = new TGCheckButton(fFrameHits, " East ", kM_EmcHits_East);
01843 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01844 fWidgets->Add(fLayout);
01845 fFrameHits->AddFrame(fChkBtnEmcHitsEast, fLayout);
01846
01847 fChkBtnEmcHitsBarrel = new TGCheckButton(fFrameHits, " Barrel ", kM_EmcHits_Barrel);
01848 fFrameHits->AddFrame(fChkBtnEmcHitsBarrel, fLayout);
01849
01850 fChkBtnEmcHitsWest = new TGCheckButton(fFrameHits, " West ", kM_EmcHits_West);
01851 fFrameHits->AddFrame(fChkBtnEmcHitsWest, fLayout);
01852
01853 fChkBtnEmcHitsSide = new TGCheckButton(fFrameHits, " Side ", kM_EmcHits_Side);
01854 fFrameHits->AddFrame(fChkBtnEmcHitsSide, fLayout);
01855
01856 fChkBtnMucHitsGlobal = new TGCheckButton(fFrameHits, "Muc hits", kM_MucHits_Global);
01857 fFrameHits->AddFrame(fChkBtnMucHitsGlobal);
01858
01859 fChkBtnMucHitsEast = new TGCheckButton(fFrameHits, " East ", kM_MucHits_East);
01860 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01861 fWidgets->Add(fLayout);
01862 fFrameHits->AddFrame(fChkBtnMucHitsEast, fLayout);
01863
01864 fChkBtnMucHitsBarrel = new TGCheckButton(fFrameHits, " Barrel ", kM_MucHits_Barrel);
01865 fFrameHits->AddFrame(fChkBtnMucHitsBarrel, fLayout);
01866
01867 fChkBtnMucHitsWest = new TGCheckButton(fFrameHits, " West ", kM_MucHits_West);
01868 fFrameHits->AddFrame(fChkBtnMucHitsWest, fLayout);
01869
01870 fChkBtnMdcHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01871 fChkBtnTofHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01872 fChkBtnTofHitsEast ->Connect("Clicked()", "BesClient", this, "SetState()");
01873 fChkBtnTofHitsBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
01874 fChkBtnTofHitsWest ->Connect("Clicked()", "BesClient", this, "SetState()");
01875 fChkBtnEmcHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01876 fChkBtnEmcHitsEast ->Connect("Clicked()", "BesClient", this, "SetState()");
01877 fChkBtnEmcHitsBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
01878 fChkBtnEmcHitsWest ->Connect("Clicked()", "BesClient", this, "SetState()");
01879 fChkBtnEmcHitsSide ->Connect("Clicked()", "BesClient", this, "SetState()");
01880 fChkBtnMucHitsGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01881 fChkBtnMucHitsEast ->Connect("Clicked()", "BesClient", this, "SetState()");
01882 fChkBtnMucHitsBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
01883 fChkBtnMucHitsWest ->Connect("Clicked()", "BesClient", this, "SetState()");
01884
01885
01886 fFrameTracks = new TGGroupFrame(tf, "Tracks");
01887 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
01888 fWidgets->Add(fLayout);
01889 tf->AddFrame(fFrameTracks, fLayout);
01890
01891 fChkBtnTracksGlobal = new TGCheckButton(fFrameTracks, "Tracks", kM_Tracks_Global);
01892 fFrameTracks->AddFrame(fChkBtnTracksGlobal);
01893
01894 fChkBtnTracksMdc = new TGCheckButton(fFrameTracks, " Mdc ", kM_Tracks_Mdc);
01895 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01896 fWidgets->Add(fLayout);
01897 fFrameTracks->AddFrame(fChkBtnTracksMdc, fLayout);
01898
01899 fChkBtnTracksTof = new TGCheckButton(fFrameTracks, " Tof ", kM_Tracks_Tof);
01900 fFrameTracks->AddFrame(fChkBtnTracksTof, fLayout);
01901
01902 fChkBtnTracksEmc = new TGCheckButton(fFrameTracks, " Emc ", kM_Tracks_Emc);
01903 fFrameTracks->AddFrame(fChkBtnTracksEmc, fLayout);
01904
01905 fChkBtnTracksMuc = new TGCheckButton(fFrameTracks, " Muc ", kM_Tracks_Muc);
01906 fFrameTracks->AddFrame(fChkBtnTracksMuc, fLayout);
01907
01908 fChkBtnTracksExt = new TGCheckButton(fFrameTracks, " Ext ", kM_Tracks_Ext);
01909 fFrameTracks->AddFrame(fChkBtnTracksExt, fLayout);
01910
01911 fChkBtnTracksGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01912 fChkBtnTracksMdc->Connect("Clicked()", "BesClient", this, "SetState()");
01913 fChkBtnTracksTof->Connect("Clicked()", "BesClient", this, "SetState()");
01914 fChkBtnTracksEmc->Connect("Clicked()", "BesClient", this, "SetState()");
01915 fChkBtnTracksMuc->Connect("Clicked()", "BesClient", this, "SetState()");
01916 fChkBtnTracksExt->Connect("Clicked()", "BesClient", this, "SetState()");
01917
01918
01919
01920
01921 tf = fTabs->AddTab("Detector");
01922 tf->SetBackgroundPixmap(GetPic("8.gif"));
01923
01924
01925 fFrameSubDetector = new TGGroupFrame(tf, "Sub-Detector");
01926
01927
01928 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
01929 fWidgets->Add(fLayout);
01930 tf->AddFrame(fFrameSubDetector, fLayout);
01931
01932
01933 fChkBtnMdcGlobal = new TGCheckButton(fFrameSubDetector, "Mdc", kM_Mdc_Global);
01934 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
01935 fFrameSubDetector->AddFrame(fChkBtnMdcGlobal, fLayout);
01936 fChkBtnMdcGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01937
01938 fChkBtnMdcTubes = new TGCheckButton(fFrameSubDetector, "Tubes", kM_Mdc_Tubes);
01939 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01940 fFrameSubDetector->AddFrame(fChkBtnMdcTubes, fLayout);
01941 fChkBtnMdcTubes->Connect("Clicked()", "BesClient", this, "SetState()");
01942
01943 fChkBtnMdcWires = new TGCheckButton(fFrameSubDetector, "Wires", kM_Mdc_Wires);
01944 fFrameSubDetector->AddFrame(fChkBtnMdcWires, fLayout);
01945 fChkBtnMdcWires->Connect("Clicked()", "BesClient", this, "SetState()");
01946
01947
01948 fChkBtnTofGlobal = new TGCheckButton(fFrameSubDetector, "Tof", kM_Tof_Global);
01949 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
01950 fFrameSubDetector->AddFrame(fChkBtnTofGlobal, fLayout);
01951 fChkBtnTofGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01952
01953 fChkBtnTofEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Tof_East);
01954 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01955 fFrameSubDetector->AddFrame(fChkBtnTofEast, fLayout);
01956 fChkBtnTofEast->Connect("Clicked()", "BesClient", this, "SetState()");
01957
01958 fChkBtnTofBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Tof_Barrel);
01959 fFrameSubDetector->AddFrame(fChkBtnTofBarrel, fLayout);
01960 fChkBtnTofBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
01961
01962 fChkBtnTofWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Tof_West);
01963 fFrameSubDetector->AddFrame(fChkBtnTofWest, fLayout);
01964 fChkBtnTofWest->Connect("Clicked()", "BesClient", this, "SetState()");
01965
01966
01967 fChkBtnEmcGlobal = new TGCheckButton(fFrameSubDetector, "Emc", kM_Emc_Global);
01968 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
01969 fFrameSubDetector->AddFrame(fChkBtnEmcGlobal, fLayout);
01970 fChkBtnEmcGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01971
01972 fChkBtnEmcEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Emc_East);
01973 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01974 fFrameSubDetector->AddFrame(fChkBtnEmcEast, fLayout);
01975 fChkBtnEmcEast->Connect("Clicked()", "BesClient", this, "SetState()");
01976
01977 fChkBtnEmcBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Emc_Barrel);
01978 fFrameSubDetector->AddFrame(fChkBtnEmcBarrel, fLayout);
01979 fChkBtnEmcBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
01980
01981 fChkBtnEmcWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Emc_West);
01982 fFrameSubDetector->AddFrame(fChkBtnEmcWest, fLayout);
01983 fChkBtnEmcWest->Connect("Clicked()", "BesClient", this, "SetState()");
01984
01985 fChkBtnEmcSide = new TGCheckButton(fFrameSubDetector, "Side ", kM_Emc_Side);
01986 fFrameSubDetector->AddFrame(fChkBtnEmcSide, fLayout);
01987 fChkBtnEmcSide->Connect("Clicked()", "BesClient", this, "SetState()");
01988
01989
01990 fChkBtnMucGlobal = new TGCheckButton(fFrameSubDetector, "Muc", kM_Muc_Global);
01991 fLayout = new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0);
01992 fFrameSubDetector->AddFrame(fChkBtnMucGlobal, fLayout);
01993 fChkBtnMucGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
01994
01995 fChkBtnMucEast = new TGCheckButton(fFrameSubDetector, "East EC", kM_Muc_East);
01996 fLayout = new TGLayoutHints(kLHintsLeft, 20, 0, 0, 0);
01997 fFrameSubDetector->AddFrame(fChkBtnMucEast, fLayout);
01998 fChkBtnMucEast->Connect("Clicked()", "BesClient", this, "SetState()");
01999
02000 fChkBtnMucBarrel = new TGCheckButton(fFrameSubDetector, "Barrel", kM_Muc_Barrel);
02001 fFrameSubDetector->AddFrame(fChkBtnMucBarrel, fLayout);
02002 fChkBtnMucBarrel->Connect("Clicked()", "BesClient", this, "SetState()");
02003
02004 fChkBtnMucWest = new TGCheckButton(fFrameSubDetector, "West EC", kM_Muc_West);
02005 fFrameSubDetector->AddFrame(fChkBtnMucWest, fLayout);
02006 fChkBtnMucWest->Connect("Clicked()", "BesClient", this, "SetState()");
02007
02008 fChkBtnMucStrips = new TGCheckButton(fFrameSubDetector, "Strips", kM_Muc_Strips);
02009 fFrameSubDetector->AddFrame(fChkBtnMucStrips, fLayout);
02010 fChkBtnMucStrips->Connect("Clicked()", "BesClient", this, "SetState()");
02011
02012
02013 fFrameOthers = new TGGroupFrame (tf, "Others");
02014 fLayout = new TGLayoutHints (kLHintsExpandX, 15, 15, 15, 15);
02015 fWidgets->Add(fLayout);
02016 tf->AddFrame (fFrameOthers, fLayout);
02017
02018 fChkBtnBeamPipe = new TGCheckButton (fFrameOthers, "Beam Pipe", kM_BeamPipe);
02019 fFrameOthers->AddFrame (fChkBtnBeamPipe);
02020 fChkBtnBeamPipe->Connect("Clicked()", "BesClient", this, "SetState()");
02021
02022 fChkBtnZRPlaneOnXY = new TGCheckButton (fFrameOthers, "ZR plane on XY", kM_ZRPlaneOnXY);
02023 fFrameOthers->AddFrame (fChkBtnZRPlaneOnXY);
02024 fChkBtnZRPlaneOnXY->Connect("Clicked()", "BesClient", this, "SetState()");
02025
02026 fChkBtnAxis = new TGCheckButton (fFrameOthers, "Axis", kM_Axis);
02027 fFrameOthers->AddFrame (fChkBtnAxis);
02028 fChkBtnAxis->Connect("Clicked()", "BesClient", this, "SetState()");
02029
02030
02031
02032
02033 tf = fTabs->AddTab("Others");
02034 tf->SetBackgroundPixmap(GetPic("8.gif"));
02035
02036
02037 fFrameMdcMatch =new TGGroupFrame(tf, "Mdc Status");
02038 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
02039 fWidgets->Add(fLayout);
02040 tf->AddFrame(fFrameMdcMatch, fLayout);
02041
02042 fChkBtnMdcTMatchGlobal = new TGCheckButton(fFrameMdcMatch, "T Fire", kM_Mdc_TMatch_Global);
02043 fChkBtnMdcTMatchGlobal->SetState(kButtonDown);
02044
02045 fFrameMdcMatch->AddFrame(fChkBtnMdcTMatchGlobal);
02046 fChkBtnMdcTMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02047
02048 fChkBtnMdcQMatchGlobal = new TGCheckButton(fFrameMdcMatch, "Q Fire", kM_Mdc_QMatch_Global);
02049 fChkBtnMdcQMatchGlobal->SetState(kButtonDown);
02050
02051 fFrameMdcMatch->AddFrame(fChkBtnMdcQMatchGlobal);
02052 fChkBtnMdcQMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02053
02054 fChkBtnMdcQOverflowGlobal = new TGCheckButton(fFrameMdcMatch, "Q Not Overflow", kM_Mdc_QNotOverflow_Global);
02055 fChkBtnMdcQOverflowGlobal->SetState(kButtonUp);
02056
02057 fFrameMdcMatch->AddFrame(fChkBtnMdcQOverflowGlobal);
02058 fChkBtnMdcQOverflowGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02059
02060
02061 fChkBtnMdcColorfulWireGlobal = new TGCheckButton(fFrameMdcMatch, "Colorful Wire", kM_Mdc_ColorfulWire_Global);
02062 fChkBtnMdcColorfulWireGlobal->SetState(kButtonUp);
02063 fFrameMdcMatch->AddFrame(fChkBtnMdcColorfulWireGlobal);
02064 fChkBtnMdcColorfulWireGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02065
02066
02067 fChkBtnMdcTimeSubEvTimeGlobal = new TGCheckButton(fFrameMdcMatch, "Sub EvTime", kM_Mdc_MdcTimeSubEvTime_Global);
02068 fChkBtnMdcTimeSubEvTimeGlobal->SetState(kButtonUp);
02069 fFrameMdcMatch->AddFrame(fChkBtnMdcTimeSubEvTimeGlobal);
02070 fChkBtnMdcTimeSubEvTimeGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02071
02072
02073 fFrameTofMatch =new TGGroupFrame(tf, "Tof TQ Match");
02074 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
02075 fWidgets->Add(fLayout);
02076 tf->AddFrame(fFrameTofMatch, fLayout);
02077
02078 fChkBtnTofTMatchGlobal = new TGCheckButton(fFrameTofMatch, "T Match", kM_Tof_TMatch_Global);
02079 fChkBtnTofTMatchGlobal->SetState(kButtonDown);
02080
02081 fFrameTofMatch->AddFrame(fChkBtnTofTMatchGlobal);
02082 fChkBtnTofTMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02083
02084 fChkBtnTofQMatchGlobal = new TGCheckButton(fFrameTofMatch, "Q Match", kM_Tof_QMatch_Global);
02085 fChkBtnTofQMatchGlobal->SetState(kButtonDown);
02086
02087 fFrameTofMatch->AddFrame(fChkBtnTofQMatchGlobal);
02088 fChkBtnTofQMatchGlobal->Connect("Clicked()", "BesClient", this, "SetState()");
02089
02090
02091 fFrameMagnetic =new TGGroupFrame(tf, "Magnetic Field(Tesla)");
02092 fLayout = new TGLayoutHints(kLHintsExpandX, 15, 15, 15, 15);
02093 fWidgets->Add(fLayout);
02094 tf->AddFrame(fFrameMagnetic, fLayout);
02095
02096
02097 fNumEntryMagnetic = new TGNumberEntry(fFrameMagnetic,
02098 1.0, 4,
02099 kM_Button_Magnetic,
02100 TGNumberFormat::kNESRealTwo,
02101 TGNumberFormat::kNEAAnyNumber);
02102 fNumEntryMagnetic->SetHeight(20);
02103 fNumEntryMagnetic->SetNumber(1.0);
02104 fNumEntryMagnetic->GetNumberEntry()
02105 ->Connect("ReturnPressed()","BesClient",this,"ExecuteReturn()");
02106 fNumEntryMagnetic->GetNumberEntry()
02107 ->Connect("TabPressed()","BesClient",this,"ChangeFocus()");
02108 fLayout = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 4, 4, 4);
02109 fWidgets->Add(fLayout);
02110 fFrameMagnetic->AddFrame(fNumEntryMagnetic, fLayout);
02111
02112
02113 for (Int_t iTab = 0; iTab < fTabs->GetNumberOfTabs(); iTab++) {
02114 fTabs->GetTabTab(iTab)->SetBackgroundPixmap(GetPic("8.gif"));
02115 }
02116 }
02117
02118 void BesClient::SetMdcQNotOverflow(Bool_t input){
02119 if (gBesGeometry){
02120 gBesGeometry->GetMdcROOTGeo()->SetQNotOverflow(input);
02121 }
02122 }
02123
02124
02125 void BesClient::SetMdcTFire(Bool_t input){
02126 if (gBesGeometry){
02127 gBesGeometry->GetMdcROOTGeo()->SetTFire(input);
02128 }
02129 }
02130
02131 void BesClient::SetMdcQFire(Bool_t input){
02132 if (gBesGeometry){
02133 gBesGeometry->GetMdcROOTGeo()->SetQFire(input);
02134 }
02135 }
02136
02137 void BesClient::SetMdcColorfulWire(Bool_t input){
02138 if (gBesGeometry){
02139 gBesGeometry->GetMdcROOTGeo()->SetColorfulWire(input);
02140 }
02141 }
02142
02143 void BesClient::SetMdcTimeSubEvTime(Bool_t input){
02144 if (gBesGeometry){
02145 gBesGeometry->GetMdcROOTGeo()->SetMdcTimeSubEvTime(input);
02146 }
02147 }
02148
02149 void BesClient::SetTofTMatch(Bool_t input){
02150 if (gBesGeometry){
02151 gBesGeometry->GetTofROOTGeo()->SetTMatch(input);
02152 }
02153 }
02154
02155 void BesClient::SetTofQMatch(Bool_t input){
02156 if (gBesGeometry){
02157 gBesGeometry->GetTofROOTGeo()->SetQMatch(input);
02158 }
02159 }
02160
02161
02162 void BesClient::InitLocal() {
02163
02164
02165 if (gDebug) cout << "BesClient::InitLocal called!" << endl;
02166
02167
02168 fWidgets = new TList();
02169 fLayout = 0;
02170
02171 gGeometry = 0;
02172 gBesCursor = new BesCursor();
02173 gBesCursor->SetType(kBesPick);
02174 gBesCursor->SetShowInfo(true);
02175
02176 fAutoDisplayEventTimer = new TTimer(fEventPlaySpeed);
02177 Connect(fAutoDisplayEventTimer,"Timeout()","BesClient",this,"AutoDisplayEventCommand()");
02178
02179 fAutoRotateTimer = new TTimer((Int_t)1000/fRotateFPS);
02180 Connect(fAutoRotateTimer,"Timeout()","BesClient",this,"AutoRotateCommand()");
02181
02182
02183 new TColor(1001, 1.0, 1.0, 225/255.0);
02184
02185 new TColor(1002, 227/255.0, 186/255.0, 227/255.0);
02186
02187 new TColor(1003, 232/255.0, 234/255.0, 117/255.0);
02188
02189 new TColor(1004, 254/255.0, 216/255.0, 31/255.0);
02190
02191 new TColor(1005, 175/255.0, 192/255.0, 227/255.0);
02192
02193 new TColor(1006, 192/255.0, 227/255.0, 226/255.0);
02194
02195 new TColor(1007, 225/255.0, 199/255.0, 162/255.0);
02196 }
02197
02198
02199
02200 void BesClient::InitParameter() {
02201
02202
02203 if (gDebug) cout << "BesClient::InitParameter called!" << endl;
02204
02205
02206 fWindowWidth = 1000;
02207 fWindowHeight = 710;
02208
02209 fBesVisPath = TString(getenv("BESVISLIBROOT"));
02210
02211 fEventPlaySpeed = 1000;
02212 fAutoDisplayEvent = kFALSE;
02213
02214 for (Int_t i = 0; i < 3; i++) {
02215 fHomeX[i] = 0.0;
02216 fHomeY[i] = 0.0;
02217 }
02218
02219 fMoveFactor = 0.1;
02220 fRotateStep = 1.0;
02221 fRotateSpeed = 10.0;
02222 fRotateFPS = 10;
02223
02224 fAutoRotate = kFALSE;
02225 fAutoRotateClockWise = 0;
02226 fAutoRotateTheta = 0;
02227 fAutoRotatePhi = 0;
02228 fAutoRotatePsi = 0;
02229
02230 fBesRunNo = 0;
02231 fBesEventNo = 0;
02232
02233 fViewer3DMode = 0;
02234 }
02235
02236
02237
02238 void BesClient::InitConnections() {
02239
02240
02241 if (gDebug) cout << "BesClient::InitConnections called!" << endl;
02242
02243
02244 Connect((TCanvas*)fEmbeddedCanvas->GetCanvas(),"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "BesClient",
02245 this, "ExecuteEvent(Int_t, Int_t, Int_t, TObject*)");
02246
02247
02248 Connect("CloseWindow()", "BesClient", this, "CloseWindow()");
02249 }
02250
02251
02252
02253 void BesClient::HandleMenu(Int_t id) {
02254
02255
02256
02257 switch (id) {
02258
02259
02260 case kM_File_LoadGeo:
02261 LoadGeoFile();
02262 break;
02263 case kM_File_SaveGeoAs:
02264 SaveGeoAs();
02265 break;
02266 case kM_File_OpenEvent:
02267 OpenEventFile();
02268 break;
02269 case kM_File_SavePicAs:
02270 SavePicAs();
02271 break;
02272 case kM_File_Close:
02273 gInterpreter->DeleteGlobal(this);
02274 delete this;
02275 break;
02276 case kM_File_Exit:
02277 CloseWindow();
02278 break;
02279
02280
02281 case kM_Edit_Editor:
02282 fEmbeddedCanvas->GetCanvas()->EditorBar();
02283 break;
02284
02285
02286 case kM_Help_Content:
02287 Help();
02288 break;
02289
02290 case kM_Help_About:
02291 new BesAboutHelp(gClient->GetRoot(), this);
02292 break;
02293
02294
02295 default:
02296 cerr << "Menu item" << id << "selected" << endl;
02297 break;
02298 }
02299 }
02300
02301
02302
02303 void BesClient::HandleViewOptionMenu(Int_t id) {
02304
02305
02306 BesView *view = (BesView*)gPad->GetView();
02307 if (!view) {
02308 cout << "BesClient::HandleViewOptionMenu(), BesView does not exist in this pad" << endl;
02309 return;
02310 }
02311
02312
02313
02314
02315 switch (id) {
02316 case kM_Header_On:
02317 if ( fMenuViewOptionHeader->IsEntryChecked(kM_Header_On) ) {
02318 fMenuViewOptionHeader->UnCheckEntry(kM_Header_On);
02319
02320 } else {
02321 fMenuViewOptionHeader->CheckEntry(kM_Header_On);
02322
02323 }
02324 break;
02325
02326 case kM_Mdc_Global:
02327 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Global) ) {
02328 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Global);
02329 view->SetVisMdcGlobal(0);
02330 } else {
02331 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Global);
02332 view->SetVisMdcGlobal(1);
02333 }
02334 break;
02335
02336 case kM_Mdc_Tubes:
02337 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Tubes) ) {
02338 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Tubes);
02339 view->SetVisMdcTubes(0);
02340 } else {
02341 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Tubes);
02342 view->SetVisMdcTubes(1);
02343 }
02344 break;
02345
02346 case kM_Mdc_Wires:
02347 if ( fMenuViewOptionMdc->IsEntryChecked(kM_Mdc_Wires) ) {
02348 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Wires);
02349 view->SetVisMdcWires(0);
02350 } else {
02351 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Wires);
02352 view->SetVisMdcWires(1);
02353 }
02354 break;
02355
02356 case kM_Tof_Global:
02357 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_Global) ) {
02358 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Global);
02359 view->SetVisTofGlobal(0);
02360 } else {
02361 fMenuViewOptionTof->CheckEntry(kM_Tof_Global);
02362 view->SetVisTofGlobal(1);
02363 }
02364 break;
02365
02366 case kM_Tof_East:
02367 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_East) ) {
02368 fMenuViewOptionTof->UnCheckEntry(kM_Tof_East);
02369 view->SetVisTofEast(0);
02370 } else {
02371 fMenuViewOptionTof->CheckEntry(kM_Tof_East);
02372 view->SetVisTofEast(1);
02373 }
02374 break;
02375
02376 case kM_Tof_Barrel:
02377 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_Barrel) ) {
02378 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Barrel);
02379 view->SetVisTofBarrel(0);
02380 } else {
02381 fMenuViewOptionTof->CheckEntry(kM_Tof_Barrel);
02382 view->SetVisTofBarrel(1);
02383 }
02384 break;
02385
02386 case kM_Tof_West:
02387 if ( fMenuViewOptionTof->IsEntryChecked(kM_Tof_West) ) {
02388 fMenuViewOptionTof->UnCheckEntry(kM_Tof_West);
02389 view->SetVisTofWest(0);
02390 } else {
02391 fMenuViewOptionTof->CheckEntry(kM_Tof_West);
02392 view->SetVisTofWest(1);
02393 }
02394 break;
02395
02396 case kM_Emc_Global:
02397 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Global) ) {
02398 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Global);
02399 view->SetVisEmcGlobal(0);
02400 } else {
02401 fMenuViewOptionEmc->CheckEntry(kM_Emc_Global);
02402 view->SetVisEmcGlobal(1);
02403 }
02404 break;
02405
02406 case kM_Emc_East:
02407 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_East) ) {
02408 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_East);
02409 view->SetVisEmcEast(0);
02410 } else {
02411 fMenuViewOptionEmc->CheckEntry(kM_Emc_East);
02412 view->SetVisEmcEast(1);
02413 }
02414 break;
02415
02416 case kM_Emc_Barrel:
02417 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Barrel) ) {
02418 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Barrel);
02419 view->SetVisEmcBarrel(0);
02420 } else {
02421 fMenuViewOptionEmc->CheckEntry(kM_Emc_Barrel);
02422 view->SetVisEmcBarrel(1);
02423 }
02424 break;
02425
02426 case kM_Emc_West:
02427 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_West) ) {
02428 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_West);
02429 view->SetVisEmcWest(0);
02430 } else {
02431 fMenuViewOptionEmc->CheckEntry(kM_Emc_West);
02432 view->SetVisEmcWest(1);
02433 }
02434 break;
02435
02436 case kM_Emc_Side:
02437 if ( fMenuViewOptionEmc->IsEntryChecked(kM_Emc_Side) ) {
02438 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Side);
02439 view->SetVisEmcSide(0);
02440 } else {
02441 fMenuViewOptionEmc->CheckEntry(kM_Emc_Side);
02442 view->SetVisEmcSide(1);
02443 }
02444 break;
02445
02446 case kM_Muc_Global:
02447 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Global) ) {
02448 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Global);
02449 view->SetVisMucGlobal(0);
02450 } else {
02451 fMenuViewOptionMuc->CheckEntry(kM_Muc_Global);
02452 view->SetVisMucGlobal(1);
02453 }
02454 break;
02455
02456 case kM_Muc_East:
02457 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_East) ) {
02458 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_East);
02459 view->SetVisMucEast(0);
02460 } else {
02461 fMenuViewOptionMuc->CheckEntry(kM_Muc_East);
02462 view->SetVisMucEast(1);
02463 }
02464 break;
02465
02466 case kM_Muc_Barrel:
02467 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Barrel) ) {
02468 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Barrel);
02469 view->SetVisMucBarrel(0);
02470 } else {
02471 fMenuViewOptionMuc->CheckEntry(kM_Muc_Barrel);
02472 view->SetVisMucBarrel(1);
02473 }
02474 break;
02475
02476 case kM_Muc_West:
02477 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_West) ) {
02478 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_West);
02479 view->SetVisMucWest(0);
02480 } else {
02481 fMenuViewOptionMuc->CheckEntry(kM_Muc_West);
02482 view->SetVisMucWest(1);
02483 }
02484 break;
02485
02486 case kM_Muc_Strips:
02487 if ( fMenuViewOptionMuc->IsEntryChecked(kM_Muc_Strips) ) {
02488 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Strips);
02489 view->SetVisMucStrips(0);
02490 } else {
02491 fMenuViewOptionMuc->CheckEntry(kM_Muc_Strips);
02492 view->SetVisMucStrips(1);
02493 }
02494 break;
02495
02496 case kM_Full3D_Mdc:
02497 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Mdc) ) {
02498 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Mdc);
02499 view->SetVisFull3DMdc(0);
02500 } else {
02501 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Mdc);
02502 view->SetVisFull3DMdc(1);
02503 }
02504
02505 if (gBesGeometry) {
02506 gBesGeometry->GetMdcROOTGeo()->SetDetector();
02507 gBesGeometry->GetMdcROOTGeo()->SetVisMdcDetector();
02508 }
02509 break;
02510
02511 case kM_Full3D_Tof:
02512 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Tof) ) {
02513 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Tof);
02514 view->SetVisFull3DTof(0);
02515 } else {
02516 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Tof);
02517 view->SetVisFull3DTof(1);
02518 }
02519
02520 if (gBesGeometry) {
02521 gBesGeometry->GetTofROOTGeo()->SetDetector();
02522 gBesGeometry->GetTofROOTGeo()->SetVisTofDetector();
02523 }
02524 break;
02525
02526 case kM_Full3D_Emc:
02527 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Emc) ) {
02528 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Emc);
02529 view->SetVisFull3DEmc(0);
02530 } else {
02531 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Emc);
02532 view->SetVisFull3DEmc(1);
02533 }
02534
02535 if (gBesGeometry) {
02536 gBesGeometry->GetEmcROOTGeo()->SetDetector();
02537 gBesGeometry->GetEmcROOTGeo()->SetVisEmcDetector();
02538 }
02539 break;
02540
02541 case kM_Full3D_Muc:
02542 if ( fMenuViewOptionFull3D->IsEntryChecked(kM_Full3D_Muc) ) {
02543 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Muc);
02544 view->SetVisFull3DMuc(0);
02545 } else {
02546 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Muc);
02547 view->SetVisFull3DMuc(1);
02548 }
02549
02550 if (gBesGeometry) {
02551 gBesGeometry->GetMucROOTGeo()->SetDetector();
02552 gBesGeometry->GetMucROOTGeo()->SetVisMucDetector();
02553 }
02554 break;
02555
02556 case kM_BeamPipe:
02557 if ( fMenuViewOptionOthers->IsEntryChecked(kM_BeamPipe) ) {
02558 fMenuViewOptionOthers->UnCheckEntry(kM_BeamPipe);
02559 view->SetVisBeamPipe(0);
02560 } else {
02561 fMenuViewOptionOthers->CheckEntry(kM_BeamPipe);
02562 view->SetVisBeamPipe(1);
02563 }
02564 break;
02565
02566 case kM_ZRPlaneOnXY:
02567 if ( fMenuViewOptionOthers->IsEntryChecked(kM_ZRPlaneOnXY) ) {
02568 fMenuViewOptionOthers->UnCheckEntry(kM_ZRPlaneOnXY);
02569 view->SetVisZRPlaneOnXY(0);
02570 } else {
02571 fMenuViewOptionOthers->CheckEntry(kM_ZRPlaneOnXY);
02572 view->SetVisZRPlaneOnXY(1);
02573 }
02574 break;
02575
02576 case kM_Axis:
02577 if ( fMenuViewOptionOthers->IsEntryChecked(kM_Axis) ) {
02578 fMenuViewOptionOthers->UnCheckEntry(kM_Axis);
02579 view->SetVisAxis(0);
02580 } else {
02581 fMenuViewOptionOthers->CheckEntry(kM_Axis);
02582 view->SetVisAxis(1);
02583 }
02584 break;
02585
02586 case kM_MdcHits_Hits:
02587 if ( fMenuViewOptionMdcHits->IsEntryChecked(kM_MdcHits_Hits) ) {
02588 fMenuViewOptionMdcHits->UnCheckEntry(kM_MdcHits_Hits);
02589 view->SetVisMdcHits(0);
02590 } else {
02591 fMenuViewOptionMdcHits->CheckEntry(kM_MdcHits_Hits);
02592 view->SetVisMdcHits(1);
02593 }
02594 break;
02595
02596 case kM_TofHits_Global:
02597 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_Global) ) {
02598 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Global);
02599 view->SetVisTofHitsGlobal(0);
02600 } else {
02601 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Global);
02602 view->SetVisTofHitsGlobal(1);
02603 }
02604 break;
02605
02606 case kM_TofHits_East:
02607 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_East) ) {
02608 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_East);
02609 view->SetVisTofHitsEast(0);
02610 } else {
02611 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_East);
02612 view->SetVisTofHitsEast(1);
02613 }
02614 break;
02615
02616 case kM_TofHits_Barrel:
02617 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_Barrel) ) {
02618 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Barrel);
02619 view->SetVisTofHitsBarrel(0);
02620 } else {
02621 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Barrel);
02622 view->SetVisTofHitsBarrel(1);
02623 }
02624 break;
02625
02626 case kM_TofHits_West:
02627 if ( fMenuViewOptionTofHits->IsEntryChecked(kM_TofHits_West) ) {
02628 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_West);
02629 view->SetVisTofHitsWest(0);
02630 } else {
02631 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_West);
02632 view->SetVisTofHitsWest(1);
02633 }
02634 break;
02635
02636 case kM_EmcHits_Global:
02637 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Global) ) {
02638 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Global);
02639 view->SetVisEmcHitsGlobal(0);
02640 } else {
02641 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Global);
02642 view->SetVisEmcHitsGlobal(1);
02643 }
02644 break;
02645
02646 case kM_EmcHits_East:
02647 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_East) ) {
02648 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_East);
02649 view->SetVisEmcHitsEast(0);
02650 } else {
02651 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_East);
02652 view->SetVisEmcHitsEast(1);
02653 }
02654 break;
02655
02656 case kM_EmcHits_Barrel:
02657 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Barrel) ) {
02658 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Barrel);
02659 view->SetVisEmcHitsBarrel(0);
02660 } else {
02661 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Barrel);
02662 view->SetVisEmcHitsBarrel(1);
02663 }
02664 break;
02665
02666 case kM_EmcHits_West:
02667 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_West) ) {
02668 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_West);
02669 view->SetVisEmcHitsWest(0);
02670 } else {
02671 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_West);
02672 view->SetVisEmcHitsWest(1);
02673 }
02674 break;
02675
02676 case kM_EmcHits_Side:
02677 if ( fMenuViewOptionEmcHits->IsEntryChecked(kM_EmcHits_Side) ) {
02678 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Side);
02679 view->SetVisEmcHitsSide(0);
02680 } else {
02681 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Side);
02682 view->SetVisEmcHitsSide(1);
02683 }
02684 break;
02685
02686 case kM_MucHits_Global:
02687 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_Global) ) {
02688 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Global);
02689 view->SetVisMucHitsGlobal(0);
02690 } else {
02691 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Global);
02692 view->SetVisMucHitsGlobal(1);
02693 }
02694 break;
02695
02696 case kM_MucHits_East:
02697 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_East) ) {
02698 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_East);
02699 view->SetVisMucHitsEast(0);
02700 } else {
02701 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_East);
02702 view->SetVisMucHitsEast(1);
02703 }
02704 break;
02705
02706 case kM_MucHits_Barrel:
02707 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_Barrel) ) {
02708 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Barrel);
02709 view->SetVisMucHitsBarrel(0);
02710 } else {
02711 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Barrel);
02712 view->SetVisMucHitsBarrel(1);
02713 }
02714 break;
02715
02716 case kM_MucHits_West:
02717 if ( fMenuViewOptionMucHits->IsEntryChecked(kM_MucHits_West) ) {
02718 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_West);
02719 view->SetVisMucHitsWest(0);
02720 } else {
02721 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_West);
02722 view->SetVisMucHitsWest(1);
02723 }
02724 break;
02725
02726 case kM_Tracks_Global:
02727 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Global) ) {
02728 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Global);
02729 view->SetVisTracksGlobal(0);
02730 } else {
02731 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Global);
02732 view->SetVisTracksGlobal(1);
02733 }
02734 break;
02735
02736 case kM_Tracks_Mdc:
02737 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Mdc) ) {
02738 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Mdc);
02739 view->SetVisTracksMdc(0);
02740 } else {
02741 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Mdc);
02742 view->SetVisTracksMdc(1);
02743 }
02744 break;
02745
02746 case kM_Tracks_Tof:
02747 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Tof) ) {
02748 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Tof);
02749 view->SetVisTracksTof(0);
02750 } else {
02751 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Tof);
02752 view->SetVisTracksTof(1);
02753 }
02754 break;
02755
02756 case kM_Tracks_Emc:
02757 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Emc) ) {
02758 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Emc);
02759 view->SetVisTracksEmc(0);
02760 } else {
02761 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Emc);
02762 view->SetVisTracksEmc(1);
02763 }
02764 break;
02765
02766 case kM_Tracks_Muc:
02767 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Muc) ) {
02768 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Muc);
02769 view->SetVisTracksMuc(0);
02770 } else {
02771 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Muc);
02772 view->SetVisTracksMuc(1);
02773 }
02774 break;
02775
02776 case kM_Tracks_Ext:
02777 if ( fMenuViewOptionTracks->IsEntryChecked(kM_Tracks_Ext) ) {
02778 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Ext);
02779 view->SetVisTracksExt(0);
02780 } else {
02781 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Ext);
02782 view->SetVisTracksExt(1);
02783 }
02784 break;
02785
02786 case kM_View_X3D:
02787 X3D();
02788 break;
02789
02790 case kM_View_OpenGL:
02791 OpenGL();
02792 break;
02793
02794
02795 default:
02796 cerr << "MenuViewOption item" << id << "selected" << endl;
02797 break;
02798 }
02799
02800 view->UpdateView(0);
02801 UpdateStatus();
02802
02803 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Modified();
02804 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Update();
02805 }
02806
02807
02808
02809 void BesClient::HandleError(const char* msg) {
02810
02811
02812 new TGMsgBox(gClient->GetRoot(), this,
02813 "Error", msg,
02814 gClient->GetPicture("mb_stop_s.xpm"));
02815 }
02816
02817
02818
02819 void BesClient::HandleInfoBar(const char* msg) {
02820
02821
02822 fStatusBar->SetText(msg, 1);
02823 }
02824
02825
02826
02827 void BesClient::HandleStatusBar(const char* msg) {
02828
02829
02830 fStatusBar->SetText(msg, 0);
02831 }
02832
02833
02834
02835 void BesClient::Show() {
02836
02837
02838 MapWindow();
02839 MapRaised();
02840 }
02841
02842
02843
02844 void BesClient::LoadGeoFile() {
02845
02846
02847
02848 if ( f_geoFile.Length() != 0){
02849 cout << "Load geoFile f_geoFile: " << f_geoFile << endl;
02850 this->OpenGeoFile(f_geoFile);
02851 }
02852 else {
02853
02854 static TString GeoDir = fBesVisPath + TString("/geom/");
02855 TGFileInfo fi;
02856 fi.fFileTypes = OpenGeoTypes;
02857 fi.fIniDir = StrDup(GeoDir);
02858 char msg[256];
02859 sprintf(msg, "Loading Geometry File");
02860 HandleStatusBar(msg);
02861 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
02862 if (&fi == 0) return;
02863 GeoDir = fi.fIniDir;
02864 this->OpenGeoFile(fi.fFilename);
02865 }
02866 }
02867
02868
02869
02870 void BesClient::OpenGeoFile(TString fname) {
02871
02872
02873 HandleStatusBar("Open Geometry File");
02874 char msg[256];
02875
02876 if (gDebug) cout << fname << " fname Length " << fname.Length() << endl;
02877 Ssiz_t posLastSlash = fname.Last('/');
02878
02879 TString fpath = fname;
02880 fpath = fpath.Remove(posLastSlash+1, fname.Length()-posLastSlash-1);
02881
02882 if (fpath.Length() == 0) return;
02883
02884 if (fDisplay->GetBesGeometry()) {
02885 Int_t ret;
02886 const char *txt;
02887 txt = Form("Geometry has already been build, Yes to rebuild it? \n (Each rebuild increase memory ~80MB)");
02888 new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
02889 "Geometry Exist", txt, kMBIconExclamation,
02890 kMBYes | kMBNo, &ret);
02891 if (ret == kMBNo) return;
02892 }
02893
02894 if ( fname.Contains(".gdml") ) {
02895 fDisplay->InitGeometryFromGDML(fpath);
02896 fDisplay->Draw();
02897 return ;
02898 }
02899
02900 if ( fname.Contains(".root") ) {
02901 fGeoFile = TFile::Open(fname, "read");
02902
02903 TGeoVolume *volBes = (TGeoVolume*)(fGeoFile->Get("volBes"));
02904
02905 if (volBes) {
02906 fDisplay->InitGeometryFromROOT(volBes);
02907 fDisplay->Draw();
02908 return ;
02909 }
02910 else {
02911 this->HandleError("This File is not a valid BesVis geometry file : \n TopVolume \"volBes\" not found!");
02912 sprintf(msg, "This File is not a valid BesVis geometry file");
02913 HandleStatusBar(msg);
02914 return;
02915 }
02916 HandleStatusBar("Ready");
02917 }
02918 }
02919
02920
02921
02922 void BesClient::SaveGeoAs() {
02923
02924
02925
02926
02927 if (!fDisplay) {
02928 this->HandleError("fDisplay not found !");
02929 return;
02930 }
02931
02932 if (!fDisplay->GetBesGeometry()) {
02933 this->HandleError("Bes Geometry not found, Load from ROOT or GDML files first !");
02934 return;
02935 }
02936
02937 TGeoVolume *volBes = fDisplay->GetBesGeometry()->GetVolBes();
02938 if (volBes) {
02939
02940 static TString EventDir(".");
02941 TGFileInfo fi;
02942 fi.fFileTypes = SaveGeoTypes;
02943 fi.fIniDir = StrDup(EventDir);
02944 char msg[256];
02945 sprintf(msg, "Saving Geometry ----> BUSY!");
02946 HandleStatusBar(msg);
02947 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
02948
02949 TFile *f = new TFile( fi.fFilename,"RECREATE");
02950 volBes->Write();
02951 f->Close();
02952 }
02953 else {
02954 this->HandleError("TGeoVolume \"volBes\" not found !");
02955 return;
02956 }
02957
02958 HandleStatusBar("Ready");
02959 }
02960
02961
02962
02963 void BesClient::OpenEventFile() {
02964
02965
02966 if (!gBesGeometry) {
02967 this->HandleError("Geometry not intialized, Load Geometry file first!");
02968 return;
02969 }
02970
02971
02972 static TString EventDir(".");
02973 TGFileInfo fi;
02974 fi.fFileTypes = OpenEventTypes;
02975 fi.fIniDir = StrDup(EventDir);
02976 char msg[256];
02977 sprintf(msg, "Loading Event File");
02978 HandleStatusBar(msg);
02979 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
02980 EventDir = fi.fIniDir;
02981 this->OpenEventFile(fi.fFilename);
02982 }
02983
02984
02985
02986 void BesClient::OpenEventFile(TString fname) {
02987
02988
02989
02990 std::cout << "OpenEventFile: " << fname << std::endl;
02991 HandleStatusBar("Open Event File");
02992 char msg[256];
02993 f_evtFile_1 = fname;
02994 if ( fname.Contains(".root")||fname.Contains(".rtraw")||fname.Contains(".rec") ) {
02995 fEvent = 0;
02996 gEvent = 0;
02997 fEvent = new BesEvent();
02998 gEvent = fEvent;
02999
03000 fEventFile = TFile::Open(fname, "read");
03001
03002 if (fEventFile){
03003 fEventTree = 0;
03004 fEventTree = (TTree*)fEventFile->Get("Event");
03005 }
03006 else {
03007 this->HandleError("This File is not a valid BesVis ROOT Event File!");
03008 sprintf(msg, "This File is not valid");
03009 HandleStatusBar(msg);
03010 return;
03011 }
03012
03013 if (fEventTree) {
03014 Long64_t nEvents = fEventTree->GetEntries();
03015 fEventPlaySlider->SetRange(0, nEvents-1);
03016 fEventPlaySlider->SetPosition(0);
03017
03018 fBesEventNo = 0;
03019 if (nEvents > 0) {
03020 if(f_bossMode == false){
03021 fDigiEvent = 0;
03022 fEvtHeader = 0;
03023
03024 fRecEvent_1 = 0;
03025 fEventTree->SetBranchAddress("TDigiEvent" , &fDigiEvent);
03026 fEventTree->SetBranchAddress("TRecEvent" , &fRecEvent_1);
03027 fEventTree->SetBranchAddress("TEvtHeader" , &fEvtHeader);
03028
03029 }
03030
03031 GetEvent(fBesEventNo);
03032 }
03033
03034 fEventPlaySlider->SetRange(0, nEvents);
03035 fEventPlaySlider->SetPosition(0);
03036 }
03037 else {
03038 this->HandleError("This File is not a valid BesVis ROOT Event File : \n Event Tree \"Event\" not found!");
03039 sprintf(msg, "This File contains no Event Tree \"Event\"");
03040 HandleStatusBar(msg);
03041 return;
03042 }
03043 HandleStatusBar("Ready");
03044 }
03045 }
03046
03047
03048
03049 void BesClient::SavePicAs() {
03050
03051
03052
03053
03054
03055 static TString EventDir(".");
03056 TGFileInfo fi;
03057 fi.fFileTypes = SavePicTypes;
03058 fi.fIniDir = StrDup(EventDir);
03059 char msg[256];
03060 sprintf(msg, "Saving Picture ----> BUSY!");
03061 HandleStatusBar(msg);
03062 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
03063
03064 if ( fi.fFilename ) {
03065 TString filename = fi.fFilename;
03066 if ( filename.EndsWith("gif") || filename.EndsWith("GIF") ) {
03067 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"gif");
03068 }
03069 else if ( filename.EndsWith("jpg") || filename.EndsWith("JPG") ) {
03070 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"jpg");
03071 }
03072 else if ( filename.EndsWith("eps") || filename.EndsWith("EPS") ) {
03073 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"eps");
03074 }
03075 else if ( filename.EndsWith("ps") || filename.EndsWith("PS") ) {
03076 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
03077 }
03078 else if ( filename.EndsWith("xpm") || filename.EndsWith("XPM") ) {
03079 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"xmp");
03080 }
03081 else if ( filename.EndsWith("png") || filename.EndsWith("PNG") ) {
03082 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"png");
03083 }
03084 else if ( filename.EndsWith("tiff") || filename.EndsWith("TIFF") ) {
03085 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"tiff");
03086 }
03087 else if ( filename.EndsWith("cxx") || filename.EndsWith("CXX") ) {
03088 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"cxx");
03089 }
03090 else if ( filename.EndsWith("xml") || filename.EndsWith("XML") ) {
03091 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"xml");
03092 }
03093 else if ( filename.EndsWith("root") || filename.EndsWith("ROOT") ) {
03094 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"root");
03095 }
03096 else {
03097 new TGMsgBox(gClient->GetRoot(), this,"Error", "Please give Name and Extension of Filename! \n Valid Extensions are *.gif, *.jpg, *.ps, *.eps, *.xpm, *.png, *.tiff!",gClient->GetPicture("mb_stop_s.xpm"));
03098 SavePicAs();
03099 return;
03100 }
03101 }
03102 HandleStatusBar("Ready");
03103 }
03104
03105
03106
03107 void BesClient::SavePicAsPS() {
03108
03109
03110
03111
03112
03113 static TString PSEventDir(".");
03114 TGFileInfo fi;
03115 fi.fFileTypes = SavePicPS;
03116 fi.fIniDir = StrDup(PSEventDir);
03117 char msg[256];
03118 sprintf(msg, "Saving Picture as PS ----> BUSY!");
03119 HandleStatusBar(msg);
03120 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
03121
03122 if ( fi.fFilename ) {
03123 TString filename = fi.fFilename;
03124 if ( filename.EndsWith("ps") || filename.EndsWith("PS") ) {
03125 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
03126 }
03127 else {
03128 filename += ".ps";
03129 fEmbeddedCanvas->GetCanvas()->Print(filename.Data(),"ps");
03130 }
03131 }
03132 HandleStatusBar("Ready");
03133 }
03134
03135
03136
03137 void BesClient::SetHome() {
03138
03139 BesView *view = (BesView*)gPad->GetView();
03140 if (view) {
03141 Double_t x1, y1, x2, y2;
03142 gPad->GetRange(x1, y1, x2, y2);
03143
03144 Int_t iPad = 0;
03145 if (view->GetViewType() == kXYView) iPad = 0;
03146 else if (view->GetViewType() == kZRView) iPad = 1;
03147 else if (view->GetViewType() == k3DView) iPad = 2;
03148 fHomeX[iPad] = 0.5*(x1+x2);
03149 fHomeY[iPad] = 0.5*(y1+y2);
03150 }
03151 }
03152
03153
03154
03155 void BesClient::GoHome() {
03156
03157 BesView *view = (BesView*)gPad->GetView();
03158 if (view) {
03159 Double_t x1, y1, x2, y2, dx, dy;
03160 gPad->GetRange(x1, y1, x2, y2);
03161 dx = x2 - x1;
03162 dy = y2 - y1;
03163
03164 Int_t iPad = 0;
03165 if (view->GetViewType() == kXYView) iPad = 0;
03166 else if (view->GetViewType() == kZRView) iPad = 1;
03167 else if (view->GetViewType() == k3DView) iPad = 2;
03168
03169 gPad->Range(fHomeX[iPad]-0.5*dx, fHomeY[iPad]-0.5*dy, fHomeX[iPad]+0.5*dx, fHomeY[iPad]+0.5*dy);
03170 }
03171 }
03172
03173
03174
03175 void BesClient::SaveMyConfig() {
03176
03177
03178
03179 Int_t ret;
03180 const char *txt;
03181 txt = Form("Save current style to ~/.besvisMyConfig.txt, Yes to save it? ");
03182 new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
03183 "Save My Style", txt, kMBIconExclamation,
03184 kMBYes | kMBNo, &ret);
03185 if (ret == kMBNo) return;
03186
03187 string homePath = getenv("HOME");
03188 string fileName = homePath + string("/.besvisMyConfig.txt");
03189
03190 ofstream fileMyConfig(fileName.c_str(), ios_base::out);
03191
03192 if (fDisplay) {
03193 BesView *viewXY = (BesView*)fDisplay->GetPadXY()->GetView();
03194 if (viewXY) {
03195 BesStatus *status = (BesStatus*)viewXY->GetStatusXY();
03196 fileMyConfig << *status;
03197
03198 }
03199
03200 BesView *viewZR = (BesView*)fDisplay->GetPadZR()->GetView();
03201 if (viewZR) {
03202 BesStatus *status = (BesStatus*)viewZR->GetStatusZR();
03203 fileMyConfig << *status;
03204
03205 }
03206
03207 BesView *view3D = (BesView*)fDisplay->GetPad3D()->GetView();
03208 if (view3D) {
03209 BesStatus *status = (BesStatus*)view3D->GetStatus3D();
03210 fileMyConfig << *status;
03211
03212 }
03213 }
03214 }
03215
03216
03217
03218 void BesClient::LoadMyConfig() {
03219
03220
03221
03222 string homePath = getenv("HOME");
03223 string fileName = homePath + string("/.besvisMyConfig.txt");
03224
03225
03226 ostringstream s;
03227 s << "The config file: " << fileName.c_str() << " does not exist ! \n Maybe You have not save your config";
03228 if (!FileExists(TString(fileName))) {
03229 this->HandleError(s.str().c_str());
03230 return;
03231 }
03232
03233 ifstream fileMyConfig(fileName.c_str());
03234 if (fDisplay) {
03235 BesView *viewXY = (BesView*)fDisplay->GetPadXY()->GetView();
03236 if (viewXY) {
03237 BesStatus status;
03238 fileMyConfig >> status;
03239 viewXY->GetStatusCurrent()->Transfer(&status, true);
03240 }
03241
03242 BesView *viewZR = (BesView*)fDisplay->GetPadZR()->GetView();
03243 if (viewZR) {
03244 BesStatus status;
03245 fileMyConfig >> status;
03246 viewZR->GetStatusCurrent()->Transfer(&status, true);
03247 }
03248
03249 BesView *view3D = (BesView*)fDisplay->GetPad3D()->GetView();
03250 if (view3D) {
03251 BesStatus status;
03252 fileMyConfig >> status;
03253 view3D->GetStatusCurrent()->Transfer(&status, true);
03254 }
03255 }
03256
03257 UpdateStatus();
03258 UpdateAllView();
03259 }
03260
03261
03262
03263 void BesClient::LoadMdcPalette() {
03264 cout<<"BesClient Loading PaletteAxis ... "<<endl;
03265
03266 new BesMdcPalette(gClient->GetRoot(), this);
03267
03268
03269
03270
03271 }
03272
03273
03274
03275 void BesClient::Help() {
03276
03277
03278
03279
03280
03281 TRootHelpDialog * hd = new TRootHelpDialog(this, "Help on BesVis...", 600, 400);
03282 hd->SetText(gHelpBesVis);
03283 hd->Popup();
03284 }
03285
03286
03287
03288 void BesClient::SetAllDisplayModeButtonUnHL() {
03289
03290 fDisplayModeButton[0]->SetPicture(gClient->GetPicture("DisplayMode2D.gif"));
03291 fDisplayModeButton[1]->SetPicture(gClient->GetPicture("DisplayModeXY.gif"));
03292 fDisplayModeButton[2]->SetPicture(gClient->GetPicture("DisplayModeZR.gif"));
03293 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3D.gif"));
03294 fDisplayModeButton[4]->SetPicture(gClient->GetPicture("DisplayModeAll.gif"));
03295
03296 for (Int_t i = 0; i < 5; i++) fDisplayModeButton[i]->SetState(false);
03297 }
03298
03299
03300
03301 void BesClient::X3D() {
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312 BesView *view = (BesView*)gPad->GetView();
03313 if (!view) return;
03314
03315 if (view && view->GetViewType() & k3DView) {
03316
03317 gPad->GetViewer3D();
03318
03319
03320 fViewer3DMode = 1;
03321
03322 TViewerX3D *x3d = 0;
03323 x3d = (TViewerX3D*)gPad->GetViewer3D();
03324
03325 if (!x3d) cout << " x3d does not exist "<< endl;
03326 else
03327 x3d->ExecCommand(0,0,'r');
03328
03329 }
03330 else {
03331 string s("Could not start X3D for 2D view, swith to 3D view first");
03332 this->HandleError(s.c_str());
03333 }
03334 }
03335
03336
03337
03338 void BesClient::OpenGL() {
03339
03340 BesView *view = (BesView*)gPad->GetView();
03341 if (!view) return;
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363 }
03364
03365
03366
03367
03368 void BesClient::CloseWindow() {
03369
03370
03371
03372
03373
03374 TGMainFrame::CloseWindow();
03375 gApplication->Terminate(0);
03376 }
03377
03378
03379
03380 Bool_t BesClient::GetEvent(Long64_t i)
03381 {
03382 if (fEventTree) {
03383
03384 Long64_t nEvents = fEventTree->GetEntries();
03385 if (i >= 0 && i < nEvents) {
03386
03387 fDigiEvent = 0;
03388 fEvtHeader = 0;
03389 fRecEvTime = 0;
03390
03391 TDisTrack * fRecEvent = new TDisTrack();
03392 if (f_bossMode == true){
03393 TBranch *digiEvent = fEventTree->GetBranch("TDigiEvent");
03394 TBranch *evtHeader = fEventTree->GetBranch("TEvtHeader");
03395
03396 TBranch *disTrack = fEventTree->GetBranch("TDisTrack");
03397 digiEvent->SetAddress(&fDigiEvent);
03398
03399 disTrack->SetAddress(&fRecEvent);
03400 disTrack->GetEntry(i);
03401 digiEvent->GetEntry(i);
03402 evtHeader->GetEntry(i);
03403
03404 }
03405
03406 if (f_bossMode == false){
03407 fEventTree->GetEntry(i);
03408 if (recTrack1){
03409 delete [] recTrack1;
03410 recTrack1 = NULL;
03411 }
03412
03413 if(fRecEvent_1){
03414 if(fRecEvent_1->getEvTimeCol()->GetEntries()==1){
03415 fRecEvTime = (TRecEvTime*) fRecEvent_1->getEvTimeCol()->At(0);
03416 }else{
03417 cout<<"WARNING:EsTimeCol size!=1, size="<<fRecEvent_1->getEvTimeCol()->GetEntries()<<endl;
03418 }
03419 }
03420
03421
03422 int no = 0;
03423
03424 recTrack1 = new TRecMdcTrack[20];
03425
03426 if (fRecEvent_1){
03427 if (fRecEvent_1->getRecMdcTrackCol()){
03428 no=(fRecEvent_1->getRecMdcTrackCol())->GetEntries();
03429 }
03430 if (no>20) no=20;
03431 for (int i=0;i<no;i++){
03432 const TRecMdcTrack* recTrack =fRecEvent_1->getRecMdcTrack(i);
03433 (recTrack1+i)->setTRecMdcTrack(recTrack);
03434 fRecEvent->addRecMdcTrack(recTrack1+i);
03435 }
03436
03438
03439
03440
03441
03442
03443
03444
03445
03446
03447
03448
03449
03450
03451
03452
03454
03455 if (tofTrack){
03456 delete [] tofTrack;
03457 tofTrack = NULL;
03458 }
03459 tofTrack = new TRecTofTrack[200];
03460 no=0;
03461 if (fRecEvent_1->getTofTrackCol()){
03462 no = (fRecEvent_1->getTofTrackCol())->GetEntries();
03463 }
03464
03465 if (no>200) no =200;
03466 for (int i=0;i<no;i++){
03467 const TRecTofTrack* tofTrack1 =fRecEvent_1->getTofTrack(i);
03468 (tofTrack+i)->setTRecTofTrack(tofTrack1);
03469 fRecEvent->addTofTrack(tofTrack+i);
03470 }
03471
03472 if (mdchit){
03473 delete [] mdchit;
03474 mdchit = NULL;
03475 }
03476 mdchit = new TRecMdcHit[1000];
03477 no=0;
03478 if (fRecEvent_1->getRecMdcHitCol()){
03479 no = (fRecEvent_1->getRecMdcHitCol())->GetEntries();
03480 }
03481 if (no>1000) no =1000;
03482 for (int i=0;i<no;i++){
03483 const TRecMdcHit* mdchit1 =fRecEvent_1->getRecMdcHit(i);
03484 (mdchit+i)->setTRecMdcHit(mdchit1);
03485 fRecEvent->addRecMdcHit(mdchit+i);
03486 }
03487
03488 if (muctrk){
03489 delete [] muctrk;
03490 muctrk= NULL;
03491 }
03492 muctrk = new TRecMucTrack[20];
03493 no=0;
03494 if (fRecEvent_1->getMucTrackCol()){
03495 no = (fRecEvent_1->getMucTrackCol())->GetEntries();
03496 }
03497 if (no>20) no=20;
03498 for (int i=0;i<no;i++){
03499 const TRecMucTrack* mucTrack1 =fRecEvent_1->getMucTrack(i);
03500 (muctrk+i)->setTRecMucTrack(mucTrack1);
03501 fRecEvent->addMucTrack(muctrk+i);
03502 }
03503
03504 if (emcshower){
03505 delete [] emcshower;
03506 emcshower=NULL;
03507 }
03508 emcshower = new TRecEmcShower[20];
03509 no=0;
03510 if (fRecEvent_1->getEmcShowerCol()){
03511 no = (fRecEvent_1->getEmcShowerCol())->GetEntries();
03512 }
03513 if (no>20) no=20;
03514 for (int i=0;i<no;i++){
03515 const TRecEmcShower* rec_emc =fRecEvent_1->getEmcShower(i);
03516 (emcshower+i)->setTRecEmcShower(rec_emc);
03517 fRecEvent->addEmcShower(emcshower+i);
03518 }
03519 }
03520 }
03521
03522
03523
03524 fEvent->SetEvent(fDigiEvent, fRecEvent, fEvtHeader, fRecEvTime);
03525
03526 UpdateAllView();
03527 UpdateStatus();
03528 return true;
03529 }
03530 else {
03531 fAutoDisplayEvent = kFALSE;
03532 if (fAutoDisplayEventTimer) {
03533 fAutoDisplayEventTimer->TurnOff();
03534 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventPlay.gif"));
03535 }
03536
03537 ostringstream s;
03538 s << "Request event entry " << i
03539 << " does not exist ! \n valid ("
03540 << 0 << "~" << nEvents - 1 << ")";
03541 this->HandleError(s.str().c_str());
03542 return false;
03543 }
03544 }
03545 else {
03546 fAutoDisplayEvent = kFALSE;
03547 if (fAutoDisplayEventTimer) fAutoDisplayEventTimer->TurnOff();
03548 this->HandleError("Event Tree does not exist !");
03549 return false;
03550 }
03551 }
03552
03553 Bool_t BesClient::GetRecEvent(){
03554 int semid, shmid, n, runNo;
03555 int *shmptr;
03556 int sem_value_F, sem_value_O;
03557
03558
03559 if (fAutoDisplayEvent){
03560 if (fAutoDisplayEventTimer)
03561 fAutoDisplayEventTimer->TurnOn();
03562 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventStop.gif"));
03563 }
03564
03565
03566 if ((semid = semget(f_pid, 2, 0)) == -1){
03567 perror("concumer -- access -- semget");
03568 exit(0);
03569 }
03570 else {
03571 acquire.sem_num = OUTPUT_STORE;
03572
03573
03574
03575
03576
03577
03578
03579
03580
03581
03582
03583
03584
03585
03587
03588
03589
03590
03591
03592
03593
03594 if ((sem_value_O = semctl(semid, OUTPUT_STORE, GETVAL, 0)) == -1){
03595 perror("Can not get OUTPUT_STORE");
03596 }
03597
03598 if (sem_value_O == 0) return true;
03599 if (f_runStatus == RUN_ERROR){
03600 release.sem_num = FREE_SPACE;
03601 if (semop(semid, &release, 1) == -1){
03602 perror("consumer -- increase -- freeSpace");
03603 exit(0);
03604 }
03605 std::cout << "read data error " << std::endl;
03606 f_runStatus = RUN_SMOOTH;
03607 return true;
03608 }
03609 f_runStatus = RUN_ERROR;
03610
03611 if (semop(semid, &acquire, 1) == -1){
03612 perror("consumer -- decrease -- storage");
03613 exit(0);
03614 }
03615
03616
03617
03618
03619
03620
03621
03622
03623
03624
03625
03626
03627
03628
03629
03630
03631
03632
03633
03634 if (fCurrentEvent >= 1){
03635 if (fDigiEvent){
03636
03637 delete fDigiEvent;
03638 fDigiEvent=0;
03639 }
03640 if (fEvtHeader){
03641 fEvtHeader->Clear();
03642 delete fEvtHeader;
03643 fEvtHeader=0;
03644 }
03645
03646
03647
03648
03649
03650 if (fEvent){
03651 delete fEvent;
03652 fEvent = NULL;
03653 }
03654 }
03655
03656
03657
03658
03659
03660 OpenEventFile(f_evtFile);
03661 if (fEventFile == NULL){
03662 return true;
03663 }
03664 if (fEventTree)
03665 delete fEventTree;
03666 fEventFile->Close();
03667 delete fEventFile;
03668
03669
03670 release.sem_num = FREE_SPACE;
03671
03672
03673
03674
03675
03676
03677
03678
03679
03680
03681
03682
03683
03684
03685
03686
03687
03688
03689
03690
03691
03692
03693
03694
03695
03696
03697 if (semop(semid, &release, 1) == -1){
03698 perror("consumer -- increase -- freeSpace");
03699 exit(0);
03700 }
03701 std::cout << "Current Event No. : " << fCurrentEvent++ << std::endl;
03702
03703
03704
03705
03706
03707
03708
03709
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719 }
03720 f_runStatus = RUN_SMOOTH;
03721 return true;
03722 }
03723
03724
03725 Bool_t BesClient::NextEvent()
03726 {
03727 Bool_t status;
03728 fBesEventNo++;
03729 if ( f_bossMode == false) {
03730 status = GetEvent(fBesEventNo);
03731 }
03732 else if ( f_bossMode == true) {
03733 std::cout << "In Boss Mode, execute NextEvent()" << std::endl;
03734 status = GetRecEvent();
03735 }
03736 if (!status) fBesEventNo--;
03737 return status;
03738 }
03739
03740
03741
03742 Bool_t BesClient::PrevEvent()
03743 {
03744 Bool_t status;
03745 fBesEventNo--;
03746 if ( f_bossMode == false){
03747 status = GetEvent(fBesEventNo);
03748 }
03749 else if ( f_bossMode == true){
03750
03751 this->HandleError("Boss Mode can not get previous event!");
03752 }
03753 if (!status) fBesEventNo++;
03754 return status;
03755 }
03756
03757
03758
03759 Bool_t BesClient::FirstEvent()
03760 {
03761 Bool_t status;
03762 if ( f_bossMode == false){
03763 fBesEventNo = 0;
03764 status = GetEvent(fBesEventNo);
03765 }
03766 else if ( f_bossMode == true){
03767
03768 this->HandleError("Boss Mode can not get first event!");
03769 }
03770 return status;
03771 }
03772
03773
03774
03775 void BesClient::AutoDisplayEvent()
03776 {
03777
03778 fAutoDisplayEvent = !fAutoDisplayEvent;
03779 std::cout << "(AutoDisplayEvent)fAutoDisplayEvent: " << fAutoDisplayEvent << std::endl;
03780 if (fAutoDisplayEventTimer) {
03781 if (fAutoDisplayEvent) {
03782 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventStop.gif"));
03783 fAutoDisplayEventTimer->TurnOn();
03784 }
03785 else {
03786 fPlayEventButton->SetPicture(gClient->GetPicture("ButtonEventPlay.gif"));
03787 fAutoDisplayEventTimer->TurnOff();
03788 }
03789 }
03790
03791
03792
03793
03794
03795
03796
03797
03798 }
03799
03800
03801
03802 void BesClient::AutoDisplayEventCommand()
03803 {
03804 NextEvent();
03805 UpdateBesInputFields();
03806 }
03807
03808
03809
03810 void BesClient::AutoRotate()
03811 {
03812 fAutoRotate = !fAutoRotate;
03813
03814 if (!fAutoRotate) {
03815 fAutoRotateClockWise = 0;
03816 fAutoRotateTheta = 0;
03817 fAutoRotatePhi = 0;
03818 fAutoRotatePsi = 0;
03819 }
03820
03821 if (fAutoRotateTimer) {
03822 if (fAutoRotate) fAutoRotateTimer->TurnOn();
03823 else fAutoRotateTimer->TurnOff();
03824 }
03825 }
03826
03827
03828
03829 void BesClient::AutoRotateCommand()
03830 {
03831 if (fAutoRotateClockWise != 0) {
03832 RotateClockWise(fAutoRotateClockWise);
03833 }
03834
03835 if (fAutoRotateTheta != 0) {
03836 RotateTheta(fAutoRotateTheta);
03837 }
03838
03839 if (fAutoRotatePhi != 0) {
03840 RotatePhi(fAutoRotatePhi);
03841 }
03842
03843 if (fAutoRotatePsi != 0) {
03844 RotatePsi(fAutoRotatePsi);
03845 }
03846
03847
03848
03849
03850
03851
03852
03853
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865 UpdateCurrentPad();
03866 UpdateBesInputFields();
03867 }
03868
03869
03870
03871 void BesClient::RotateClockWise(int clockwise)
03872 {
03873 Double_t phi = 0.0;
03874 Int_t iret;
03875 if (fDisplay->GetPadXY()->GetView()) {
03876 phi = fDisplay->GetPadXY()->GetView()->GetLongitude();
03877 phi += clockwise * fRotateStep;
03878 fDisplay->GetPadXY()->GetView()->SetView(phi,
03879 fDisplay->GetPadXY()->GetView()->GetLatitude(),
03880 fDisplay->GetPadXY()->GetView()->GetPsi(), iret);
03881 fDisplay->GetPadXY()->Modified();
03882 fDisplay->GetPadXY()->Update();
03883 }
03884 if (fDisplay->GetPadZR()->GetView()) {
03885
03886
03887 phi += 180.0;
03888 fDisplay->GetPadZR()->GetView()->SetView(phi,
03889 fDisplay->GetPadZR()->GetView()->GetLatitude(),
03890 fDisplay->GetPadZR()->GetView()->GetPsi(), iret);
03891 fDisplay->GetPadZR()->Modified();
03892 fDisplay->GetPadZR()->Update();
03893 }
03894 }
03895
03896
03897
03898 void BesClient::RotateTheta(int pn)
03899 {
03900 BesView *view = (BesView*)gPad->GetView();
03901
03902 if (view) {
03903 Double_t theta = view->GetLatitude() + pn*fRotateStep;
03904 Int_t iret;
03905 SetRange(theta, 0.0, 180.0);
03906 view->SetView(view->GetLongitude(), theta, view->GetPsi(), iret);
03907
03908
03909 }
03910 }
03911
03912
03913
03914 void BesClient::RotatePhi(int pn)
03915 {
03916 BesView *view = (BesView*)gPad->GetView();
03917
03918 if (view) {
03919 Double_t phi = view->GetLongitude() + pn*fRotateStep;
03920 Int_t iret;
03921 SetRange(phi, 0.0, 360.0);
03922 view->SetView(phi, view->GetLatitude(), view->GetPsi(), iret);
03923
03924
03925 }
03926 }
03927
03928
03929
03930 void BesClient::RotatePsi(int pn)
03931 {
03932 BesView *view = (BesView*)gPad->GetView();
03933
03934 if (view) {
03935 Double_t psi = view->GetPsi() + pn*fRotateStep;
03936 Int_t iret;
03937 SetRange(psi, 0.0, 360.0);
03938 view->SetView(view->GetLongitude(), view->GetLatitude(), psi, iret);
03939
03940
03941 }
03942 }
03943
03944
03945
03946 void BesClient::HandleEventList(TGListTreeItem *entry, Int_t btn) {
03947
03948
03949
03950 if ( entry->GetFirstChild() != 0 ) {
03951
03952 if ( entry->IsOpen() ) {
03953 fEventListTree->CloseItem(entry);
03954 } else {
03955 fEventListTree->OpenItem(entry);
03956 }
03957 } else {
03958 fEventListTree->HighlightItem(entry);
03959 gClient->NeedRedraw(fEventListTree);
03960
03961
03962 fItem = entry;
03963 fRunItem = entry->GetParent();
03964 TString msg1("Displaying Run ");
03965 HandleStatusBar(msg1.Data());
03966
03967 SetState();
03968
03969 TString msg2("Run ");
03970 HandleStatusBar(msg2.Data());
03971 }
03972
03973
03974 TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
03975 canvas->Modified();
03976 canvas->Update();
03977 }
03978
03979
03980
03981 void BesClient::ExecuteEvent(Int_t event, Int_t px, Int_t py, TObject *sel) {
03982
03983
03984
03985
03986 if ( !gBesGeometry ) {
03987 cout << "there is not BesGeometry" << endl;
03988 return;
03989 }
03990
03991
03992 BesView *view = (BesView*)gPad->GetView();
03993 TString viewInfo;
03994 if (view) viewInfo = TString(view->GetObjectInfo(px, py));
03995
03996 switch (event) {
03997
03998 case kKeyPress:
03999
04000
04001 if ( py <= 0 ) py = 1;
04002 switch ( Char_t(px) ) {
04003 case '-':
04004 case 'k':
04005 case 'K':
04006 case 'q':
04007 case 'Q':
04008 view->ZoomOut();
04009 break;
04010 case '+':
04011 case 'j':
04012 case 'J':
04013 case 'e':
04014 case 'E':
04015 view->ZoomIn();
04016 break;
04017 case 'h':
04018 case 'H':
04019 case 'a':
04020 case 'A':
04021 view->Move(-10,0);
04022 fEmbeddedCanvas->GetCanvas()->Update();
04023 break;
04024 case 'l':
04025 case 'L':
04026 case 'd':
04027 case 'D':
04028 view->Move(10,0);
04029 fEmbeddedCanvas->GetCanvas()->Update();
04030 break;
04031 case 'u':
04032 case 'U':
04033 case 'w':
04034 case 'W':
04035 view->Move(0,-10);
04036 fEmbeddedCanvas->GetCanvas()->Update();
04037 break;
04038 case 'i':
04039 case 'I':
04040 case 's':
04041 case 'S':
04042 view->Move(0,10);
04043 fEmbeddedCanvas->GetCanvas()->Update();
04044 break;
04045 case 'n':
04046 case 'N':
04047 this->NextEvent();
04048 break;
04049 case 'p':
04050 case 'P':
04051 this->PrevEvent();
04052 break;
04053 case 'g':
04054 case 'G':
04055 this->SavePicAs();
04056 default:
04057 break;
04058 }
04059 break;
04060
04061 default:
04062 if ( sel != 0 ) {
04063
04064 if ( gPad->GetName() != TString("PadHeader")) {
04065 TString info(sel->GetTitle());
04066 info.Append(": ");
04067 info.Append(sel->GetObjectInfo(px, py));
04068
04069 HandleInfoBar(info.Data());
04070 }
04071 }
04072 break;
04073 }
04074
04075 UpdateBesInputFields();
04076 }
04077
04078
04079
04080 void BesClient::SetState(Int_t id) {
04081
04082
04083 if (id == -1) {
04084 TGButton *btn = (TGButton *) gTQSender;
04085 id = btn->WidgetId();
04086 }
04087
04088 BesView *view = (BesView*)gPad->GetView();
04089 if ( view ) {
04090 switch (id) {
04091
04092 case kM_Header_Global:
04093 break;
04094
04095 case kM_Mdc_Global:
04096 view->SetVisMdcGlobal(fChkBtnMdcGlobal->GetState());
04097
04098
04099 break;
04100
04101 case kM_Mdc_Tubes:
04102 view->SetVisMdcTubes(fChkBtnMdcTubes->GetState());
04103
04104 break;
04105
04106 case kM_Mdc_Wires:
04107 view->SetVisMdcWires(fChkBtnMdcWires->GetState());
04108
04109 break;
04110
04111 case kM_Tof_Global:
04112 view->SetVisTofGlobal(fChkBtnTofGlobal->GetState());
04113
04114 break;
04115
04116 case kM_Tof_East:
04117 view->SetVisTofEast(fChkBtnTofEast->GetState());
04118 break;
04119
04120 case kM_Tof_Barrel:
04121 view->SetVisTofBarrel(fChkBtnTofBarrel->GetState());
04122 break;
04123
04124 case kM_Tof_West:
04125 view->SetVisTofWest(fChkBtnTofWest->GetState());
04126 break;
04127
04128 case kM_Emc_Global:
04129 view->SetVisEmcGlobal(fChkBtnEmcGlobal->GetState());
04130
04131 break;
04132
04133 case kM_Emc_East:
04134 view->SetVisEmcEast(fChkBtnEmcEast->GetState());
04135 break;
04136
04137 case kM_Emc_Barrel:
04138 view->SetVisEmcBarrel(fChkBtnEmcBarrel->GetState());
04139 break;
04140
04141 case kM_Emc_West:
04142 view->SetVisEmcWest(fChkBtnEmcWest->GetState());
04143 break;
04144
04145 case kM_Emc_Side:
04146 view->SetVisEmcSide(fChkBtnEmcSide->GetState());
04147 break;
04148
04149 case kM_Muc_Global:
04150 view->SetVisMucGlobal(fChkBtnMucGlobal->GetState());
04151
04152 break;
04153
04154 case kM_Muc_East:
04155 view->SetVisMucEast(fChkBtnMucEast->GetState());
04156 break;
04157
04158 case kM_Muc_Barrel:
04159 view->SetVisMucBarrel(fChkBtnMucBarrel->GetState());
04160 break;
04161
04162 case kM_Muc_West:
04163 view->SetVisMucWest(fChkBtnMucWest->GetState());
04164 break;
04165
04166 case kM_Muc_Strips:
04167 view->SetVisMucStrips(fChkBtnMucStrips->GetState());
04168 break;
04169
04170 case kM_BeamPipe:
04171 view->SetVisBeamPipe(fChkBtnBeamPipe->GetState());
04172 break;
04173
04174 case kM_ZRPlaneOnXY:
04175 view->SetVisZRPlaneOnXY(fChkBtnZRPlaneOnXY->GetState());
04176 break;
04177
04178 case kM_Axis:
04179 view->SetVisAxis(fChkBtnAxis->GetState());
04180 break;
04181
04182 case kM_MdcHits_Global:
04183 view->SetVisMdcHitsGlobal(fChkBtnMdcHitsGlobal->GetState());
04184 break;
04185
04186 case kM_TofHits_Global:
04187 view->SetVisTofHitsGlobal(fChkBtnTofHitsGlobal->GetState());
04188 break;
04189
04190 case kM_TofHits_East:
04191 view->SetVisTofHitsEast(fChkBtnTofHitsEast->GetState());
04192 break;
04193
04194 case kM_TofHits_Barrel:
04195 view->SetVisTofHitsBarrel(fChkBtnTofHitsBarrel->GetState());
04196 break;
04197
04198 case kM_TofHits_West:
04199 view->SetVisTofHitsWest(fChkBtnTofHitsWest->GetState());
04200 break;
04201
04202 case kM_EmcHits_Global:
04203 view->SetVisEmcHitsGlobal(fChkBtnEmcHitsGlobal->GetState());
04204 break;
04205
04206 case kM_EmcHits_East:
04207 view->SetVisEmcHitsEast(fChkBtnEmcHitsEast->GetState());
04208 break;
04209
04210 case kM_EmcHits_Barrel:
04211 view->SetVisEmcHitsBarrel(fChkBtnEmcHitsBarrel->GetState());
04212 break;
04213
04214 case kM_EmcHits_West:
04215 view->SetVisEmcHitsWest(fChkBtnEmcHitsWest->GetState());
04216 break;
04217
04218 case kM_EmcHits_Side:
04219 view->SetVisEmcHitsSide(fChkBtnEmcHitsSide->GetState());
04220 break;
04221
04222 case kM_MucHits_Global:
04223 view->SetVisMucHitsGlobal(fChkBtnMucHitsGlobal->GetState());
04224 break;
04225
04226 case kM_MucHits_East:
04227 view->SetVisMucHitsEast(fChkBtnMucHitsEast->GetState());
04228 break;
04229
04230 case kM_MucHits_Barrel:
04231 view->SetVisMucHitsBarrel(fChkBtnMucHitsBarrel->GetState());
04232 break;
04233
04234 case kM_MucHits_West:
04235 view->SetVisMucHitsWest(fChkBtnMucHitsWest->GetState());
04236 break;
04237
04238 case kM_Tracks_Global:
04239 view->SetVisTracksGlobal(fChkBtnTracksGlobal->GetState());
04240 break;
04241
04242 case kM_Tracks_Mdc:
04243 view->SetVisTracksMdc(fChkBtnTracksMdc->GetState());
04244 break;
04245
04246 case kM_Tracks_Tof:
04247 view->SetVisTracksTof(fChkBtnTracksTof->GetState());
04248 break;
04249
04250 case kM_Tracks_Emc:
04251 view->SetVisTracksEmc(fChkBtnTracksEmc->GetState());
04252 break;
04253
04254 case kM_Tracks_Muc:
04255 view->SetVisTracksMuc(fChkBtnTracksMuc->GetState());
04256 break;
04257
04258 case kM_Tracks_Ext:
04259 view->SetVisTracksExt(fChkBtnTracksExt->GetState());
04260 break;
04261
04262 case kM_Mdc_TMatch_Global:
04263 this->SetMdcTFire(fChkBtnMdcTMatchGlobal->GetState());
04264 break;
04265
04266 case kM_Mdc_QMatch_Global:
04267 this->SetMdcQFire(fChkBtnMdcQMatchGlobal->GetState());
04268 break;
04269
04270
04271
04272
04273
04274 case kM_Mdc_QNotOverflow_Global:
04275 this->SetMdcQNotOverflow(fChkBtnMdcQOverflowGlobal->GetState());
04276 break;
04277
04278 case kM_Mdc_ColorfulWire_Global:
04279 this->SetMdcColorfulWire(fChkBtnMdcColorfulWireGlobal->GetState());
04280 break;
04281
04282 case kM_Mdc_MdcTimeSubEvTime_Global:
04283 this->SetMdcTimeSubEvTime(fChkBtnMdcTimeSubEvTimeGlobal->GetState());
04284 break;
04285
04286 case kM_Tof_TMatch_Global:
04287 this->SetTofTMatch(fChkBtnTofTMatchGlobal->GetState());
04288 break;
04289
04290 case kM_Tof_QMatch_Global:
04291 this->SetTofQMatch(fChkBtnTofQMatchGlobal->GetState());
04292 break;
04293 }
04294
04295
04296 view->UpdateView(0);
04297
04298 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Modified();
04299 ((TCanvas*)fEmbeddedCanvas->GetCanvas())->Update();
04300 }
04301
04302 UpdateStatus();
04303 }
04304
04305
04306
04307 void BesClient::UpdateStatus() {
04308
04309
04310 BesView *view = (BesView*)gPad->GetView();
04311
04312 if ( view ) {
04313 fZoomRatioNumber->SetNumber(view->GetStatusCurrent()->fZoom*100.0);
04314 view->SetZoomRatio(view->GetStatusCurrent()->fZoom);
04315
04316
04317 view->SetFishEye(view->GetFishEyeStatus());
04318
04319
04320 fChkBtnMdcGlobal->SetOn(view->GetVisMdcGlobal());
04321
04322
04323 fChkBtnMdcTubes->SetOn(view->GetVisMdcTubes());
04324
04325
04326 fChkBtnMdcWires->SetOn(view->GetVisMdcWires());
04327
04328
04329 fChkBtnTofGlobal->SetOn(view->GetVisTofGlobal());
04330
04331
04332 fChkBtnTofEast->SetOn(view->GetVisTofEast());
04333
04334
04335 fChkBtnTofBarrel->SetOn(view->GetVisTofBarrel());
04336
04337
04338 fChkBtnTofWest->SetOn(view->GetVisTofWest());
04339
04340
04341 fChkBtnEmcGlobal->SetOn(view->GetVisEmcGlobal());
04342
04343
04344 fChkBtnEmcEast->SetOn(view->GetVisEmcEast());
04345
04346
04347 fChkBtnEmcBarrel->SetOn(view->GetVisEmcBarrel());
04348
04349
04350 fChkBtnEmcWest->SetOn(view->GetVisEmcWest());
04351
04352
04353 fChkBtnEmcSide->SetOn(view->GetVisEmcSide());
04354
04355
04356 fChkBtnMucGlobal->SetOn(view->GetVisMucGlobal());
04357
04358
04359 fChkBtnMucEast->SetOn(view->GetVisMucEast());
04360
04361
04362 fChkBtnMucBarrel->SetOn(view->GetVisMucBarrel());
04363
04364
04365 fChkBtnMucWest->SetOn(view->GetVisMucWest());
04366
04367
04368 fChkBtnMucStrips->SetOn(view->GetVisMucStrips());
04369
04370
04371 fChkBtnBeamPipe->SetOn(view->GetVisBeamPipe());
04372
04373
04374 fChkBtnZRPlaneOnXY->SetOn(view->GetVisZRPlaneOnXY());
04375
04376
04377 fChkBtnAxis->SetOn(view->GetVisAxis());
04378
04379
04380 fChkBtnMdcHitsGlobal->SetOn(view->GetVisMdcHitsGlobal());
04381
04382
04383 fChkBtnTofHitsGlobal->SetOn(view->GetVisTofHitsGlobal());
04384
04385
04386 fChkBtnTofHitsEast->SetOn(view->GetVisTofHitsEast());
04387
04388
04389 fChkBtnTofHitsBarrel->SetOn(view->GetVisTofHitsBarrel());
04390
04391
04392 fChkBtnTofHitsWest->SetOn(view->GetVisTofHitsWest());
04393
04394
04395 fChkBtnEmcHitsGlobal->SetOn(view->GetVisEmcHitsGlobal());
04396
04397
04398 fChkBtnEmcHitsEast->SetOn(view->GetVisEmcHitsEast());
04399
04400
04401 fChkBtnEmcHitsBarrel->SetOn(view->GetVisEmcHitsBarrel());
04402
04403
04404 fChkBtnEmcHitsWest->SetOn(view->GetVisEmcHitsWest());
04405
04406
04407 fChkBtnEmcHitsSide->SetOn(view->GetVisEmcHitsSide());
04408
04409
04410 fChkBtnMucHitsGlobal->SetOn(view->GetVisMucHitsGlobal());
04411
04412
04413 fChkBtnMucHitsEast->SetOn(view->GetVisMucHitsEast());
04414
04415
04416 fChkBtnMucHitsBarrel->SetOn(view->GetVisMucHitsBarrel());
04417
04418
04419 fChkBtnMucHitsWest->SetOn(view->GetVisMucHitsWest());
04420
04421
04422
04423 fChkBtnTracksGlobal->SetOn(view->GetVisTracksGlobal());
04424
04425
04426 fChkBtnTracksMdc->SetOn(view->GetVisTracksMdc());
04427
04428
04429 fChkBtnTracksTof->SetOn(view->GetVisTracksTof());
04430
04431
04432 fChkBtnTracksEmc->SetOn(view->GetVisTracksEmc());
04433
04434
04435 fChkBtnTracksMuc->SetOn(view->GetVisTracksMuc());
04436
04437
04438 fChkBtnTracksExt->SetOn(view->GetVisTracksExt());
04439
04440
04441
04442 if ( view->GetVisMdcGlobal() )
04443 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Global);
04444 else
04445 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Global);
04446
04447
04448 if ( view->GetVisMdcTubes() )
04449 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Tubes);
04450 else
04451 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Tubes);
04452
04453
04454 if ( view->GetVisMdcWires() )
04455 fMenuViewOptionMdc->CheckEntry(kM_Mdc_Wires);
04456 else
04457 fMenuViewOptionMdc->UnCheckEntry(kM_Mdc_Wires);
04458
04459
04460 if ( view->GetVisTofGlobal() )
04461 fMenuViewOptionTof->CheckEntry(kM_Tof_Global);
04462 else
04463 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Global);
04464
04465
04466 if ( view->GetVisTofEast() )
04467 fMenuViewOptionTof->CheckEntry(kM_Tof_East);
04468 else
04469 fMenuViewOptionTof->UnCheckEntry(kM_Tof_East);
04470
04471
04472 if ( view->GetVisTofBarrel() )
04473 fMenuViewOptionTof->CheckEntry(kM_Tof_Barrel);
04474 else
04475 fMenuViewOptionTof->UnCheckEntry(kM_Tof_Barrel);
04476
04477
04478 if ( view->GetVisTofWest() )
04479 fMenuViewOptionTof->CheckEntry(kM_Tof_West);
04480 else
04481 fMenuViewOptionTof->UnCheckEntry(kM_Tof_West);
04482
04483
04484 if ( view->GetVisEmcGlobal() )
04485 fMenuViewOptionEmc->CheckEntry(kM_Emc_Global);
04486 else
04487 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Global);
04488
04489
04490 if ( view->GetVisEmcEast() )
04491 fMenuViewOptionEmc->CheckEntry(kM_Emc_East);
04492 else
04493 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_East);
04494
04495
04496 if ( view->GetVisEmcBarrel() )
04497 fMenuViewOptionEmc->CheckEntry(kM_Emc_Barrel);
04498 else
04499 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Barrel);
04500
04501
04502 if ( view->GetVisEmcWest() )
04503 fMenuViewOptionEmc->CheckEntry(kM_Emc_West);
04504 else
04505 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_West);
04506
04507
04508 if ( view->GetVisEmcSide() )
04509 fMenuViewOptionEmc->CheckEntry(kM_Emc_Side);
04510 else
04511 fMenuViewOptionEmc->UnCheckEntry(kM_Emc_Side);
04512
04513
04514 if ( view->GetVisMucGlobal() )
04515 fMenuViewOptionMuc->CheckEntry(kM_Muc_Global);
04516 else
04517 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Global);
04518
04519
04520 if ( view->GetVisMucEast() )
04521 fMenuViewOptionMuc->CheckEntry(kM_Muc_East);
04522 else
04523 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_East);
04524
04525
04526 if ( view->GetVisMucBarrel() )
04527 fMenuViewOptionMuc->CheckEntry(kM_Muc_Barrel);
04528 else
04529 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Barrel);
04530
04531
04532 if ( view->GetVisMucWest() )
04533 fMenuViewOptionMuc->CheckEntry(kM_Muc_West);
04534 else
04535 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_West);
04536
04537
04538 if ( view->GetVisMucStrips() )
04539 fMenuViewOptionMuc->CheckEntry(kM_Muc_Strips);
04540 else
04541 fMenuViewOptionMuc->UnCheckEntry(kM_Muc_Strips);
04542
04543
04544 if ( view->GetVisFull3DMdc() )
04545 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Mdc);
04546 else
04547 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Mdc);
04548
04549
04550 if ( view->GetVisFull3DTof() )
04551 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Tof);
04552 else
04553 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Tof);
04554
04555
04556 if ( view->GetVisFull3DEmc() )
04557 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Emc);
04558 else
04559 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Emc);
04560
04561
04562 if ( view->GetVisFull3DMuc() )
04563 fMenuViewOptionFull3D->CheckEntry(kM_Full3D_Muc);
04564 else
04565 fMenuViewOptionFull3D->UnCheckEntry(kM_Full3D_Muc);
04566
04567
04568 if ( view->GetVisBeamPipe() )
04569 fMenuViewOptionOthers->CheckEntry(kM_BeamPipe);
04570 else
04571 fMenuViewOptionOthers->UnCheckEntry(kM_BeamPipe);
04572
04573
04574 if ( view->GetVisZRPlaneOnXY() )
04575 fMenuViewOptionOthers->CheckEntry(kM_ZRPlaneOnXY);
04576 else
04577 fMenuViewOptionOthers->UnCheckEntry(kM_ZRPlaneOnXY);
04578
04579
04580 if ( view->GetVisAxis() ) {
04581 fMenuViewOptionOthers->CheckEntry(kM_Axis);
04582 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxisST.gif"));
04583 fShowAxisButton->SetState(true);
04584 }
04585 else {
04586 fMenuViewOptionOthers->UnCheckEntry(kM_Axis);
04587 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxis.gif"));
04588 fShowAxisButton->SetState(false);
04589 }
04590
04591
04592 if ( view->GetVisMdcHits() )
04593 fMenuViewOptionMdcHits->CheckEntry(kM_MdcHits_Hits);
04594 else
04595 fMenuViewOptionMdcHits->UnCheckEntry(kM_MdcHits_Hits);
04596
04597
04598 if ( view->GetVisTofHitsGlobal() )
04599 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Global);
04600 else
04601 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Global);
04602
04603
04604 if ( view->GetVisTofHitsEast() )
04605 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_East);
04606 else
04607 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_East);
04608
04609
04610 if ( view->GetVisTofHitsBarrel() )
04611 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_Barrel);
04612 else
04613 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_Barrel);
04614
04615
04616 if ( view->GetVisTofHitsWest() )
04617 fMenuViewOptionTofHits->CheckEntry(kM_TofHits_West);
04618 else
04619 fMenuViewOptionTofHits->UnCheckEntry(kM_TofHits_West);
04620
04621
04622 if ( view->GetVisEmcHitsGlobal() )
04623 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Global);
04624 else
04625 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Global);
04626
04627
04628 if ( view->GetVisEmcHitsEast() )
04629 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_East);
04630 else
04631 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_East);
04632
04633
04634 if ( view->GetVisEmcHitsBarrel() )
04635 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Barrel);
04636 else
04637 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Barrel);
04638
04639
04640 if ( view->GetVisEmcHitsWest() )
04641 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_West);
04642 else
04643 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_West);
04644
04645
04646 if ( view->GetVisEmcHitsSide() )
04647 fMenuViewOptionEmcHits->CheckEntry(kM_EmcHits_Side);
04648 else
04649 fMenuViewOptionEmcHits->UnCheckEntry(kM_EmcHits_Side);
04650
04651
04652 if ( view->GetVisMucHitsGlobal() )
04653 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Global);
04654 else
04655 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Global);
04656
04657
04658 if ( view->GetVisMucHitsEast() )
04659 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_East);
04660 else
04661 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_East);
04662
04663
04664 if ( view->GetVisMucHitsBarrel() )
04665 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_Barrel);
04666 else
04667 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_Barrel);
04668
04669
04670 if ( view->GetVisMucHitsWest() )
04671 fMenuViewOptionMucHits->CheckEntry(kM_MucHits_West);
04672 else
04673 fMenuViewOptionMucHits->UnCheckEntry(kM_MucHits_West);
04674
04675
04676 if ( view->GetVisTracksGlobal() )
04677 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Global);
04678 else
04679 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Global);
04680
04681
04682 if ( view->GetVisTracksMdc() )
04683 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Mdc);
04684 else
04685 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Mdc);
04686
04687
04688 if ( view->GetVisTracksTof() )
04689 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Tof);
04690 else
04691 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Tof);
04692
04693
04694 if ( view->GetVisTracksEmc() )
04695 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Emc);
04696 else
04697 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Emc);
04698
04699
04700 if ( view->GetVisTracksMuc() )
04701 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Muc);
04702 else
04703 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Muc);
04704
04705
04706 if ( view->GetVisTracksExt() )
04707 fMenuViewOptionTracks->CheckEntry(kM_Tracks_Ext);
04708 else
04709 fMenuViewOptionTracks->UnCheckEntry(kM_Tracks_Ext);
04710
04711
04712 if ( view->GetFishEye() ) {
04713 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeViewST.gif"));
04714 }
04715 else {
04716 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeView.gif"));
04717 }
04718
04719
04720 if ( view->IsPerspective() ) {
04721 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelView.gif"));
04722 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveViewST.gif"));
04723 }
04724 else {
04725 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelViewST.gif"));
04726 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveView.gif"));
04727 }
04728 }
04729 UpdateBesInputFields();
04730 }
04731
04732
04733
04734 void BesClient::HandleButtons(Int_t id) {
04735
04736
04737 if (id == -1) {
04738 TGButton *btn = (TGButton *) gTQSender;
04739 id = btn->WidgetId();
04740 }
04741
04742
04743 TString query = "";
04744 Int_t displayMode = 0;
04745
04746 Double_t xmin=0.0, ymin=0.0, xmax=0.0, ymax=0.0;
04747 if (gPad) {
04748 xmin = gPad->GetX1();
04749 ymin = gPad->GetY1();
04750 xmax = gPad->GetX2();
04751 ymax = gPad->GetY2();
04752 }
04753
04754 BesView *view = 0;
04755 if (gPad) view = (BesView*)gPad->GetView();
04756 Int_t iret;
04757
04758
04759 switch ( id ) {
04760
04761 case kM_Button_LoadGeoFile:
04762 LoadGeoFile();
04763 fLoadGeoFileButton->SetPicture(gClient->GetPicture("ButtonLoadGeoFile.gif"));
04764 break;
04765
04766 case kM_Button_OpenEventFile:
04767 OpenEventFile();
04768 fOpenEventFileButton->SetPicture(gClient->GetPicture("ButtonOpenEventFile.gif"));
04769 break;
04770
04771 case kM_Button_SavePicAs:
04772 SavePicAs();
04773 fSavePicAsButton->SetPicture(gClient->GetPicture("ButtonSavePicAs.gif"));
04774 break;
04775
04776 case kM_Button_SavePicAsPS:
04777 fSavePicAsPSButton->SetPicture(gClient->GetPicture("ButtonSavePicAsPSHL.gif"));
04778
04779 fEmbeddedCanvas->GetCanvas()->Print("besvis.ps", "ps");
04780 fSavePicAsPSButton->SetPicture(gClient->GetPicture("ButtonSavePicAsPS.gif"));
04781 break;
04782
04783 case kM_Button_Refresh:
04784
04785
04786 if (view) view->UpdateView(0);
04787 break;
04788
04789 case kM_Button_ResetCurrent:
04790 if (view) view->Reset();
04791 break;
04792
04793 case kM_Button_ResetAll:
04794 if (view) fDisplay->Reset();
04795 break;
04796
04797 case kM_Button_CursorPick:
04798 gBesCursor->SetType(kBesPick);
04799 fCursorButton[0]->SetPicture(gClient->GetPicture("ButtonCursorPickST.gif"));
04800 fCursorButton[0]->SetState(true);
04801 fCursorButton[1]->SetPicture(gClient->GetPicture("ButtonCursorHand.gif"));
04802 fCursorButton[1]->SetState(false);
04803
04804
04805 break;
04806
04807 case kM_Button_CursorHand:
04808 gBesCursor->SetType(kBesHand);
04809 fCursorButton[0]->SetPicture(gClient->GetPicture("ButtonCursorPick.gif"));
04810 fCursorButton[0]->SetState(false);
04811 fCursorButton[1]->SetPicture(gClient->GetPicture("ButtonCursorHandST.gif"));
04812 fCursorButton[1]->SetState(true);
04813 break;
04814
04815 case kM_Button_ZoomOut:
04816 if (view) view->ZoomOut();
04817 break;
04818
04819 case kM_Button_ZoomIn:
04820 if (view) view->ZoomIn();
04821 break;
04822
04823 case kM_Button_SetHome:
04824 SetHome();
04825 break;
04826
04827 case kM_Button_GoHome:
04828 GoHome();
04829 break;
04830
04831 case kM_Button_SaveMyConfig:
04832 SaveMyConfig();
04833 fSaveMyConfigButton->SetPicture(gClient->GetPicture("ButtonSaveMyConfig.gif"));
04834 break;
04835
04836 case kM_Button_LoadMyConfig:
04837 LoadMyConfig();
04838 fLoadMyConfigButton->SetPicture(gClient->GetPicture("ButtonLoadMyConfig.gif"));
04839 break;
04840
04841 case kM_Button_Palette:
04842 LoadMdcPalette();
04843 fPaletteButton->SetPicture(gClient->GetPicture("ButtonPalette.gif"));
04844 break;
04845
04846 case kM_Button_Help:
04847 Help();
04848 break;
04849
04850 case kM_Button_ShowInfo:
04851 gBesCursor->SetShowInfo(!gBesCursor->GetShowInfo());
04852 if (gBesCursor->GetShowInfo()) {
04853 fShowInfoButton->SetState(true);
04854 fShowInfoButton->SetPicture(gClient->GetPicture("ButtonShowInfoST.gif"));
04855 }
04856 else {
04857 fShowInfoButton->SetState(false);
04858 fShowInfoButton->SetPicture(gClient->GetPicture("ButtonShowInfo.gif"));
04859 }
04860 break;
04861
04862 case kM_Button_ShowAxis:
04863 if (view) {
04864 view->SetVisAxis(!view->GetVisAxis());
04865 if (view->GetVisAxis()) {
04866 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxisST.gif"));
04867 fShowAxisButton->SetState(true);
04868 }
04869 else {
04870 fShowAxisButton->SetPicture(gClient->GetPicture("ButtonShowAxis.gif"));
04871 fShowAxisButton->SetState(false);
04872 }
04873 view->UpdateView(0);
04874 }
04875 break;
04876
04877 case kM_Button_FishEyeView:
04878 if (view) {
04879 view->SetFishEye(!view->GetFishEye());
04880 if (view->GetFishEye()) {
04881 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeViewST.gif"));
04882 fFishEyeViewButton->SetState(true);
04883 }
04884 else {
04885 fFishEyeViewButton->SetPicture(gClient->GetPicture("ButtonFishEyeView.gif"));
04886 fFishEyeViewButton->SetState(false);
04887 }
04888 }
04889 break;
04890
04891 case kM_Button_ParallelView:
04892 if (view && view->IsPerspective()) {
04893 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelViewST.gif"));
04894 fParallelViewButton->SetState(true);
04895 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveView.gif"));
04896 fPerspectiveViewButton->SetState(false);
04897
04898 view->SetParallel();
04899
04900
04901 view->UpdateView(0);
04902 }
04903 break;
04904
04905 case kM_Button_PerspectiveView:
04906 if (view && !view->IsPerspective()) {
04907 fParallelViewButton->SetPicture(gClient->GetPicture("ButtonParallelView.gif"));
04908 fParallelViewButton->SetState(false);
04909 fPerspectiveViewButton->SetPicture(gClient->GetPicture("ButtonPerspectiveViewST.gif"));
04910 fPerspectiveViewButton->SetState(true);
04911 view->SetPerspective();
04912 view->UpdateView(0);
04913 }
04914 break;
04915
04916 case kM_Button_X3D:
04917 X3D();
04918 fX3DButton->SetPicture(gClient->GetPicture("ButtonX3D.gif"));
04919 break;
04920
04921 case kM_Button_OpenGL:
04922 OpenGL();
04923 fOpenGLButton->SetPicture(gClient->GetPicture("ButtonOpenGL.gif"));
04924 break;
04925
04926 case kM_Button_NextEvent:
04927 NextEvent();
04928 break;
04929
04930 case kM_Button_PrevEvent:
04931 PrevEvent();
04932 break;
04933
04934 case kM_Button_PlayEvent:
04935 AutoDisplayEvent();
04936 break;
04937
04938 case kM_Button_FirstEvent:
04939 FirstEvent();
04940 break;
04941
04942 case kM_Button_ViewResetAngle:
04943 if (view->GetViewType() == k3DView) view->Front();
04944 if (view->GetViewType() == kXYView) view->SetView( 0, 0, 270, iret);
04945 if (view->GetViewType() == kZRView) view->SetView(180, 90, 90, iret);
04946 break;
04947
04948 case kM_Button_ViewCounterClockWise:
04949 RotateClockWise(-1);
04950 if (fAutoRotate) {
04951 if (fAutoRotateClockWise != -1) {
04952 fAutoRotateClockWise = -1;
04953 fAutoRotatePhi = 0;
04954 }
04955 else fAutoRotateClockWise = 0;
04956 }
04957 break;
04958
04959 case kM_Button_ViewClockWise:
04960 RotateClockWise(1);
04961 if (fAutoRotate) {
04962 if (fAutoRotateClockWise != 1) {
04963 fAutoRotateClockWise = 1;
04964 fAutoRotatePhi = 0;
04965 }
04966 else fAutoRotateClockWise = 0;
04967 }
04968 break;
04969
04970 case kM_Button_ViewMoveUp:
04971 view->Move(0,10);
04972
04973 break;
04974
04975 case kM_Button_ViewMoveDown:
04976 view->Move(0,-10);
04977 break;
04978
04979 case kM_Button_ViewMoveLeft:
04980 view->Move(-10,0);
04981 break;
04982
04983 case kM_Button_ViewMoveRight:
04984 view->Move(10,0);
04985 break;
04986
04987 case kM_Button_ViewMoveCenter:
04988 view->Center();
04989 break;
04990
04991 case kM_Button_ViewAngleThetaPlus:
04992 RotateTheta(1);
04993 if (fAutoRotate) {
04994 if (fAutoRotateTheta != 1) fAutoRotateTheta = 1;
04995 else fAutoRotateTheta = 0;
04996 }
04997 break;
04998
04999 case kM_Button_ViewAngleThetaMinus:
05000 RotateTheta(-1);
05001 if (fAutoRotate) {
05002 if (fAutoRotateTheta != -1) fAutoRotateTheta = -1;
05003 else fAutoRotateTheta = 0;
05004 }
05005 break;
05006
05007 case kM_Button_ViewAnglePhiPlus:
05008 RotatePhi(1);
05009 if (fAutoRotate) {
05010 if (fAutoRotatePhi != 1) {
05011 fAutoRotatePhi = 1;
05012 fAutoRotateClockWise = 0;
05013 }
05014 else fAutoRotatePhi = 0;
05015 }
05016 break;
05017
05018 case kM_Button_ViewAnglePhiMinus:
05019 RotatePhi(-1);
05020 if (fAutoRotate) {
05021 if (fAutoRotatePhi != -1) {
05022 fAutoRotatePhi = -1;
05023 fAutoRotateClockWise = 0;
05024 }
05025 else fAutoRotatePhi = 0;
05026 }
05027 break;
05028
05029 case kM_Button_ViewAnglePsiPlus:
05030 if (view->GetViewType() == k3DView) {
05031 RotatePsi(1);
05032 if (fAutoRotate) {
05033 if (fAutoRotatePsi != 1) fAutoRotatePsi = 1;
05034 else fAutoRotatePsi = 0;
05035 }
05036 }
05037 break;
05038
05039 case kM_Button_ViewAnglePsiMinus:
05040 if (view->GetViewType() == k3DView) {
05041 RotatePsi(-1);
05042 if (fAutoRotate) {
05043 if (fAutoRotatePsi != -1) fAutoRotatePsi = -1;
05044 else fAutoRotatePsi = 0;
05045 }
05046 }
05047 break;
05048
05049 case kM_Button_AutoRotate:
05050 AutoRotate();
05051 break;
05052
05053 case kM_Button_DisplayMode2D:
05054 SetAllDisplayModeButtonUnHL();
05055 fDisplayModeButton[0]->SetState(true);
05056 fDisplayModeButton[0]->SetPicture(gClient->GetPicture("DisplayMode2DST.gif"));
05057 fDisplay->SwitchDisplayMode(0);
05058 break;
05059
05060 case kM_Button_DisplayModeXY:
05061 SetAllDisplayModeButtonUnHL();
05062 fDisplayModeButton[1]->SetState(true);
05063 fDisplayModeButton[1]->SetPicture(gClient->GetPicture("DisplayModeXYST.gif"));
05064 fDisplay->SwitchDisplayMode(1);
05065 break;
05066
05067 case kM_Button_DisplayModeZR:
05068 SetAllDisplayModeButtonUnHL();
05069 fDisplayModeButton[2]->SetState(true);
05070 fDisplayModeButton[2]->SetPicture(gClient->GetPicture("DisplayModeZRST.gif"));
05071 fDisplay->SwitchDisplayMode(2);
05072 break;
05073
05074 case kM_Button_DisplayMode3D:
05075 SetAllDisplayModeButtonUnHL();
05076 fDisplayModeButton[3]->SetState(true);
05077 fDisplayModeButton[3]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
05078 fDisplay->SwitchDisplayMode(3);
05079 break;
05080
05081 case kM_Button_DisplayModeAll:
05082 SetAllDisplayModeButtonUnHL();
05083 fDisplayModeButton[4]->SetState(true);
05084 fDisplayModeButton[4]->SetPicture(gClient->GetPicture("DisplayModeAllST.gif"));
05085 fDisplay->SwitchDisplayMode(4);
05086 break;
05087
05088 case kM_Button_SwitchDisplayMode:
05089 displayMode = fDisplay->GetDisplayMode();
05090 displayMode++;
05091 if (displayMode >= 5) displayMode -= 5;
05092 fDisplay->SwitchDisplayMode(displayMode);
05093
05094 SetAllDisplayModeButtonUnHL();
05095 switch (displayMode) {
05096 case 0 :
05097 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayMode2DST.gif"));
05098 break;
05099 case 1 :
05100 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeXYST.gif"));
05101 break;
05102 case 2 :
05103 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeZRST.gif"));
05104 break;
05105 case 3 :
05106 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayMode3DST.gif"));
05107 break;
05108 case 4 :
05109 fDisplayModeButton[displayMode]->SetPicture(gClient->GetPicture("DisplayModeAllST.gif"));
05110 break;
05111 default:
05112 break;
05113 }
05114 break;
05115
05116 case kM_Button_SwitchPad:
05117 fDisplay->SwitchPad();
05118 break;
05119 }
05120
05121 UpdateStatus();
05122 UpdateCurrentPad();
05123 UpdateBesInputFields();
05124 }
05125
05126
05127
05128 void BesClient::HandleSliders(Int_t slider)
05129 {
05130
05131
05132 if (gDebug) cout << "BesClient::DoSlider called!" << endl;
05133
05134 TGButton *btn = (TGButton *) gTQSender;
05135 Int_t id = btn->WidgetId();
05136
05137 BesView *view = (BesView*)gPad->GetView();
05138 Int_t iret;
05139
05140 switch (id) {
05141
05142 case kM_Slider_EventPlay:
05143 fEventPlaySlider->SetPosition(slider);
05144 if (fEventTree) {
05145 fBesEventNo = slider;
05146 this->GetEvent(fBesEventNo);
05147 }
05148 break;
05149
05150 case kM_Slider_ViewAngleTheta:
05151 if (view) {
05152 view->SetView(view->GetLongitude(), slider, view->GetPsi(), iret);
05153 }
05154 break;
05155
05156 case kM_Slider_ViewAnglePhi:
05157 if (view) {
05158 view->SetView(slider, view->GetLatitude(), view->GetPsi(), iret);
05159 }
05160 break;
05161
05162 case kM_Slider_ViewAnglePsi:
05163 if (view && view->GetViewType() == k3DView) {
05164 view->SetView(view->GetLongitude(), view->GetLatitude(), slider, iret);
05165 }
05166 break;
05167 }
05168
05169 UpdateCurrentPad();
05170 UpdateBesInputFields();
05171 }
05172
05173
05174
05175 void BesClient::UpdateAllView()
05176 {
05177 TCanvas *canvas = (TCanvas*)fEmbeddedCanvas->GetCanvas();
05178 TPad *curPad = (TPad*)gPad;
05179
05180 fDisplay->GetPadXY()->cd();
05181 BesView *view = (BesView*)fDisplay->GetPadXY()->GetView();
05182 if (view) {
05183 view->UpdateView(0);
05184 cout << "update xy view" << endl;
05185 }
05186 else cout << "no xy view" << endl;
05187
05188 fDisplay->GetPadZR()->cd();
05189 view = (BesView*)fDisplay->GetPadZR()->GetView();
05190 if (view) {
05191 view->UpdateView(0);
05192 cout << "update zr view" << endl;
05193 }
05194 else cout << "no zr view" << endl;
05195
05196 fDisplay->GetPad3D()->cd();
05197 view = (BesView*)fDisplay->GetPad3D()->GetView();
05198 if (view) {
05199 view->UpdateView(0);
05200 cout << "update 3d view" << endl;
05201 }
05202 else cout << "no 3d view" << endl;
05203
05204
05205 fDisplay->DrawHeader();
05206
05207 curPad->cd();
05208
05209 UpdateBesInputFields();
05210
05211
05212 canvas->Modified();
05213 canvas->Update();
05214 }
05215
05216
05217
05218 void BesClient::UpdateCurrentPad()
05219 {
05220 if (gPad) {
05221 gPad->Modified();
05222 gPad->Update();
05223 }
05224
05225
05226
05227
05228
05229
05230
05231
05232
05236
05237
05238
05239
05240
05241
05242
05243
05244
05245
05246
05247
05248
05249
05250
05251
05252
05253
05254
05255
05256
05257
05258
05259
05260
05261
05262
05263
05264
05265
05266
05267
05268
05269
05270
05271
05272
05273
05274
05275
05276
05277
05278
05279
05280
05281
05282
05283 }
05284
05285
05286
05287 void BesClient::UpdateBesInputFields()
05288 {
05289 fNumEntryRunNo->SetNumber(GetBesRunNo());
05290 fNumEntryEventNo->SetIntNumber(GetBesEventNo());
05291 fNumEntryEventPlaySpeed->SetNumber(Double_t(GetEventPlaySpeed()) / 1000.0);
05292 fEventPlaySlider->SetPosition(GetBesEventNo());
05293
05294 fNumEntryRotateStep->SetNumber(GetRotateStep());
05295 fNumEntryRotateSpeed->SetNumber(GetRotateSpeed());
05296 fNumEntryRotateFPS->SetIntNumber(GetRotateFPS());
05297
05298 BesView *view = (BesView*)gPad->GetView();
05299 if (view) {
05300 fZoomRatioNumber->SetNumber(view->GetZoomRatio()*100.0);
05301
05302 Double_t theta = view->GetLatitude();
05303 Double_t phi = view->GetLongitude();
05304 Double_t psi = view->GetPsi();
05305 SetRange(theta, 0.0, 180.0);
05306 SetRange(phi, 0.0, 360.0);
05307 SetRange(psi, 0.0, 360.0);
05308 fViewAngleThetaNumber->SetNumber(theta);
05309 fViewAnglePhiNumber->SetNumber(phi);
05310 fViewAnglePsiNumber->SetNumber(psi);
05311 }
05312 fViewAngleThetaSlider->SetPosition((Int_t)fViewAngleThetaNumber->GetNumber());
05313 fViewAnglePhiSlider->SetPosition((Int_t)fViewAnglePhiNumber->GetNumber());
05314 fViewAnglePsiSlider->SetPosition((Int_t)fViewAnglePsiNumber->GetNumber());
05315
05316 fChkBtnAutoRotate->SetOn(fAutoRotate);
05317 }
05318
05319
05320
05321 void BesClient::ChangeFocus() {
05322
05323
05324 if (gDebug) cout << "BesClient::ChangeFocus called!" << endl;
05325
05326 if ( gTQSender == fNumEntryRunNo->GetNumberEntry() ) {
05327 fNumEntryEventNo->GetNumberEntry()->SelectAll();
05328 fNumEntryEventNo->GetNumberEntry()->SetFocus();
05329 }
05330 else if ( gTQSender == fNumEntryEventPlaySpeed->GetNumberEntry() ) {
05331 fNumEntryEventPlaySpeed->GetNumberEntry()->SelectAll();
05332 fNumEntryEventPlaySpeed->GetNumberEntry()->SetFocus();
05333 }
05334 else if ( gTQSender == fNumEntryMagnetic->GetNumberEntry() ) {
05335 fNumEntryMagnetic->GetNumberEntry()->SelectAll();
05336 fNumEntryMagnetic->GetNumberEntry()->SetFocus();
05337 }
05338 }
05339
05340
05341
05342 void BesClient::ExecuteReturn() {
05343
05344
05345 if (gDebug) cout << "BesClient::ExecuteReturn called!" << endl;
05346
05347 BesView *view = (BesView*)gPad->GetView();
05348
05349 Int_t iret;
05350
05351 if ( gTQSender == fZoomRatioNumber ) {
05352 if (view) view->SetZoomRatio(fZoomRatioNumber->GetNumber()/100.0);
05353 }
05354
05355 if ( gTQSender == fNumEntryEventNo->GetNumberEntry() ) {
05356 fBesEventNo = fNumEntryEventNo->GetIntNumber();
05357 this->GetEvent(fBesEventNo);
05358 }
05359
05360 else if ( gTQSender == fNumEntryEventPlaySpeed->GetNumberEntry() ) {
05361 fEventPlaySpeed = Int_t(fNumEntryEventPlaySpeed->GetNumber() * 1000);
05362 fAutoDisplayEventTimer->SetTime(fEventPlaySpeed);
05363 }
05364
05365 else if ( gTQSender == fNumEntryRotateSpeed ) {
05366 fRotateSpeed = fNumEntryRotateSpeed->GetNumber();
05367 this->SetRotateStep();
05368 cout << "fRotateSpeed " << fRotateSpeed << " fRotateStep " << fRotateStep << endl;
05369
05370 }
05371
05372 else if ( gTQSender == fNumEntryRotateFPS->GetNumberEntry() ) {
05373 fRotateFPS = fNumEntryRotateFPS->GetIntNumber();
05374 this->SetRotateSpeed();
05375 fAutoRotateTimer->SetTime((Int_t)1000/fRotateFPS);
05376 cout << "fRotateFPS " << fRotateFPS << " fRotateStep " << fRotateStep << endl;
05377 }
05378
05379 else if ( gTQSender == fNumEntryMagnetic->GetNumberEntry() ) {
05380 if (gEvent){
05381 gEvent->SetMagnetic(fNumEntryMagnetic->GetNumber());
05382 }
05383 }
05384
05385 else if ( gTQSender == fNumEntryRotateStep ) {
05386 fRotateStep = fNumEntryRotateStep->GetNumber();
05387 fRotateSpeed = fRotateStep * fRotateFPS;
05388 cout << "fRotateSpeed " << fRotateSpeed << " fRotateStep " << fRotateStep << endl;
05389 }
05390
05391 else if ( gTQSender == fViewAngleThetaNumber ) {
05392 if (view) {
05393 view->SetView(view->GetLongitude(), fViewAngleThetaNumber->GetNumber(), view->GetPsi(), iret);
05394 }
05395 }
05396
05397 else if ( gTQSender == fViewAnglePhiNumber ) {
05398 if (view) {
05399 view->SetView(fViewAnglePhiNumber->GetNumber(), view->GetLatitude(), view->GetPsi(), iret);
05400 }
05401 }
05402
05403 else if ( gTQSender == fViewAnglePsiNumber ) {
05404 if (view && view->GetViewType() == k3DView) {
05405 view->SetView(view->GetLongitude(), view->GetLatitude(), fViewAnglePsiNumber->GetNumber(), iret);
05406 }
05407 }
05408
05409 fEmbeddedCanvas->RequestFocus();
05410 UpdateCurrentPad();
05411 UpdateBesInputFields();
05412 }
05413
05414 Pixmap_t BesClient::GetPic(const char *file)
05415 {
05416 TString filePath = fBesVisPath;
05417 filePath += "/icons/";
05418 filePath += file;
05419
05420 TASImage asImage(filePath);
05421 Pixmap_t pic = asImage.GetPixmap();
05422
05423 return pic;
05424 }
05425
05426 Bool_t BesClient::FileExists(TString fname)
05427 {
05428
05429 return (!gSystem->AccessPathName(fname, kFileExists));
05430 }
05431
05432
05433 void BesClient::SetRange(Double_t &input, Double_t min, Double_t max)
05434 {
05435 Double_t range = max - min;
05436 if (input < min) {
05437 do {
05438 input += range;
05439 }
05440 while (input < min);
05441 }
05442
05443 if (input >= max) {
05444 do {
05445 input -= range;
05446 }
05447 while (input >= max);
05448 }
05449 }