Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1485)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1487)
@@ -92,4 +92,6 @@
 //! Also we can derive MEvtLoop from MTaskList to have a static tasklist, too
 //!
+
+TList *gListOfPrimitives; // forard declaration in MParContainer.h
 
 // --------------------------------------------------------------------------
@@ -346,4 +348,6 @@
 
     fout << "}" << endl;
+
+    *fLog << inf << "Macro '" << name << "' written." << endl;
 }
 
@@ -365,4 +369,6 @@
         out << endl;
     }
+
+    gListOfPrimitives = new TList;
 
     if (fParList)
@@ -376,4 +382,10 @@
     out << "   if (!evtloop.Eventloop())" << endl;
     out << "      return;" << endl;
+
+    gListOfPrimitives->ForEach(TObject, ResetBit)(BIT(15));
+    delete gListOfPrimitives;
+    gListOfPrimitives = 0;
+
+    // remove all objects with BIT(15) set from gObjectTable
 }
 
@@ -477,5 +489,19 @@
     HasDuplicateNames(list, "MEvtLoop::Read");
 
+    *fLog << inf << "Eventloop '" << name << "' read from file." << endl;
+
     return n;
+}
+
+// --------------------------------------------------------------------------
+//
+// If available print the contents of the parameter list.
+//
+void MEvtLoop::Print(Option_t *opt="") const
+{
+    if (fParList)
+        fParList->Print();
+    else
+        *fLog << all << "MEvtloop: No Parameter List available." << endl;
 }
 
@@ -530,4 +556,6 @@
     HasDuplicateNames(list, "MEvtLoop::Write");
 
+    *fLog << inf << "Eventloop written to file as " << name << "." << endl;
+
     return n;
 }
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 1485)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 1487)
@@ -53,9 +53,13 @@
     void SavePrimitive(ofstream &out, Option_t *o="");
 
-    Int_t Read(const char *name);
-    Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0);
+    Int_t Read(const char *name="Evtloop");
+    Int_t Write(const char *name="Evtloop", Int_t option=0, Int_t bufsize=0);
+
+    void Print(Option_t *opt="") const;
 
     ClassDef(MEvtLoop, 1) // Class to execute the tasks in a tasklist
 };
 
+R__EXTERN TList *gListOfPrimitives; // instantiation in MEvtLoop
+
 #endif
