Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 1540)
@@ -34,5 +34,4 @@
 
 #include "MGeomCam.h"
-#include "MGeomPix.h"
 
 ClassImp(MCerPhotEvt);
@@ -159,6 +158,4 @@
         return -5.;
 
-    const Float_t A0 = geom ? (*geom)[0].GetA() : 0;
-
     Float_t minval = (*this)[0].GetNumPhotons();
 
@@ -170,5 +167,5 @@
 
         if (geom)
-            testval *= A0/(*geom)[pix.GetPixId()].GetA();
+            testval *= geom->GetPixRatio(pix.GetPixId());
 
         if (testval < minval)
@@ -190,5 +187,4 @@
         return 50.;
 
-    const Float_t A0 = geom ? (*geom)[0].GetA() : 0;
     Float_t maxval = (*this)[0].GetNumPhotons();
 
@@ -200,5 +196,5 @@
 
         if (geom)
-            testval *= A0/(*geom)[pix.GetPixId()].GetA();
+            testval *= geom->GetPixRatio(pix.GetPixId());
 
         if (testval > maxval)
@@ -208,2 +204,104 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// get the minimum ratio of photons/error
+//
+Float_t MCerPhotEvt::GetRatioMin() const
+{
+    if (fNumPixels <= 0)
+        return -5.;
+
+    Float_t minval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot();
+
+    for (UInt_t i=1; i<fNumPixels; i++)
+    {
+        const MCerPhotPix &pix = (*this)[i];
+
+        Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
+        if (testval < minval)
+            minval = testval;
+    }
+
+    return minval;
+}
+
+// --------------------------------------------------------------------------
+//
+// get the maximum ratio of photons/error
+//
+Float_t MCerPhotEvt::GetRatioMax() const
+{
+    if (fNumPixels <= 0)
+        return -5.;
+
+    Float_t maxval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot();
+
+    for (UInt_t i=1; i<fNumPixels; i++)
+    {
+        const MCerPhotPix &pix = (*this)[i];
+
+        Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
+        if (testval > maxval)
+            maxval = testval;
+    }
+
+    return maxval;
+}
+
+// --------------------------------------------------------------------------
+//
+// get the minimum of error
+// If you specify a geometry the number of photons is weighted with the
+// area of the pixel
+//
+Float_t MCerPhotEvt::GetErrorPhotMin(const MGeomCam *geom) const
+{
+    if (fNumPixels <= 0)
+        return 50.;
+
+    Float_t minval = (*this)[0].GetErrorPhot();
+
+    for (UInt_t i=1; i<fNumPixels; i++)
+    {
+        const MCerPhotPix &pix = (*this)[i];
+
+        Float_t testval = pix.GetErrorPhot();
+
+        if (geom)
+            testval *= geom->GetPixRatio(pix.GetPixId());
+
+        if (testval < minval)
+            minval = testval;
+    }
+    return minval;
+}
+
+// --------------------------------------------------------------------------
+//
+// get the maximum ratio of photons/error
+// If you specify a geometry the number of photons is weighted with the
+// area of the pixel
+//
+Float_t MCerPhotEvt::GetErrorPhotMax(const MGeomCam *geom) const
+{
+    if (fNumPixels <= 0)
+        return 50.;
+
+    Float_t maxval = (*this)[0].GetErrorPhot();
+
+    for (UInt_t i=1; i<fNumPixels; i++)
+    {
+        const MCerPhotPix &pix = (*this)[i];
+
+        Float_t testval = pix.GetErrorPhot();
+
+        if (geom)
+            testval *= geom->GetPixRatio(pix.GetPixId());
+
+        if (testval > maxval)
+            maxval = testval;
+    }
+    return maxval;
+}
+
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 1540)
@@ -38,4 +38,10 @@
     Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
 
+    Float_t GetRatioMin() const;
+    Float_t GetRatioMax() const;
+
+    Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
+    Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
+
     MCerPhotPix &operator[](int i)       { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
     MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
Index: trunk/MagicSoft/Mars/manalysis/MHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 1540)
@@ -220,6 +220,12 @@
 // In case you don't call Calc from within an eventloop make sure, that
 // you call the Reset member function before.
