Index: trunk/MagicSoft/MarsOctober/mars.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mars.cc	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mars.cc	(revision 452)
@@ -39,5 +39,5 @@
   TApplication theApp("App", &argc, argv);
 
-  MGOctMain mainWin(gClient->GetRoot(), 500, 600);     
+  MGOctMain mainWin(gClient->GetRoot(), 1, 1);     
   
   theApp.Run();
Index: trunk/MagicSoft/MarsOctober/mbase/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mbase/BaseLinkDef.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mbase/BaseLinkDef.h	(revision 452)
@@ -21,3 +21,5 @@
 #pragma link C++ class MInputStreamID;
 
+#pragma link C++ class MEvtLoop;
+
 #endif
Index: trunk/MagicSoft/MarsOctober/mocttest/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/BaseLinkDef.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/BaseLinkDef.h	(revision 452)
@@ -12,4 +12,5 @@
 #pragma link C++ class MTdcSpect ;
 #pragma link C++ class MShowSpect ;
+#pragma link C++ class MCalcPed1 ;
 
 #endif
Index: trunk/MagicSoft/MarsOctober/mocttest/MCalcPed1.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MCalcPed1.cc	(revision 452)
+++ trunk/MagicSoft/MarsOctober/mocttest/MCalcPed1.cc	(revision 452)
@@ -0,0 +1,150 @@
+#include "MCalcPed1.h"
+
+#include <stdlib.h>
+
+#include <TROOT.h> 
+#include <TApplication.h> 
+#include <TSystem.h> 
+#include <TGClient.h> 
+#include <TGFileDialog.h> 
+#include <TVirtualX.h>
+
+#include "MRawEvt.h"
+#include "MParList.h"
+#include "MHistosAdc.h"
+
+
+////////////////////////////////////////////////////////////////////////
+//
+//  MGShowSpect.h
+//
+//  A Gui Task to show the raw ADC values in the histograms
+//
+
+ClassImp(MCalcPed1)
+  
+
+Bool_t MCalcPed1::PreProcess(MParList *pList)
+{
+  //
+  //   Do the preprocessing for MCalcPed1
+  // 
+  //   Connects Histogramms in the MHistosAdc container as the input
+  //   and the MPedest class in the list for output
+  //
+
+  fHists = (MHistosAdc*) pList->FindObject("MHistosAdc");
+  
+  if (!fHists)
+    {
+      cout << "ERROR: MCalcPed1::PreProc():  MHistosAdc  not found!" << endl;
+      exit(1);
+    }
+  
+  fPedData = (MPedest*) pList->FindObject("MPedest");
+  
+  if (!fPedData)
+    {
+      cout << "ERROR: MCalcPed1::PreProc(): MPedest   not found!" << endl;
+      exit(1);
+    }
+  
+  return (kTRUE) ; 
+} 
+
+
+Bool_t MCalcPed1::PostProcess()
+{
+  //   just start the gui for displaying the adc spectra
+
+
+  //  loop over the high gain histograms and do a fit to them to get
+  //  the pedestal datas
+
+  //   define the function to fit
+
+  TH1F *histofit ; 
+  TF1  *gausfit = new TF1 ("gausfit", "gaus", 0., 100.  )  ; 
+  
+  TObjArray  *histList ; 
+
+  Int_t iEnt ; 
+
+  //  all for the high gains 
+  
+  histList = fHists->GetHighList() ; 
+  for ( Int_t i=0; i< fHists->GetHighEntries() ; i++ ) { 
+    
+    //   select the histogram
+    histofit = (TH1F*) histList->At(i) ; 
+    iEnt = histofit->GetEntries() ; 
+
+    if ( iEnt  > 1. ) { 
+      histofit->Fit("gausfit", "RQN" ) ;
+      fPedData->SetAllHigh(i, 
+			   gausfit->GetParameter(1), gausfit->GetParameter(1)/sqrt(iEnt-1.) , 
+			   gausfit->GetParameter(2), gausfit->GetParameter(2)/sqrt(2. * iEnt ) ) ; 
+    } 
+    else { 
+      fPedData->SetAllHigh(i, -1., -1., -1., -1. ) ; 
+    } 
+  } 
+
+   //  all for the low gains 
+  
+  histList = fHists->GetLowList() ; 
+  for ( Int_t i=0; i< fHists->GetLowEntries() ; i++ ) { 
+    
+    histofit = (TH1F*) histList->At(i) ; 
+    iEnt = histofit->GetEntries() ; 
+
+    if ( iEnt  > 1. ) { 
+      histofit->Fit("gausfit", "RQN" ) ;
+      
+      fPedData->SetAllLow(i, 
+			  gausfit->GetParameter(1), gausfit->GetParameter(1)/sqrt(iEnt-1.) , 
+			  gausfit->GetParameter(2), gausfit->GetParameter(2)/sqrt(2. * iEnt ) ) ; 
+    } 
+    else { 
+      fPedData->SetAllLow(i, -1., -1., -1., -1. ) ; 
+    } 
+  } 
+
+  
+  
+  //  fPedData->Print() ; 
+
+  
+    if (strcmp (fFileOut, "nooutput"))
+    {
+        //
+        //   write the histograms to File
+        //
+        cout << endl << "--> INFO: write the histograms to file: "
+            << fFileOut  << endl ;
+
+   
+	TFile out( fFileOut, "recreate") ;
+
+	//
+	//  write the pedestal container to file
+	//
+	
+	fPedData->Write() ;
+	
+	out.Close() ; 
+    }
+
+
+  return (kTRUE) ; 
+} 
+
+
+
+
+
+
+
+
+
+
Index: trunk/MagicSoft/MarsOctober/mocttest/MCalcPed1.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MCalcPed1.h	(revision 452)
+++ trunk/MagicSoft/MarsOctober/mocttest/MCalcPed1.h	(revision 452)
@@ -0,0 +1,44 @@
+#ifndef MCALCPED1_H
+#define MCALCPED1_H
+
+#include "Magic.h"
+
+#include "TH1.h"
+#include "TF1.h"
+#include "TFile.h"
+
+#include "MTask.h"
+#include "MObjBuffer.h"
+#include "MPedest.h"
+
+class MHistosAdc;
+class MParList ;
+class MPedest ; 
+
+class MCalcPed1 : public MTask 
+{
+private:
+  
+  char fFileOut[256] ; 
+
+  MHistosAdc *fHists;		// Pointer to Container with the histograms
+  
+  MPedest    *fPedData ;        // Pointer to Container with Pedestals datas
+ 
+ public:
+  MCalcPed1( Char_t* fileout = "nooutput" ) { 
+    sprintf ( fFileOut, "%s", fileout ) ;   
+  } ; 
+
+
+  Bool_t PreProcess(MParList * pList); 
+  //  Bool_t Process() ; 
+  Bool_t PostProcess();
+  
+  ClassDef(MCalcPed1, 1)	// Fill the raw ADC in the histograms
+};
+
+#endif
+
+
+
Index: trunk/MagicSoft/MarsOctober/mocttest/MGDisplayAdc.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MGDisplayAdc.cc	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MGDisplayAdc.cc	(revision 452)
@@ -1,83 +1,96 @@
-#include "MGDisplayAdc.h" 
+
+#include "MGDisplayAdc.h"
 
 MGDisplayAdc::MGDisplayAdc ( MHistosAdc *Histos,
-			     const TGWindow *p, const TGWindow *main, 
-			     UInt_t w, UInt_t h, 
-			     UInt_t options) 
-  : TGTransientFrame(p, main, w, h, options ) 
+			    const TGWindow *p, const TGWindow *main, 
+			    UInt_t w, UInt_t h, 
+			    UInt_t options) 
+	: TGTransientFrame(p, main, w, h, options ) 
 {
   //   default constructor
-
+  // 
   fHists = Histos ; 
-
+  
   //   the top frame for the list and some buttons and the Canvas 
-
+  
   fFrameTop = new TGHorizontalFrame (this, 60,20,  kFitWidth ) ;
-
+  
+  
   //    left part of top frame
   fFT1 =  new TGVerticalFrame (fFrameTop, 80,300,  kFitWidth ) ; 
-
+  
   fHistoList = new TGListBox ( fFT1, M_LIST_HISTO ) ; 
   fHistoList->Associate( this ) ; 
-  fFT1->AddFrame ( fHistoList, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 10 ) )  ; 
+  fFT1->AddFrame ( fHistoList, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 10 ) )  ;
+  
   fHistoList->Resize(80, 300 ) ; 
