Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4631)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4632)
@@ -26,7 +26,14 @@
      - change to support also 'No calibration of data'
      - removed obsolete dependancie on *'FromData' containers
+     - added member function ReadEnv
 
    * mbase/MTime.[h,cc]:
      - added new member function SetStringFmt
+
+   * mcalib/MHCalibrationChargeBlindPix.cc:
+     - removed unused variable
+
+   * mcalib/MHCalibrationChargeBlindPix.cc:
+     - removed unused variable
 
 
@@ -39,4 +46,5 @@
      - replace two gLog by *fLog
      - add the pulser color (needed for the datacheck histograms)
+
    * mjobs/MJCalibration.[h,cc]
      - some small modifications in the data-check display, discussed 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 4631)
+++ 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 4631)
+++ 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:
Index: trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 4631)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 4632)
@@ -99,4 +99,6 @@
 #include <fstream>
 
+#include <TEnv.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -636,2 +638,52 @@
     }
 }
+
+// --------------------------------------------------------------------------
+//
+// Read the setup from a TEnv, eg:
+//   MJPedestal.MCalibrateDate.PedestalFlag: no,run,event
+//   MJPedestal.MCalibrateDate.CalibrationMode: skip,none,flatcharge,blindpixel,ffactor,pindiode,combined,dummy,default
+//
+Int_t MCalibrateData::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
+{
+    Bool_t rc = kFALSE;
+    if (IsEnvDefined(env, prefix, "PedestalFlag"))
+    {
+        rc = kTRUE;
+        TString s = GetEnvValue(env, prefix, "PedestalFlag", "");
+        s.ToLower();
+        if (s==(TString)"no")
+            SetPedestalFlag(kNo);
+        if (s==(TString)"run")
+            SetPedestalFlag(kRun);
+        if (s==(TString)"event")
+            SetPedestalFlag(kEvent);
+    }
+
+    if (IsEnvDefined(env, prefix, "CalibrationMode"))
+    {
+        rc = kTRUE;
+        TString s = GetEnvValue(env, prefix, "CalibrationMode", "");
+        s.ToLower();
+        if (s==(TString)"skip")
+            SetCalibrationMode(kSkip);
+        if (s==(TString)"none")
+            SetCalibrationMode(kNone);
+        if (s==(TString)"flatcharge")
+            SetCalibrationMode(kFlatCharge);
+        if (s==(TString)"blindpixel")
+            SetCalibrationMode(kBlindPixel);
+        if (s==(TString)"ffactor")
+            SetCalibrationMode(kFfactor);
+        if (s==(TString)"pindiode")
+            SetCalibrationMode(kPinDiode);
+        if (s==(TString)"combined")
+            SetCalibrationMode(kCombined);
+        if (s==(TString)"dummy")
+            SetCalibrationMode(kDummy);
+        if (s==(TString)"default")
+            SetCalibrationMode();
+    }
+
+    return rc;
+}
Index: trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrateData.h	(revision 4631)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrateData.h	(revision 4632)
@@ -61,6 +61,6 @@
   Bool_t ReInit(MParList *pList);
   Int_t  Process();
-
-  void   StreamPrimitive( ofstream &out ) const;
+  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
+  void   StreamPrimitive(ofstream &out) const;
   
 public:
