Index: trunk/MagicSoft/Mars/mdata/MDataArray.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataArray.cc	(revision 5100)
+++ trunk/MagicSoft/Mars/mdata/MDataArray.cc	(revision 5692)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2005
 !
 !
@@ -86,4 +86,30 @@
 // --------------------------------------------------------------------------
 //
+// Try to find a MData which has the same rule (GetRule()).
+// Be carefull: This may already fail if the rule is A*B and you are
+// searching for B*A - FIXME: A more intelligent comaparton (based on
+// IsEqual()) should be developed.
+//
+// Returns the index in the array, -1 if rule was not found.
+//
+Int_t MDataArray::FindRule(const char *rule) const
+{
+    const MDataChain data(rule);
+    if (!data.IsValid())
+        return -1;
+
+    const TString r(data.GetRule());
+
+    TIter Next(&fList);
+    const MData *d = NULL;
+    while ((d=(MData*)Next()))
+        if (d->GetRule()==r)
+            return fList.IndexOf(d);
+
+    return -1;
+}
+
+// --------------------------------------------------------------------------
+//
 // Return the i-th entry
 //
@@ -131,9 +157,11 @@
     Int_t n=0;
 
-    TIter Next(&fList);
-    MData *data = NULL;
-    while ((data=(MData*)Next()))
-    {
-        *fLog << all << " " << fName << "[" << setw(3) << n++ << "] = " << flush;
+    const Int_t w = 1+(Int_t)TMath::Log10(fList.GetEntries());
+
+    TIter Next(&fList);
+    MData *data = NULL;
+    while ((data=(MData*)Next()))
+    {
+        *fLog << all << " " << fName << "[" << setw(w) << n++ << "] = " << flush;
         data->Print();
         *fLog << endl;
Index: trunk/MagicSoft/Mars/mdata/MDataArray.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataArray.h	(revision 5100)
+++ trunk/MagicSoft/Mars/mdata/MDataArray.h	(revision 5692)
@@ -32,4 +32,6 @@
     void AddEntry(MData *data);
 
+    Int_t FindRule(const char *rule) const;
+
     MData &operator[](Int_t i) const;
     Double_t operator()(Int_t i) const;
Index: trunk/MagicSoft/Mars/mdata/MDataChain.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 5100)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 5692)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2005
 !
 !
@@ -211,5 +211,5 @@
         return;
 
-    *fLog << inf << "Trying to resolve rule... " << flush;
+    *fLog << inf << "Parsing rule... " << flush;
     if (!(fMember=ParseString(rule, 1)))
     {