-//
-Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
+// Returns:
+//   0  no error
+//   1  number of pixels < 3
+//   2  size==0
+//   3  number of used pixel < 3
+//   4  CorrXY == 0
+//
+Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
 {
     const UInt_t npixevt = evt.GetNumPixels();
@@ -228,8 +234,8 @@
     // sanity check
     //
-    if (npixevt <= 2)
-    {
-        *fLog << warn << "MHillas::Calc: Event has less than two pixels... skipped." << endl;
-        return kFALSE;
+    if (npixevt < 3)
+    {
+        //*fLog << warn << "MHillas::Calc: Event has less than three pixels... skipped." << endl;
+        return 1;
     }
 
@@ -280,5 +286,5 @@
     {
         //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl;
-        return kFALSE;
+        return 2;
     }
 
@@ -286,5 +292,5 @@
     {
         //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl;
-        return kFALSE;
+        return 3;
     }
 
@@ -334,6 +340,6 @@
     if (corrxy==0)
     {
-        *fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
-        return kFALSE;
+        //*fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
+        return 4;
     }
 
@@ -375,5 +381,5 @@
     SetReadyToSave();
 
-    return kTRUE;
+    return 0;
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MHillas.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillas.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillas.h	(revision 1540)
@@ -45,5 +45,5 @@
     void Reset();
 
-    virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
+    virtual Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
 
     virtual void Print(Option_t *opt=NULL) const;
Index: trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 1540)
@@ -88,4 +88,6 @@
         return kFALSE;
 
+    memset(fErrors, 0, sizeof(fErrors));
+
     return kTRUE;
 }
@@ -100,5 +102,34 @@
 Bool_t MHillasCalc::Process()
 {
-    return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE;
+    const Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
+    if (rc<0 || rc>4)
+    {
+        *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl;
+        return kFALSE;
+    }
+    fErrors[rc]++;
+
+    return rc==0 ? kTRUE : kCONTINUE;
 }
 
+// --------------------------------------------------------------------------
+//
+//  Prints some statistics about the hillas calculation. The percentage
+//  is calculated with respect to the number of executions of this task.
+//
+Bool_t MHillasCalc::PostProcess()
+{
+    if (GetNumExecutions()==0)
+        return kTRUE;
+
+    *fLog << inf << endl;
+    *fLog << GetDescriptor() << " execution statistics:" << endl;
+    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl;
+    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl;
+    *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Number of used pixels < 3" << endl;
+    *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) << (int)(fErrors[4]*100/GetNumExecutions()) << "%) Evts skipped due to: CorrXY==0" << endl;
+    *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl;
+    *fLog << endl;
+
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/manalysis/MHillasCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasCalc.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasCalc.h	(revision 1540)
@@ -24,10 +24,13 @@
           MHillas     *fHillas;     // ouput container to store result
 
-    TString fHilName;
-public:
-    MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL);
+          TString      fHilName;
+          Int_t        fErrors[5];
 
     Bool_t PreProcess(MParList *pList);
     Bool_t Process();
+    Bool_t PostProcess();
+
+public:
+    MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL);
 
     ClassDef(MHillasCalc, 0)   // Task to calculate Hillas parameters
Index: trunk/MagicSoft/Mars/manalysis/MHillasExt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasExt.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasExt.cc	(revision 1540)
@@ -111,8 +111,9 @@
 // and the cerenkov photon event
 //
