Index: trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8475)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8477)
@@ -57,4 +57,5 @@
 /////////////////////////////////////////////////////////////////////////////
 #include <iostream>
+#include <iomanip>
 
 #include <TEnv.h>
@@ -73,4 +74,14 @@
 
 using namespace std;
+
+Int_t CalcUnsuitable(const MHCamera &cam, Float_t f)
+{
+    Int_t n = 0;
+    for (int i=0; i<cam.GetNbinsX(); i++)
+        if (cam.GetBinContent(i+1)>f)
+            n++;
+
+    return n;
+}
 
 int Process(MSQLServer &serv, TString fname, Bool_t dummy)
@@ -238,4 +249,14 @@
     meanpul = TMath::Nint(meanpul*100)/100.;
     rmspul  = TMath::Nint(rmspul *100)/100.;
+
+    cam = (MHCamera*)arr.FindObjectInCanvas("Unsuitable;avg", "MHCamera", "Unsuitable");
+    if (!cam)
+    {
+        cout << "WARNING - Reading of Unsuitable;avg failed." << endl;
+        return 2;
+    }
+
+    Int_t unsuitable50 = CalcUnsuitable(*cam, 0.50);
+    Int_t unsuitable01 = CalcUnsuitable(*cam, 0.01);
 
 /*
@@ -293,4 +314,6 @@
     cout << "  Lo-Hi gain offset:      " << medpuloff    << " +-  " << devpuloff    << endl;
     cout << "  Hi/Lo gain ratio:        " << medhilocal   << " +- " << devhilocal   << endl;
+    cout << "  Unsuitable > 50%:       " << setw(6) << unsuitable50 << endl;
+    cout << "  Unsuitable >  1%:       " << setw(6) << unsuitable01 << endl;
     cout << endl;
 
@@ -307,5 +330,6 @@
                          //" fPulsePosLoMean=%s,    fPulsePosLoRms=%s,    "
                          " fPulsePosOffMed=%s,    fPulsePosOffDev=%s,   "
-                         " fHiLoGainRatioMed=%s,  fHiLoGainRatioDev=%s  "
+                         " fHiLoGainRatioMed=%s,  fHiLoGainRatioDev=%s,  "
+                         " fUnsuitable50=%d,  fUnsuitable01=%d  "
                          " WHERE fSequenceFirst='%d' ",
                          meanrmsinner.Data(),  meanrmsouter.Data(),
@@ -317,4 +341,5 @@
                          medpuloff.Data(),    devpuloff.Data(),
                          medhilocal.Data(),   devhilocal.Data(),
+                         unsuitable50, unsuitable01,
                          seq);
 