-
+  
   fFrameTop->AddFrame (fFT1, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 
-
-
+  
   //    middle part of top frame
- 
+  // 
+  
   fFT2 =  new TGVerticalFrame (fFrameTop, 80,20,  kFitWidth ) ;  
-
+  
   fButtonPrev = new TGTextButton ( fFT2, "Prev Histo", M_BUTTON_PREV ) ; 
   fButtonPrev->Associate (this) ; 
-  fFT2->AddFrame ( fButtonPrev, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 50, 10 ) )  ; 
-
-  fButtonNext = new TGTextButton ( fFT2, "Next Histo", M_BUTTON_NEXT ) ; 
-  fButtonNext->Associate (this) ; 
-  fFT2->AddFrame ( fButtonNext, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) )  ; 
-
-  fFrameTop->AddFrame (fFT2, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 
-
+  fFT2->AddFrame ( fButtonPrev, new TGLayoutHints (kLHintsLeft | kLHintsTop,10, 10, 0, 10 ) )  ; 
+  
+  
+  fVslider1 = new TGVSlider (fFT2, 250, kSlider1 | kScaleBoth, VSId1);
+  
+  fVslider1->Associate(this);
+  fVslider1->SetRange(0, 576);
+  fFT2->AddFrame(fVslider1);   	
+  
+  fButtonNext = new TGTextButton ( fFT2, "Next Histo", M_BUTTON_NEXT ) ;
+  fButtonNext->Associate (this) ;
+  fFT2->AddFrame ( fButtonNext, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 10, 5 ) )  ;  		
+	
+  fFrameTop->AddFrame (fFT2, new TGLayoutHints ( kLHintsTop , 10, 10, 10, 10 ) ) ; 	
+  
+  
   //    right part of top frame
