Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5537)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5557)
@@ -1689,16 +1689,17 @@
     //
     if (fExtractor->InheritsFrom("MExtractTimeAndCharge"))
-      {
+    {
         SetTimeAndCharge();
         if (fExtractorCam.GetSize() == pedcam.GetSize())
-          {
-            plist.AddToList(&fExtractorCam);
-            calcalc.SetNamePedestalCam(fExtractorCam.GetName());
-          }
+            calcalc.SetPedestals(&fExtractorCam);
         else
-          *fLog << warn << "Used Extractor derives from MExtractTimeAndCharge, " 
-                << "but no MExtractorCam has been handed over! " << endl;
-      }
-    
+        {
+            *fLog << warn;
+            *fLog << "Used Extractor derives from MExtractTimeAndCharge, " << endl;
+            *fLog << "but MExtractorCam size " << fExtractorCam.GetSize() << " ";
+            *fLog << "mismatch pedcam size " << pedcam.GetSize() << "! " << endl;
+        }
+    }
+
     MTaskEnv taskenv("ExtractSignal");
     taskenv.SetDefault(fExtractor);
@@ -1965,52 +1966,47 @@
 Bool_t MJCalibration::WriteResult(TObject *geom)
 {
-
-  if (fPathOut.IsNull())
-    return kTRUE;
-  
-  const TString oname(GetOutputFile());
-  
-  *fLog << inf << "Writing to file: " << oname << endl;
-
-  TFile file(oname, "UPDATE", "File created by MJCalibration", 9);
-  if (!file.IsOpen())
-    {
-      *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
-      return kFALSE;
-    }
-  
-  *fLog << inf << " - MStatusDisplay..." << flush;
-  if (fDisplay && fDisplay->Write()<=0)
-    {
-      *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
-      return kFALSE;
-    }
-  *fLog << inf << "ok." << endl;
-  
-  TObjArray cont;
-  if (IsIntensity())
-    {
-      cont.Add(&fIntensBadCam);
-      cont.Add(&fIntensCalibCam);
-      cont.Add(&fIntensQECam);
-      cont.Add(&fIntensBlindCam);
-    }
-  else
-    {
-      cont.Add(&fBadPixels);
-      cont.Add(&fCalibrationCam);
-      cont.Add(&fQECam);
-      cont.Add(&fCalibrationBlindCam);
-    }
-  cont.Add(&fCalibrationPINDiode);
-  if (IsRelTimes())
-    cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
-  
-  if (!geom)
-    *fLog << warn << " - WARNING - MGeomCam... not found!" << endl;
-  else
-    cont.Add(geom);
-  
-  return WriteContainer(cont);
+    if (fPathOut.IsNull())
+        return kTRUE;
+
+    const TString oname(GetOutputFile());
+
+    *fLog << inf << "Writing to file: " << oname << endl;
+
+    TFile file(oname, "UPDATE", "File created by MJCalibration", 9);
+    if (!file.IsOpen())
+    {
+        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
+        return kFALSE;
+    }
+
+    TObjArray cont;
+    if (fDisplay)
+        cont.Add(fDisplay);
+
+    if (IsIntensity())
+    {
+        cont.Add(&fIntensBadCam);
+        cont.Add(&fIntensCalibCam);
+        cont.Add(&fIntensQECam);
+        cont.Add(&fIntensBlindCam);
+    }
+    else
+    {
+        cont.Add(&fBadPixels);
+        cont.Add(&fCalibrationCam);
+        cont.Add(&fQECam);
+        cont.Add(&fCalibrationBlindCam);
+    }
+    cont.Add(&fCalibrationPINDiode);
+
+    if (IsRelTimes())
+        cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
+
+    if (!geom)
+        *fLog << warn << " - WARNING - MGeomCam... not found!" << endl;
+    else
+        cont.Add(geom);
+
+    return WriteContainer(cont);
 }
 
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5537)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5557)
@@ -31,37 +31,5 @@
 #include "MJPedestal.h"
 
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MTaskEnv.h"
-#include "MSequence.h"
-#include "MRunIter.h"
-#include "MParList.h"
-#include "MTaskList.h"
-#include "MEvtLoop.h"
-#include "MExtractor.h"
-
-#include "MStatusDisplay.h"
-
-#include "MGeomCam.h"
-#include "MHCamera.h"
-#include "MPedestalCam.h"
-#include "MPedestalPix.h"
-#include "MBadPixelsCam.h"
-
-#include "MCalibrationPedCam.h"
-#include "MCalibrationPix.h"
-#include "MHPedestalCam.h"
-#include "MHPedestalPix.h"
-#include "MFillH.h"
-
-
-#include "MReadMarsFile.h"
-#include "MRawFileRead.h"
-#include "MGeomApply.h"
-#include "MBadPixelsMerge.h"
-#include "MPedCalcPedRun.h"
-#include "MPedCalcFromLoGain.h"
-
+// root classes
 #include <TF1.h>
 #include <TEnv.h>
