Index: trunk/MagicSoft/Mars/mbase/MEnv.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 9343)
+++ trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 9345)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  2/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2007
+!   Copyright: MAGIC Software Development, 2000-2009
 !
 !
@@ -44,4 +44,8 @@
 // the including file.
 //
+// Class Version 1:
+// ----------------
+//  + TString fName
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MEnv.h"
@@ -71,5 +75,10 @@
 // is called which can then be checked by IsValid()
 //
-MEnv::MEnv(const char *name) : TEnv(name)
+// The second argument is the default name. Usually as name of the MEnv
+// the base name of the file is returned. By giving a default name
+// you can overwrite this behavious. This is useful for I/O
+// because it allows to use Read and Write without argument.
+//
+MEnv::MEnv(const char *name, const char *defname) : TEnv(name), fName(defname)
 {
     fChecked.SetOwner();
@@ -174,5 +183,5 @@
     inc = inc.Strip(TString::kBoth);
 
-    // Set final resource, now as kEnvLocal (previously set as kEnvChnaged)
+    // Set final resource, now as kEnvLocal (previously set as kEnvChanged)
     SetValue("Include", inc, kEnvLocal);
 
@@ -198,4 +207,17 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Read an object from the current directory. If no name is given
+// the name of this object is used. 
+//
+Int_t MEnv::Read(const char *name)
+{
+    const Int_t rc = TEnv::Read(name?name:(const char*)fName);
+    //if (name)
+    //    SetName(name);
+    return rc;
+}
+
 //---------------------------------------------------------------------------
 //
@@ -204,4 +226,7 @@
 const char *MEnv::GetName() const
 {
+    if (!fName.IsNull())
+        return fName;
+
     const char *pos = strrchr(GetRcName(), '/');
     return pos>0 ? pos+1 : GetRcName();
@@ -1061,6 +1086,12 @@
 void MEnv::PrintEnv(EEnvLevel level) const
 {
-    cout << "# Path: " << GetRcName() << endl;
-    cout << "# Name: " << GetName() << endl;
+    if (!TString(GetRcName()).IsNull())
+    {
+        cout << "# Path: " << GetRcName() << endl;
+        cout << "# File: " << gSystem->BaseName(GetRcName()) << endl;
+    }
+    if (!fName.IsNull())
+        cout << "# Name: " << fName << endl;
+
     TEnv::PrintEnv(level);
 }
Index: trunk/MagicSoft/Mars/mbase/MEnv.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 9343)
+++ trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 9345)
@@ -21,5 +21,7 @@
 {
 private:
-    TOrdCollection fChecked;
+    TOrdCollection fChecked; //!
+
+    TString fName;
 
     TString Compile(TString str, const char *post) const;
@@ -27,5 +29,5 @@
 
 public:
-    MEnv(const char *name="");
+    MEnv(const char *name="", const char *defname=0);
 
     Bool_t      IsValid() const { return !TString(GetRcName()).IsNull(); }
@@ -44,4 +46,5 @@
 
     const char *GetName() const;
+    void        SetName(const char *name=0) { fName = name; }
 
     Int_t       GetColor(const char *name, Int_t dftl);
@@ -73,4 +76,5 @@
     Bool_t      TakeEnv(MArgs &args, Bool_t print=kFALSE, Bool_t overwrite=kTRUE);
 
+    Int_t       Read(const char *name=0);
     Int_t       ReadFile(const char *fname, EEnvLevel level);
 
@@ -85,5 +89,5 @@
     Int_t GetNumUntouched() const;
 
-    ClassDef(MEnv, 0) // A slightly more advanced version of TEnv
+    ClassDef(MEnv, 1) // A slightly more advanced version of TEnv
 };
     
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 9343)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 9345)
@@ -245,5 +245,6 @@
 // --------------------------------------------------------------------------
 //
-//  Add all entries of the TObjArray to the list.
+// Add all entries which derive from MParContainer
+// of the TObjArray to the list.
 //
 void MParList::AddToList(TObjArray *list)
@@ -255,9 +256,12 @@
         return;
 
-    MIter Next(list);
-
-    MParContainer *cont = NULL;
+    TIter Next(list);
+
+    TObject *cont = NULL;
     while ((cont=Next()))
     {
+        if (!dynamic_cast<MParContainer*>(cont))
+            continue;
+
         cont->SetBit(kMustCleanup);
         AddToList(cont);
