Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 5361)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 5381)
@@ -332,5 +332,10 @@
         apply.SetGeometry(geom);
     MBadPixelsMerge        merge(&badpix);
+
     MPedCalcFromLoGain     pedlo;
+    pedlo.SetPedestalUpdate(kTRUE);
+    // FIXME: How to get the fixed value 15 automatically?
+    pedlo.SetExtractWindow(15, (Int_t)static_cast<MExtractor*>(extractor1)->GetNumHiGainSamples());
+
     MMcPedestalCopy        pcopy;
     MTaskEnv taskenv1("ExtractSignal");
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5361)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5381)
@@ -503,20 +503,19 @@
 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("UseExtractor"))
-    if (GetEnv("UseExtractor",kFALSE))
-      fExtractType = kUseExtractor;
-
-  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("UseExtractor"))
+        if (GetEnv("UseExtractor",kFALSE))
+            fExtractType = kUseExtractor;
+
+    SetNoStorage(GetEnv("DisableOutput", IsNoStorage()));
+
+    return kTRUE;
 }
 
@@ -666,42 +665,37 @@
 
     MTaskEnv taskenv("ExtractPedestal");
-    if (IsUseData())
-      taskenv.SetDefault(&pedlogain);
-    else if (IsUseExtractor())
-      taskenv.SetDefault(fExtractor);
-    else
-      taskenv.SetDefault(&pedcalc);
-
-    if (fExtractor)
-    {
-      if (IsUseData())
-        pedlogain.SetExtractWindow(15,(Int_t)fExtractor->GetNumHiGainSamples());          
-      else if (IsUsePedRun())
+    switch (fExtractType)
+    {
+    case kUseData:
+        taskenv.SetDefault(&pedlogain);
+        if (!fExtractor)
+            break;
+        pedlogain.SetExtractWindow(15,(Int_t)fExtractor->GetNumHiGainSamples());
+        break;
+
+    case kUsePedRun:
+        if (!fExtractor)
+            break;
+        taskenv.SetDefault(&pedcalc);
+        pedcalc.SetWindowSize((Int_t)fExtractor->GetNumHiGainSamples());
+        pedcalc.SetRange(fExtractor->GetHiGainFirst(), fExtractor->GetHiGainLast());
+        break;
+
+    case kUseExtractor:
+        if (!fExtractor)
         {
-          pedcalc.SetWindowSize((Int_t)fExtractor->GetNumHiGainSamples());
-          pedcalc.SetRange(fExtractor->GetHiGainFirst(), fExtractor->GetHiGainLast());
+            *fLog << err << GetDescriptor();
+            *fLog << "Extraction Type kUseExtractor is chosen, but no extractor has been handed over" << endl;
+            return kFALSE;
         }
-      else if (IsUseExtractor())
-        if (!fExtractor->IsNoiseCalculation())
-          {
-            *fLog << err << GetDescriptor() 
-                  << "Extraction Type kUseExtractor is chosen, but the extractor has no flag kNoiseCalculation set! " << endl;
-            return kFALSE;
-          }
-    }
-    else if (IsUseExtractor())
-      {
-        *fLog << err << GetDescriptor()
-              << "Extraction Type kUseExtractor is chosen, but no extractor has been handed over" << endl;
-        return kFALSE;
-      }
-    
-  /*
-    else
-    {
+        taskenv.SetDefault(fExtractor);
+        if (fExtractor->IsNoiseCalculation())
+            break;
+
         *fLog << warn << GetDescriptor();
-        *fLog << ": No extractor has been chosen, take default number of FADC samples " << endl;
-    }
-    */
+        *fLog <<"Extraction type is kUseExtractor, but extractor has kNoiseCalculation not set... set." << endl;
+        fExtractor->SetNoiseCalculation();
+        return kFALSE;
+    }
 
     tlist.AddToList(&geomapl);