-Bool_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
-{
-    if (!MHillas::Calc(geom, evt))
-        return kFALSE;
+Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
+{
+    const Int_t rc = MHillas::Calc(geom, evt);
+    if (rc>0)
+        return rc;
 
     //
@@ -237,5 +238,5 @@
     SetReadyToSave();
 
-    return kTRUE;
+    return 0;
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MHillasExt.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasExt.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasExt.h	(revision 1540)
@@ -30,5 +30,5 @@
     Float_t GetM3Trans() const { return fM3Trans; }
 
-    Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
+    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
 
     void Print(Option_t *opt=NULL) const;
Index: trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc	(revision 1540)
@@ -113,5 +113,5 @@
     if (dist==0)
     {
-        *fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
+        //*fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
         return kFALSE;
     }
Index: trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1540)
@@ -91,4 +91,6 @@
     fHillasSrc->SetSrcPos(fSrcPos);
 
+    fErrors = 0;
+
     return kTRUE;
 }
@@ -98,7 +100,31 @@
 Bool_t MHillasSrcCalc::Process()
 {
-    return fHillasSrc->Calc(fHillas) ? kTRUE : kCONTINUE;
+
+    if (!fHillasSrc->Calc(fHillas))
+    {
+        fErrors++;
+        return kCONTINUE;
+
+    }
+    return kTRUE;
 }
 
+// --------------------------------------------------------------------------
+//
+//  Prints some statistics about the hillas calculation. The percentage
+//  is calculated with respect to the number of executions of this task.
+//
+Bool_t MHillasSrcCalc::PostProcess()
+{
+    if (GetNumExecutions()==0)
+        return kTRUE;
+
+    *fLog << inf << endl;
+    *fLog << GetDescriptor() << " execution statistics:" << endl;
+    *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) << "%) Evts skipped due to: Dist==0" << endl;
+    *fLog << endl;
+
+    return kTRUE;
+}
 
 // --------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h	(revision 1540)
@@ -20,5 +20,11 @@
     TString     fHillasName;
 
+    Int_t       fErrors;
+
     void StreamPrimitive(ofstream &out) const;
+
+    Bool_t PreProcess(MParList *plist);
+    Bool_t Process();
+    Bool_t PostProcess();
 
 public:
@@ -26,7 +32,4 @@
                    const char *name=NULL, const char *title=NULL);
 
-    Bool_t PreProcess(MParList *plist);
-    Bool_t Process();
-
     ClassDef(MHillasSrcCalc, 1) // task to calculate the source position depandant hillas parameters
 };
Index: trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1540)
@@ -159,6 +159,8 @@
         // check if pixel is in use, if not goto next pixel in list
         //
+#if 0
         if (!pix.IsPixelUsed())
             continue;
+#endif
 
         //
@@ -168,10 +170,10 @@
 
         //
-        // count number of next neighbors of this pixel which
-        // state is 'used'
+        // check for 'used' neighbors this pixel which
         //
         const MGeomPix &gpix  = (*fCam)[id];
         const Int_t     nnmax = gpix.GetNumNeighbors();
 
+#if 0
         Bool_t cnt = kFALSE;
         for (Int_t j=0; j<nnmax; j++)
@@ -179,5 +181,5 @@
             const Int_t id2 = gpix.GetNeighbor(j);
 
-            if (!ispixused[id2])
+            if (id2>max || !ispixused[id2])
                 continue;
 
@@ -187,4 +189,24 @@
         if (cnt)
             continue;
+#else
+        Int_t cnt = 0;
+        for (Int_t j=0; j<nnmax; j++)
+        {
+            const Int_t id2 = gpix.GetNeighbor(j);
+
+            if (id2>max || !ispixused[id2])
+                continue;
+
+            if (cnt++>nnmax-4)
+                break;
+        }
+        if (cnt==nnmax-2 && nnmax>=4)
+        {
+            pix.SetPixelUsed();
+            continue;
+        }
+        if (cnt>0)
+            continue;
+#endif
 
         //
@@ -238,5 +260,5 @@
         const Float_t noise = pix.GetErrorPhot();
 
-        if (entry <= fCleanLvl2 * noise )
+        if (entry <= fCleanLvl2 * noise)
             continue;
 
Index: trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h	(revision 1540)
@@ -36,4 +36,7 @@
     void Print(Option_t *o="") const;
 
