Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1592)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1593)
@@ -1,7 +1,31 @@
                                                                   -*-*- END -*-*-
-
- 2002/11/7: Oscar Blanch
+ 2002/11/08: Thomas Bretz
+
+   * mhist/MHMatrix.cc:
+     - implemented a zero suppression
+
+
+
+ 2002/11/07: Thomas Bretz
+
+   * mfilter/Makefile, mfilter/FilterLinkDef.h:
+     - added MFEventSelector
+
+   * mfilter/MFEventSelector.[h,cc]:
+     - added
+
+   * mfilter/MF.[h,cc]:
+     - made gsDef[Name,Title] a static const member
+
+   * manalysis/MMultiDimDistCalc.cc:
+     - changed the default function to kernel
+
+
+
+ 2002/11/07: Oscar Blanch
    * mmc/MMcEvt.[hxx,cxx]
-     - Some new varaible from the reflector header event.
+     - Some new variable from the reflector header event.
+
+
 
  2002/11/07: Wolfgang Wittek
@@ -10,4 +34,5 @@
      - changed to avoid warnings : "member initializers will be re-ordered
                                     to match declaration order"
+
 
 
Index: trunk/MagicSoft/Mars/mhist/MHMatrix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1592)
+++ trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1593)
@@ -427,5 +427,20 @@
     TMath::Sort(dists.GetSize(), dists.GetArray(), idx.GetArray(), kFALSE);
 
-    const Int_t n = TMath::Abs(num)<rows ? TMath::Abs(num) : rows;
+    Int_t from = 0;
+    Int_t to   = TMath::Abs(num)<rows ? TMath::Abs(num) : rows;
+    //
+    // This is a zero-suppression for the case a test- and trainings
+    // sample is identical. This would result in an unwanted leading
+    // zero in the array. To suppress also numerical uncertanties of
+    // zero we cut at 1e-5. Due to Rudy this should be enough. If
+    // you encounter problems we can also use (eg) 1e-25
+    //
+    if (dists[idx[0]]<1e-5)
+    {
+        from++;
+        to ++;
+        if (to>rows)
+            to = rows;
+    }
 
     if (num<0)
@@ -438,8 +453,8 @@
 
         Double_t res = 0;
-        for (int i=0; i<n; i++)
+        for (int i=from; i<to; i++)
             res += TMath::Exp(-dists[idx[i]]/hwin);
 
-        return -TMath::Log(res/n);
+        return -TMath::Log(res/(to-from));
     }
     else
@@ -449,8 +464,8 @@
         //
         Double_t res = 0;
-        for (int i=0; i<n; i++)
+        for (int i=from; i<to; i++)
             res += dists[idx[i]];
 
-        return TMath::Sqrt(res/n);
+        return TMath::Sqrt(res/(to-from));
     }
 }
