Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 9344)
+++ trunk/MagicSoft/Mars/Changelog	(revision 9345)
@@ -18,4 +18,32 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2009/02/16 Thomas Bretz
+
+   * mimage/MHHillas.cc, mimage/MHHillasExt.cc, mimage/MHHillasSrc.cc,
+     mimage/MHImagePar.cc:
+     - replaced green by blue for better readability on projectors
+
+   * mbase/MEnv.[h,cc]:
+     - added the option of a default name to allow i/o more similar
+       to MParContainer
+     - improved Print()
+
+   * ceres.cc, callisto.cc, star.cc, ganymed.cc, sponde.cc:
+     - make use of the new default name of MEnv
+
+   * mjobs/MJSpectrum.cc:
+     - read and write ganymed.rc
+
+   * mbase/MParList.cc:
+     - if adding a TObjArray add only MParContainers (for sanity)
+
+   * mjobs/MJob.cc:
+     - when reading read also TObjects
+
+   * mjobs/MJSpectrum.cc:
+     - now read the ganymed.rc and write it to the output
+
+
+
  2009/02/15 Thomas Bretz
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 9344)
+++ trunk/MagicSoft/Mars/NEWS	(revision 9345)
@@ -84,4 +84,7 @@
      eff. on-time from the fit in the new tab, e.g. when a zenith distance
      cut was made in ganymed. This can now be forced by ''--force-ontimefit''
+
+   * now reads the ''ganymed.rc'' from the ''ganymed.root'' and writes
+     it to its own output file (for convinience)
 
 
Index: trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- trunk/MagicSoft/Mars/callisto.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/callisto.cc	(revision 9345)
@@ -216,5 +216,5 @@
     // --rc= from the list of arguments.
     //
-    MEnv env(kConfig);
+    MEnv env(kConfig, "callisto.rc");
     if (!env.IsValid())
     {
Index: trunk/MagicSoft/Mars/ceres.cc
===================================================================
--- trunk/MagicSoft/Mars/ceres.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/ceres.cc	(revision 9345)
@@ -137,5 +137,5 @@
     // --rc= from the list of arguments.
     //
-    MEnv env(kConfig);
+    MEnv env(kConfig, "ceres.rc");
     if (!env.IsValid())
     {
Index: trunk/MagicSoft/Mars/ganymed.cc
===================================================================
--- trunk/MagicSoft/Mars/ganymed.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/ganymed.cc	(revision 9345)
@@ -185,5 +185,5 @@
     // --rc= from the list of arguments.
     //
-    MEnv env(kConfig);
+    MEnv env(kConfig, "ganymed.rc");
     if (!env.IsValid())
     {
Index: trunk/MagicSoft/Mars/mbase/MEnv.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 9344)
+++ 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 9344)
+++ 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 9344)
+++ 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);
Index: trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc	(revision 9345)
@@ -58,4 +58,5 @@
 #include "MH3.h"
 #include "MHn.h"
+#include "MEnv.h"
 #include "MBinning.h"
 #include "MParameters.h"
@@ -1539,4 +1540,6 @@
     MBinning binsa("BinningAsym");
     MBinning binsb("BinningConc1");
+
+    MEnv env("", "ganymed.rc");
 
     MAlphaFitter fit;
@@ -1963,6 +1966,7 @@
         // Write the output
         TObjArray cont;
-        cont.Add((TObject*)GetEnv()); // const_cast
-        cont.Add((TObject*)&set);     // const_cast
+        cont.Add(&env);                           // ganymed.rc
+        cont.Add(const_cast<TEnv*>(GetEnv()));    // sponde.rc
+        cont.Add(const_cast<MDataSet*>(&set));    // Dataset
         cont.Add(plist.FindObject("MAlphaFitter"));
         cont.Add(&area0);
Index: trunk/MagicSoft/Mars/mjobs/MJob.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 9345)
@@ -460,12 +460,12 @@
     }
 
-    MIter Next(&list);
-    MParContainer *o=0;
+    TIter Next(&list);
+    TObject *o=0;
     while ((o=Next()))
     {
-        *fLog << inf << " - Reading " << o->GetDescriptor() << "..." << flush;
+        *fLog << inf << " - Reading " << MParContainer::GetDescriptor(*o) << "..." << flush;
         if (o->Read(o->GetName())<=0)
         {
-            *fLog << err << dbginf << "ERROR - Reading " << o->GetDescriptor() << " from file " << gFile->GetName() << endl;
+            *fLog << err << dbginf << "ERROR - Reading " << MParContainer::GetDescriptor(*o) << " from file " << gFile->GetName() << endl;
             return kFALSE;
         }
Index: trunk/MagicSoft/Mars/sponde.cc
===================================================================
--- trunk/MagicSoft/Mars/sponde.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/sponde.cc	(revision 9345)
@@ -151,5 +151,5 @@
     // --rc= from the list of arguments.
     //
-    MEnv env(kConfig);
+    MEnv env(kConfig, "sponde.rc");
     if (!env.IsValid())
     {
Index: trunk/MagicSoft/Mars/star.cc
===================================================================
--- trunk/MagicSoft/Mars/star.cc	(revision 9344)
+++ trunk/MagicSoft/Mars/star.cc	(revision 9345)
@@ -149,5 +149,5 @@
     // --rc= from the list of arguments.
     //
-    MEnv env(kConfig);
+    MEnv env(kConfig, "star.rc");
     if (!env.IsValid())
     {