-  
+  // 
   fFT3 =  new TGVerticalFrame (fFrameTop, 60, 60,  kFitWidth ) ;
-
+  
   fECanv = new TRootEmbeddedCanvas("fECanv", fFT3, 400, 400 ) ; 
-  fFT3->AddFrame( fECanv, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 
-
+  fFT3->AddFrame( fECanv, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ;
+  
   fCanv = fECanv->GetCanvas() ; 
-
+	
   fFrameTop->AddFrame (fFT3, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY , 10, 10, 10, 10 ) ) ; 
   
   AddFrame ( fFrameTop, new TGLayoutHints ( kLHintsTop | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 
-
+  
   //
   //   the low frame for the control buttons
   //
   fFrameLow = new TGHorizontalFrame (this, 60,20, kFixedWidth ) ;
-    
+  
   fButtonSave = new TGTextButton ( fFrameLow, "Save", M_BUTTON_SAVE ) ; 
   fButtonSave->Associate (this) ; 
-  fFrameLow->AddFrame ( fButtonSave, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) )  ; 
-
+  fFrameLow->AddFrame ( fButtonSave, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) )  ;
+  
   fButtonPrint = new TGTextButton ( fFrameLow, "Print", M_BUTTON_PRINT ) ; 
   fButtonPrint->Associate (this) ; 
   fFrameLow->AddFrame ( fButtonPrint, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) )  ; 
-
+  
   fButtonPrintAll = new TGTextButton ( fFrameLow, "PrintAll", M_BUTTON_PRINTALL ) ; 
   fButtonPrintAll->Associate (this) ; 
