Changeset 427 for trunk/MagicSoft/Simulation/Corsika/GuiSimone
- Timestamp:
- 07/19/00 11:59:08 (24 years ago)
- Location:
- trunk/MagicSoft/Simulation/Corsika/GuiSimone
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx
r426 r427 12 12 13 13 14 char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ; 15 16 14 17 MainFrameSimone::MainFrameSimone(const TGWindow *p, UInt_t w, UInt_t h) 15 18 : TGMainFrame(p, w, h) … … 29 32 "WaveLen:PosX:PosY:Height:Time:DireX:DireY") ; 30 33 31 32 34 // 33 35 // Create a main frame with a number of different buttons. … … 35 37 36 38 // 37 // First create the MenuBar. // 39 // First create the MenuBar. 40 // 38 41 39 42 fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, … … 304 307 // create the entries in the third subframe 305 308 306 fButtonWave = new TGTextButton(fTabF3c, "Wavelength", M_BUTTON_WAVELEN ); 307 fButtonWave->Associate(this) ; 308 fTabF3c->AddFrame (fButtonWave, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) ); 309 310 fButtonPosit = new TGTextButton(fTabF3c, "Position", M_BUTTON_POSIT ); 311 fButtonPosit->Associate(this) ; 312 fTabF3c->AddFrame (fButtonPosit, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) ); 313 314 fButtonHeight = new TGTextButton(fTabF3c, "Height", M_BUTTON_HEIGHT ); 315 fButtonHeight->Associate(this) ; 316 fTabF3c->AddFrame (fButtonHeight, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) ); 317 318 fButtonTime = new TGTextButton(fTabF3c, "Time", M_BUTTON_TIME ); 319 fButtonTime->Associate(this) ; 320 fTabF3c->AddFrame (fButtonTime, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) ); 321 322 fButtonDire = new TGTextButton(fTabF3c, "Direction", M_BUTTON_DIRE ); 323 fButtonDire->Associate(this) ; 324 fTabF3c->AddFrame (fButtonDire, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) ); 325 309 // 310 // set up the Radio Button 311 // 312 313 fRadioEvt[0] = new TGRadioButton(fTabF3c, new TGHotString("WaveLen") , M_BUTTON_WAVELEN ); 314 fRadioEvt[1] = new TGRadioButton(fTabF3c, new TGHotString("Position"), M_BUTTON_POSIT ); 315 fRadioEvt[2] = new TGRadioButton(fTabF3c, new TGHotString("Height") , M_BUTTON_HEIGHT ); 316 fRadioEvt[3] = new TGRadioButton(fTabF3c, new TGHotString("Time") , M_BUTTON_TIME ); 317 fRadioEvt[4] = new TGRadioButton(fTabF3c, new TGHotString("Direction"),M_BUTTON_DIRE); 318 319 for (Int_t i = 0; i < 5; i++ ) { 320 fTabF3c->AddFrame(fRadioEvt[i], new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 10, 2, 2) ); 321 fRadioEvt[i]->Associate(this); 322 } 323 324 fRadioEvt[0]->SetState(kButtonDown) ; 325 326 327 326 328 // 327 329 // create Tab 4 … … 369 371 370 372 MainFrameSimone::~MainFrameSimone() { 371 373 374 // first delete all entries in the tab frames 375 376 // Tab 1 377 378 delete fFileView, fFileCont ; 379 delete fCdup, fListMode, fDetail ; 380 delete fDir, fSelectButton ; 381 delete fTabF1a, fTabF1b ; 382 383 // Tab 2 384 385 delete fButtonTheta, fButtonPhi, fButtonFirst; 386 delete fButtonPartID, fButtonEnergy, fButtonCore; 387 delete fCanvasRun ; 388 delete fButtonPrint ; 389 delete fDir2, fDirNum ; 390 delete fLabelInput, fLabelNumEvts ; 391 delete fTabF2a, fTabF2b, fTabF2c ; 392 393 // Tab 3 394 395 delete fRadioEvt[0], fRadioEvt[1], fRadioEvt[2], fRadioEvt[3], fRadioEvt[4]; 396 delete fButtonPrev, fButtonNext ; 397 delete fCanvasEvt; 398 delete fLabelTheta, fLabelPhi, fLabelDireX, fLabelDireY ; 399 delete fLabelCoreX, fLabelCoreY ; 400 delete fLabelNbPhot ; 401 delete fLabelId, fLabelEner ; 402 delete fDir3, fDirEvtNb ; 403 delete fLabel3, fLabel4; 404 delete fTabF3bI, fTabF3bII ; 405 delete fTabF3a, fTabF3b, fTabF3c ; 406 407 // Tab4 408 372 409 delete fButton1 ; 373 410 delete fButton2 ; 411 delete fButton3 ; 374 412 delete fFrame, fTab, fTabF1, fTabF2, fTabF4 ; 375 delete fTabF1a, fTabF1b ; 376 delete fDir, fCdup, fListMode, fDetail ; 377 delete fFileCont, fFileView ; 378 delete fFileMenu, fMenuBar; 413 414 415 // then delete the rest of the main frame 416 417 delete fFileMenu, fMenuBar; 418 delete fTabF1, fTabF2, fTabF3, fTabF4 ; 419 delete fFrame, fTab; 420 379 421 delete fLayout, fLayMenuBar, fLayMenuItem, fLayTab ; 380 422 381 423 delete fPicCdup, fPicList, fPicDetail ; 424 425 426 delete fNtup, fNtupEvt ; 427 382 428 383 429 } … … 443 489 } 444 490 else 445 printf("No Ntuple exist!!\n"); 446 491 { 492 canvas->Clear() ; 493 canvas->Modified() ; 494 canvas->Update() ; 495 } 447 496 return (kFALSE) ; 448 497 } … … 452 501 // ====================================================================== 453 502 454 Bool_t MainFrameSimone::DrawEvtParam ( Char_t *paraName) {503 Bool_t MainFrameSimone::DrawEvtParam () { 455 504 456 505 TCanvas *canvas = fCanvasEvt->GetCanvas(); … … 458 507 canvas->cd() ; 459 508 460 if ( fNtupEvt->GetEntries() > 0 ) 461 { 462 fNtupEvt->Draw(paraName) ; 463 canvas->Modified() ; 464 canvas->Update() ; 465 466 return(kTRUE) ; 509 char paraName[20] ; 510 511 for ( Int_t i=0 ; i<5 ; i++ ) { 512 if ( fRadioEvt[i]->GetState() == kButtonDown) { 513 sprintf( paraName, "%s\0", NtupName[i] ) ; 514 break ; 467 515 } 468 else 469 printf("No entries in Ntuple!!\n"); 470 471 return (kFALSE) ; 516 } 517 518 if ( fNtupEvt->GetEntries() > 0 ) { 519 520 fNtupEvt->Draw(paraName) ; 521 canvas->Modified() ; 522 canvas->Update() ; 523 524 return(kTRUE) ; 525 } 526 else { 527 528 canvas->Clear() ; 529 canvas->Modified() ; 530 canvas->Update() ; 531 532 return (kFALSE) ; 533 } 472 534 } 473 535 … … 477 539 Bool_t MainFrameSimone::CheckNtup() 478 540 { 541 Int_t buttons = 4, retval ; 542 479 543 if ( ! strcmp( fInputPath, "\0") ) { 480 printf ("No InputPath specified!! Do this before!!\n") ; 544 545 546 new TGMsgBox(fClient->GetRoot(), this, 547 "Warning", 548 "No Input Path specified\n Do this before!!", 549 kMBIconExclamation, buttons, &retval); 550 481 551 return (kFALSE) ; 482 552 } … … 510 580 COREventHeader Event ; 511 581 512 printf("readin the input path: %s \n", fInputPath ) ;513 514 582 fNtup->Reset() ; 515 583 … … 654 722 Bool_t MainFrameSimone::ReadinEvt() 655 723 { 724 Int_t buttons =4 , retval ; 725 656 726 Char_t wort[256] ; 657 727 FILE *unit ; … … 663 733 CORParticle Photon ; 664 734 665 Int_t iPhotonInShower ; 735 Int_t iPhotonInShower ; 666 736 Float_t lambda ; 667 737 … … 671 741 672 742 if ( ! strcmp( fInputPath, "\0") ) { 673 printf ("No InputPath specified!! Do this before!!\n") ; 743 744 new TGMsgBox(fClient->GetRoot(), this, 745 "Warning", 746 "No Input Path specified\n Do this before!!", 747 kMBIconExclamation, buttons, &retval); 748 674 749 return (kFALSE) ; 675 750 } … … 681 756 682 757 sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ; 683 cout << filename << endl ;684 758 685 759 fNtupEvt->Reset() ; … … 692 766 693 767 if ( cerfile.bad() ) { 694 cout << "Cannot open input file: " << filename << endl ; 768 769 new TGMsgBox(fClient->GetRoot(), this, 770 "ERROR", 771 "Can't open the cer file!!", 772 kMBIconExclamation, buttons, &retval); 695 773 696 774 return (kFALSE) ; … … 760 838 iPhotonInShower++ ; 761 839 762 Photon.print() ;763 764 840 fNtupEvt->Fill(Photon.get_wl(), 765 841 Photon.get_x(), … … 790 866 Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t) 791 867 { 792 Int_t retval = 0 ;868 Int_t buttons = 4, retval = 0 ; 793 869 Char_t wort[100] ; 794 870 Char_t wort2[10] ; … … 940 1016 ReadinEvt() ; 941 1017 1018 DrawEvtParam() ; 1019 942 1020 break; 943 1021 … … 954 1032 ReadinEvt() ; 955 1033 1034 DrawEvtParam() ; 1035 956 1036 break; 957 1037 958 959 case M_BUTTON_WAVELEN:960 DrawEvtParam("WaveLen") ;961 break;962 963 case M_BUTTON_POSIT:964 DrawEvtParam("PosY:PosX") ;965 break;966 967 case M_BUTTON_HEIGHT:968 DrawEvtParam("Height") ;969 break;970 971 case M_BUTTON_TIME:972 DrawEvtParam("Time") ;973 break;974 975 case M_BUTTON_DIRE:976 DrawEvtParam("DireX:DireY") ;977 break;978 1038 979 1039 … … 997 1057 break; 998 1058 999 case kCM_RADIOBUTTON: 1059 case kCM_RADIOBUTTON: 1060 if (parm1 >= M_BUTTON_WAVELEN && parm1 <= M_BUTTON_DIRE) 1061 { 1062 for (Int_t i=0; i<5; ++i) 1063 if (fRadioEvt[i]->WidgetId() != parm1) 1064 fRadioEvt[i]->SetState(kButtonUp); 1065 } 1066 1067 DrawEvtParam() ; 1068 1000 1069 break; 1001 1070 … … 1045 1114 1046 1115 if ( CerFileExist( wort ) ) { 1047 printf ("Warning: Cer files in directory\n") ; 1116 1048 1117 fSelectButton->SetState(kButtonUp) ; 1118 1119 new TGMsgBox(fClient->GetRoot(), this, 1120 "Information", 1121 "This is a directory containing cer files\n click on select to chose it!", 1122 kMBIconAsterisk, buttons, &retval); 1123 1049 1124 } 1050 1125 else { -
trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx
r426 r427 3 3 #include <TGClient.h> 4 4 #include <TGButton.h> 5 //#include <TGRadioButton.h> 5 6 #include <TGMenu.h> 6 7 #include <TGTab.h> … … 67 68 TGCompositeFrame *fTabF1, *fTabF2, *fTabF3, *fTabF4 ; 68 69 70 // Tab 1 69 71 TGCompositeFrame *fTabF1a, *fTabF1b ; 70 72 TGTextButton *fSelectButton ; … … 74 76 TGListView *fFileView ; 75 77 78 // Tab2 76 79 TGCompositeFrame *fTabF2a, *fTabF2b, *fTabF2c ; 77 80 TGLabel *fLabelInput, *fLabelNumEvts ; … … 82 85 TGTextButton *fButtonTheta, *fButtonPhi, *fButtonFirst ; 83 86 87 // Tab3 84 88 TGCompositeFrame *fTabF3a, *fTabF3b, *fTabF3c ; 85 89 TGCompositeFrame *fTabF3bI, *fTabF3bII ; … … 90 94 TGLabel *fLabelCoreX, *fLabelCoreY ; 91 95 TGLabel *fLabelTheta, *fLabelPhi, *fLabelDireX, *fLabelDireY ; 92 93 94 96 TRootEmbeddedCanvas *fCanvasEvt ; 95 97 TGTextButton *fButtonPrev, *fButtonNext ; 96 TGTextButton *fButtonWave, *fButtonPosit ; 97 TGTextButton *fButtonHeight, *fButtonTime, *fButtonDire ; 98 TGRadioButton *fRadioEvt[5] ; 98 99 99 100 // Tab4 100 101 TGTextButton *fButton1 ; 101 102 TGTextButton *fButton2 ; … … 114 115 Bool_t CerFileExist(Char_t *dir) ; 115 116 Bool_t DrawRunParam(Char_t *paraName) ; 116 Bool_t DrawEvtParam( Char_t *paraName) ;117 Bool_t DrawEvtParam() ; 117 118 118 119 Bool_t CheckNtup() ;
Note:
See TracChangeset
for help on using the changeset viewer.