Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 890)
+++ trunk/MagicSoft/Mars/Changelog	(revision 891)
@@ -7,4 +7,12 @@
    * mhist/MFillH.cc:
      - added comments
+
+   * mbase/MParList.[h,cc]:
+     - Added AddToList from a TObjArray
+     - Added GetClassName
+     - Added GetObjName
+     - Added FindObjectList
+     - Added FindCreateObjList
+     - Added CreateObjList
 
 
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 890)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 891)
@@ -69,5 +69,8 @@
 // --------------------------------------------------------------------------
 //
-// copy constructor
+//  Copy constructor. It copies all entries of the parameter list, but it
+//  takes care of, that the automatically created entries are only deleted
+//  once. (doesn't copy the list which holds the automatically created
+//  entries)
 //
 MParList::MParList(MParList &ts)
@@ -78,5 +81,6 @@
 // --------------------------------------------------------------------------
 //
-//  create the Iterator over the tasklist
+//  Set the logging streamer of the parameter list and all contained
+//  parameter containers
 //
 void MParList::SetLogStream(MLog *log)
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 890)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 891)
@@ -29,4 +29,7 @@
     TOrdCollection fAutodelete; // All what this list contains is deleted in the destructor
 
+    static TString GetClassName(const char *classname);
+    static TString GetObjectName(const char *classname, const char *objname);
+
 public:
     MParList(const char *name=NULL, const char *title=NULL);
@@ -38,4 +41,5 @@
 
     Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
+    void   AddToList(TObjArray *list);
 
     void SetLogStream(MLog *log);
@@ -44,4 +48,9 @@
     TObject       *FindObject(TObject *obj) const;
     MParContainer *FindCreateObj(const char *classname, const char *objname=NULL);
+
+    TObjArray FindObjectList(const char *name, const UInt_t from, const UInt_t to=0) const;
+    TObjArray FindCreateObjList(const char *cname, const UInt_t from, const UInt_t to=0, const char *oname=NULL);
+
+    static TObjArray CreateObjList(const char *cname, const UInt_t from, const UInt_t to=0, const char *oname=NULL);
 
     void Reset();
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergies.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergies.cc	(revision 890)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier Lopez 05/2001 (jlopez@ifae.es)
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-//  MHMcEnergies
-//
-// This class holds and array of MHMcEnergy objects in order to be able
-// to compute the threshold for each of the different trigger conditions
-// in a root file.
-//
-////////////////////////////////////////////////////////////////////////////
-#include "MHMcEnergies.h" 
-
-#include "MParList.h"
-#include "MHMcEnergy.h"
-
-ClassImp(MHMcEnergies);
-
-// --------------------------------------------------------------------------
-//
-// Default Constructor.
-//
-MHMcEnergies::MHMcEnergies(const UInt_t count, const char *name, const char *title)
-    : fNum(count)
-{ 
-    char aux[25]="MHMcEnergies";
-    sprintf(aux+12, "[%i]", fNum);
-
-    *fName  = name  ? name  : aux;
-    *fTitle = title ? title : "Container for a MC enegry histogram" ;
-
-    fHists = new TClonesArray("MHMcEnergy", fNum);
-
-    for (UInt_t i=0; i<fNum; i++)
-        new ((*fHists)[i]) MHMcEnergy(i);
-}
-
-// --------------------------------------------------------------------------
-//
-// Default Destructor.
-//
-MHMcEnergies::~MHMcEnergies()
-{
-    delete fHists;
-}
-
-// --------------------------------------------------------------------------
-//
-// Add to the parameter list all the MHMcEnergy objects contained in the array.
-//
-void MHMcEnergies::AddEntriesToList(MParList *plist)
-{
-    for (UInt_t i=0; i<fNum; i++)
-        plist->AddToList((MParContainer*)(*fHists)[i]);
-}
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergies.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergies.h	(revision 890)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#ifndef MHMCENERGIES_H
-#define MHMCENERGIES_H
-
-#ifndef MAGIC_H
-#include "MAGIC.h"
-#endif
-#ifndef ROOT_TClonesArray
-#include <TClonesArray.h>
-#endif
-#ifndef MPARCONTAINER_H
-#include "MParContainer.h"
-#endif
-#ifndef MHMCENERGY_H
-#include "MHMcEnergy.h"
-#endif
-
-class MParList;
-
-class MHMcEnergies : public MParContainer
-{
-private:
-    UInt_t        fNum;   // Num of histograms
-    TClonesArray *fHists; // Array with the energy histograms
-
-public:
-
-    MHMcEnergies(const UInt_t count=0, const char *name=NULL, const char *title=NULL);
-    ~MHMcEnergies();
-
-    void AddEntriesToList(MParList *plist);
-
-    MHMcEnergy &operator[](UInt_t idx) { return *(MHMcEnergy*)(*fHists)[idx]; }
-
-    ClassDef(MHMcEnergies, 1)  // container to hold several MHMcEnergy histograms
-};
-
-#endif
-
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc	(revision 890)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc	(revision 891)
@@ -33,4 +33,5 @@
 #include "MHMcEnergy.h" 
 
