Index: trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 3159)
+++ trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 3160)
@@ -17,6 +17,7 @@
 
 #pragma link C++ class MPedestalPix+;
-#pragma link C++ class MHPedestalPixel+;
+#pragma link C++ class MHPedestalPix+;
 #pragma link C++ class MPedestalCam+;
+#pragma link C++ class MHPedestalCam+;
 #pragma link C++ class MPedCalcPedRun+;
 #pragma link C++ class MPedPhotCalc+;
Index: trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc	(revision 3159)
+++ trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc	(revision 3160)
@@ -55,6 +55,10 @@
 // Default Constructor. 
 //
-MHPedestalPix::MHPedestalPix() : fPixId(-1)
+MHPedestalPix::MHPedestalPix(const char *name, const char *title) 
+    : fPixId(-1)
 { 
+
+  fName  = name  ? name  : "MHPedestalPix";
+  fTitle = title ? title : "Histogrammed Pedestal events";
 
   SetChargeNbins();
Index: trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h	(revision 3159)
+++ trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h	(revision 3160)
@@ -6,7 +6,4 @@
 #endif
 
-class TObject;
-class TH1F;
-class MBinning;
 class MHPedestalPix : public MHGausEvents
 {
@@ -24,9 +21,7 @@
   Int_t fPixId;                  // Pixel Nr
 
-  Int_t fTotalEntries;
-
 public:
 
-  MHPedestalPix();
+  MHPedestalPix(const char *name=NULL, const char *title=NULL);
   ~MHPedestalPix();
 
@@ -38,7 +33,4 @@
   void SetChargeLast( const Axis_t last =fgChargeLast)     { fChargeLast  = last; }
   
-  // Getters
-  const Int_t GetTotalEntries() const   { return fTotalEntries;    }     
-
   // Others
   void ChangeHistId(Int_t i);
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 3159)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 3160)
@@ -41,7 +41,4 @@
 #include "MParList.h"
 
-#include "MExtractedSignalCam.h"
-#include "MExtractedSignalPix.h"
-
 #include "MGeomCam.h"
 
@@ -50,5 +47,4 @@
 using namespace std;
 
-const UInt_t MPedestalCam::gkBlindPixelId = 559;
 // --------------------------------------------------------------------------
 //
@@ -56,5 +52,5 @@
 //
 MPedestalCam::MPedestalCam(const char *name, const char *title) 
-    : fTotalEntries(0), fExtractSlices(0.)
+    : fTotalEntries(0)
 {
     fName  = name  ? name  : "MPedestalCam";
@@ -63,12 +59,4 @@
     fArray = new TClonesArray("MPedestalPix", 1);
     
-    //
-    // loop over all Pixels and create two histograms
-    // one for the Low and one for the High gain
-    // connect all the histogram with the container fHist
-    //
-    fHArray = new TObjArray;
-    fHArray->SetOwner();
-
 }
 
@@ -80,5 +68,4 @@
 {
   delete fArray;
-  delete fHArray;
 }
 
@@ -104,10 +91,4 @@
 }
 
-Int_t MPedestalCam::GetHistSize() const 
-{
-  return fHArray->GetEntriesFast();
-}
-
-
 // --------------------------------------------------------------------------
 //
@@ -123,28 +104,9 @@
 // Get i-th pixel (pixel number)
 //
-MPedestalPix &MPedestalCam::operator[](Int_t i) const
+const MPedestalPix &MPedestalCam::operator[](Int_t i) const
 {
   return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
 }
 
-// --------------------------------------------------------------------------
-//
-// Get i-th pixel (pixel number)
-//
-MHPedestalPixel &MPedestalCam::operator()(UInt_t i)
-{
-  return *static_cast<MHPedestalPixel*>(fHArray->UncheckedAt(i));
-}
-
-// --------------------------------------------------------------------------
-//
-// Get i-th pixel (pixel number)
-//
-MHPedestalPixel &MPedestalCam::operator()(UInt_t i) const
-{
-  return *static_cast<MHPedestalPixel*>(fHArray->UncheckedAt(i));
-}
-
-
 // -------------------------------------------------------------------------
 //
@@ -155,159 +117,6 @@
 
     fTotalEntries     = 0;