@@ -75,4 +43,41 @@
 #include <TPad.h>
 
+// mars core
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MTaskEnv.h"
+#include "MSequence.h"
+#include "MRunIter.h"
+#include "MParList.h"
+#include "MTaskList.h"
+#include "MEvtLoop.h"
+
+#include "MStatusDisplay.h"
+
+// Other basic classes
+#include "MExtractor.h"
+
+// parameter containers
+#include "MGeomCam.h"
+#include "MHCamera.h"
+#include "MPedestalCam.h"
+#include "MPedestalPix.h"
+#include "MBadPixelsCam.h"
+
+#include "MCalibrationPedCam.h"
+#include "MCalibrationPix.h"
+#include "MHPedestalCam.h"
+#include "MHPedestalPix.h"
+
+// tasks
+#include "MReadMarsFile.h"
+#include "MRawFileRead.h"
+#include "MGeomApply.h"
+#include "MBadPixelsMerge.h"
+#include "MFillH.h"
+#include "MPedCalcPedRun.h"
+#include "MPedCalcFromLoGain.h"
+
 ClassImp(MJPedestal);
 
@@ -94,5 +99,4 @@
 const Float_t  MJPedestal::fgRefPedRmsGalacticOuter      = 4.2;
 
-const TString  MJPedestal::fgNameExtractorCam = "ExtractorResolution";
 // --------------------------------------------------------------------------
 //
@@ -106,5 +110,4 @@
 // - fStorage to Normal Storage
 // - fExtractorResolution to kFALSE
-// - fNameExtractorCam to "ExtractorResolution"
 //
 MJPedestal::MJPedestal(const char *name, const char *title) 
@@ -119,5 +122,10 @@
     SetPathIn("");
     SetExtractorResolution(kFALSE);
-    SetNameExtractorCam();
+}
+
+MJPedestal::~MJPedestal()
+{
+    if (fExtractor)
+        delete fExtractor;
 }
 
@@ -323,15 +331,15 @@
       }
 
-    disp0.SetYTitle("Pedestal [counts/slice]");
-    disp1.SetYTitle("RMS [counts/slice]");
-    disp2.SetYTitle("Hist. Mean  [counts/slice]");
-    disp3.SetYTitle("Hist. Sigma [counts/slice]");
-    disp4.SetYTitle("Calc. Mean  [counts/slice]");
-    disp5.SetYTitle("Calc. RMS   [counts/slice]");
-    disp6.SetYTitle("Diff. Mean  [counts/slice]");
-    disp7.SetYTitle("Diff. RMS   [counts/slice]");
-    disp8.SetYTitle("Diff. Mean  [counts/slice]");
-    disp9.SetYTitle("Abs. Diff. RMS   [counts/slice]");
-    disp10.SetYTitle("Rel. Diff. RMS   [1]");
+    disp0.SetYTitle("P [cts/slice]");
+    disp1.SetYTitle("P_{rms} [cts/slice]");
+    disp2.SetYTitle("Hist. Mean  [cts/slice]");
+    disp3.SetYTitle("Hist. Sigma [cts/slice]");
+    disp4.SetYTitle("Calc. Mean  [cts/slice]");
+    disp5.SetYTitle("Calc. RMS   [cts/slice]");
+    disp6.SetYTitle("Diff. Mean  [cts/slice]");
+    disp7.SetYTitle("Diff. RMS   [cts/slice]");
+    disp8.SetYTitle("Diff. Mean  [cts/slice]");
+    disp9.SetYTitle("Abs.Diff.RMS [cts/slice]");
+    disp10.SetYTitle("Rel.Diff.RMS [1]");
 
     //
@@ -381,5 +389,5 @@
       {
 
-        TCanvas &c3 = fDisplay->AddTab(fExtractorResolution ? "Extr.Res." : "Pedestals");
+        TCanvas &c3 = fDisplay->AddTab(fExtractorResolution ? "PedExtrd" : "Ped");
         c3.Divide(2,3);
         
@@ -538,5 +546,5 @@
       {
             
-        TCanvas &c3 = fDisplay->AddTab("Extr.Res.");
+        TCanvas &c3 = fDisplay->AddTab("PedExtrd");
         c3.Divide(2,3);
         
@@ -544,5 +552,5 @@
         disp1.CamDraw(c3, 2, 2, 6);
         
-        TCanvas &c13 = fDisplay->AddTab("Diff.(Extr.-Pedestal)");
+        TCanvas &c13 = fDisplay->AddTab("PedDiff");
         c13.Divide(2,3);
         
@@ -672,4 +680,11 @@
 */
 
+void MJPedestal::SetExtractor(MExtractor* ext)
+{
+    if (fExtractor)
+        delete fExtractor;
+    fExtractor = ext ? (MExtractor*)ext->Clone() : NULL;
+}
+
 // --------------------------------------------------------------------------
 //
@@ -690,23 +705,37 @@
 Bool_t MJPedestal::CheckEnvLocal()
 {
-
-  SetDataCheck(GetEnv("DataCheck", fDataCheck));
-  
-  if (HasEnv("DataCheckDisplay"))
-    fDisplayType = GetEnv("DataCheckDisplay", kFALSE) ? kDataCheckDisplay : kNormalDisplay;
-  
-  if (HasEnv("UseData"))
-    fExtractType = GetEnv("UseData",kFALSE) ? kUseData : kUsePedRun;
-  
-  if (HasEnv("UseHists"))
-    if (GetEnv("UseHists",kFALSE))
-      fExtractType = kUseHists;
-
-  SetExtractorResolution(GetEnv("ExtractorResolution", fExtractorResolution));
-  SetNameExtractorCam(GetEnv("NameExtractorCam", fNameExtractorCam));
-  
-  SetNoStorage(GetEnv("DisableOutput", IsNoStorage()));
-  
-  return kTRUE;
+    SetDataCheck(GetEnv("DataCheck", fDataCheck));
+
+    if (HasEnv("DataCheckDisplay"))
+        fDisplayType = GetEnv("DataCheckDisplay", kFALSE) ? kDataCheckDisplay : kNormalDisplay;
+
+    if (HasEnv("UseData"))
+        fExtractType = GetEnv("UseData",kFALSE) ? kUseData : kUsePedRun;
+
+    if (HasEnv("UseHists"))
+        if (GetEnv("UseHists",kFALSE))
+            fExtractType = kUseHists;
+
+    SetExtractorResolution(GetEnv("ExtractorResolution", fExtractorResolution));
+
+    SetNoStorage(GetEnv("DisableOutput", IsNoStorage()));
+
+    MTaskEnv tenv;
+    tenv.SetDefault(fExtractor);
+
+    if (tenv.ReadEnv(*GetEnv(), GetEnvPrefix()+".ExtractSignal", GetEnvDebug())==kERROR)
+        return kFALSE;
+
+    if (fExtractor==tenv.GetTask())
+        return kTRUE;
+
+    if (!tenv.GetTask()->InheritsFrom(MExtractor::Class()))
+    {
+        *fLog << err << "ERROR: ExtractSignal from resource file doesn't inherit from MExtractor.... abort." << endl;
+        return kFALSE;
+    }
+
+    SetExtractor((MExtractor*)tenv.GetTask());
+    return kTRUE;
 }
 
@@ -738,23 +767,13 @@
     }
 
-    if (fDisplay && fDisplay->Write()<=0)
-    {
-        *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
-        return kFALSE;
-    }
-
-    if (fPedestalCamOut.Write()<=0)
-    {
-        *fLog << err << "Unable to write MPedestalCam to " << oname << endl;
-        return kFALSE;
-    }
-
-    if (fBadPixels.Write()<=0)
-    {
-        *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl;
-        return kFALSE;
-    }
-
-    return kTRUE;
+    TObjArray cont;
+
+    if (fDisplay)
+        cont.Add(fDisplay);
+
+    cont.Add(&fPedestalCamOut);
+    cont.Add(&fBadPixels);
+
+    return WriteContainer(cont);
 }
 
@@ -763,4 +782,18 @@
     if (!ReadPedestalCam())
         return ProcessFile();
+
+    return kTRUE;
+}
+
+Bool_t MJPedestal::SetupExtractor(MParList &plist, MExtractPedestal &extped)
+{
+    if (!fExtractor)
+        return kTRUE;
+
+    if (!fExtractorResolution || !fExtractor->InheritsFrom("MExtractTimeAndCharge"))
+        return kFALSE;
+
+    extped.SetPedestalsIn(&fPedestalCamIn);
+    extped.SetExtractor((MExtractTimeAndCharge*)fExtractor);
 
     return kTRUE;
@@ -849,16 +882,17 @@
     plist.AddToList(&fBadPixels);
     
-    MGeomApply      geomapl;
+    MGeomApply geomapl;
     MBadPixelsMerge merge(&fBadPixels);
 
-    MPedCalcPedRun     pedcalc;
+    MPedCalcPedRun pedcalc;
     pedcalc.SetPedestalUpdate(kFALSE);
+
     MPedCalcFromLoGain pedlogain;
     pedlogain.SetPedestalUpdate(kFALSE);
 
-    MHPedestalCam      hpedcam;
+    MHPedestalCam hpedcam;
     hpedcam.SetRenorm(kTRUE);
     
-    MFillH fillped(&hpedcam, "MExtractedSignalCam");
+    MFillH fillped(&hpedcam, "MExtractedSignalCam", "FillPedestalCam");
     fillped.SetBit(MFillH::kDoNotDisplay);
 
@@ -873,5 +907,5 @@
 
         *fLog << all;
-        *fLog << underline << "Signal Extractor found in calibration file" << endl;
+        *fLog << underline << "Signal Extractor found in calibration file:" << endl;
         fExtractor->Print();
         *fLog << endl;
@@ -882,49 +916,36 @@
     {
     case kUseData:
-      taskenv.SetDefault(&pedlogain);
-      tlist.AddToList(&taskenv);
-      if (!fExtractor)
+        taskenv.SetDefault(&pedlogain);
+        tlist.AddToList(&taskenv);
+
+        if (!SetupExtractor(plist, pedlogain))
+            pedlogain.SetExtractWindow(15, (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
         break;
-      if (fExtractorResolution && fExtractor->InheritsFrom("MExtractTimeAndCharge"))
+
+    case kUsePedRun:
+        taskenv.SetDefault(&pedcalc);
+        tlist.AddToList(&taskenv);
+
+        if (!SetupExtractor(plist, pedcalc))
+            pedcalc.SetExtractWindow(fExtractor->GetHiGainFirst(), TMath::Nint(fExtractor->GetNumHiGainSamples()));
+        break;
+
+    case kUseHists:
+        if (!fExtractor)
         {
-          plist.AddToList(&fPedestalCamIn);
-          fPedestalCamOut.SetName(fNameExtractorCam.Data());
-          pedlogain.SetNamePedestalCamOut(fNameExtractorCam.Data());
-          pedlogain.SetExtractor((MExtractTimeAndCharge*)fExtractor);
+            *fLog << err << GetDescriptor() << " - ERROR: ";
+            *fLog << "Extraction Type is kUseHists, but no extractor was set" << endl;
+            return kFALSE;
         }
-      else
-        pedlogain.SetExtractWindow(15, (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
-      break;
-
-    case kUsePedRun:
-      taskenv.SetDefault(&pedcalc);
-      tlist.AddToList(&taskenv);
-      if (!fExtractor)
+
+        tlist.AddToList(fExtractor);
+        tlist.AddToList(&fillped);
         break;
-      if (fExtractorResolution && fExtractor->InheritsFrom("MExtractTimeAndCharge"))
-        {
-          plist.AddToList(&fPedestalCamIn);
-          fPedestalCamOut.SetName(fNameExtractorCam.Data());
-          pedcalc.SetNamePedestalCamOut(fNameExtractorCam.Data());
-          pedcalc.SetExtractor((MExtractTimeAndCharge*)fExtractor);
-        }
-      else
-        pedcalc.SetExtractWindow(fExtractor->GetHiGainFirst(),TMath::Nint(fExtractor->GetNumHiGainSamples()));
-      break;
-      
-    case kUseHists:
-      if (!fExtractor)
-        {
-          *fLog << err << GetDescriptor();
-          *fLog << ": Extraction Type kUseExtractor is chosen, but no extractor has been handed over" 
-                << endl;
-          return kFALSE;
-        }
-      
-      plist.AddToList(&hpedcam);
-      tlist.AddToList(fExtractor);
-      tlist.AddToList(&fillped);
-
-      break;
+    }
+
+    if (!fPathIn.IsNull())
+    {
+        delete fExtractor;
+        fExtractor = 0;
     }
 
@@ -933,17 +954,6 @@
     // means that the each "sliding" of the sliding window is not applied
     //
-    if (fExtractorResolution && !fExtractor->IsNoiseCalculation())
-      {
-        *fLog << warn << GetDescriptor();
-        *fLog <<": Extraction type is kUseExtractor, but extractor has kNoiseCalculation not set... set." 
-              << endl;
-        fExtractor->SetNoiseCalculation();
-      }
-    
-    if (!fPathIn.IsNull())
-    {
-      delete fExtractor;
-      fExtractor = 0;
-    }
+    if (fExtractor)
+        fExtractor->SetNoiseCalculation(fExtractorResolution);
 
     //
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 5537)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 5557)
@@ -18,4 +18,5 @@
 class TH1D;
 class MExtractor;
+class MExtractPedestal;
 class MEvtLoop;
 
@@ -23,95 +24,91 @@
 {
 private:
+    static const Double_t fgPedestalMin;                 //! Minimum Axis value for pedestal datacheck display
+    static const Double_t fgPedestalMax;                 //! Maximum Axis value for pedestal datacheck display
+    static const Double_t fgPedRmsMin;                   //! Minimum Axis value for ped. RMS datacheck display
+    static const Double_t fgPedRmsMax;                   //! Maximum Axis value for ped. RMS datacheck display
 
-  static const Double_t fgPedestalMin;                 //! Minimum Axis value for pedestal datacheck display
-  static const Double_t fgPedestalMax;                 //! Maximum Axis value for pedestal datacheck display
-  static const Double_t fgPedRmsMin;                   //! Minimum Axis value for ped. RMS datacheck display
-  static const Double_t fgPedRmsMax;                   //! Maximum Axis value for ped. RMS datacheck display
-  
-  static const Float_t  fgRefPedClosedLids;            //! Reference line pedestal for closed lids run
-  static const Float_t  fgRefPedExtraGalactic;         //! Reference line pedestal for extragalactic source
-  static const Float_t  fgRefPedGalactic;              //! Reference line pedestal for galactic source     
-  
-  static const Float_t  fgRefPedRmsClosedLidsInner;    //! Ref. line ped. RMS for closed lids run - inner pixels     
-  static const Float_t  fgRefPedRmsExtraGalacticInner; //! Ref. line ped. RMS for extragalactic source - inner pixels 
-  static const Float_t  fgRefPedRmsGalacticInner;      //! Ref. line ped. RMS for galactic source - inner pixels     
-  
-  static const Float_t  fgRefPedRmsClosedLidsOuter;    //! Ref. line ped. RMS for closed lids run - outer pixels     
-  static const Float_t  fgRefPedRmsExtraGalacticOuter; //! Ref. line ped. RMS for extragalactic source - outer pixels
-  static const Float_t  fgRefPedRmsGalacticOuter;      //! Ref. line ped. RMS for galactic source - outer pixels     
-    
-  static const TString  fgNameExtractorCam;            //! "ExtractorResolution"
+    static const Float_t  fgRefPedClosedLids;            //! Reference line pedestal for closed lids run
+    static const Float_t  fgRefPedExtraGalactic;         //! Reference line pedestal for extragalactic source
+    static const Float_t  fgRefPedGalactic;              //! Reference line pedestal for galactic source
 
-  MRunIter   *fRuns;                                   // Used pedestal runs
-  MExtractor *fExtractor;                              // Signal extractor, used to find the nr. of used FADC slices
-  
-  MPedestalCam  fPedestalCamIn;                        // Handed over pedestal results
-  MPedestalCam  fPedestalCamOut;                       // Created pedestal results
-  MBadPixelsCam fBadPixels;                            // Bad Pixels
+    static const Float_t  fgRefPedRmsClosedLidsInner;    //! Ref. line ped. RMS for closed lids run - inner pixels
+    static const Float_t  fgRefPedRmsExtraGalacticInner; //! Ref. line ped. RMS for extragalactic source - inner pixels
+    static const Float_t  fgRefPedRmsGalacticInner;      //! Ref. line ped. RMS for galactic source - inner pixels
 
-  TString fNameExtractorCam;                           // Name of the outgoing MPedestalCam if fExtractorResolution
-  
-  enum Display_t {kDataCheckDisplay, kNormalDisplay};  // Possible Display types
-  Display_t fDisplayType;                              // Chosen Display type    
-  
-  enum Storage_t { kNoStorage };                       // Possible flags for the storage of results
-  Byte_t fStorage;                                     // Bit-field for chosen storage type
-    
-  Bool_t fDataCheck;                                   // Flag if the data check is run on raw data
+    static const Float_t  fgRefPedRmsClosedLidsOuter;    //! Ref. line ped. RMS for closed lids run - outer pixels
+    static const Float_t  fgRefPedRmsExtraGalacticOuter; //! Ref. line ped. RMS for extragalactic source - outer pixels
+    static const Float_t  fgRefPedRmsGalacticOuter;      //! Ref. line ped. RMS for galactic source - outer pixels
 
-  enum Extract_t {kUseData, kUsePedRun, kUseHists };   // Possible flags for the extraction of the pedestal
-  Extract_t fExtractType;                              // Chosen extractor type
+    MRunIter   *fRuns;                                   // Used pedestal runs
+    MExtractor *fExtractor;                              // Signal extractor, used to find the nr. of used FADC slices
 
-  Bool_t fExtractorResolution;                         // Flag if the extractor is used to calculate the pedestals
-  
-  MExtractor *ReadCalibration() const;
-  Bool_t ReadPedestalCam();
-  Bool_t WriteResult();
-  //Bool_t WriteEventloop(MEvtLoop &evtloop) const;
+    MPedestalCam  fPedestalCamIn;                        // Handed over pedestal results
+    MPedestalCam  fPedestalCamOut;                       // Created pedestal results
+    MBadPixelsCam fBadPixels;                            // Bad Pixels
 
-  void   DisplayResult(MParList &plist);
-  void   DisplayReferenceLines(MHCamera *cam, const Int_t what) const;
-  void   DisplayOutliers(TH1D *hist) const;
-  void   FixDataCheckHist(TH1D *hist) const;
-  
-  Bool_t IsNoStorage() const { return TESTBIT(fStorage, kNoStorage); }
-  
-  Bool_t CheckEnvLocal();
-    
+    enum Display_t {kDataCheckDisplay, kNormalDisplay};  // Possible Display types
+    Display_t fDisplayType;                              // Chosen Display type
+
+    enum Storage_t { kNoStorage };                       // Possible flags for the storage of results
+    Byte_t fStorage;                                     // Bit-field for chosen storage type
+
+    Bool_t fDataCheck;                                   // Flag if the data check is run on raw data
+
+    enum Extract_t {kUseData, kUsePedRun, kUseHists };   // Possible flags for the extraction of the pedestal
+    Extract_t fExtractType;                              // Chosen extractor type
+
+    Bool_t fExtractorResolution;                         // Flag if the extractor is used to calculate the pedestals
+
+    MExtractor *ReadCalibration() const;
+    Bool_t ReadPedestalCam();
+    Bool_t WriteResult();
+    //Bool_t WriteEventloop(MEvtLoop &evtloop) const;
+
+    Bool_t SetupExtractor(MParList &plist, MExtractPedestal &extped);
+
+    void   DisplayResult(MParList &plist);
+    void   DisplayReferenceLines(MHCamera *cam, const Int_t what) const;
+    void   DisplayOutliers(TH1D *hist) const;
+    void   FixDataCheckHist(TH1D *hist) const;
+
+    Bool_t IsNoStorage() const { return TESTBIT(fStorage, kNoStorage); }
+
+    Bool_t CheckEnvLocal();
+
 public:
+    MJPedestal(const char *name=NULL, const char *title=NULL);
+    ~MJPedestal();
 
-  MJPedestal(const char *name=NULL, const char *title=NULL);
+    MPedestalCam &GetPedestalCam()            { return fPedestalCamOut; }
+    const MBadPixelsCam &GetBadPixels() const { return fBadPixels;   }
 
-  MPedestalCam &GetPedestalCam()            { return fPedestalCamOut; }
-  const MBadPixelsCam &GetBadPixels() const { return fBadPixels;   }
-  
-  const char*  GetNameExtractorCam()  const { return fNameExtractorCam.Data(); }
-  const char*  GetOutputFile()        const;
+    const char*  GetOutputFile() const;
 
-  const Bool_t IsDataCheck()          const { return fDataCheck; }
-  const Bool_t IsUseData()            const { return fExtractType == kUseData; }
-  
-  Bool_t Process    ();
-  Bool_t ProcessFile();
-  
-  void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
-  void SetPedestals(const MPedestalCam  &ped) { ped.Copy(fPedestalCamIn); }  
-  void SetExtractor(MExtractor* ext)          { fExtractor = ext;     }
-  void SetInput(MRunIter  *iter)              { fRuns      = iter;    }
-  void SetUseData()                           { fExtractType = kUseData;   }
-  void SetUseHists()                          { fExtractType = kUseHists;  }
-  void SetUsePedRun()                         { fExtractType = kUsePedRun; }
-  void SetDataCheck(const Bool_t b=kTRUE)     { fDataCheck = b; b ? SetDataCheckDisplay() : SetNormalDisplay(); }
-  void SetDataCheckDisplay()                  { fDisplayType = kDataCheckDisplay; }
-  void SetNormalDisplay()                     { fDisplayType = kNormalDisplay;    }
-  void SetExtractorResolution(const Bool_t b=kTRUE) { fExtractorResolution = b;  }
-  void SetNameExtractorCam( const char* name= fgNameExtractorCam.Data())  { fNameExtractorCam = name;  }
-  
-  
-  // Storage
-  void SetNoStorage(const Bool_t b)           { b ? SETBIT(fStorage, kNoStorage) : CLRBIT(fStorage,kNoStorage); }
-  void SetNormalStorage()                     { CLRBIT(fStorage, kNoStorage); }
-  
-  ClassDef(MJPedestal, 0) // Tool to create a pedestal file (MPedestalCam)
+    const Bool_t IsDataCheck() const { return fDataCheck; }
+    const Bool_t IsUseData() const { return fExtractType == kUseData; }
+
+    Bool_t Process    ();
+    Bool_t ProcessFile();
+
+    void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); }
+    void SetPedestals(const MPedestalCam  &ped) { ped.Copy(fPedestalCamIn); }
+    void SetExtractor(MExtractor* ext);
+    void SetInput(MRunIter  *iter)              { fRuns      = iter;    }
+    void SetUseData()                           { fExtractType = kUseData;   }
+    void SetUseHists()                          { fExtractType = kUseHists;  }
+    void SetUsePedRun()                         { fExtractType = kUsePedRun; }
+    void SetDataCheck(const Bool_t b=kTRUE)     { fDataCheck = b; b ? SetDataCheckDisplay() : SetNormalDisplay(); }
+    void SetDataCheckDisplay()                  { fDisplayType = kDataCheckDisplay; }
+    void SetNormalDisplay()                     { fDisplayType = kNormalDisplay;    }
+    void SetExtractorResolution(const Bool_t b=kTRUE) { fExtractorResolution = b;  }
+
+    MExtractor *GetExtractor() const { return fExtractor; }
+
+    // Storage
+    void SetNoStorage(const Bool_t b=kTRUE)     { b ? SETBIT(fStorage, kNoStorage) : CLRBIT(fStorage,kNoStorage); }
+    void SetNormalStorage()                     { CLRBIT(fStorage, kNoStorage); }
+
+    ClassDef(MJPedestal, 0) // Tool to create a pedestal file (MPedestalCam)
 };
 
Index: trunk/MagicSoft/Mars/mjobs/MJob.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 5537)
+++ trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 5557)
@@ -181,12 +181,12 @@
     }
 
