Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 849)
+++ trunk/MagicSoft/Mars/Changelog	(revision 850)
@@ -8,4 +8,13 @@
    * mbase/MParContainer.[h,cc]:
      - added a 'dummy' function for AsciiRead, AsciiWrite
+
+   * mbase/MWriteAsciiFile.[h,cc]:
+     - added new constructor (specify directly the pointer to the class)
+
+   * mgui/MHexagon.cc:
+     - made Copy-function more readable
+
+   * mgui/MParContainer.cc:
+     - made Copy-function more readable
 
 
Index: trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 849)
+++ trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 850)
@@ -50,5 +50,4 @@
 // --------------------------------------------------------------------------
 //
-// Default constructor.
 // Specify the name of the ascii output file 'filename' and the name
 // of the container you want to write. (Normally this is the name
@@ -57,5 +56,6 @@
 //
 MWriteAsciiFile::MWriteAsciiFile(const char *filename, const char *contname,
-                                 const char *name, const char *title) : fOut(NULL)
+                                 const char *name, const char *title)
+    : fOut(NULL), fContainer(NULL)
 {
     *fName  = name  ? name  : "MWriteAsciiFile";
@@ -64,4 +64,20 @@
     fNameFile      = filename;
     fNameContainer = contname;
+}
+
+// --------------------------------------------------------------------------
+//
+// Specify a the name of the ascii output file 'filename' and a pointer to
+// the container you want to write. 
+//
+MWriteAsciiFile::MWriteAsciiFile(const char *filename, MParContainer *cont,
+                                 const char *name, const char *title)
+    : fOut(NULL), fContainer(cont)
+{
+    *fName  = name  ? name  : "MWriteAsciiFile";
+    *fTitle = title ? title : "Task to write one container to an ascii file";
+
+    fNameFile      = filename;
+    fNameContainer = cont->GetName();
 }
 
@@ -86,4 +102,20 @@
 Bool_t MWriteAsciiFile::PreProcess (MParList *pList)
 {
+    //
+    // Try to find the container which should be stored.
+    //
+    if (!fContainer)
+    {
+        fContainer = (MParContainer*)pList->FindObject(fNameContainer);
+        if (!fContainer)
+        {
+            *fLog << dbginf << "Cannot find parameter container '" << fContainer << "'." << endl;
+            return kFALSE;
+        }
+    }
+
+    //
+    // Try to open the output file
+    //
     fOut = new ofstream(fNameFile);
 
@@ -96,11 +128,7 @@
     *fLog << "Ascii file '" << fNameFile << "' opened for writing." << endl;
 
-    fContainer = (MParContainer*)pList->FindObject(fNameContainer);
-    if (!fContainer)
-    {
-        *fLog << dbginf << "Cannot find parameter container '" << fContainer << "'." << endl;
-        return kFALSE;
-    }
-
+    //
+    // write the container if it is already in changed state
+    //
     if (fContainer->HasChanged())
         fContainer->AsciiWrite(*fOut);
@@ -133,7 +161,13 @@
 Bool_t MWriteAsciiFile::PostProcess()
 {
+    //
+    // check if the container changed state is set
+    //
     if (fContainer->HasChanged())
         fContainer->AsciiWrite(*fOut);
 
+    //
+    // delete (close) file
+    //
     delete fOut;
     fOut = NULL;
Index: trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h	(revision 849)
+++ trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h	(revision 850)
@@ -10,11 +10,15 @@
 private:
     ofstream *fOut;
-    TString  fNameFile;
-    TString  fNameContainer;
+
+    TString fNameFile;
+    TString fNameContainer;
 
     MParContainer *fContainer;
 
 public:
-    MWriteAsciiFile(const char *filename, const char *contname, const char *name=NULL, const char *title=NULL);
+    MWriteAsciiFile(const char *filename, const char *contname,
+                    const char *name=NULL, const char *title=NULL);
+    MWriteAsciiFile(const char *filename, MParContainer *cont,
+                    const char *name=NULL, const char *title=NULL);
     ~MWriteAsciiFile();
 