-    fExtractSlices    = 0.;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Our own clone function is necessary since root 3.01/06 or Mars 0.4
-// I don't know the reason
-//
-TObject *MPedestalCam::Clone(const char *) const
-{
-
-  const Int_t n1 = fArray->GetSize();
-  const Int_t n2 = fHArray->GetSize();
-  
-  //
-  // FIXME, this might be done faster and more elegant, by direct copy.
-  //
-  MPedestalCam *cam = new MPedestalCam;
-  
-  cam->fArray->Expand(n1);
-  cam->fHArray->Expand(n2);
-  
-  for (int i=0; i<n1; i++)
-    {
-      delete (*cam->fArray)[i];
-      (*cam->fArray)[i] = (*fArray)[i]->Clone();
-    }
-
-  for (int i=0; i<n2; i++)
-    {
-      delete (*cam->fHArray)[i];
-      (*cam->fHArray)[i] = (*fHArray)[i]->Clone();
-    }
-  return cam;
-}
-
-
-
-// --------------------------------------------------------------------------
-//
-// To setup the object we get the number of pixels from a MGeomCam object
-// in the Parameter list. 
-// MPedestalPix sets its parameters to 0. (other than default which is -1.)
-//
-Bool_t MPedestalCam::SetupFill(const MParList *pList)
-{
-
-  fHArray->Delete();
-
-  return kTRUE;
-
-}
-
-// --------------------------------------------------------------------------
-//
-Bool_t MPedestalCam::Fill(const MParContainer *par, const Stat_t w)
-{
-
-  MExtractedSignalCam *signal = (MExtractedSignalCam*)par;
-  if (!signal)
-    {
-      gLog << err << "No argument in MExtractedSignalCam::Fill... abort." << endl;
-      return kFALSE;
-    }
-  
-
-  Float_t slices = (Float_t)signal->GetNumUsedFADCSlices();
-
-  if (slices == 0.)
-    {
-      gLog << err << "Number of used signal slices in MExtractedSignalCam is zero  ... abort." 
-           << endl;
-      return kFALSE;
-    }
-
-  if (fExtractSlices != 0. && slices != fExtractSlices )
-    {
-      gLog << err << "Number of used signal slices changed in MExtractedSignalCam  ... abort." 
-           << endl;
-      return kFALSE;
-    }
-
-  fExtractSlices = slices;
-
-  const Int_t n = signal->GetSize();
-  
-  if (fHArray->GetEntries()==0)
-    {
-      fHArray->Expand(n);
-      
-      for (Int_t i=0; i<n; i++)
-        {
-          (*fHArray)[i] = new MHPedestalPixel;
-          MHPedestalPixel &hist = (*this)(i);
-          hist.ChangeHistId(i);
-          MPedestalPix &pix = (*this)[i];
-          pix.InitUseHists();
-        }
-    }
-  
-  if (fHArray->GetEntries() != n)
-    {
-      gLog << err << "ERROR - Size mismatch... abort." << endl;
-      return kFALSE;
-    }
-  
-  for (Int_t i=0; i<n; i++)
-    {
-
-      const MExtractedSignalPix &pix = (*signal)[i];
-      
-      const Float_t sig = pix.GetExtractedSignalHiGain();
-
-      MHPedestalPixel &hist = (*this)(i);
-      //
-      // Don't fill signal per slice, we get completely screwed up 
-      // with the sigma. Better fill like it is and renorm later
-      //
-      //      const Float_t sigPerSlice = sig/fExtractSlices;
-      //      hist.FillCharge(sigPerSlice);
-      //      hist.FillChargevsN(sigPerSlice);
-      const Float_t signal = sig;
-      hist.FillCharge(signal);
-      hist.FillChargevsN(signal);
-    }
-  
-  return kTRUE;
-}
-
-Bool_t MPedestalCam::Finalize()
-{
-    for (Int_t i=0; i<fHArray->GetSize(); i++)
-    {
-
-        MHPedestalPixel &hist = (*this)(i);
-
-        //
-        // 1) Return if the charge distribution is already succesfully fitted
-        //    or if the histogram is empty
-        //
-        if (hist.IsFitOK() || hist.IsEmpty())
-            continue;
-
-        hist.CutAllEdges();
-      
-        //
-        // 2) Fit the Hi Gain histograms with a Gaussian
-        //
-        hist.FitCharge();
-        hist.Renorm(fExtractSlices);
-
-    }
-    return kTRUE;
-}
+}
+
 
 
@@ -381,37 +190,9 @@
     return kFALSE;
 
-  if (!(*this)[idx].IsValid())
-    return kFALSE;
-
-  if ((UInt_t)idx == gkBlindPixelId)
-    return kFALSE;
-
   const Float_t ped      = (*this)[idx].GetPedestal();
   const Float_t rms      = (*this)[idx].GetPedestalRms();
 
   const Float_t pederr   = rms/TMath::Sqrt((Float_t)fTotalEntries);
-  const Float_t rmserr   = rms/TMath::Sqrt((Float_t)fTotalEntries*2.);
-
-  Float_t mean     = 0.;
-  Float_t meanerr  = 0.;
-  Float_t sigma    = 0.;
-  Float_t sigmaerr = 0.;
-  Float_t prob     = 0.;
-  
-  if (type > 3) 
-    if (GetHistSize() != 0)
-      {
-        if (!(*this)(idx).IsFitOK())
-          return kFALSE;
-
-        const MHPedestalPixel &hist = (*this)(idx);
-        mean     = hist.GetChargeMean();
-        meanerr  = hist.GetChargeMeanErr();
-        sigma    = hist.GetChargeSigma() ;
-        sigmaerr = hist.GetChargeSigmaErr();
-        prob     = hist.GetChargeProb();
-      }
-    else
-      return kFALSE;
+  const Float_t rmserr   = rms/TMath::Sqrt((Float_t)fTotalEntries)/2.;
 
   switch (type)
@@ -429,61 +210,4 @@
       val = rmserr;
       break;
-    case 4:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = mean;
-      break;
-    case 5:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = meanerr;
-      break;
-    case 6:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = sigma;
-      break;
-    case 7:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = sigmaerr;
-      break;
-    case 8:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = prob;
-      break;
-    case 9:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = 2.*(ped-mean)/(ped+mean);
-      break;
-    case 10:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = TMath::Sqrt((pederr*pederr + meanerr*meanerr) * (ped*ped + mean*mean))
-            *2./(ped+mean)/(ped+mean);
-      break;
-    case 11:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = 2.*(pederr - meanerr)/(pederr + meanerr);
-      break;
-    case 12:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = 2.*(sigma-rms)/(sigma+rms);
-      break;
-    case 13:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = TMath::Sqrt((rmserr*rmserr + sigmaerr*sigmaerr) * (rms*rms + sigma*sigma))
-            *2./(rms+sigma)/(rms+sigma);
-      break;
-    case 14:
-      if (!(*this)(idx).IsFitOK())
-        return kFALSE;
-      val = 2.*(sigmaerr - rmserr)/(sigmaerr + rmserr);
-      break;
     default:
       return kFALSE;
@@ -494,4 +218,4 @@
 void MPedestalCam::DrawPixelContent(Int_t idx) const
 {
-  (*this)(idx).Draw();
-}
+  *fLog << warn << "MPedestalCam::DrawPixelContent - not available." << endl;
+}
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 3159)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 3160)
@@ -2,11 +2,4 @@
 #define MARS_MPedestalCam
 
-#ifndef ROOT_TObjArray
-#include <TObjArray.h>
-#endif
-
-#ifndef MARS_MH
-#include "MH.h"
-#endif
 #ifndef MARS_MParContainer
 #include "MParContainer.h"
@@ -20,19 +13,12 @@
 class MGeomCam;
 class MPedestalPix;
-class MHPedestalPixel;
-
-class MPedestalCam : public MH, public MCamEvent
+class MPedestalCam : public MCamEvent, public MParContainer
 {
 
- private:
+private:
 
-  static const UInt_t gkBlindPixelId;
-  
   TClonesArray *fArray;  // FIXME: Change TClonesArray away from a pointer?
   
-  TObjArray    *fHArray; //-> List of Lo/Hi gain Histograms
-  
   ULong_t fTotalEntries;
-  Float_t fExtractSlices;
   
 public:
@@ -45,22 +31,13 @@
   
   MPedestalPix &operator[](Int_t i);
-  MPedestalPix &operator[](Int_t i) const;
-  
-  MHPedestalPixel &operator()(UInt_t i);
-  MHPedestalPixel &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;
-  
+  const MPedestalPix &operator[](Int_t i) const;
+
   // Setters
-  void SetTotalEntries(ULong_t n)    { fTotalEntries = n; }
+  void SetTotalEntries(const ULong_t n)    { fTotalEntries = n; }
 
   // Getters
   Int_t   GetSize()                          const;
-  Int_t   GetHistSize()                      const;  
   ULong_t GetTotalEntries()                  const { return fTotalEntries; }
+
   Float_t GetPedestalMin(const MGeomCam *cam) const;
   Float_t GetPedestalMax(const MGeomCam *cam) const;
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 3159)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 3160)
@@ -33,6 +33,7 @@
 
 SRCFILES = MPedestalPix.cc \
-           MHPedestalPixel.cc \
+           MHPedestalPix.cc \
            MPedestalCam.cc \
+           MHPedestalCam.cc \
            MPedPhotPix.cc \
            MPedPhotCam.cc \
