Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 4608)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 4632)
@@ -55,4 +55,5 @@
 #include "MBadPixelsCalc.h"
 
+#include <TEnv.h>
 #include <TArrayD.h>
 
@@ -102,5 +103,5 @@
     if (fPedestalLevel>0)
     {
-      fPedPhotCam = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotContainer), "MPedPhotCam");
+        fPedPhotCam = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotContainer), "MPedPhotCam");
         if (!fPedPhotCam)
         {
@@ -115,12 +116,4 @@
             return kFALSE;
         }
-
-	/*        fSigmabar = (MSigmabar*)pList->FindObject(AddSerialNumber("MSigmabar"));
-        if (!fSigmabar)
-        {
-            *fLog << err << "MSigmabar not found... aborting." << endl;
-            return kFALSE;
-        }
-	*/
     }
     return kTRUE;
@@ -158,5 +151,7 @@
 }
 */
-// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+//
 // Check the pedestal Rms of the pixels: compute with 2 iterations the mean 
 // for inner and outer pixels. Set as blind the pixels with too small or 
@@ -257,10 +252,25 @@
 Int_t MBadPixelsCalc::Process()
 {
-  if (fPedestalLevel>0){
-    CheckPedestalRms();
-    fPedPhotCam->ReCalc(*fGeomCam,fBadPixels);
-  }
-  return kTRUE;
-}
-
-
+    if (fPedestalLevel>0)
+    {
+        CheckPedestalRms();
+        fPedPhotCam->ReCalc(*fGeomCam, fBadPixels);
+    }
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Read the setup from a TEnv, eg:
+//   MBadPixelsCalc.PedestalLevel: 3.0
+//
+Int_t MBadPixelsCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
+{
+    Bool_t rc = kFALSE;
+    if (IsEnvDefined(env, prefix, "PedestalLevel"))
+    {
+        rc = kTRUE;
+        SetPedestalLevel(GetEnvValue(env, prefix, "PedestalLevel", fPedestalLevel));
+    }
+    return rc;
+}
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h	(revision 4608)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h	(revision 4632)
@@ -7,5 +7,4 @@
 
 class MBadPixelsCam;
-//class MSigmabar;
 class MGeomCam;
 class MPedPhotCam;
@@ -15,7 +14,5 @@
 private:
     MGeomCam      *fGeomCam;    //! Input container storing the pixel sizes
-    //    MSigmabar     *fSigmabar;   //! Input container storing mean pedestal rms of the camera
     MPedPhotCam   *fPedPhotCam; //! Input container storing the pedestal and pedestal rms of all pixels
-
     MBadPixelsCam *fBadPixels;  //! Output container holding the bad pixels
 
@@ -28,4 +25,5 @@
     Int_t PreProcess(MParList *pList);
     Int_t Process();
+    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
 
 public:
