Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1186)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1187)
@@ -10,4 +10,10 @@
    * manalysis/MMcPedestalNSBAdd.cc:
      - small changes to output
+ 
+   * mbase/MParList.[h,cc]:
+     - added FindObject with class type argument
+   
+   * mbase/MWriteAsciiFile.cc
+     - replaced call to InheritsFrom by new FindObject
  
  
Index: /trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1186)
+++ /trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1187)
@@ -234,4 +234,44 @@
 // --------------------------------------------------------------------------
 //
+//  Find an object in the list and check for the correct inheritance.
+//  'name' is the name of the object you are searching for.
+//
+TObject *MParList::FindObject(const char *name, const char *classname) const
+{
+    TObject *obj = fContainer->FindObject(name);
+
+    if (!obj)
+        return NULL;
+
+    if (obj->InheritsFrom(classname))
+        return obj;
+
+    *fLog << dbginf << warn << "Found object '" << name << "' doesn't ";
+    *fLog << "inherit from " << "'" << classname << "'" << endl;
+    return NULL;
+}
+
+// --------------------------------------------------------------------------
+//
+//  check if the object is in the list or not and check for the correct
+//  inheritance
+//
+TObject *MParList::FindObject(const TObject *obj, const char *classname) const
+{
+    TObject *nobj = fContainer->FindObject(obj);
+
+    if (!nobj)
+        return NULL;
+
+    if (nobj->InheritsFrom(classname))
+        return nobj;
+
+    *fLog << dbginf << warn << "Found object '" << nobj->GetName() << "' ";
+    *fLog << "doesn't inherit from " << "'" << classname << "'" << endl;
+    return NULL;
+}
+
+// --------------------------------------------------------------------------
+//
 //  returns the ClassName without anything which is behind that last ';' in
 //  string.
Index: /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 1186)
+++ /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 1187)
@@ -176,5 +176,5 @@
         const char *name = obj->GetName();
 
-        MParContainer *cont = (MParContainer*)pList->FindObject(name);
+        MParContainer *cont = (MParContainer*)pList->FindObject(name, "MParContainer");
         if (!cont)
         {
@@ -183,11 +183,4 @@
         }
 
-        if (!cont->InheritsFrom(MParContainer::Class()))
-        {
-            *fLog << err << dbginf << "'" << name << "' doesn't inherit from MParContainer." << endl;
-            return kFALSE;
-
-        }
-
         AddContainer(cont);
     }
