Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 5156)
@@ -1,2 +1,3 @@
+
 /* ======================================================================== *\
 !
@@ -955,7 +956,7 @@
   if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
     {
-      *fLog << warn << GetDescriptor() 
-            << Form(": Fitted Charge: %5.2f is smaller than %2.1f",cal.GetMean(),fChargeLimit)
-            << Form("  Pedestal RMS: %5.2f in %s%4i",cal.GetPedRms(),what,cal.GetPixId()) << endl;
+      *fLog << warn
+            << Form("Fitted Charge: %5.2f < %2.1f",cal.GetMean(),fChargeLimit)
+            << Form(" * Pedestal RMS %5.2f in %s%3i",cal.GetPedRms(),what,cal.GetPixId()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
     }
@@ -963,7 +964,7 @@
    if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 
     {
-      *fLog << warn << GetDescriptor() 
-            << Form(": Fitted Charge: %4.2f is smaller than %2.1f",cal.GetMean(),fChargeRelErrLimit) 
-            << Form(" times its error: %4.2f in %s%4i",cal.GetMeanErr(),what,cal.GetPixId()) << endl;
+      *fLog << warn
+            << Form("Fitted Charge: %4.2f < %2.1f",cal.GetMean(),fChargeRelErrLimit)
+            << Form(" * its error %4.2f in %s%3i",cal.GetMeanErr(),what,cal.GetPixId()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid );
     }
@@ -971,7 +972,7 @@
   if (cal.GetSigma() < cal.GetPedRms())
     {
-      *fLog << warn << GetDescriptor() 
-            << Form(": Sigma of Fitted Charge: %6.2f is smaller than",cal.GetSigma())
-	    << Form(" Ped. RMS: %5.2f in %s%4i",cal.GetPedRms(),what,cal.GetPixId()) << endl;
+      *fLog << warn
+            << Form("Sigma of Fitted Charge: %6.2f <",cal.GetSigma())
+	    << Form(" Ped. RMS=%5.2f in %s%3i",cal.GetPedRms(),what,cal.GetPixId()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
       return kFALSE;
@@ -980,6 +981,6 @@
   if (!cal.CalcReducedSigma())
     {
-      *fLog << warn << GetDescriptor() 
-            << Form(": Could not calculate the reduced sigma in %s:               ",what)
+      *fLog << warn 
+            << Form("Could not calculate the reduced sigma in %s:               ",what)
             << Form("         %4i",cal.GetPixId()) 
             << endl;
@@ -990,6 +991,6 @@
   if (!cal.CalcFFactor())
     {
-      *fLog << warn << GetDescriptor() 
-            << Form(": Could not calculate the F-Factor in %s:                    ",what)
+      *fLog << warn 
+            << Form("Could not calculate the F-Factor in %s:                    ",what)
             << Form("         %4i",cal.GetPixId()) 
             << endl;
@@ -1000,6 +1001,6 @@
   if (!cal.CalcConvFFactor())
     {
-      *fLog << warn << GetDescriptor() 
-            << Form(": Could not calculate the Conv. FADC counts to Phes in %s:  ",what)
+      *fLog << warn 
+            << Form("Could not calculate the Conv. FADC counts to Phes in %s:  ",what)
             << Form("         %4i",cal.GetPixId()) 
             << endl;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 5156)
@@ -418,7 +418,7 @@
       if ( res < lowlim[aidx] || res > upplim[aidx] )
         {
-          *fLog << warn << GetDescriptor() << ": Deviating time resolution: " 
-            << Form("%4.2f",res) << " out of accepted limits: [" 
-                << Form("%4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i << endl;
+          *fLog << warn << "Deviating time resolution: "
+            << Form("%4.2f",res) << " out of accepted limits ["
+                << Form("%4.2f,%4.2f",lowlim[aidx],upplim[aidx]) << "] in pixel " << i << endl;
           bad.SetUncalibrated( MBadPixelsPix::kDeviatingTimeResolution);
           pix.SetExcluded();
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 5156)
@@ -923,7 +923,7 @@
       if (overflow > 0.1)
         {
-          *fLog << warn << GetDescriptor()
-                << ": HiGain Histogram Overflow occurred " << overflow 
-                << " times in pixel: " << i << " (without saturation!) " << endl;
+          *fLog << warn
+                << "HiGain Hist-overflow " << overflow
+                << " times in pix: " << i << " (w/o saturation!) " << endl;
           bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 
         }
@@ -932,7 +932,7 @@
       if (overflow > 0.1)
         {
-          *fLog << warn << GetDescriptor()
-                << ": HiGain Histogram Underflow occurred " << overflow
-                << " times in pixel: " << i << " (without saturation!) " << endl;
+          *fLog << warn
+                << "HiGain Hist-underflow " << overflow
+                << " times in pix: " << i << " (w/o saturation!) " << endl;
           bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 
         }
@@ -965,7 +965,7 @@
         if (overflow > 0.1)
           {
-            *fLog << warn << GetDescriptor()
-                  << ": LoGain Histogram Overflow occurred " << overflow
-                  << " times in pixel: " << i << " (without saturation!) " << endl;
+              *fLog << warn
+                  << "LoGain Hist-overflow " << overflow
+                  << " times in pix: " << i << " (w/o saturation!) " << endl;
             bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow ); 
           }
@@ -974,7 +974,7 @@
         if (overflow > 0.1)
           {
-            *fLog << warn << GetDescriptor()
-                  << ": LoGain Histogram Underflow occurred " << overflow
-                  << " times in pixel: " << i << " (without saturation!) " << endl;
+            *fLog << warn
+                  << "LoGain Hist-underflow " << overflow
+                  << " times in pix: " << i << " (w/o saturation!) " << endl;
             bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow ); 
           }
@@ -1108,7 +1108,7 @@
   if ( mean < lowerlimit)
     {
-      *fLog << warn << GetDescriptor() 
-            << Form("%s%3.1f%s%2.1f%s%s",": Mean ArrivalTime: ",mean," smaller than ",fTimeLowerLimit,
-                    " FADC slices from lower edge in pixel ",hist.GetName()) << endl;
+      *fLog << warn
+            << Form("%s%3.1f%s%2.1f%s%s","Mean ArrivalTime=",mean," < ",fTimeLowerLimit,
+                    " slices from lower edge in pixel ",hist.GetName()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
     }
@@ -1116,7 +1116,7 @@
   if ( mean  > upperlimit )
     {
-      *fLog << warn << GetDescriptor() 
-            << Form("%s%3.1f%s%2.1f%s%s",": Mean ArrivalTime: ",mean," greater than ",fTimeUpperLimit,
-                    " FADC slices from upper edge in pixel ",hist.GetName()) << endl;
+      *fLog << warn
+            << Form("%s%3.1f%s%2.1f%s%s","Mean ArrivalTime=",mean," > ",fTimeUpperLimit,
+                    " slices from upper edge in pixel ",hist.GetName()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
     }
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc	(revision 5156)
@@ -436,7 +436,6 @@
       if (overflow > 0.1)
         {
-          *fLog << warn << GetDescriptor()
-                << ": HiGain Histogram Overflow occurred " << overflow 
-                << " times in pixel: " << i << " (without saturation!) " << endl;
+          *fLog << warn << "HiGain Hist-overflow occurred " << overflow
+                << " times in pix: " << i << " (w/o saturation!) " << endl;
           //          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 
         }
@@ -445,7 +444,6 @@
       if (overflow > 0.1)
         {
-          *fLog << warn << GetDescriptor()
-                << ": HiGain Histogram Underflow occurred " << overflow
-                << " times in pixel: " << i << " (without saturation!) " << endl;
+          *fLog << warn << "HiGain Hist-underflow occurred " << overflow
+                << " times in pix: " << i << " (w/o saturation!) " << endl;
           //          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 
         }
Index: trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 5156)
@@ -30,6 +30,16 @@
 // currents or enything else derived from MCamEvent
 //
+// Setup
+// =====
+//
 // To plot the variance instead of the rms use:
 //    MHCamEvent::SetBit(MHCamera::kVariance);
+//  or
+//    MHCamEvent::EnableVariance()
+//
+// To count how often a certain pixel is above or below a threshold do:
+//    MHCamEvent::SetThreshold(5.5);  // Default=LowerBound
+//    MHCamEvent::SetThreshold(5.5, MHCamEvent::kIsUpperBound);
+//
 //
 // Axis titles
@@ -47,5 +57,4 @@
 //   MHCamEvent myhist("Titele;;y [cm]");
 //
-//
 /////////////////////////////////////////////////////////////////////////////
 #include "MHCamEvent.h"
@@ -88,5 +97,5 @@
 //
 MHCamEvent::MHCamEvent(const char *name, const char *title)
-    : fSum(NULL), fEvt(NULL), fType(0)
+    : fSum(NULL), fEvt(NULL), fType(0), fThreshold(0), fUseThreshold(0)
 {
     Init(name, title);
@@ -98,5 +107,5 @@
 //
 MHCamEvent::MHCamEvent(Int_t type, const char *name, const char *title)
-    : fSum(NULL), fEvt(NULL), fType(type)
+    : fSum(NULL), fEvt(NULL), fType(type), fThreshold(0), fUseThreshold(0)
 {
     Init(name, title);
@@ -111,4 +120,13 @@
     if (fSum)
         delete fSum;
+}
+
+// --------------------------------------------------------------------------
+//
+// use this to display the variance instead of the rms.
+//
+void MHCamEvent::EnableVariance(Bool_t b)
+{
+    b ? SetBit(MHCamera::kVariance) : ResetBit(MHCamera::kVariance);
 }
 
@@ -140,9 +158,12 @@
     }
 
+    // Delete a posible old histogram from a previous loop
     if (fSum)
         delete (fSum);
 
+    // combine name
     const TString name = fNameEvt.IsNull() ? fName : fNameEvt;
 
+    // create and setup MHCamera
     fSum = new MHCamera(*cam, name+";avg");
     if (fTitle!=gsDefTitle)
@@ -169,5 +190,8 @@
         return kFALSE;
     }
-    fSum->AddCamContent(*evt, fType);
+    if (fUseThreshold)
+        fSum->CntCamContent(*evt, fThreshold, fType, fUseThreshold>0);
+    else
+        fSum->AddCamContent(*evt, fType);
     return kTRUE;
 }
@@ -274,5 +298,5 @@
     MHCamera *cam = new MHCamera(*fSum->GetGeometry());
     cam->SetName(Form("Err_%p", this));
-    cam->SetTitle(TestBit(MHCamera::kVariance)?"Variance":"Root Mean Squared (rms)");
+    cam->SetTitle(fSum->TestBit(MHCamera::kVariance)?"Variance":"Root Mean Squared (rms)");
     cam->SetYTitle(fSum->GetYaxis()->GetTitle());
     cam->SetCamContent(*fSum, 1);
@@ -292,2 +316,3 @@
     h->Draw();
 }
+
Index: trunk/MagicSoft/Mars/mhist/MHCamEvent.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 5155)
+++ trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 5156)
@@ -15,10 +15,13 @@
     static const TString gsDefTitle;
 
-    MHCamera  *fSum; // storing the sum
-    MCamEvent *fEvt; //! the current event
+    MHCamera  *fSum;       // storing the sum
+    MCamEvent *fEvt;       //! the current event
 
-    TString fNameEvt;
+    TString fNameEvt;      // Nameof MCamEvent to fill into histogram
 
-    Int_t fType;
+    Int_t fType;           // Type to used for calling GetPixelContent
+
+    Float_t fThreshold;    // Count pixel above/below this threshold
+    Char_t fUseThreshold;  // Use a threshold? Which direction has it?
 
     void Init(const char *name, const char *title);
@@ -28,4 +31,6 @@
 
 public:
+    enum { kIsLowerBound=1, kIsUpperBound=-1, kNoBound=0 };
+
     MHCamEvent(const char *name=NULL, const char *title=NULL);
     MHCamEvent(Int_t type, const char *name=NULL, const char *title=NULL);
@@ -42,4 +47,7 @@
     void PrintOutliers(Float_t s) const;
 
+    void SetThreshold(Float_t f, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; }
+    void EnableVariance(Bool_t b=kTRUE);
+
     ClassDef(MHCamEvent, 1) // Histogram to sum camera events
 };
Index: trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc	(revision 5156)
@@ -71,5 +71,6 @@
 //
 MHCamEventRot::MHCamEventRot(const char *name, const char *title)
-    : fTime(0), fPointPos(0), fObservatory(0), fType(0), fNameTime("MTime")
+    : fTime(0), fPointPos(0), fObservatory(0), fType(0), fNameTime("MTime"),
+    fThreshold(0), fUseThreshold(kNoBound)
 {
     //
@@ -192,5 +193,12 @@
 
             // Fill histogram
-            fHist.Fill(cx[ix], cy[iy], val);
+            if (fUseThreshold!=kNoBound)
+            {
+                if (val>fThreshold && fUseThreshold==kIsLowerBound ||
+                    val<fThreshold && fUseThreshold==kIsUpperBound)
+                    fHist.Fill(cx[ix], cy[iy]);
+            }
+            else
+                fHist.Fill(cx[ix], cy[iy], val);
         }
     }
Index: trunk/MagicSoft/Mars/mhist/MHCamEventRot.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEventRot.h	(revision 5155)
+++ trunk/MagicSoft/Mars/mhist/MHCamEventRot.h	(revision 5156)
@@ -28,5 +28,5 @@
     TH2D    fHist;               // Alpha vs. x and y
 
-    Int_t fType;
+    Int_t fType;                 // Type to used for calling GetPixelContent
 
     Double_t fRa;
@@ -35,7 +35,12 @@
     TString fNameTime;
 
+    Float_t fThreshold;          // Count pixel above/below this threshold
+    Char_t fUseThreshold;        // Use a threshold? Which direction has it?
+
     TObject *GetCatalog();
 
 public:
+    enum { kIsLowerBound=1, kIsUpperBound=-1, kNoBound=0 };
+
     MHCamEventRot(const char *name=NULL, const char *title=NULL);
 
@@ -49,4 +54,6 @@
     void Draw(Option_t *option="");
 
+    void SetThreshold(Float_t f, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; }
+
     ClassDef(MHCamEventRot, 1) //2D-histogram in MCamEvent data (derotated)
 };
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 5155)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 5156)
@@ -1257,4 +1257,6 @@
 // 1 is added to each pixel if the contents of MCamEvent<threshold (in case isabove is set to kFALSE)
 //
+// in unused pixel is not counted if it didn't fullfill the condition.
+//
 void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type, Bool_t isabove)
 {
@@ -1267,10 +1269,12 @@
         Double_t val=threshold;
         if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/)
+        {
             SetUsed(idx);
 
-        if (val>threshold && isabove)
-            Fill(idx);
-        if (val<threshold && !isabove)
-            Fill(idx);
+            if (isabove && val>threshold)
+                Fill(idx);
+            if (!isabove && val<threshold)
+                Fill(idx);
+        }
     }
     fEntries++;
@@ -1283,4 +1287,6 @@
 // 1 is added to each pixel if the contents of MCamEvent<threshold (in case isabove is set to kFALSE)
 //
+// in unused pixel is not counted if it didn't fullfill the condition.
+//
 void MHCamera::CntCamContent(const MCamEvent &event, TArrayD threshold, Int_t type, Bool_t isabove)
 {
@@ -1293,10 +1299,12 @@
         Double_t val=threshold[idx];
         if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/)
+        {
             SetUsed(idx);
 
-        if (val>threshold[idx] && isabove)
-            Fill(idx);
-        if (val<threshold[idx] && !isabove)
-            Fill(idx);
+            if (val>threshold[idx] && isabove)
+                Fill(idx);
+            if (val<threshold[idx] && !isabove)
+                Fill(idx);
+        }
     }
     fEntries++;
@@ -1315,5 +1323,5 @@
     for (Int_t idx=0; idx<fNcells-2; idx++)
     {
-        if (const_cast<TArrayD&>(event)[idx]>threshold)
+        if (event[idx]>threshold)
             Fill(idx);
 