-    MIter Next(&list);
-    MParContainer *o=0;
+    TIter Next(&list);
+    TObject *o=0;
     while ((o=Next()))
     {
-        *fLog << inf << " - Writing " << o->GetDescriptor() << "..." << flush;
+        *fLog << inf << " - Writing " << MParContainer::GetDescriptor(*o) << "..." << flush;
         if (o->Write(o->GetName())<=0)
         {
-            *fLog << err << dbginf << "ERROR - Writing " << o->GetDescriptor() << " to file " << gFile->GetName() << endl;
+            *fLog << err << dbginf << "ERROR - Writing " << MParContainer::GetDescriptor(*o) << " to file " << gFile->GetName() << endl;
             return kFALSE;
         }
Index: trunk/MagicSoft/Mars/mjobs/MJob.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 5537)
+++ trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 5557)
@@ -14,7 +14,7 @@
     void FixPath(TString &path) const;
 
-    TEnv     *fEnv;           // Resource file
-    TString   fEnvPrefix;     // Prefix for resources
-    Bool_t    fEnvDebug;      // Debug setup of resources
+    const TEnv *fEnv;         // Resource file
+    TString     fEnvPrefix;   // Prefix for resources
+    Bool_t      fEnvDebug;    // Debug setup of resources
 
 protected:
@@ -28,4 +28,8 @@
 
     MSequence fSequence;      // Sequence
+
+    const TEnv *GetEnv() const { return fEnv; }
+    const TString &GetEnvPrefix() const { return fEnvPrefix; }
+    Bool_t GetEnvDebug() const { return fEnvDebug; }
 
     Int_t       GetEnv(const char *name, Int_t dflt) const;
