Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 6324)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 6331)
@@ -102,5 +102,5 @@
 MJPedestal::MJPedestal(const char *name, const char *title) 
     : fExtractor(NULL), fDisplayType(kDisplayDataCheck),
-      fExtractType(kUsePedRun), fExtractionType(kFundamental)
+      fExtractType(kUsePedRun), fExtractionType(kFundamental), fIsUseHists(kFALSE)
 {
     fName  = name  ? name  : "MJPedestal";
@@ -277,5 +277,5 @@
     disp1.SetCamError  (fPedestalCamOut, 3);
 
-    if (fExtractType == kUseHists)
+    if (fIsUseHists)
       {
         disp2.SetCamContent(calpedcam, 0);
@@ -357,5 +357,5 @@
     // Display data
     //
-    if (fDisplayType != kDisplayDataCheck && fExtractType != kUseHists && fExtractionType==kFundamental/*fExtractorResolution*/)
+    if (fDisplayType != kDisplayDataCheck &&  !fIsUseHists && fExtractionType==kFundamental/*fExtractorResolution*/)
       {
         TCanvas &c3 = fDisplay->AddTab("Pedestals");
@@ -367,5 +367,5 @@
       }
     
-    if (fExtractType == kUseHists)
+    if (fIsUseHists)
       {
         
@@ -796,5 +796,5 @@
     if (HasEnv("UseHists"))
       if (GetEnv("UseHists",kFALSE))
-        fExtractType = kUseHists;
+        fIsUseHists = kTRUE;
     
     SetNoStorage(GetEnv("DisableOutput", IsNoStorage()));
@@ -956,9 +956,14 @@
     MPedCalcFromLoGain pedlogain;
     pedlogain.SetPedestalUpdate(kFALSE);
-
-    fPedestalHist.SetRenorm(kTRUE);
-    
-    MFillH fillped(&fPedestalHist, "MExtractedSignalCam", "FillPedestalCam");
-    fillped.SetBit(MFillH::kDoNotDisplay);
+    
+    MHPedestalCam hpedcam;
+    //    fPedestalHist.SetRenorm(kTRUE);
+
+    MPedestalCam pedinter;
+    pedinter.SetName("MPedestalCamIntermediate");
+
+    MFillH fillped(&hpedcam, "MPedestalCamIntermediate", "FillPedCam");
+    //    MFillH fillped(&fPedestalHist, "MPedestalCamIntermediate", "FillPedCam");
+    //    fillped.SetBit(MFillH::kDoNotDisplay);
 
     tlist.AddToList(&geomapl);
@@ -979,6 +984,6 @@
     MFEventSelector sel;
     sel.SetNumSelectEvts(0);
-
-    if (fExtractionType!=kFundamental && fExtractType!=kUseHists)
+    
+    if (fExtractionType!=kFundamental)
       {
         fExtractor->SetFilter(&sel);
@@ -1006,22 +1011,22 @@
         tlist.AddToList(&taskenv);
         break;
-
-    case kUseHists:
-        if (!fExtractor)
-        {
-            *fLog << err << GetDescriptor() << " - ERROR: ";
-            *fLog << "Extraction Type is kUseHists, but no extractor was set" << endl;
-            return kFALSE;
-        }
-
-        fExtractor->SetPedestals(&fPedestalCamIn);
-        plist.AddToList(&fPedestalHist);
-        tlist.AddToList(fExtractor);
+    }
+    
+    if (fIsUseHists)
+      {
+        pedcalc.SetIntermediateStorage();
+        pedlogain.SetIntermediateStorage();
+        plist.AddToList(&pedinter);
+        plist.AddToList(&hpedcam);
+        //        plist.AddToList(&fPedestalHist);
         tlist.AddToList(&fillped);
-        break;
-    }
+      }
 
     pedcalc.SetPedestalsIn(&fPedestalCamIn);
     pedlogain.SetPedestalsIn(&fPedestalCamIn);
+    pedcalc.SetPedestalsInter(&pedinter);
+    pedlogain.SetPedestalsInter(&pedinter);
+    pedcalc.SetPedestalsOut(&fPedestalCamOut);
+    pedlogain.SetPedestalsOut(&fPedestalCamOut);
 
      // kFundamental
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 6324)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 6331)
@@ -55,6 +55,6 @@
     MPedestalCam  fPedestalCamOut;           // Created pedestal results
     MBadPixelsCam fBadPixels;                // Bad Pixels
-    MHPedestalCam fPedestalHist;             // Histogramming pedestal Camera
-    
+    //    MHPedestalCam fPedestalHist;             // Histogramming pedestal Camera
+
     enum Display_t { kDisplayNone, kDisplayNormal, kDisplayDataCheck }; // Possible Display types
     Display_t fDisplayType;                  // Chosen Display type
@@ -63,9 +63,11 @@
     Byte_t fStorage;                         // Bit-field for chosen storage type
 
-    enum Extract_t { kUseData, kUsePedRun, kUseHists };  // Possible flags for the extraction of the pedestal
+    enum Extract_t { kUseData, kUsePedRun }; // Possible flags for the extraction of the pedestal
     Extract_t fExtractType;                  // Chosen extractor type
 
     enum Extraction { kFundamental, kWithExtractorRndm, kWithExtractor };
     Int_t fExtractionType;                   // Flag if the extractor is used to calculate the pedestals
+
+    Bool_t fIsUseHists;                      // Switch on histogramming or not
 
     MExtractor *ReadCalibration() const;
@@ -96,6 +98,6 @@
     const char*  GetOutputFile() const;
 
-    MHPedestalCam &GetPedestalHist()   { return fPedestalHist;  }
-    
+    //    const MHPedestalCam &GetPedestalHist() const { return fPedestalHist;  }
+
     const Bool_t IsUseData() const { return fExtractType == kUseData; }
 
@@ -107,5 +109,5 @@
     void SetExtractor(MExtractor* ext);
     void SetUseData()                           { fExtractType = kUseData;   }
-    void SetUseHists()                          { fExtractType = kUseHists;  }
+    void SetUseHists()                          { fIsUseHists = kTRUE;  }
     void SetUsePedRun()                         { fExtractType = kUsePedRun; }
     void SetDataCheckDisplay()                  { fDisplayType = kDisplayDataCheck; }
