Index: trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx	(revision 426)
+++ trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx	(revision 427)
@@ -12,4 +12,7 @@
 
 
+char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ;  
+
+
 MainFrameSimone::MainFrameSimone(const TGWindow *p, UInt_t w, UInt_t h)
     : TGMainFrame(p, w, h)
@@ -29,5 +32,4 @@
 			  "WaveLen:PosX:PosY:Height:Time:DireX:DireY") ; 
   
-
   //
   // Create a main frame with a number of different buttons.
@@ -35,5 +37,6 @@
 
   //
-  // First create the MenuBar.   //
+  // First create the MenuBar.   
+  //
 
   fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX,
@@ -304,24 +307,23 @@
   //  create the entries in the third subframe
 
-  fButtonWave = new TGTextButton(fTabF3c, "Wavelength", M_BUTTON_WAVELEN );
-  fButtonWave->Associate(this) ;
-  fTabF3c->AddFrame (fButtonWave, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
-
-  fButtonPosit = new TGTextButton(fTabF3c, "Position", M_BUTTON_POSIT );
-  fButtonPosit->Associate(this) ;
-  fTabF3c->AddFrame (fButtonPosit, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
-
-  fButtonHeight = new TGTextButton(fTabF3c, "Height", M_BUTTON_HEIGHT );
-  fButtonHeight->Associate(this) ;
-  fTabF3c->AddFrame (fButtonHeight, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
-
-  fButtonTime = new TGTextButton(fTabF3c, "Time", M_BUTTON_TIME );
-  fButtonTime->Associate(this) ;
-  fTabF3c->AddFrame (fButtonTime, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
-
-  fButtonDire = new TGTextButton(fTabF3c, "Direction", M_BUTTON_DIRE );
-  fButtonDire->Associate(this) ;
-  fTabF3c->AddFrame (fButtonDire, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
-
+  //
+  //   set up the Radio Button
+  //
+
+  fRadioEvt[0] = new TGRadioButton(fTabF3c, new TGHotString("WaveLen") , M_BUTTON_WAVELEN );
+  fRadioEvt[1] = new TGRadioButton(fTabF3c, new TGHotString("Position"), M_BUTTON_POSIT );
+  fRadioEvt[2] = new TGRadioButton(fTabF3c, new TGHotString("Height")  , M_BUTTON_HEIGHT );
+  fRadioEvt[3] = new TGRadioButton(fTabF3c, new TGHotString("Time")    , M_BUTTON_TIME );
+  fRadioEvt[4] = new TGRadioButton(fTabF3c, new TGHotString("Direction"),M_BUTTON_DIRE);
+
+  for (Int_t i = 0; i < 5; i++ ) {
+    fTabF3c->AddFrame(fRadioEvt[i], new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 10, 2, 2) );
+    fRadioEvt[i]->Associate(this);
+  }         
+  
+  fRadioEvt[0]->SetState(kButtonDown) ; 
+
+
+                 
   //
   //  create Tab 4 
@@ -369,15 +371,59 @@
 
 MainFrameSimone::~MainFrameSimone() {
-  
+
+  // first delete all entries in the tab frames
+
+  // Tab 1
+
+  delete fFileView, fFileCont ; 
+  delete fCdup, fListMode, fDetail ; 
+  delete fDir, fSelectButton ; 
+  delete fTabF1a, fTabF1b ; 
+
+  // Tab 2
+
+  delete fButtonTheta, fButtonPhi, fButtonFirst; 
+  delete fButtonPartID, fButtonEnergy, fButtonCore; 
+  delete fCanvasRun ; 
+  delete fButtonPrint ; 
+  delete fDir2, fDirNum ; 
+  delete fLabelInput, fLabelNumEvts ; 
+  delete fTabF2a, fTabF2b, fTabF2c ; 
+  
+  // Tab 3
+
+  delete fRadioEvt[0], fRadioEvt[1], fRadioEvt[2], fRadioEvt[3], fRadioEvt[4]; 
+  delete fButtonPrev, fButtonNext ; 
+  delete fCanvasEvt; 
+  delete fLabelTheta, fLabelPhi, fLabelDireX, fLabelDireY ; 
+  delete fLabelCoreX, fLabelCoreY ;
+  delete fLabelNbPhot ; 
+  delete fLabelId, fLabelEner ; 
+  delete fDir3, fDirEvtNb ; 
+  delete fLabel3, fLabel4; 
+  delete fTabF3bI, fTabF3bII ; 
+  delete fTabF3a, fTabF3b, fTabF3c ; 
+
+  // Tab4 
+
   delete fButton1 ; 
   delete fButton2 ; 
+  delete fButton3 ; 
   delete fFrame, fTab, fTabF1, fTabF2, fTabF4 ; 
-  delete fTabF1a, fTabF1b ; 
-  delete fDir, fCdup, fListMode, fDetail ; 
-  delete fFileCont, fFileView ;
-  delete fFileMenu, fMenuBar; 
+  
+  
+  //  then delete the rest of the main frame
+  
+  delete fFileMenu, fMenuBar;
+  delete fTabF1, fTabF2, fTabF3, fTabF4 ; 
+  delete fFrame, fTab; 
+
   delete fLayout, fLayMenuBar, fLayMenuItem, fLayTab ; 
  
   delete  fPicCdup, fPicList, fPicDetail ; 
+  
+  
+  delete fNtup, fNtupEvt ; 
+
   
 }
@@ -443,6 +489,9 @@
     }
   else  
-    printf("No Ntuple exist!!\n");
-
+    {
+      canvas->Clear() ; 
+      canvas->Modified() ; 
+      canvas->Update() ; 
+    }
   return (kFALSE) ; 
 }
@@ -452,5 +501,5 @@
 // ======================================================================        
 
-Bool_t MainFrameSimone::DrawEvtParam (Char_t *paraName) {
+Bool_t MainFrameSimone::DrawEvtParam () {
 
   TCanvas *canvas =  fCanvasEvt->GetCanvas();
@@ -458,16 +507,29 @@
   canvas->cd() ; 
 
-  if ( fNtupEvt->GetEntries() > 0  )  
-    {
-      fNtupEvt->Draw(paraName) ; 
-      canvas->Modified() ; 
-      canvas->Update() ; 
-      
-      return(kTRUE) ; 
+  char paraName[20] ; 
+  
+  for ( Int_t i=0  ; i<5 ; i++ ) {
+    if ( fRadioEvt[i]->GetState() == kButtonDown) {
+      sprintf( paraName, "%s\0", NtupName[i] ) ; 
+      break ; 
     }
-  else  
-    printf("No entries in Ntuple!!\n");
-
-  return (kFALSE) ; 
+  }
+
+  if ( fNtupEvt->GetEntries() > 0  )  {
+      
+    fNtupEvt->Draw(paraName) ; 
+    canvas->Modified() ; 
+    canvas->Update() ; 
+    
+    return(kTRUE) ; 
+  }
+  else {
+
+    canvas->Clear() ; 
+    canvas->Modified() ; 
+    canvas->Update() ; 
+    
+    return (kFALSE) ; 
+  }
 }
 
@@ -477,6 +539,14 @@
 Bool_t MainFrameSimone::CheckNtup()
 {
+  Int_t buttons = 4, retval ; 
+
   if ( ! strcmp( fInputPath, "\0")  ) {
-    printf ("No InputPath specified!! Do this before!!\n") ; 
+    
+
+    new TGMsgBox(fClient->GetRoot(), this,
+		 "Warning", 
+		 "No Input Path specified\n Do this before!!", 
+		 kMBIconExclamation, buttons, &retval);
+    
     return (kFALSE) ;
   }
@@ -510,6 +580,4 @@
   COREventHeader Event ;  
   
-  printf("readin the input path: %s \n", fInputPath ) ; 
-
   fNtup->Reset() ; 
 
@@ -654,4 +722,6 @@
 Bool_t MainFrameSimone::ReadinEvt()
 {
+  Int_t  buttons =4 , retval ;
+
   Char_t  wort[256] ; 
   FILE  *unit ; 
@@ -663,5 +733,5 @@
   CORParticle    Photon ; 
   
-  Int_t iPhotonInShower ; 
+  Int_t iPhotonInShower ;
   Float_t lambda ; 
 
@@ -671,5 +741,10 @@
 
   if ( ! strcmp( fInputPath, "\0")  ) {
-    printf ("No InputPath specified!! Do this before!!\n") ; 
+
+    new TGMsgBox(fClient->GetRoot(), this,
+		 "Warning", 
+		 "No Input Path specified\n Do this before!!", 
+		 kMBIconExclamation, buttons, &retval);
+    
     return (kFALSE) ;
   }
@@ -681,5 +756,4 @@
 
   sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ;
-  cout << filename << endl ;
 
   fNtupEvt->Reset() ; 
@@ -692,5 +766,9 @@
     
   if ( cerfile.bad() ) { 
-    cout << "Cannot open input file:  " << filename << endl ;
+
+    new TGMsgBox(fClient->GetRoot(), this,
+		 "ERROR", 
+		 "Can't open the cer file!!", 
+		 kMBIconExclamation, buttons, &retval);
     
     return (kFALSE) ; 
@@ -760,6 +838,4 @@
     iPhotonInShower++ ; 
     
-    Photon.print() ; 
-
     fNtupEvt->Fill(Photon.get_wl(), 
 		   Photon.get_x(), 
@@ -790,5 +866,5 @@
 Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
 {
-  Int_t retval = 0 ; 
+  Int_t   buttons = 4, retval = 0 ; 
   Char_t  wort[100] ;
   Char_t  wort2[10] ;
@@ -940,4 +1016,6 @@
 	ReadinEvt() ; 
 
+	DrawEvtParam() ; 
+
 	break; 	
 
@@ -954,26 +1032,8 @@
 	ReadinEvt() ; 
 
+	DrawEvtParam() ; 
+
 	break; 	
 
-
-      case M_BUTTON_WAVELEN:
-	DrawEvtParam("WaveLen") ; 
-	break; 
-
-      case M_BUTTON_POSIT:
-	DrawEvtParam("PosY:PosX") ; 
-	break; 
-
-      case M_BUTTON_HEIGHT:
-	DrawEvtParam("Height") ; 
-	break; 
-
-      case M_BUTTON_TIME:
-	DrawEvtParam("Time") ; 
-	break; 
-
-      case M_BUTTON_DIRE:
-	DrawEvtParam("DireX:DireY") ; 
-	break; 
 
 
@@ -997,5 +1057,14 @@
       break;
 
-    case kCM_RADIOBUTTON:
+    case kCM_RADIOBUTTON: 
+      if (parm1 >= M_BUTTON_WAVELEN && parm1 <= M_BUTTON_DIRE) 
+	{
+	  for (Int_t i=0; i<5; ++i)
+	    if (fRadioEvt[i]->WidgetId() != parm1)
+	      fRadioEvt[i]->SetState(kButtonUp);
+	}
+
+      DrawEvtParam() ; 
+
       break;
 
@@ -1045,6 +1114,12 @@
 
 	    if ( CerFileExist( wort ) ) {
-	      printf ("Warning: Cer files in directory\n") ; 
+
 	      fSelectButton->SetState(kButtonUp) ; 
+	      
+	      new TGMsgBox(fClient->GetRoot(), this,
+			   "Information", 
+			   "This is a directory containing cer files\n click on select to chose it!",
+			   kMBIconAsterisk, buttons, &retval);
+
 	    }  
 	    else {
Index: trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx	(revision 426)
+++ trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx	(revision 427)
@@ -3,4 +3,5 @@
 #include <TGClient.h>
 #include <TGButton.h>
+//#include <TGRadioButton.h>
 #include <TGMenu.h>
 #include <TGTab.h>
@@ -67,4 +68,5 @@
   TGCompositeFrame  *fTabF1, *fTabF2, *fTabF3, *fTabF4 ; 
 
+  //  Tab 1 
   TGCompositeFrame  *fTabF1a, *fTabF1b ; 
   TGTextButton      *fSelectButton ; 
@@ -74,4 +76,5 @@
   TGListView        *fFileView ;
 
+  // Tab2 
   TGCompositeFrame  *fTabF2a, *fTabF2b, *fTabF2c ; 
   TGLabel           *fLabelInput, *fLabelNumEvts ;
@@ -82,4 +85,5 @@
   TGTextButton      *fButtonTheta, *fButtonPhi, *fButtonFirst ; 
 
+  // Tab3 
   TGCompositeFrame  *fTabF3a, *fTabF3b, *fTabF3c ; 
   TGCompositeFrame  *fTabF3bI, *fTabF3bII ;   
@@ -90,12 +94,9 @@
   TGLabel           *fLabelCoreX, *fLabelCoreY ;
   TGLabel           *fLabelTheta, *fLabelPhi, *fLabelDireX, *fLabelDireY ;
-
-
   TRootEmbeddedCanvas    *fCanvasEvt ;  
   TGTextButton      *fButtonPrev, *fButtonNext ; 
-  TGTextButton      *fButtonWave, *fButtonPosit ; 
-  TGTextButton      *fButtonHeight, *fButtonTime, *fButtonDire ; 
+  TGRadioButton     *fRadioEvt[5] ; 
 
-
+  // Tab4 
   TGTextButton      *fButton1 ;
   TGTextButton      *fButton2 ;
@@ -114,5 +115,5 @@
   Bool_t CerFileExist(Char_t *dir) ; 
   Bool_t DrawRunParam(Char_t *paraName) ; 
-  Bool_t DrawEvtParam(Char_t *paraName) ; 
+  Bool_t DrawEvtParam() ; 
 
   Bool_t CheckNtup() ; 