-  fFrameLow->AddFrame ( fButtonPrintAll, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) )  ; 
-
+  fFrameLow->AddFrame ( fButtonPrintAll, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) )  ;
+  
+  
+  
   fButtonClose = new TGTextButton ( fFrameLow, "Close", M_BUTTON_CLOSE ) ; 
   fButtonClose->Associate (this) ; 
   fFrameLow->AddFrame ( fButtonClose, new TGLayoutHints (kLHintsLeft | kLHintsTop, 10, 10, 5, 5 ) )  ; 
   AddFrame ( fFrameLow, new TGLayoutHints ( kLHintsBottom | kLHintsExpandX , 10, 10, 10, 10 ) ) ; 
-
+  
   //
   //
   //
   BuildHistoList() ; 
-
+  
   MapSubwindows();
   
@@ -87,11 +100,13 @@
   SetIconName("ADC Spectra");
   
-  MapWindow(); 
+  MapWindow();
+  
+  SetWMSizeHints(400, 470, 1000, 1000, 10, 10);
 }  
-  
-// ======================================================================
-// ======================================================================
-
-
+
+// ======================================================================
+// ======================================================================
+// 
+// 
 
 MGDisplayAdc::~MGDisplayAdc () 
@@ -101,5 +116,5 @@
   delete fButtonPrintAll ; 
   delete fButtonClose ; 
- 
+  
   delete fButtonPrev; 
   delete fButtonNext ; 