+#include <stdlib.h>
 #include <iostream.h>
 
@@ -46,13 +47,7 @@
 //  Default Constructor.
 //
-MHMcEnergy::MHMcEnergy(const UInt_t idx, const char *name, const char *title)
+MHMcEnergy::MHMcEnergy(const char *name, const char *title)
 { 
-    char aux[15]="MHMcEnergy";
-
-    if (idx>0)
-        sprintf(aux+strlen(aux), ";%i", idx);
-
-    *fName  = name  ? name  : aux;
-    *fTitle = title ? title : "Container for an energy distribution histogram" ;
+    *fTitle = title ? title : "Container for an energy distribution histogram";
 
     //  - we initialize the histogram
@@ -60,13 +55,42 @@
     //    root don't allow us to have diferent histograms with the same name
 
+    fHist = new TH1F("", "", 40, 0.5, 4.5);
+    fHist->SetXTitle("log(E/GeV)");
+    fHist->SetYTitle("dN/dE");
+
+    SetName(name ? name : "MHMcEnergy");
+}
+
+// -------------------------------------------------------------------------
+//
+//  This doesn't only set the name. It tries to get the number from the
+//  name and creates also name and title of the histogram.
+//
+//  This is necessary for example if a list of such MHMcEnergy histograms
+//  is created (s. MParList::CreateObjList)
+//
+void MHMcEnergy::SetName(const char *name)
+{
+    TString cname(name);
+    const char *semicolon = strrchr(cname, ';');
+
+    UInt_t idx = semicolon ? atoi(semicolon+1) : 0;
+
+    *fName = cname;
+
     char text[256];
-    sprintf(text, "Energy Distribution for trigger condition #%i", idx);
-
+    if (idx>0)
+        sprintf(text, "Energy Distribution for trigger condition #%i", idx);
+    else
+        sprintf(text, "Energy Distribution");
+
+    char aux[256];
     strcpy(aux, "log(E)");
+
     if (idx>0)
         sprintf(aux+strlen(aux), " #%i", idx);
-    fHist = new TH1F(aux, text, 40, 0.5, 4.5);
-    fHist->SetXTitle("log(E/GeV)");
-    fHist->SetYTitle("dN/dE");
+
+    fHist->SetName(aux);
+    fHist->SetTitle(text);
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergy.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergy.h	(revision 890)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergy.h	(revision 891)
@@ -31,6 +31,8 @@
 public:
 
-    MHMcEnergy(const UInt_t idx=0, const char *name=NULL, const char *title=NULL);
+    MHMcEnergy(const char *name=NULL, const char *title=NULL);
     ~MHMcEnergy();
+
+    void SetName(const char *name);
 
     Float_t GetThreshold() const { return fThreshold; }
