Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 5810)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 5841)
@@ -177,5 +177,5 @@
 //
 // For more details see the class description and the corresponding Getters
-// 
+//
 Bool_t MJCalibrateSignal::CheckEnvLocal()
 {
@@ -282,7 +282,4 @@
     plist.AddToList(&calibcont);
 
-    pedcamab.SetName("MPedestalFundamental");
-    plist.AddToList(&pedcamab);
-
     // Setup Tasklist
     MTaskList tlist;
@@ -364,9 +361,5 @@
     if (extractor1)
     {
-        // FIXME: How to get the fixed value 15 automatically?
-        const Float_t win = extractor1->GetNumHiGainSamples();
-        pedlo1.SetExtractWindow(15, (UShort_t)TMath::Nint(win));
-        pedlo2.SetExtractWindow(15, (UShort_t)TMath::Nint(win));
-        pedlo3.SetExtractWindow(15, (UShort_t)TMath::Nint(win));
+        extractor1->SetPedestals(&pedcamab);
 
         if (extractor1->InheritsFrom("MExtractTimeAndCharge"))
@@ -374,7 +367,20 @@
             pedlo2.SetExtractor((MExtractTimeAndCharge*)extractor1);
             pedlo3.SetExtractor((MExtractTimeAndCharge*)extractor1);
-            extractor1->SetPedestals(&pedcamab);
+            pedlo1.SetExtractWindow(15, 0/*obsolete*/);
+            pedlo2.SetExtractWindow(15, 0/*obsolete*/);
+            pedlo3.SetExtractWindow(15, 0/*obsolete*/);
         }
-    }
+        else
+        {
+            // FIXME: How to get the fixed value 15 automatically?
+            const Int_t f = (Int_t)(15.5+extractor1->GetHiGainFirst());
+            const Int_t n = (Int_t)(15.5+extractor1->GetNumHiGainSamples());
+            pedlo1.SetExtractWindow(f, n);
+            pedlo2.SetExtractWindow(f, n);
+            pedlo3.SetExtractWindow(f, n);
+        }
+    }
+    if (extractor2)
+        extractor2->SetPedestals(&pedcamab);
 
     MFCosmics fcosmics;
@@ -414,4 +420,6 @@
     treat.AddNamePedPhotCam("MPedPhotFromExtractor");
     treat.AddNamePedPhotCam("MPedPhotFromExtractorRndm");
+    if (!extractor2 && !extractor1->InheritsFrom("MExtractTimeAndCharge"))
+        treat.SetProcessTimes(kFALSE);
 
 
@@ -461,5 +469,5 @@
     write.AddContainer("MTime",                     "Events",     kFALSE);
     write.AddContainer("MRawEvtHeader",             "Events");
-    write.AddContainer("MArrivalTime",              "Events");
+    write.AddContainer("MArrivalTime",              "Events",     kFALSE);
     // Slow-Control: Current
     write.AddContainer("MTimeCurrents",             "Currents",   kFALSE);
@@ -509,5 +517,6 @@
     tlist2.AddToList(&fill2);
     tlist2.AddToList(&calib);
-    tlist2.AddToList(&caltm);
+    if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
+        tlist2.AddToList(&caltm);
     tlist2.AddToList(&bpcal);
     tlist2.AddToList(&treat);
@@ -516,5 +525,6 @@
     tlist2.AddToList(&fill4);
     tlist2.AddToList(&fill5);
-    tlist2.AddToList(&fill7);
+    if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
+        tlist2.AddToList(&fill7);
 
     // Setup List for Drive-tree
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5810)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5841)
@@ -1711,5 +1711,5 @@
     {
         taskenv2.SetDefault(fTimeExtractor);
-    
+   
         if (IsRelTimes())
             tlist.AddToList(&taskenv2);
@@ -1760,5 +1760,5 @@
     }
 
-    if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask()))
+    if (!WriteTasks(taskenv.GetTask(), IsRelTimes() ? taskenv2.GetTask() : 0))
         return kFALSE;
 
@@ -1995,6 +1995,6 @@
     cont.Add(&fCalibrationPINDiode);
 
-    if (IsRelTimes())
-        cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
+    //if (IsRelTimes())
+    cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
 
     if (!geom)
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5810)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5841)
@@ -783,19 +783,4 @@
 }
 