Index: trunk/MagicSoft/Mars/mbase/MFilterList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MFilterList.cc	(revision 1485)
+++ 	(revision )
@@ -1,341 +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): Thomas Bretz  07/2001 <mailto:tbretz@uni-sw.gwdg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//   MFilterList                                                           //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-
-#include "MFilterList.h"
-
-#include <fstream.h>
-
-#include <TString.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MFilterList);
-
-// --------------------------------------------------------------------------
-//
-//   Constructor.
-//
-//   Specify the boolean operation which is used to evaluate the
-//   result of this list. If no operation is specified "land" is
-//   used.
-//
-//   Options:
-//      and, &   : is a bitwise and
-//      or, |    : is a bitwise or
-//      xor, ^   : is a bitwise exclusive or
-//      land, && : is a logical and
-//      lor, ||  : is a logical or
-//
-MFilterList::MFilterList(const char *type, const char *name, const char *title)
-{
-    fName  = name  ? name  : "MFilterList";
-    fTitle = title ? title : "List combining filters logically.";
-
-    fFilterType = kEAnd;
-
-    TString str(type);
-
-    if (!str.CompareTo("OR", TString::kIgnoreCase)  || !str.CompareTo("|"))
-        fFilterType = kEOr;
-    if (!str.CompareTo("XOR", TString::kIgnoreCase) || !str.CompareTo("^"))
-        fFilterType = kEXor;
-    if (!str.CompareTo("LAND", TString::kIgnoreCase) || !str.CompareTo("&&"))
-        fFilterType = kELAnd;
-    if (!str.CompareTo("LOR", TString::kIgnoreCase) || !str.CompareTo("||"))
-        fFilterType = kELOr;
-}
-
-// --------------------------------------------------------------------------
-//
-//   CopyConstructor
-//
-MFilterList::MFilterList(MFilterList &ts)
-{
-    fFilters.AddAll(&ts.fFilters);
-    fFilterType = ts.fFilterType;
-}
-
-// --------------------------------------------------------------------------
-//
-//  Evaluates and returns the result of the filter list.
-//  The expression is evaluated step by step, eg:
-//  ((filter[0] # filter[1]) # filter[3]) # filter[4])
-//  The '#' stands for the boolean operation which is specified in
-//  the constructor.
-//
-Bool_t MFilterList::IsExpressionTrue() const
-{
-    TIter Next(&fFilters);
-
-    MFilter *filter=(MFilter*)Next();
-
-    if (!filter)
-        return kTRUE;
-
-    Bool_t rc = filter->IsExpressionTrue();
-
-    //
-    // loop over all filters
-    //
-    switch (fFilterType)
-    {
-    case kEAnd:
-        while ((filter=(MFilter*)Next()))
-            rc &= filter->IsExpressionTrue();
-        break;
-
-    case kEOr:
-        while ((filter=(MFilter*)Next()))
-            rc |= filter->IsExpressionTrue();
-        break;
-
-    case kEXor:
-        while ((filter=(MFilter*)Next()))
-            rc ^= filter->IsExpressionTrue();
-        break;
-
-    case kELAnd:
-        while ((filter=(MFilter*)Next()))
-            rc = (rc && filter->IsExpressionTrue());
-        break;
-
-    case kELOr:
-        while ((filter=(MFilter*)Next()))
-            rc = (rc || filter->IsExpressionTrue());
-        break;
-    }
-    return rc;
-}
-
-// --------------------------------------------------------------------------
-//
-// If you want to add a new filter to the list call this function with the
-// pointer to the filter to be added. 
-//
-Bool_t MFilterList::AddToList(MFilter *filter)
-{
-    if (!filter)
-        return kTRUE;
-
-    const char *name = filter->GetName();
-
-    if (fFilters.FindObject(filter))
-    {
-        *fLog << warn << dbginf << "Filter already existing... skipped." << endl;
-        return kTRUE;
-    }
-
-    if (fFilters.FindObject(name))
-    {
-        *fLog << warn << dbginf << "'" << name << "' exists in List already... skipped." << endl;
-        return kTRUE;
-    }
-
-    *fLog << inf << "Adding " << name << " to " << GetName() << "... " << flush;
-
-    fFilters.Add(filter);
-
-    *fLog << "Done." << endl;
-
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// PreProcesses all filters in the list
-//
-Bool_t MFilterList::PreProcess(MParList *pList)
-{
-    TIter Next(&fFilters);
-
-    MFilter *filter=NULL;
-
-    //
-    // loop over all filters
-    //
-    while ((filter=(MFilter*)Next()))
-        if (!filter->PreProcess(pList))
-        {
-            *fLog << err << "Error - Preprocessing Filter ";
-            *fLog << filter->GetName() << " in " << fName << endl;
-            return kFALSE;
-        }
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Processes (updates) all filters in the list.
-//
-Bool_t MFilterList::Process()
-{
-    TIter Next(&fFilters);
-
-    MFilter *filter=NULL;
-
-    //
-    // loop over all filters
-    //
-    while ((filter=(MFilter*)Next()))
-        if (!filter->Process())
-            return kFALSE;
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// PostProcesses all filters in the list.
-//
-Bool_t MFilterList::PostProcess()
-{
-    TIter Next(&fFilters);
-
-    MFilter *filter=NULL;
-
-    //
-    // loop over all filters
-    //
-    while ((filter=(MFilter*)Next()))
-        if (!filter->PostProcess())
-            return kFALSE;
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// If you want to use a verbose output ("and") instead of a symbolic ("&")
-// one the option string must conatin a "v"
-//
-void MFilterList::Print(Option_t *opt) const
-{
-    *fLog << all << GetRule(opt) << flush;
-}
-
-// --------------------------------------------------------------------------
-//
-// Implementation of SavePrimitive. Used to write the call to a constructor
-// to a macro. In the original root implementation it is used to write
-// gui elements to a macro-file.
-//
-void MFilterList::StreamPrimitive(ofstream &out) const
-{
-    out << "   MFilterList " << ToLower(fName) << "(\"";
-
-    switch (fFilterType)
-    {
-    case kEAnd:
-        out << "&";
-        break;
-
-    case kEOr:
-        out  << "|";
-        break;
-
-    case kEXor:
-        out  << "^";
-        break;
-
-    case kELAnd:
-        out << "&&";
-        break;
-
-    case kELOr:
-        out << "||";
-        break;
-    }
-
-    out << fName << "\", \"" << fName << "\", \"" << fTitle << "\");" << endl << endl;
-
-    TIter Next(&fFilters);
-
-    TObject *cont = NULL;
-    while ((cont=Next()))
-    {
-        cont->SavePrimitive(out, "");
-
-        out << "   " << ToLower(fName) << ".AddToList(&";
-        out << ToLower(cont->GetName()) << ");" << endl << endl;
-    }
-}
-
-TString MFilterList::GetRule(Option_t *opt) const
-{
-    TString str(opt);
-    const Bool_t verbose = str.Contains("V", TString::kIgnoreCase);
-
-    TString ret = "(";
-
-    TIter Next(&fFilters);
-
-    MFilter *filter=(MFilter*)Next();
-
-    //
-    // loop over all filters
-    //
-    if (!filter)
-        return "<empty>";
-
-    ret += filter->GetRule();
-
-    while ((filter=(MFilter*)Next()))
-    {
-        switch (fFilterType)
-        {
-        case kEAnd:
-            ret += (verbose?" and ":" & ");
-            break;
-
-        case kEOr:
-            ret += (verbose?" or ":" | ");
-            break;
-
-        case kEXor:
-            ret += (verbose?" xor ":" ^ ");
-            break;
-
-        case kELAnd:
-            ret += (verbose?" land ":" && ");
-            break;
-
-        case kELOr:
-            ret += (verbose?" lor ":" || ");
-            break;
-        }
-
-        ret += filter->GetRule();
-    }
-
-    return ret+")";
-}
Index: trunk/MagicSoft/Mars/mbase/MFilterList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MFilterList.h	(revision 1485)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#ifndef MARS_MFilterList
-#define MARS_MFilterList
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//  MFilterList                                                            //
-//                                                                         //
-//  List of several filters                                                //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef ROOT_TOrdCollection
-#include <TOrdCollection.h>
-#endif
-#ifndef MARS_MFilter
-#include "MFilter.h"
-#endif
-
-class MParList;
-
-class MFilterList : public MFilter
-{
-private:
-    TOrdCollection fFilters;	// Container for the filters
-
-    typedef enum { kEAnd, kEOr, kEXor, kELAnd, kELOr } FilterType_t;
-    FilterType_t fFilterType;
-
-    enum { kIsOwner = BIT(14) };
-
-    void StreamPrimitive(ofstream &out) const;
-
-public:
-    MFilterList(const char *type="&&", const char *name=NULL, const char *title=NULL);
-    MFilterList(MFilterList &ts);
-    ~MFilterList()
-    {
-        if (TestBit(kIsOwner))
-            fFilters.SetOwner();
-    }
-
-    Bool_t AddToList(MFilter *filter);
-    void SetOwner(Bool_t enable=kTRUE) { enable ? SetBit(kIsOwner) : ResetBit(kIsOwner); }
-
-    Bool_t IsExpressionTrue() const;
-
-    Bool_t PreProcess(MParList *pList);
-    Bool_t Process();
-    Bool_t PostProcess();
-
-    void Print(Option_t *opt = "") const;
-    TString GetRule(Option_t *opt="") const;
-
-    ClassDef(MFilterList, 1)		// List to combine several filters logically
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1485)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1487)
@@ -51,4 +51,6 @@
 #include "MLogManip.h"
 
+#include "MEvtLoop.h"    // gListOfPrimitives
+
 ClassImp(MParContainer);
 
@@ -383,7 +385,11 @@
         return;
 
-    SetUniqueID(uid++/*gRandom->Uniform(kMaxInt)*/);
+    SetUniqueID(uid++);
+    SetBit(kIsSavedAsPrimitive);
+
+    if (gListOfPrimitives && !gListOfPrimitives->FindObject(this))
+        gListOfPrimitives->Add(this);
+
     StreamPrimitive(out);
-    SetBit(kIsSavedAsPrimitive);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1485)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1487)
@@ -672,5 +672,5 @@
 {
     out << "   MParList " << GetUniqueName();
-    if (fName!=gsDefName)
+    if (fName!=gsDefName || fTitle!=gsDefTitle)
     {
         out << "(\"" << fName << "\"";
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1485)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1487)
@@ -525,5 +525,5 @@
 {
     out << "   MTaskList " << GetUniqueName();
-    if (fName!=gsDefName)
+    if (fName!=gsDefName || fTitle!=gsDefTitle)
     {
         out << "(\"" << fName << "\"";
