Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 7103)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 7109)
@@ -136,4 +136,10 @@
 Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsPix::UnsuitableType_t type) const
 {
+    if (!fGeomCam || !fPedPhotCam || !fBadPixels)
+    {
+        *fLog << err << "MBadPixelsCalc::CheckPedestalRms: ERROR - One of the necessary container are not initialized..." << endl;
+        return kFALSE;
+    }
+
     if (fPedestalLevel<=0 && fPedestalLevelVariance<=0)
         return kTRUE;
@@ -247,11 +253,32 @@
     // Check if the number of pixels to blind is > 60% of total number of pixels
     //
-    //    if (bads>0.6*entries)
-    //    {
-    //    fErrors[2]++;
-    //    return kFALSE;
-    //    }
+    if (bads>0.5*entries)
+    {
+        *fLog << err << "ERROR - More than 50% unsuitable pixels... something must be wrong!" << endl;
+        return kFALSE;
+    }
 
     return kTRUE;
+}
+
+Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsCam &cam, const MPedPhotCam &ped, MBadPixelsPix::UnsuitableType_t t)
+{
+    MBadPixelsCam *store1 = fBadPixels;
+    const MPedPhotCam *store2 = fPedPhotCam;
+
+    fBadPixels  = &cam;
+    fPedPhotCam = &ped;
+
+    const Bool_t rc = CheckPedestalRms(t);
+
+    fBadPixels  = store1;
+    fPedPhotCam = store2;
+
+    return rc;
+}
+
+Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsCam &cam, const MPedestalCam &ped, MBadPixelsPix::UnsuitableType_t t)
+{
+    return CheckPedestalRms(cam, MPedPhotCam(ped), t);
 }
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h	(revision 7103)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h	(revision 7109)
@@ -12,11 +12,12 @@
 class MGeomCam;
 class MPedPhotCam;
+class MPedestalCam;
 
 class MBadPixelsCalc : public MTask
 {
 private:
-    MGeomCam      *fGeomCam;    //! Input container storing the pixel sizes
-    MPedPhotCam   *fPedPhotCam; //! Input container storing the pedestal and pedestal rms of all pixels
-    MBadPixelsCam *fBadPixels;  //! Output container holding the bad pixels
+    const MGeomCam      *fGeomCam;    //! Input container storing the pixel sizes
+    const MPedPhotCam   *fPedPhotCam; //! Input container storing the pedestal and pedestal rms of all pixels
+          MBadPixelsCam *fBadPixels;  //! Output container holding the bad pixels
 
     Float_t fPedestalLevel;
@@ -27,7 +28,4 @@
     Bool_t fCheckInProcess;
     Bool_t fCheckInPostProcess;
-
-    // MBadPixelsCalc
-    Bool_t CheckPedestalRms(MBadPixelsPix::UnsuitableType_t t) const;
 
     // MTask
@@ -47,6 +45,13 @@
     void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; }
 
+    void SetGeomCam(const MGeomCam *geom) { fGeomCam = geom; }
+
     void EnableCheckInProcess(Bool_t b=kTRUE)     { fCheckInProcess = b; }
     void EnableCheckInPostProcess(Bool_t b=kTRUE) { fCheckInPostProcess = b; }
+
+    // MBadPixelsCalc
+    Bool_t CheckPedestalRms(MBadPixelsPix::UnsuitableType_t t) const;
+    Bool_t CheckPedestalRms(MBadPixelsCam &cam, const MPedPhotCam  &ped, MBadPixelsPix::UnsuitableType_t t=MBadPixelsPix::kUnsuitableRun);
+    Bool_t CheckPedestalRms(MBadPixelsCam &cam, const MPedestalCam &ped, MBadPixelsPix::UnsuitableType_t t=MBadPixelsPix::kUnsuitableRun);
 
     ClassDef(MBadPixelsCalc, 1) // Task to find bad pixels (star, broken pixels, etc)
