Index: trunk/MagicSoft/Mars/manalysis/MHPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHPedestalCam.h	(revision 3157)
+++ trunk/MagicSoft/Mars/manalysis/MHPedestalCam.h	(revision 3157)
@@ -0,0 +1,48 @@
+#ifndef MARS_MHPedestalCam
+#define MARS_MHPedestalCam
+
+#ifndef ROOT_TObjArray
+#include <TObjArray.h>
+#endif
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+
+class MHPedestalPix;
+class MPedestalCam;
+class MHPedestalCam : public MH, public MCamEvent
+{
+
+private:
+
+  TObjArray  *fArray;       //-> List of Lo/Hi gain Histograms
+
+  MPedestalCam *fPedestals; //! need to initialize MPedestalCam to zero (which is not default!)
+  
+  Float_t fExtractSlices;
+  
+public:
+  MHPedestalCam(const char *name=NULL, const char *title=NULL);
+  ~MHPedestalCam();
+  
+  MHPedestalPix &operator[](UInt_t i);
+  const MHPedestalPix &operator[](UInt_t i) const;
+  
+  Bool_t SetupFill(const MParList *pList);
+  Bool_t Fill(const MParContainer *par, const Stat_t w=1);
+  Bool_t Finalize();
+  
+  TObject *Clone(const char *) const;
+  
+  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
+  void DrawPixelContent(Int_t idx) const;
+  
+  ClassDef(MHPedestalCam, 1)	// Storage Container for all pedestal information of the camera
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc	(revision 3157)
+++ trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc	(revision 3157)
@@ -0,0 +1,119 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MHPedestalPix
+//
+//  Performs all the necessary fits to extract the mean number of photons
+//              out of the derived light flux
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MHPedestalPix.h"
+
+#include <TH1.h>
+#include <TF1.h>
+
+#include <TStyle.h>
+#include <TCanvas.h>
+
+#include "MH.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MHPedestalPix);
+
+using namespace std;
+//
+const Int_t   MHPedestalPix::fgChargeNbins    = 450 ;
+const Axis_t  MHPedestalPix::fgChargeFirst    = -0.5;
+const Axis_t  MHPedestalPix::fgChargeLast     = 449.5;
+// --------------------------------------------------------------------------
+//
+// Default Constructor. 
+//
+MHPedestalPix::MHPedestalPix() : fPixId(-1)
+{ 
+
+  SetChargeNbins();
+  SetChargeFirst();
+  SetChargeLast();
+
+  // Create a large number of bins, later we will rebin
+  fHGausHist.SetName("HPedestalCharge");
+  fHGausHist.SetTitle("Distribution of Summed FADC Pedestal Slices Pixel ");
+  fHGausHist.SetXTitle("Sum FADC Slices");
+  fHGausHist.SetYTitle("Nr. of events");
+  fHGausHist.Sumw2();
+
+}
+
+MHPedestalPix::~MHPedestalPix()
+{
+}
+
+
+void MHPedestalPix::InitBins()
+{
+
+  fHGausHist.SetBins(fChargeNbins,fChargeFirst,fChargeLast);
+
+}
+
+
+void MHPedestalPix::ChangeHistId(Int_t id)
+{
+
+  fPixId = id;
+
+  fHGausHist.SetName(Form("%s%d", fHGausHist.GetName(), id));
+  fHGausHist.SetTitle(Form("%s%d", fHGausHist.GetTitle(), id));
+}
+
+
+void MHPedestalPix::Renorm(const Float_t nslices)
+{
+
+  if (!IsGausFitOK())
+    return;
+
+  Float_t sqslices = TMath::Sqrt(nslices);
+  
+  SetMean(GetMean()/nslices);
+  //
+  // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices
+  // 
+  SetMeanErr(GetMeanErr()/nslices);
+  //
+  // Sigma goes like PedestalRMS -> scale with sqrt(slices)    
+  //
+  SetSigma(GetSigma()/sqslices);
+  //
+  // Sigma error goes like PedestalRMS/2.(entries) -> scale with slices
+  //
+  SetSigmaErr(GetSigmaErr()/nslices);
+  
+}
+
Index: trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h	(revision 3157)
+++ trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h	(revision 3157)
@@ -0,0 +1,52 @@
+#ifndef MARS_MHPedestalPix
+#define MARS_MHPedestalPix
+
+#ifndef MARS_MHGausEvents
+#include "MHGausEvents.h"
+#endif
+
+class TObject;
+class TH1F;
+class MBinning;
+class MHPedestalPix : public MHGausEvents
+{
+
+private:
+
+  static const Int_t   fgChargeNbins;
+  static const Axis_t  fgChargeFirst;
+  static const Axis_t  fgChargeLast;
+
+  Int_t   fChargeNbins;
+  Axis_t  fChargeFirst;
+  Axis_t  fChargeLast;
+
+  Int_t fPixId;                  // Pixel Nr
+
+  Int_t fTotalEntries;
+
+public:
+
+  MHPedestalPix();
+  ~MHPedestalPix();
+
+  void InitBins();
+  
+  // Setters
+  void SetChargeNbins(const Int_t  bins =fgChargeNbins)    { fChargeNbins = bins; }
+  void SetChargeFirst(const Axis_t first=fgChargeFirst)    { fChargeFirst = first; }
+  void SetChargeLast( const Axis_t last =fgChargeLast)     { fChargeLast  = last; }
+  
+  // Getters
+  const Int_t GetTotalEntries() const   { return fTotalEntries;    }     
+
+  // Others
+  void ChangeHistId(Int_t i);
+  void Renorm(const Float_t nslices);  
+
+  //  TObject *DrawClone(Option_t *opt="") const;
+  
+  ClassDef(MHPedestalPix, 1)     // Histograms for each calibrated pixel
+};
+
+#endif
