Ignore:
Timestamp:
07/19/00 11:59:08 (24 years ago)
Author:
harald
Message:
Added some Message boxes to inform what is going on.
Location:
trunk/MagicSoft/Simulation/Corsika/GuiSimone
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx

    r426 r427  
    1212
    1313
     14char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ; 
     15
     16
    1417MainFrameSimone::MainFrameSimone(const TGWindow *p, UInt_t w, UInt_t h)
    1518    : TGMainFrame(p, w, h)
     
    2932                          "WaveLen:PosX:PosY:Height:Time:DireX:DireY") ;
    3033 
    31 
    3234  //
    3335  // Create a main frame with a number of different buttons.
     
    3537
    3638  //
    37   // First create the MenuBar.   //
     39  // First create the MenuBar.   
     40  //
    3841
    3942  fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX,
     
    304307  //  create the entries in the third subframe
    305308
    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                 
    326328  //
    327329  //  create Tab 4
     
    369371
    370372MainFrameSimone::~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
    372409  delete fButton1 ;
    373410  delete fButton2 ;
     411  delete fButton3 ;
    374412  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
    379421  delete fLayout, fLayMenuBar, fLayMenuItem, fLayTab ;
    380422 
    381423  delete  fPicCdup, fPicList, fPicDetail ;
     424 
     425 
     426  delete fNtup, fNtupEvt ;
     427
    382428 
    383429}
     
    443489    }
    444490  else 
    445     printf("No Ntuple exist!!\n");
    446 
     491    {
     492      canvas->Clear() ;
     493      canvas->Modified() ;
     494      canvas->Update() ;
     495    }
    447496  return (kFALSE) ;
    448497}
     
    452501// ======================================================================       
    453502
    454 Bool_t MainFrameSimone::DrawEvtParam (Char_t *paraName) {
     503Bool_t MainFrameSimone::DrawEvtParam () {
    455504
    456505  TCanvas *canvas =  fCanvasEvt->GetCanvas();
     
    458507  canvas->cd() ;
    459508
    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 ;
    467515    }
    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  }
    472534}
    473535
     
    477539Bool_t MainFrameSimone::CheckNtup()
    478540{
     541  Int_t buttons = 4, retval ;
     542
    479543  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   
    481551    return (kFALSE) ;
    482552  }
     
    510580  COREventHeader Event ; 
    511581 
    512   printf("readin the input path: %s \n", fInputPath ) ;
    513 
    514582  fNtup->Reset() ;
    515583
     
    654722Bool_t MainFrameSimone::ReadinEvt()
    655723{
     724  Int_t  buttons =4 , retval ;
     725
    656726  Char_t  wort[256] ;
    657727  FILE  *unit ;
     
    663733  CORParticle    Photon ;
    664734 
    665   Int_t iPhotonInShower ; 
     735  Int_t iPhotonInShower ;
    666736  Float_t lambda ;
    667737
     
    671741
    672742  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   
    674749    return (kFALSE) ;
    675750  }
     
    681756
    682757  sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ;
    683   cout << filename << endl ;
    684758
    685759  fNtupEvt->Reset() ;
     
    692766   
    693767  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);
    695773   
    696774    return (kFALSE) ;
     
    760838    iPhotonInShower++ ;
    761839   
    762     Photon.print() ;
    763 
    764840    fNtupEvt->Fill(Photon.get_wl(),
    765841                   Photon.get_x(),
     
    790866Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
    791867{
    792   Int_t retval = 0 ;
     868  Int_t   buttons = 4, retval = 0 ;
    793869  Char_t  wort[100] ;
    794870  Char_t  wort2[10] ;
     
    9401016        ReadinEvt() ;
    9411017
     1018        DrawEvtParam() ;
     1019
    9421020        break; 
    9431021
     
    9541032        ReadinEvt() ;
    9551033
     1034        DrawEvtParam() ;
     1035
    9561036        break; 
    9571037
    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;
    9781038
    9791039
     
    9971057      break;
    9981058
    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
    10001069      break;
    10011070
     
    10451114
    10461115            if ( CerFileExist( wort ) ) {
    1047               printf ("Warning: Cer files in directory\n") ;
     1116
    10481117              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
    10491124            } 
    10501125            else {
  • trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx

    r426 r427  
    33#include <TGClient.h>
    44#include <TGButton.h>
     5//#include <TGRadioButton.h>
    56#include <TGMenu.h>
    67#include <TGTab.h>
     
    6768  TGCompositeFrame  *fTabF1, *fTabF2, *fTabF3, *fTabF4 ;
    6869
     70  //  Tab 1
    6971  TGCompositeFrame  *fTabF1a, *fTabF1b ;
    7072  TGTextButton      *fSelectButton ;
     
    7476  TGListView        *fFileView ;
    7577
     78  // Tab2
    7679  TGCompositeFrame  *fTabF2a, *fTabF2b, *fTabF2c ;
    7780  TGLabel           *fLabelInput, *fLabelNumEvts ;
     
    8285  TGTextButton      *fButtonTheta, *fButtonPhi, *fButtonFirst ;
    8386
     87  // Tab3
    8488  TGCompositeFrame  *fTabF3a, *fTabF3b, *fTabF3c ;
    8589  TGCompositeFrame  *fTabF3bI, *fTabF3bII ;   
     
    9094  TGLabel           *fLabelCoreX, *fLabelCoreY ;
    9195  TGLabel           *fLabelTheta, *fLabelPhi, *fLabelDireX, *fLabelDireY ;
    92 
    93 
    9496  TRootEmbeddedCanvas    *fCanvasEvt ; 
    9597  TGTextButton      *fButtonPrev, *fButtonNext ;
    96   TGTextButton      *fButtonWave, *fButtonPosit ;
    97   TGTextButton      *fButtonHeight, *fButtonTime, *fButtonDire ;
     98  TGRadioButton     *fRadioEvt[5] ;
    9899
    99 
     100  // Tab4
    100101  TGTextButton      *fButton1 ;
    101102  TGTextButton      *fButton2 ;
     
    114115  Bool_t CerFileExist(Char_t *dir) ;
    115116  Bool_t DrawRunParam(Char_t *paraName) ;
    116   Bool_t DrawEvtParam(Char_t *paraName) ;
     117  Bool_t DrawEvtParam() ;
    117118
    118119  Bool_t CheckNtup() ;
Note: See TracChangeset for help on using the changeset viewer.