Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1882)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1883)
@@ -2,4 +2,10 @@
 
  2003/03/31: Thomas Bretz
+
+   * mhist/MHArray.[h,cc]:
+     - added default constructor
+     - added Set-function
+     - added Init function
+     - moved code from constructors to Set and Init
  
    * Makefile.conf.linux:
Index: /trunk/MagicSoft/Mars/mhist/MHArray.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHArray.cc	(revision 1882)
+++ /trunk/MagicSoft/Mars/mhist/MHArray.cc	(revision 1883)
@@ -182,4 +182,72 @@
 };
 
+void MHArray::Init(const char *name)
+{
+    fName  = name  ? name  : "MHArray";
+
+    fMapIdx = new MMap;
+
+    fArray = new TList;
+    fArray->SetOwner();
+}
+
+// --------------------------------------------------------------------------
+//
+// Can replace a constructor. Use the default constructor and afterwards
+// the Set function of your need.
+//
+void MHArray::Set(const TString hname, Bool_t istempl)
+{
+    if (fTemplate || fClass || fTemplateName!="<dummy>")
+    {
+        *fLog << warn << "WARNING - MHArray already setup... Set ignored." << endl;
+        return;
+    }
+
+    if (istempl)
+    {
+        fTemplateName = hname;
+        return;
+    }
+
+    //
+    // try to get class from root environment
+    //
+    fClass = gROOT->GetClass(hname);
+    if (!fClass)
+    {
+        //
+        // if class is not existing in the root environment
+        //
+        *fLog << err << dbginf << "Class '" << hname << "' not existing in dictionary." << endl;
+    }
+
+    //
+    // check for ineritance from MH
+    //
+    if (!fClass->InheritsFrom(MH::Class()))
+    {
+        //
+        // if class doesn't inherit from MH --> error
+        //
+        *fLog << err << dbginf << "Class '" << hname << "' doesn't inherit from MH." << endl;
+        fClass = NULL;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Can replace a constructor. Use the default constructor and afterwards
+// the Set function of your need.
+//
+void MHArray::Set(const MH *hist)
+{
+    fIdx=0;
+    fClass=NULL;
+    fTemplate=hist;
+    fTemplateName="<dummy>";
+}
+
+
 // --------------------------------------------------------------------------
 //
@@ -200,47 +268,27 @@
     //   set the name and title of this object
     //
-    fName  = name  ? name  : "MHArray";
+    Init(name);
     fTitle = title ? TString(title) : (TString("Base class for Mars histogram arrays:") + hname);
 
-    fMapIdx = new MMap;
-
-    fArray = new TList;
-    fArray->SetOwner();
-
-    if (istempl)
-    {
-        fTemplateName = hname;
-        return;
-    }
-
-    //
-    // try to get class from root environment
-    //
-    fClass = gROOT->GetClass(hname);
-    if (!fClass)
-    {
-        //
-        // if class is not existing in the root environment
-        //
-        *fLog << err << dbginf << "Class '" << hname << "' not existing in dictionary." << endl;
-    }
-
-    //
-    // check for ineritance from MH
-    //
-    if (!fClass->InheritsFrom(MH::Class()))
-    {
-        //
-        // if class doesn't inherit from MH --> error
-        //
-        *fLog << err << dbginf << "Class '" << hname << "' doesn't inherit from MH." << endl;
-        fClass = NULL;
-    }
-}
-
-// --------------------------------------------------------------------------
-//
-// Default Constructor. hname is the name of the histogram class which
-// is in the array.
+    Set(hname, istempl);
+}
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. Use MHArray::Set to setup the MHArray afterwards
+//
+MHArray::MHArray(const char *name=NULL, const char *title=NULL)
+    : fIdx(0), fClass(NULL), fTemplate(NULL), fTemplateName("<dummy>")
+{
+    //
+    //   set the name and title of this object
+    //
+    Init(name);
+    fTitle = title ? title : "A Mars histogram array";
+}
+
+// --------------------------------------------------------------------------
+//
+// hname is the name of the histogram class which is in the array.
 //
 // istempl=kTRUE tells MHArray to use the first histogram retrieved from the
@@ -258,11 +306,6 @@
     //   set the name and title of this object
     //
-    fName  = name  ? name  : "MHArray";
+    Init(name);
     fTitle = title ? TString(title) : (TString("Base class for Mars histogram arrays:") + hist->GetName());
-
-    fMapIdx = new MMap;
-
-    fArray = new TList;
-    fArray->SetOwner();
 }
 
Index: /trunk/MagicSoft/Mars/mhist/MHArray.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHArray.h	(revision 1882)
+++ /trunk/MagicSoft/Mars/mhist/MHArray.h	(revision 1883)
@@ -30,8 +30,14 @@
     enum { kUseTemplate=BIT(14) };
 
+    void Init(const char *name);
+
 public:
+    MHArray(const char *name=NULL, const char *title=NULL);
     MHArray(const TString hname, Bool_t istempl=kFALSE, const char *name=NULL, const char *title=NULL);
     MHArray(const MH *hist, const char *name=NULL, const char *title=NULL);
     ~MHArray();
+
+    void Set(const TString hname, Bool_t istempl=kFALSE);
+    void Set(const MH *hist);
 
     virtual Bool_t SetupFill(const MParList *pList);
