Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 7035)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 7094)
@@ -86,5 +86,6 @@
 //
 MBadPixelsCalc::MBadPixelsCalc(const char *name, const char *title)
-    : fPedestalLevel(3), fPedestalLevelVariance(5), fNamePedPhotCam("MPedPhotCam")
+    : fPedestalLevel(3), fPedestalLevelVariance(5), fNamePedPhotCam("MPedPhotCam"),
+    fCheckInProcess(kTRUE), fCheckInPostProcess(kFALSE)
 {
     fName  = name  ? name  : gsDefName.Data();
@@ -129,42 +130,13 @@
 // --------------------------------------------------------------------------
 //
-// Check the pedestal RMS of every pixel with respect to the mean pedestal RMS 
-// of the camera (Sigmabar).
-//
-// The pixels can be set as blind if the pedestalRMS is too big or 0.
-//
-// If you don't want to use this option set the PedestalLevel<=0;
-//
-//     MBadPixelsCalc calc;
-//     calc.SetPedestalLevel(-1);
-/*
-void MBadPixelsCalc::CheckPedestalRMS() const
-{
-    const Int_t entries = fPedPhotCam->GetSize();
-
-    const Float_t meanPedRMS = fSigmabar->GetSigmabar();
-
-    for (Int_t i=0; i<entries; i++)
-    {
-        //
-        // get pixel as entry from list
-        //
-        const Double_t nratio    = fGeomCam->GetPixRatio(i);
-        const Double_t pixPedRms = (*fPedPhotCam)[i].GetRms();
-
-        if (pixPedRms*nratio > fPedestalLevel * meanPedRMS || pixPedRms == 0)
-            (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt);
-    }
-}
-*/
-
-// --------------------------------------------------------------------------
-//
 // Check the pedestal Rms of the pixels: compute with 2 iterations the mean 
 // for inner and outer pixels. Set as blind the pixels with too small or 
 // too high pedestal Rms with respect to the mean.
 // 
-Bool_t MBadPixelsCalc::CheckPedestalRms() const
-{
+Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsPix::UnsuitableType_t type) const
+{
+    if (fPedestalLevel<=0 && fPedestalLevelVariance<=0)
+        return kTRUE;
+
     const Int_t entries = fPedPhotCam->GetSize();
 
@@ -266,5 +238,8 @@
             continue;
 
-        (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt);
+        (*fBadPixels)[i].SetUnsuitable(type);
+        if (type==MBadPixelsPix::kUnsuitableRun)
+            (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kDeadPedestalRms);
+
         bads++;
     }
@@ -281,5 +256,4 @@
 }
 
-
 // --------------------------------------------------------------------------
 //
@@ -287,8 +261,13 @@
 Int_t MBadPixelsCalc::Process()
 {
-    if (fPedestalLevel>0 || fPedestalLevelVariance>0)
-        CheckPedestalRms();
-
-    return kTRUE;
+    return fCheckInProcess ? CheckPedestalRms(MBadPixelsPix::kUnsuitableEvt) : kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+//
+Int_t MBadPixelsCalc::PostProcess()
+{
+    return fCheckInPostProcess ? CheckPedestalRms(MBadPixelsPix::kUnsuitableRun) : kTRUE;
 }
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h	(revision 7035)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h	(revision 7094)
@@ -4,4 +4,7 @@
 #ifndef MARS_MTask
 #include "MTask.h"
+#endif
+#ifndef MARS_MBadPixelsPix
+#include "MBadPixelsPix.h"
 #endif
 
@@ -21,10 +24,17 @@
 
     TString fNamePedPhotCam; // name of the 'MPedPhotCam' container
-   
-    //    void CheckPedestalRMS() const;
-    Bool_t CheckPedestalRms() const;
 
+    Bool_t fCheckInProcess;
+    Bool_t fCheckInPostProcess;
+
+    // MBadPixelsCalc
+    Bool_t CheckPedestalRms(MBadPixelsPix::UnsuitableType_t t) const;
+
+    // MTask
     Int_t PreProcess(MParList *pList);
     Int_t Process();
+    Int_t PostProcess();
+
+    // MParContainer
     Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
 
@@ -32,7 +42,11 @@
     MBadPixelsCalc(const char *name=NULL, const char *title=NULL);
 
+    // Setter
     void SetPedestalLevel(Float_t f)         { fPedestalLevel=f; }
     void SetPedestalLevelVariance(Float_t f) { fPedestalLevelVariance=f; }
     void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; }
+
+    void EnableCheckInProcess(Bool_t b=kTRUE)     { fCheckInProcess = b; }
+    void EnableCheckInPostProcess(Bool_t b=kTRUE) { fCheckInPostProcess = b; }
 
     ClassDef(MBadPixelsCalc, 1) // Task to find bad pixels (star, broken pixels, etc)