+    Float_t GetCleanLvl1() const { return fCleanLvl1; }
+    Float_t GetCleanLvl2() const { return fCleanLvl2; }
+
     Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
 
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1540)
@@ -46,5 +46,7 @@
 #include "MLogManip.h"
 
+#include "MPedestalPix.h"
 #include "MPedestalCam.h"
+
 #include "MRawRunHeader.h"
 #include "MMcFadcHeader.hxx"
@@ -113,6 +115,5 @@
 // --------------------------------------------------------------------------
 //
-// Check for the runtype. (not yet: If the check fails the eventloop is
-// stopped.)
+// Check for the runtype.
 // Initialize the size of MPedestalCam to the number of pixels from
 // MMcFadcHeader.
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1540)
@@ -26,10 +26,11 @@
 //                                                                         //
 //  MMcPedestalNSBAdd                                                      //
+//  -----------------                                                      //
 //                                                                         //
 //  This Task adds the contribution of the diffuse NSB to the FADC         //
 //  pedestals. We assume that NSB introduces larger fluctuation but does   //
 //  not change the mean value.                                             //
-//  To be precise we add quadratically to the rms that is already in       //
-//  MPedestalCam the NSB contribution.                                     //
+//  To be precise we add quadratically to the rms, which is already in     //
+//  MPedestalCam, the NSB contribution.                                    //
 //  The number of photons from the diffuse NSB follows a poisson           // 
 //  distribution with expected mean value X, then its standard deviation   //
@@ -50,5 +51,4 @@
 //                                                                         //
 /////////////////////////////////////////////////////////////////////////////
-
 #include "MMcPedestalNSBAdd.h"
 
@@ -58,10 +58,13 @@
 #include "MLogManip.h"
 
+#include "MGeomCam.h"
+#include "MGeomPix.h"
+
+#include "MPedestalPix.h"
 #include "MPedestalCam.h"
+
 #include "MRawRunHeader.h"
 #include "MMcRunHeader.hxx"
 #include "MMcFadcHeader.hxx"
-#include "MGeomCam.h"
-#include "MGeomPix.h"
 
 ClassImp(MMcPedestalNSBAdd);
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 1540)
@@ -31,6 +31,13 @@
 /////////////////////////////////////////////////////////////////////////////
 #include "MPedestalCam.h"
+#include "MPedestalPix.h"
+
+#include <TClonesArray.h>
 
 #include "MLog.h"
+#include "MLogManip.h"
+
+#include "MGeomCam.h"
+
 
 ClassImp(MPedestalCam);
@@ -62,4 +69,40 @@
 // --------------------------------------------------------------------------
 //
