Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 6301)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 6302)
@@ -21,4 +21,12 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2005/02/09 Markus Gaug 
+
+   * mjobs/MJPedestal.[h,cc]
+   * mjobs/badpixels_0_559.rc
+     - allow exclusion of bad pixels from the beginning (default is 
+       Pixel 0 and 559).
+
+
  2005/02/08 Markus Gaug 
  
@@ -26,4 +34,5 @@
    * mcalib/MCalibrationChargeCalc.cc
      - replaced GetNumExecutions()==0 condition by GetNumExecution() < 1 
+
 
  2005/02/08 Thomas Bretz
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 6301)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 6302)
@@ -45,4 +45,5 @@
 #include <TPad.h>
 #include <TEnv.h>
+#include <TH2F.h>
 
 // mars core
@@ -85,4 +86,6 @@
 #include "MPedCalcFromLoGain.h"
 
+#include <fstream>
+
 ClassImp(MJPedestal);
 
@@ -90,4 +93,5 @@
 
 const TString  MJPedestal::fgReferenceFile = "mjobs/pedestalref.rc";
+const TString  MJPedestal::fgBadPixelsFile = "mjobs/badpixels_0_559.rc";
 // --------------------------------------------------------------------------
 //
@@ -111,4 +115,5 @@
     SetPathIn("");
     SetReferenceFile();
+    SetBadPixelsFile();
 
     //
@@ -149,11 +154,12 @@
 const char* MJPedestal::GetOutputFileName() const
 {
-    if (fSequence.IsValid())
-        return Form("pedest%08d.root", fSequence.GetSequence());
-
-    if (!fRuns)
-        return "";
-
-    return Form("%s-F0.root", (const char*)fRuns->GetRunsAsFileName());
+
+  if (fSequence.IsValid())
+    return Form("pedest%08d.root", fSequence.GetSequence());
+  
+  if (!fRuns)
+    return "";
+  
+  return Form("%s-F0.root", (const char*)fRuns->GetRunsAsFileName());
 }
 
@@ -815,5 +821,6 @@
     SetExtractor((MExtractor*)tenv.GetTask());
 
-    fReferenceFile = GetEnv("ReferenceFile", fReferenceFile.Data());
+    fBadPixelsFile = GetEnv("BadPixelsFile",fBadPixelsFile.Data());
+    fReferenceFile = GetEnv("ReferenceFile",fReferenceFile.Data());
     ReadReferenceFile();
 
@@ -934,4 +941,15 @@
     plist.AddToList(&fBadPixels);
     
+    //
+    // Read bad pixels from outside
+    // 
+    if (!fBadPixelsFile.IsNull())
+      {
+        *fLog << err << "Excluding: " << fBadPixelsFile << endl;
+        ifstream f(fBadPixelsFile.Data());
+        fBadPixels.AsciiRead((istream&)f);  
+        f.close();
+      }
+
     MGeomApply geomapl;
     MBadPixelsMerge merge(&fBadPixels);
@@ -943,8 +961,7 @@
     pedlogain.SetPedestalUpdate(kFALSE);
 
-    MHPedestalCam hpedcam;
-    hpedcam.SetRenorm(kTRUE);
+    fPedestalHist.SetRenorm(kTRUE);
     
-    MFillH fillped(&hpedcam, "MExtractedSignalCam", "FillPedestalCam");
+    MFillH fillped(&fPedestalHist, "MExtractedSignalCam", "FillPedestalCam");
     fillped.SetBit(MFillH::kDoNotDisplay);
 
@@ -967,5 +984,5 @@
     sel.SetNumSelectEvts(0);
 
-    if (fExtractionType!=kFundamental)
+    if (fExtractionType!=kFundamental && fExtractType!=kUseHists)
       {
         fExtractor->SetFilter(&sel);
@@ -1002,4 +1019,6 @@
         }
 
+        fExtractor->SetPedestals(&fPedestalCamIn);
+        plist.AddToList(&fPedestalHist);
         tlist.AddToList(fExtractor);
         tlist.AddToList(&fillped);
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 6301)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 6302)
@@ -2,4 +2,7 @@
 #define MARS_MJPedestal
 
+#ifndef MARS_MJob
+#include "MJob.h"
+#endif
 #ifndef MARS_MJCalib
 #include "MJCalib.h"
@@ -7,4 +10,7 @@
 #ifndef MARS_MPedestalCam
 #include "MPedestalCam.h"
+#endif
+#ifndef MARS_MHPedestalCam
+#include "MHPedestalCam.h"
 #endif
 #ifndef MARS_MBadPixelsCam
@@ -20,9 +26,10 @@
 class MEvtLoop;
 
-class MJPedestal : public MJCalib
+class MJPedestal : public MJob, public MJCalib
 {
 private:
 
     static const TString  fgReferenceFile;   //! default for fReferenceFile ("pedestalref.rc")
+    static const TString  fgBadPixelsFile;   //! default for fBadPixelsFile ("badpixels_0_559.rc")
 
     Axis_t fPedestalMin;                     //! Minimum Axis value for pedestal datacheck display
@@ -43,6 +50,7 @@
     Float_t fRefPedRmsGalacticOuter;         //! Ref. line ped. RMS for galactic source - outer pixels
 
-    TString     fReferenceFile;              // File name containing the reference values
-
+    TString fReferenceFile;                  // File name containing the reference values
+    TString fBadPixelsFile;                  // File name containing the bad pixels excluded beforehand 
+    
     MExtractor *fExtractor;                  // Signal extractor, used to find the nr. of used FADC slices
 
@@ -50,5 +58,6 @@
     MPedestalCam  fPedestalCamOut;           // Created pedestal results
     MBadPixelsCam fBadPixels;                // Bad Pixels
-
+    MHPedestalCam fPedestalHist;             // Histogramming pedestal Camera
+    
     enum Display_t { kDisplayNone, kDisplayNormal, kDisplayDataCheck }; // Possible Display types
     Display_t fDisplayType;                  // Chosen Display type
@@ -76,5 +85,4 @@
 
     Bool_t CheckEnvLocal();
-    void ReadReferenceFile();
 
     const char*  GetOutputFileName() const;
@@ -89,4 +97,6 @@
     const char*  GetOutputFile() const;
 
+    MHPedestalCam &GetPedestalHist()   { return fPedestalHist;  }
+    
     const Bool_t IsUseData() const { return fExtractType == kUseData; }
 
@@ -108,5 +118,6 @@
     void SetExtractionWithExtractor()     { fExtractionType=kWithExtractor;     /*fPedestalCamOut.SetName("MPedestalExtractor");*/     }
 
-    void SetReferenceFile( const TString ref=fgReferenceFile) { fReferenceFile = ref; } // Only usefull to overwrite CheckEnvLocal-default
+    void SetReferenceFile( const TString ref=fgReferenceFile ) { fReferenceFile = ref; }
+    void SetBadPixelsFile( const TString ref=fgBadPixelsFile ) { fBadPixelsFile = ref; }
 
     MExtractor *GetExtractor() const { return fExtractor; }
Index: /trunk/MagicSoft/Mars/mjobs/badpixels_0_559.rc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/badpixels_0_559.rc	(revision 6302)
+++ /trunk/MagicSoft/Mars/mjobs/badpixels_0_559.rc	(revision 6302)
@@ -0,0 +1,1 @@
+0: 0 559