-Bool_t MJPedestal::SetupExtractor(MParList &plist, MExtractPedestal &extped)
-{
-    if (!fExtractor)
-        return kTRUE;
-
-    if (fExtractionType==kFundamental || !fExtractor->InheritsFrom("MExtractTimeAndCharge"))
-        return kFALSE;
-
-    extped.SetPedestalsIn(&fPedestalCamIn);
-    extped.SetExtractor((MExtractTimeAndCharge*)fExtractor);
-    extped.SetRandomCalculation(fExtractionType==kWithExtractorRndm);
-
-    return kTRUE;
-}
-
 Bool_t MJPedestal::ProcessFile()
 {
@@ -908,21 +893,22 @@
     }
 
+    // ----------------------------------------------------------------------
+    //   Now we make sure, that in all cases the ranges are setup correctly
+    // ----------------------------------------------------------------------
     MTaskEnv taskenv("ExtractPedestal");
     switch (fExtractType)
     {
+    case kUsePedRun:
+        // In case  other than 'fundamental' second argument is obsolete
+        pedcalc.SetExtractWindow(0, 13);  // kUsePedRun
+        taskenv.SetDefault(&pedcalc);
+        tlist.AddToList(&taskenv);
+        break;
+
     case kUseData:
+        // In case  other than 'fundamental' second argument is obsolete
+        pedlogain.SetExtractWindow(15, 28); // kUseData
         taskenv.SetDefault(&pedlogain);
         tlist.AddToList(&taskenv);
-
-        if (!SetupExtractor(plist, pedlogain))
-            pedlogain.SetExtractWindow(15, (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
-        break;
-
-    case kUsePedRun:
-        taskenv.SetDefault(&pedcalc);
-        tlist.AddToList(&taskenv);
-
-        if (!SetupExtractor(plist, pedcalc))
-            pedcalc.SetExtractWindow(fExtractor->GetHiGainFirst(), TMath::Nint(fExtractor->GetNumHiGainSamples()));
         break;
 
@@ -940,4 +926,76 @@
     }
 
+    pedcalc.SetPedestalsIn(&fPedestalCamIn);
+    pedlogain.SetPedestalsIn(&fPedestalCamIn);
+
+     // kFundamental
+    if (fExtractor)
+    {
+        if (!fExtractor->InheritsFrom("MExtractTimeAndCharge"))
+        {
+            const Float_t f = 0.5+fExtractor->GetHiGainFirst();
+            const Float_t n = 0.5+fExtractor->GetNumHiGainSamples();
+            pedcalc.SetExtractWindow((Int_t)f, (Int_t)n);
+            pedlogain.SetExtractWindow((Int_t)(15+f), (Int_t)(15+n));
+
+            if (fExtractionType!=kFundamental)
+            {
+                *fLog << inf;
+                *fLog << "Signal extractor doesn't inherit from MExtractTimeAndCharge..." << endl;
+                *fLog << " --> falling back to fundamental pedestal extraction." << endl;
+                fExtractionType=kFundamental;
+            }
+        }
+        else
+        {
+            pedcalc.SetExtractor((MExtractTimeAndCharge*)fExtractor);
+            pedlogain.SetExtractor((MExtractTimeAndCharge*)fExtractor);
+        }
+
+        if (fExtractionType!=kFundamental)
+        {
+            pedcalc.SetRandomCalculation(fExtractionType==kWithExtractorRndm);
+            pedlogain.SetRandomCalculation(fExtractionType==kWithExtractorRndm);
+        }
+    }
+
+    /*
+    switch (fExtractType)
+    {
+    case kUseData:
+        *fLog << all << "TYPE: USEDATA " << fExtractor << endl;
+        taskenv.SetDefault(&pedlogain);
+        tlist.AddToList(&taskenv);
+
+        if (!SetupExtractor(plist, pedlogain))
+        {
+            *fLog << all <<  "SETTING TO: " << fExtractor << " " << fExtractor->GetNumHiGainSamples() << endl;
+            fExtractor->Print();
+            pedlogain.SetExtractWindow(15, (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
+        }
+        break;
+
+    case kUsePedRun:
+        *fLog << all <<  "TYPE: USEPEDRUN " << fExtractor << endl;
+        taskenv.SetDefault(&pedcalc);
+        tlist.AddToList(&taskenv);
+
+        if (!SetupExtractor(plist, pedcalc))
+            pedcalc.SetExtractWindow(fExtractor->GetHiGainFirst(), TMath::Nint(fExtractor->GetNumHiGainSamples()));
+        break;
+
+    case kUseHists:
+        if (!fExtractor)
+        {
+            *fLog << err << GetDescriptor() << " - ERROR: ";
+            *fLog << "Extraction Type is kUseHists, but no extractor was set" << endl;
+            return kFALSE;
+        }
+
+        tlist.AddToList(fExtractor);
+        tlist.AddToList(&fillped);
+        break;
+    } */
+
     /*
     if (!fPathIn.IsNull())