+// Set the size of the camera
+//
+inline void MPedestalCam::InitSize(const UInt_t i)
+{
+    fArray->ExpandCreate(i);
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the size of the MPedestalCam
+//
+inline Int_t MPedestalCam::GetSize() const
+{
+    return fArray->GetEntries();
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+inline MPedestalPix &MPedestalCam::operator[](Int_t i)
+{
+    return *(MPedestalPix*)fArray->UncheckedAt(i);
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+inline MPedestalPix &MPedestalCam::operator[](Int_t i) const
+{
+    return *(MPedestalPix*)fArray->UncheckedAt(i);
+}
+
+// --------------------------------------------------------------------------
+//
 // Check if position i is inside bounds
 //
@@ -69,3 +112,70 @@
 } 
 
+void MPedestalCam::Clear(Option_t *o)
+{
+    fArray->ForEach(TObject, Clear)();
+}
 
+void MPedestalCam::Print(Option_t *o="") const
+{
+    *fLog << all << GetDescriptor() << ":" << endl;
+    int id = 0;
+
+    TIter Next(fArray);
+    MPedestalPix *pix;
+    while ((pix=(MPedestalPix*)Next()))
+    {
+        id++;
+
+        if (!pix->IsValid())
+            continue;
+
+        *fLog << id-1 << ": ";
+        *fLog << pix->GetMean() << " " << pix->GetSigma() << " ";
+        *fLog << pix->GetMeanRms() << " " << pix->GetSigmaRms() << endl;
+    }
+}
+
+Float_t MPedestalCam::GetMeanMin(const MGeomCam *geom) const
+{
+    if (fArray->GetEntries() <= 0)
+        return 50.;
+
+    Float_t minval = (*this)[0].GetMean();
+
+    for (Int_t i=1; i<fArray->GetEntries(); i++)
+    {
+        const MPedestalPix &pix = (*this)[i];
+
+        Float_t testval = pix.GetMean();
+
+        if (geom)
+            testval *= geom->GetPixRatio(i);
+
+        if (testval < minval)
+            minval = testval;
+    }
+    return minval;
+}
+
+Float_t MPedestalCam::GetMeanMax(const MGeomCam *geom) const
+{
+    if (fArray->GetEntries() <= 0)
+        return 50.;
+
+    Float_t maxval = (*this)[0].GetMean();
+
+    for (Int_t i=1; i<fArray->GetEntries(); i++)
+    {
+        const MPedestalPix &pix = (*this)[i];
+
+        Float_t testval = pix.GetMean();
+
+        if (geom)
+            testval *= geom->GetPixRatio(i);
+
+        if (testval > maxval)
+            maxval = testval;
+    }
+    return maxval;
+}
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 1540)
@@ -6,11 +6,8 @@
 #endif
 
-#ifndef MARS_MPedestalPix
-#include "MPedestalPix.h"
-#endif
+class TClonesArray;
 
-#ifndef ROOT_TClonesArray
-#include <TClonesArray.h>
-#endif
+class MGeomCam;
+class MPedestalPix;
 
 class MPedestalCam : public MParContainer
@@ -23,10 +20,18 @@
     ~MPedestalCam();
 
-    void InitSize(const UInt_t i) { fArray->ExpandCreate(i); }
+    void Clear(Option_t *o="");
 
-    MPedestalPix &operator[](Int_t i)       { return *(MPedestalPix*)fArray->UncheckedAt(i); }
-    MPedestalPix &operator[](Int_t i) const { return *(MPedestalPix*)fArray->UncheckedAt(i); }
+    void InitSize(const UInt_t i);
+    Int_t GetSize() const;
+
+    MPedestalPix &operator[](Int_t i);
+    MPedestalPix &operator[](Int_t i) const;
+
+    Float_t GetMeanMin(const MGeomCam *cam) const;
+    Float_t GetMeanMax(const MGeomCam *cam) const;
 
     Bool_t CheckBounds(Int_t i);
+
+    void Print(Option_t *o="") const;
 
     ClassDef(MPedestalCam, 1)	// Storage Container for all pedestal information of the camera
Index: trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc	(revision 1540)
@@ -38,6 +38,18 @@
 
 MPedestalPix::MPedestalPix()
-    : fMean(0.0), fSigma(0.0), fMeanRms(0.0), fSigmaRms(0.0)
 {
+    Clear();
 }
 
+// ------------------------------------------------------------------------
+//
+// Invalidate values
+//
+void MPedestalPix::Clear(Option_t *o)
+{
+    fMean = -1;
+    fSigma = -1;
+    fMeanRms = -1;
+    fSigmaRms = -1;
+}
+
Index: trunk/MagicSoft/Mars/manalysis/MPedestalPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalPix.h	(revision 1537)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalPix.h	(revision 1540)
@@ -17,4 +17,6 @@
     MPedestalPix();
 
+    void Clear(Option_t *o="");
+
     Float_t GetMean() const     { return fMean;     }
     Float_t GetSigma() const    { return fSigma;    }
@@ -30,4 +32,6 @@
     void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; }
 
+    Bool_t IsValid() const { return fMean>=0||fSigma>=0||fMeanRms>=0||fSigmaRms>=0; }
+
     ClassDef(MPedestalPix, 1)	// Storage Container for Pedestal information of one pixel
 };