@@ -120,9 +135,9 @@
 void MGDisplayAdc::CloseWindow()
 {
-   // Got close message for this MainFrame. Calls parent CloseWindow()
-   // (which destroys the window) and terminate the application.
-   // The close message is generated by the window manager when its close
-   // window menu item is selected.
-
+  // Got close message for this MainFrame. Calls parent CloseWindow()
+  // (which destroys the window) and terminate the application.
+  // The close message is generated by the window manager when its close
+  // window menu item is selected.
+  // 
   delete this ; 
   //  TGTransientFrame::CloseWindow();
@@ -137,102 +152,152 @@
 Bool_t MGDisplayAdc::BuildHistoList() 
 { 
-  //   looks in the container of the AdcSpectra and reads in the 
-  //   Histogramms in there. 
-  //
-  //   In the class MHistosAdc are in fact two lists. One for the high and
-  //   one for the low gain. Here we will use only the high gain list!!!
-  //   With some special options (settings in the gui) we will also be able
-  //   to plot the low gain
-  
-  for ( Int_t i=0 ; i < fHists->GetHighEntries(); i++ ) { 
+	//   looks in the container of the AdcSpectra and reads in the 
+	//   Histogramms in there. 
+	//
+	//   In the class MHistosAdc are in fact two lists. One for the high and
+	//   one for the low gain. Here we will use only the high gain list!!!
+	//   With some special options (settings in the gui) we will also be able
+	//   to plot the low gain
+	// 
+	for ( Int_t i=0 ; i < fHists->GetHighEntries(); i++ ) { 
+		
+		fHistoList->AddEntry(fHists->GetHighList()->At(i)->GetName(), i+1) ; 
+	} 
+	
+	fHistoList->MapSubwindows() ; 
+	fHistoList->Layout() ; 
+
+	return (kTRUE) ; 
+} 
+
+// ======================================================================
+// ======================================================================
+
+Bool_t MGDisplayAdc::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
+{     
+	
+//	cout <<"Entering process method." << endl;
+	// Process events generated by the buttons in the frame.
+  	// 
+	Int_t   buttons = 4, retval = 0 ; 
+	Char_t  wort[100] ;
+	Char_t  extens[5] ;
+	Char_t  command[110] ;
+	
+	TGFileItem *item ;     // to process items in the file view container
+	void *np = NULL ;      // null pointer
+	
+	switch (GET_MSG(msg)) 
+	{
+	    case kC_COMMAND:
+		switch (GET_SUBMSG(msg)) 
+		{
+		    case kCM_BUTTON:
+			
+			switch (parm1)
+			{  
+				
+			    case M_BUTTON_SAVE:
+				new TGMsgBox(fClient->GetRoot(), this,
+					     "WARNING!",
+					     "Not implemented yet.",
+					     kMBIconExclamation, buttons, &retval); 
+				
+				break ; 
+				
+			    case M_BUTTON_PRINT:
+				break;
+				
+			    case M_BUTTON_CLOSE: 
+				CloseWindow() ; 
+				break ; 
+			    case M_BUTTON_PREV:
+				fCanv->cd() ;
  
-    fHistoList->AddEntry(fHists->GetHighList()->At(i)->GetName(), i+1) ; 
-  } 
-  
-  fHistoList->MapSubwindows() ; 
-  fHistoList->Layout() ; 
-
-  return (kTRUE) ; 
-} 
-
-// ======================================================================
-// ======================================================================
-
-Bool_t MGDisplayAdc::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
-{     
-  // Process events generated by the buttons in the frame.
-  
-  Int_t   buttons = 4, retval = 0 ; 
-  Char_t  wort[100] ;
-  Char_t  extens[5] ;
-  Char_t  command[110] ;
- 
-  TGFileItem *item ;     // to process items in the file view container
-  void *np = NULL ;      // null pointer
-
-  switch (GET_MSG(msg)) 
-    {
-    case kC_COMMAND:
-      switch (GET_SUBMSG(msg)) 
-	{
-	case kCM_BUTTON:
-	  
-	  switch (parm1)
-	    {  
-
-	    case M_BUTTON_SAVE: 
-	      break ; 
+				fHists->GetHighList()->At( fHistoList->GetSelected()-1-1)->Draw() ;
+				
+				fCanv->Modified() ;
+				fCanv->Update() ;
+				fVslider1->SetPosition( fHistoList->GetSelected()-1);
+				
+
+				
+				break;
+				
+			    default:
+				break ;
+			} 
+			
+		    case kCM_MENU:
+			switch (parm1)
+			{
+			}
+			break ;
+			
+		    default:
+			break ;
+			
+		}
+		
+	    case kCM_LISTBOX:
+	      switch  (GET_SUBMSG(msg)) 
+		{
+		case M_LIST_HISTO: 
+		  fCanv->cd() ; 
+		  
+		  fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 
+		  
+		  fCanv->Modified() ; 
+		  fCanv->Update() ;
+		  fVslider1->SetPosition( fHistoList->GetSelected()-1);
+		  
+		  
+		  
+		default:
+		  break ;
+		}
 	      
-	    case M_BUTTON_CLOSE: 
-	      CloseWindow() ; 
-	      break ; 
+		
+	case kC_CONTAINER: 
+	  switch (GET_SUBMSG(msg)) 
+	    {
 	      
+	    case kCT_ITEMDBLCLICK: 
+	      
+	      break; 
+			
 	    default:
 	      break ;
-	    } 
-
-	case kCM_MENU:
-	  switch (parm1) {
-	  }
-	  break ;
+	    }
+	  
+	  
 	  
 	default:
-	  break ;
+	  break;
+	  
+	case kC_VSLIDER:
+	  switch(GET_SUBMSG(msg))
+	    {
+	    case kSL_POS:
+	      {
+		switch(parm1)
+		  {
+		  case VSId1:
+		    fCanv->cd() ;
+		    
+		    fHists->GetHighList()->At(parm2)->Draw() ;
+					
+		    fCanv->Modified() ;
+		    fCanv->Update() ;
+		    
+		    break;
+		  }
+		break;				
+	      }					
+	      break;
+	    }
+	  break;
 	  
 	}
-
-    case kCM_LISTBOX:
-      switch  (GET_SUBMSG(msg)) 
-	{
-	case M_LIST_HISTO: 
-	  fCanv->cd() ; 
-	  
-	  fHists->GetHighList()->At( fHistoList->GetSelected()-1)->Draw() ; 
-
-	  fCanv->Modified() ; 
-	  fCanv->Update() ; 
-	  
-	  break; 
-	  
-	default:
-	  break ;
-	}
-
-    case kC_CONTAINER: 
-      switch (GET_SUBMSG(msg)) {
-	      
-      case kCT_ITEMDBLCLICK: 
-	
-	break; 
-	
-      default:
-	break ;
-      }
-      
-      
-      
-    default:
-      break;
-    }
-  return kTRUE;
+	return kTRUE;
 } 
Index: trunk/MagicSoft/MarsOctober/mocttest/MGDisplayAdc.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MGDisplayAdc.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MGDisplayAdc.h	(revision 452)
@@ -16,4 +16,16 @@
 #include <TGFSContainer.h>
 #include <TGMsgBox.h>
+#include <TVirtualX.h>
+#include <TGFrame.h>
+#include <TGTextEntry.h>
+#include <TGSlider.h>
+#include <TGDoubleSlider.h>
+#include <TGScrollBar.h>
+#include <TSlider.h>
+
+
+
+
+////#include <TGPrintDialog>
 
 #include <TVirtualX.h>
@@ -23,4 +35,9 @@
 
 class MHistosAdc;
+
+enum ETestCommandIdentifiers {
+                VSId1 
+}; 
+
 
 enum ComIdentDisplayAdc {
@@ -56,6 +73,10 @@
   TGTextButton   *fButtonSave, *fButtonPrint, *fButtonPrintAll, *fButtonClose ; 
   
-  TCanvas            *fCanv ; 
-
+  TCanvas            *fCanv ;
+	
+  //for sliders
+  
+  TGVSlider       *fVslider1;
+  
  public:
   
Index: trunk/MagicSoft/MarsOctober/mocttest/MGOctMain.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MGOctMain.cc	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MGOctMain.cc	(revision 452)
@@ -47,6 +47,5 @@
   fTop1->AddFrame (fButEvtDisp, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
  
-  fFrameTop->AddFrame (fTop1, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
-
+  fFrameTop->AddFrame (fTop1, new TGLayoutHints(kLHintsCenterX, 10, 10, 5, 5) );
 
   fTop2 = new TGHorizontalFrame (fFrameTop, 300, 100 ) ; 
@@ -60,6 +59,5 @@
   fTop2->AddFrame (fButCrADC, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
 
-  fFrameTop->AddFrame (fTop2, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
-
+  fFrameTop->AddFrame (fTop2, new TGLayoutHints(kLHintsCenterX, 10, 10, 5, 5) );
 
   fTop3 = new TGHorizontalFrame (fFrameTop, 300, 100 ) ; 
@@ -73,9 +71,8 @@
   fTop3->AddFrame (fButCrTDC, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
 
-  fFrameTop->AddFrame (fTop3, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
-
-
- 
-  AddFrame(fFrameTop, new TGLayoutHints (kLHintsExpandX ) ) ;   
+  fFrameTop->AddFrame (fTop3, new TGLayoutHints(kLHintsCenterX, 10, 10, 5, 5) );
+
+  AddFrame(fFrameTop, new TGLayoutHints (kLHintsTop ) ) ;   
+
 
   //
@@ -85,5 +82,5 @@
   fFrameLow = new TGCompositeFrame (this, 300,100, kHorizontalFrame ) ; 
   
-  fLayTab = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX  , 5, 5, 5, 5 ) ;
+  fLayTab = new TGLayoutHints ( kLHintsExpandX   , 5, 5, 5, 5 ) ;
 
   //    create the first tab
@@ -94,5 +91,5 @@
   
   fTabF1 = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ; 
-  tf->AddFrame(fTabF1, fLayTab ) ; 
+  //  tf->AddFrame(fTabF1, fLayTab ) ; 
 
   
@@ -152,6 +149,6 @@
   fTabF1b->AddFrame(fFileView, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5) ) ; 
 
-   
-  tf->AddFrame(fTabF1, fLayTab) ; 
+  tf->AddFrame(fTabF1, fLayTab) ;
+ 
   fFrameLow->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) ); 
 
@@ -161,4 +158,6 @@
   //   Map the window, set up the layout, etc. 
   //
+
+  SetWMSizeHints(400, 650, 1000, 1000, 10, 10 ) ;      // set the smallest and biggest size of the Main frame
 
   MapSubwindows();
Index: trunk/MagicSoft/MarsOctober/mocttest/MHistosAdc.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MHistosAdc.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MHistosAdc.h	(revision 452)
@@ -27,4 +27,9 @@
       { 
 	return ( fHistHigh ) ; 
+      }   
+
+    TObjArray* GetLowList() 
+      { 
+	return ( fHistLow ) ; 
       } 
     
Index: trunk/MagicSoft/MarsOctober/mocttest/Makefile
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/Makefile	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/Makefile	(revision 452)
@@ -59,5 +59,6 @@
 	   MTdcSpect.cc \
 	   MShowSpect.cc \
-	   MGDisplayAdc.cc 
+	   MGDisplayAdc.cc \
+	   MCalcPed1.cc
 
 SRCS    = $(SRCFILES)
Index: trunk/MagicSoft/MarsOctober/mrootformat/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mrootformat/BaseLinkDef.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mrootformat/BaseLinkDef.h	(revision 452)
@@ -7,4 +7,7 @@
 #pragma link C++ class MRawPixel;
 
+#pragma link C++ class MPixPedest;
+#pragma link C++ class MPedest;
+
 
 #endif
Index: trunk/MagicSoft/MarsOctober/mrootformat/MPedest.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mrootformat/MPedest.cc	(revision 452)
+++ trunk/MagicSoft/MarsOctober/mrootformat/MPedest.cc	(revision 452)
@@ -0,0 +1,70 @@
+#include "MPedest.h"
+
+#include <iostream.h>
+
+ClassImp(MPedest) 
+
+MPedest::MPedest( Int_t iPix ) 
+{
+  //  default destructor 
+
+  fName  = "MPedest" ;
+  fTitle = "Container for Pedestals" ;
+
+
+  fNumPix  = iPix  ;   
+  fHighPed = new MPixPedest[fNumPix] ; 
+  fLowPed  = new MPixPedest[fNumPix] ; 
+  
+} 
+
+MPedest::~MPedest() 
+{
+  //  default destructor 
+  
+  delete fHighPed ; 
+  delete fLowPed ; 
+  
+} 
+
+void MPedest::SetAllHigh( Int_t iPix, Float_t mean, Float_t errMean, Float_t sig, Float_t errSig ) { 
+  //   set the value of one pixel 
+
+  fHighPed[iPix].SetMean(mean) ; 
+  fHighPed[iPix].SetErrMean(errMean) ; 
+  fHighPed[iPix].SetSigma(sig); 
+  fHighPed[iPix].SetErrSigma(errSig) ; 
+} 
+
+void MPedest::SetAllLow( Int_t iPix, Float_t mean, Float_t errMean, Float_t sig, Float_t errSig ) { 
+  //   set the value of one pixel 
+
+  fLowPed[iPix].SetMean(mean) ; 
+  fLowPed[iPix].SetErrMean(errMean) ; 
+  fLowPed[iPix].SetSigma(sig); 
+  fLowPed[iPix].SetErrSigma(errSig) ; 
+} 
+
+
+
+void MPedest::Print() 
+{ 
+  //   information about the content on screen
+
+  cout << " content of Pedestal " << endl ; 
+  cout << " HIGH gain " << endl ; 
+   
+  for ( Int_t i=0; i< fNumPix; i++ ) { 
+    cout << " Pixel: " << i << " High" ; 
+    fHighPed[i].Print() ; 
+  } 
+
+  cout << " LOW gain " << endl ; 
+   
+  for ( Int_t i=0; i< fNumPix; i++ ) { 
+    cout << " Pixel: " << i << " High" ; 
+    fLowPed[i].Print() ; 
+  } 
+   
+} 
+
Index: trunk/MagicSoft/MarsOctober/mrootformat/MPedest.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mrootformat/MPedest.h	(revision 452)
+++ trunk/MagicSoft/MarsOctober/mrootformat/MPedest.h	(revision 452)
@@ -0,0 +1,32 @@
+#ifndef MPEDEST_H
+#define MPEDEST_H
+
+#include "TObject.h"
+
+#include "Magic.h"
+#include "MPixPedest.h"
+#include "MParContainer.h"
+
+
+class MPedest : public MParContainer
+{
+private:
+  Int_t       fNumPix ;        // number of pixels  
+  MPixPedest  *fHighPed ;     // an array with the data for all pixels of the high  gain
+  MPixPedest  *fLowPed ;      // an array with the data for all pixels of the low gain
+
+public:
+
+  MPedest( Int_t iPix = 577 ) ; 
+
+  ~MPedest() ; 
+  
+  void SetAllHigh ( Int_t iPix, Float_t mean, Float_t errMean, Float_t sig, Float_t errSig ) ; 
+  void SetAllLow  ( Int_t iPix, Float_t mean, Float_t errMean, Float_t sig, Float_t errSig ) ; 
+
+  void Print() ; 
+   
+  ClassDef(MPedest, 1)
+};				// end of class definition of MRawPixel 
+
+#endif
Index: trunk/MagicSoft/MarsOctober/mrootformat/MPixPedest.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mrootformat/MPixPedest.cc	(revision 452)
+++ trunk/MagicSoft/MarsOctober/mrootformat/MPixPedest.cc	(revision 452)
@@ -0,0 +1,35 @@
+#include "MPixPedest.h"
+
+#include <iostream.h>
+
+
+ClassImp(MPixPedest) 
+
+
+MPixPedest::MPixPedest() 
+{
+  //   default constructor
+  //
+  
+  fMean    = 0. ; 
+  fErrMean = 0. ; 
+
+  fSig     = 0. ; 
+  fErrSig  = 0. ; 
+} 
+
+
+MPixPedest::~MPixPedest() 
+{
+  //  default constructor 
+
+} 
+
+void MPixPedest::Print() 
+{ 
+  //   information about the content on screen
+
+  cout << " MPixPedest:  Mean:" << fMean << " +- " << fErrMean 
+            << "        Sigma: " << fSig << " +- " << fErrSig 
+       << endl ;   
+} 
Index: trunk/MagicSoft/MarsOctober/mrootformat/MPixPedest.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mrootformat/MPixPedest.h	(revision 452)
+++ trunk/MagicSoft/MarsOctober/mrootformat/MPixPedest.h	(revision 452)
@@ -0,0 +1,73 @@
+#ifndef MPIXPEDEST_H
+#define MPIXPEDEST_H
+
+#include "Magic.h"
+
+#include "TObject.h"
+
+class MPixPedest : public TObject
+{
+private:
+  
+  Float_t   fMean ;           //     the mean value of the pedestal
+  Float_t   fErrMean ;        //     the error of the mean value
+  
+  Float_t   fSig ;            //     the sigma (Width) of the pedestal
+  Float_t   fErrSig ;         //     the error of sigma value
+
+public:
+  MPixPedest() ; 
+
+  ~MPixPedest() ; 
+  
+  void Print() ; 
+
+  // 
+  //   Setter and Getter
+  //
+
+  void SetMean( Float_t  x ) 
+    { 
+      fMean = x ; 
+    } 
+
+  void SetErrMean( Float_t  x ) 
+    { 
+      fErrMean = x ; 
+    } 
+
+  void SetSigma( Float_t  x ) 
+    { 
+      fSig = x ; 
+    } 
+
+   void SetErrSigma( Float_t  x ) 
+    { 
+      fErrSig = x ; 
+    } 
+
+ 
+   Float_t GetMean () 
+     { 
+       return ( fMean ) ; 
+     } 
+
+   Float_t GetErrMean () 
+     { 
+       return ( fErrMean ) ; 
+     } 
+
+   Float_t GetSigma () 
+     { 
+       return !( fSig )  ; 
+     } 
+  
+   Float_t GetErrSigma() 
+     { 
+       return ( fErrSig ) ; 
+     } 
+   
+  ClassDef(MPixPedest, 1)
+};				// end of class definition of MRawPixel 
+
+#endif
Index: trunk/MagicSoft/MarsOctober/mrootformat/Makefile
===================================================================
--- trunk/MagicSoft/MarsOctober/mrootformat/Makefile	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mrootformat/Makefile	(revision 452)
@@ -54,5 +54,7 @@
 
 SRCFILES = MRawPixel.cc \
-	   MRawEvt.cc
+	   MRawEvt.cc \
+	   MPixPedest.cc \
+	   MPedest.cc 
 
 SRCS    = $(SRCFILES)
