Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1486)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1487)
@@ -1,3 +1,38 @@
                                                                   -*-*- END -*-*-
+
+ 2002/08/07: Thomas Bretz
+
+   * macros/dohtml.C:
+     - added missing paths
+
+   * manalysis/MBlindPixelCalc.[h,cc]:
+     - replaced booleans by fFlags
+     - added StreamPrimitive
+     - changed version number to 1
+
+   * manalysis/MHillasSrcCalc.[h,cc]:
+     - added correct initializations for the pointers
+     - made the pointers persistent
+
+   * manalysis/MImgCleanStd.cc, manalysis/MSrcPosCam.cc,
+     mfileio/MWriteRootFile.cc:
+     - don't stream name and title if not necessary
+
+   * mbase/MEvtLoop.[h,cc]:
+     - added some output
+     - added print function
+     - added gListOfPrimitives to delete BIT(15) of streamed containers
+     - Added default argument for Read and Write
+
+   * mbase/MParContainer.cc:
+     - added usage of gListOfPrimitives
+
+   * mbase/MParList.cc, mbase/MTaskList.cc, mhist/MBinning.cc:
+     - fixed a bug when only the title is different from the default
+
+   * mhist/MHHillas.cc:
+     - fixed the wrong usage of ApplyBinning for the 2D-Hist fCenter
+
+
 
  2002/08/06: Thomas Bretz
Index: /trunk/MagicSoft/Mars/macros/dohtml.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/dohtml.C	(revision 1486)
+++ /trunk/MagicSoft/Mars/macros/dohtml.C	(revision 1487)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
+!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2001
+!   Copyright: MAGIC Software Development, 2000-2002
 !
 !
@@ -36,5 +36,5 @@
 
     html.SetOutputDir("htmldoc");
-    html.SetSourceDir(".:mbase:mraw:mgui:manalysis:mdatacheck:mmain:meventdisp:mmc:mmontecarlo:mhist:mfilter");
+    html.SetSourceDir(".:mbase:mdata:mdatacheck:meventdisp:mfileio:mfilter:mgeom:mgui:mhist:mmain:mmc:mmontecarlo:mraw:mtools");
 
     html.MakeAll(kTRUE);
Index: /trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc	(revision 1486)
+++ /trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc	(revision 1487)
@@ -53,4 +53,6 @@
 #include "MBlindPixelCalc.h"
 
+#include <fstream.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -68,4 +70,7 @@
 ClassImp(MBlindPixelCalc);
 
+static const TString gsDefName  = "MBlindPixelCalc";
+static const TString gsDefTitle = "Task to deal with hot spots (star, broken pixels, etc)";
+
 // --------------------------------------------------------------------------
 //
@@ -73,8 +78,8 @@
 //
 MBlindPixelCalc::MBlindPixelCalc(const char *name, const char *title)
-    : fUseInterpolation(kFALSE), fUseCentralPixel(kFALSE)
-{
-    fName  = name  ? name  : "MBlindPixelCalc";
-    fTitle = title ? title : "Task which removes a list of pixel from analysis";
+    : fFlags(0)
+{
+    fName  = name  ? name  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 }
 
@@ -129,5 +134,5 @@
 //
 //  Replaces each pixel by the average of its surrounding pixels.
-//  If fUseCentralPixel is set the central pixel is also included.
+//  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also included.
 //
 void MBlindPixelCalc::Interpolate() const
@@ -155,6 +160,6 @@
         const Int_t n = gpix.GetNumNeighbors();
 
-        nphot[i] = fUseCentralPixel ? (*fEvt)[id].GetNumPhotons() : 0;
-        perr[i]  = fUseCentralPixel ? (*fEvt)[id].GetErrorPhot()  : 0;
+        nphot[i] = TESTBIT(fFlags, kUseCentralPixel) ? (*fEvt)[id].GetNumPhotons() : 0;
+        perr[i]  = TESTBIT(fFlags, kUseCentralPixel) ? (*fEvt)[id].GetErrorPhot()  : 0;
         for (int j=0; j<n; j++)
         {
@@ -165,9 +170,9 @@
         }
 
-        nphot[i] /= fUseCentralPixel ? n+1 : n;
-        perr[i]  /= fUseCentralPixel ? n+1 : n;
-    }
-
-    if (fUseInterpolation && fGeomCam)
+        nphot[i] /= TESTBIT(fFlags, kUseCentralPixel) ? n+1 : n;
+        perr[i]  /= TESTBIT(fFlags, kUseCentralPixel) ? n+1 : n;
+    }
+
+    if (TESTBIT(fFlags, kUseInterpolation) && fGeomCam)
         for (UShort_t i=0; i<entries; i++)
         {
@@ -211,5 +216,5 @@
 Bool_t MBlindPixelCalc::Process()
 {
-    if (fUseInterpolation && fGeomCam)
+    if (TESTBIT(fFlags, kUseInterpolation) && fGeomCam)
         Interpolate();
     else
@@ -289,3 +294,29 @@
 }
 
-
+void MBlindPixelCalc::StreamPrimitive(ofstream &out) const
+{
+    out << "   MBlindPixelCalc " << GetUniqueName();
+    if (fName!=gsDefName || fTitle!=gsDefTitle)
+    {
+        out << "(\"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+        out <<")";
+    }
+    out << ";" << endl;
+
+    if (TESTBIT(fFlags, kUseInterpolation))
+        out << "   " << GetUniqueName() << ".SetUseInterpolation();" << endl;
+    if (TESTBIT(fFlags, kUseCentralPixel))
+        out << "   " << GetUniqueName() << ".SetUseCentralPixel();" << endl;
+
+    if (fPixelsID.GetSize()==0)
+        return;
+
+    out << "   {" << endl;
+    out << "      TArrayS dummy;" << endl;
+    for (int i=0; i<fPixelsID.GetSize(); i++)
+        out << "      dummy[" << i << "]=" << ((TArrayS)fPixelsID)[i] << ";" << endl;
+    out << "      " << GetUniqueName() << ".SetPixels(dummy);" << endl;
+    out << "   }" << endl;
+}
Index: /trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.h	(revision 1486)
+++ /trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.h	(revision 1487)
@@ -23,15 +23,27 @@
     TArrayS fPixelsID;  // Pixel IDs for blind pixels, which are entered by the user.
 
-    Bool_t fUseInterpolation;
-    Bool_t fUseCentralPixel;
+    Byte_t fFlags;      // flag for the method which is used
+
+    enum
+    {
+        kUseInterpolation = 1,
+        kUseCentralPixel  = 2
+    };
 
     void Interpolate() const;
     void Unmap() const;
+    void StreamPrimitive(ofstream &out) const;
 
 public:
     MBlindPixelCalc(const char *name=NULL, const char *title=NULL);
 
-    void SetUseInterpolation(Bool_t b=kTRUE) { fUseInterpolation=kTRUE; }
-    void SetUseCetralPixel(Bool_t b=kTRUE)   { fUseCentralPixel=kTRUE; }
+    void SetUseInterpolation(Bool_t b=kTRUE)
+    {
+        b ? SETBIT(fFlags, kUseInterpolation) : CLRBIT(fFlags, kUseInterpolation);
+    }
+    void SetUseCetralPixel(Bool_t b=kTRUE)
+    {
+        b ? SETBIT(fFlags, kUseCentralPixel) : CLRBIT(fFlags, kUseCentralPixel);
+    }
 
     Bool_t PreProcess(MParList *pList);
@@ -39,7 +51,8 @@
 
     void SetPixels(Int_t num, Short_t *ids);
+    void SetPixels(const TArrayS pix) { SetPixels(pix.GetSize(), pix.GetArray()); }
     virtual Bool_t ReInit(MParList *pList);
 
-    ClassDef(MBlindPixelCalc, 0) // task to disable given pixels for analysis
+    ClassDef(MBlindPixelCalc, 1) // task to deal with hot spots (star, broken pixels, etc)
 }; 
 
Index: /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1486)
+++ /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1487)
@@ -45,4 +45,7 @@
 ClassImp(MHillasSrcCalc);
 
+static const TString gsDefName  = "MHillasSrcCalc";
+static const TString gsDefTitle = "Calculate position dependant image parameters";
+
 // -------------------------------------------------------------------------
 //
@@ -55,7 +58,8 @@
 MHillasSrcCalc::MHillasSrcCalc(const char *src, const char *hil,
                                const char *name, const char *title)
+    : fHillas(NULL), fSrcPos(NULL), fHillasSrc(NULL)
 {
-    fName  = name  ? name  : "MHillasSrcCalc";
-    fTitle = title ? title : "add parameters dependent on source position (MHillasSrc)";
+    fName  = name  ? name  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 
     fSrcName    = src;
@@ -122,4 +126,6 @@
         out << "\"" << fSrcName << "\"";
 
+    out << ", ";
+
     if (fHillasSrc)
         out << "&" << fHillasSrc->GetUniqueName();
@@ -127,4 +133,10 @@
         out << "\"" << fHillasName << "\"";
 
-    out << ", \"" << fName << "\", \"" << fTitle << "\");" << endl;
+    if (fName!=gsDefName || fTitle!=gsDefTitle)
+    {
+        out << ", \"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+    }
+    out << ");" << endl;
 }
Index: /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h	(revision 1486)
+++ /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h	(revision 1487)
@@ -13,7 +13,7 @@
 {
 private:
-    MHillas    *fHillas;     // Pointer to the source independant hillas parameters
-    MSrcPosCam *fSrcPos;     // Pointer to the source position
-    MHillasSrc *fHillasSrc;  // Pointer to the output container for the source dependant parameters
+    MHillas    *fHillas;     //! Pointer to the source independant hillas parameters
+    MSrcPosCam *fSrcPos;     //! Pointer to the source position
+    MHillasSrc *fHillasSrc;  //! Pointer to the output container for the source dependant parameters
 
     TString     fSrcName;
Index: /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1486)
+++ /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1487)
@@ -68,4 +68,7 @@
 };
 
+static const TString gsDefName  = "MImgCleanStd";
+static const TString gsDefTitle = "Task to perform a standard image cleaning";
+
 // --------------------------------------------------------------------------
 //
@@ -78,6 +81,6 @@
     : fCleanLvl1(lvl1), fCleanLvl2(lvl2)
 {
-    fName  = name  ? name  : "MImgCleanStd";
-    fTitle = title ? title : "Task which does a standard image cleaning";
+    fName  = name  ? name  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 
     Print();
@@ -417,5 +420,12 @@
 {
     out << "   MImgCleanStd " << GetUniqueName() << "(";
-    out << fCleanLvl1 << ", " << fCleanLvl2 << ", \"";
-    out << fName << "\", \"" << fTitle << "\");" << endl;
-}
+    out << fCleanLvl1 << ", " << fCleanLvl2;
+
+    if (fName!=gsDefName || fTitle!=gsDefTitle)
+    {
+        out << ", \"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+    }
+    out << ");" << endl;
+}
Index: /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc	(revision 1486)
+++ /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc	(revision 1487)
@@ -41,4 +41,7 @@
 ClassImp(MSrcPosCam);
 
+static const TString gsDefName  = "MSrcPosCam";
+static const TString gsDefTitle = "Virtual source position in the camera";
+
 // --------------------------------------------------------------------------
 //
@@ -47,6 +50,6 @@
 MSrcPosCam::MSrcPosCam(const char *name, const char *title) : fX(0), fY(0)
 {
-    fName  = name  ? name  : "MSrcPosCam";
-    fTitle = title ? title : "Source position in the camera";
+    fName  = name  ? name  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 }
 
@@ -90,6 +93,13 @@
 void MSrcPosCam::StreamPrimitive(ofstream &out) const
 {
-    out << "   MSrcPosCam " << GetUniqueName() << "(\"";
-    out << fName << "\", \"" << fTitle << "\");" << endl;
+    out << "   MSrcPosCam " << GetUniqueName();
+    if (fName!=gsDefName)
+    {
+        out << "(\"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+        out <<")";
+    }
+    out << ";" << endl;
 
     out << "   " << GetUniqueName() << ".SetXY(" << fX << ", " << fY << ");" << endl;}
Index: /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1486)
+++ /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 1486)
+++ /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: unk/MagicSoft/Mars/mbase/MFilterList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MFilterList.cc	(revision 1486)
+++ 	(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: unk/MagicSoft/Mars/mbase/MFilterList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MFilterList.h	(revision 1486)
+++ 	(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 1486)
+++ /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 1486)
+++ /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 1486)
+++ /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 << "\"";
Index: /trunk/MagicSoft/Mars/mhist/MBinning.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MBinning.cc	(revision 1486)
+++ /trunk/MagicSoft/Mars/mhist/MBinning.cc	(revision 1487)
@@ -120,5 +120,5 @@
 {
     out << "   MBinning " << GetUniqueName();
-    if (fName!=gsDefName)
+    if (fName!=gsDefName || fTitle!=gsDefTitle)
     {
         out << "(\"" << fName << "\"";
Index: /trunk/MagicSoft/Mars/mhist/MHHillas.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHHillas.cc	(revision 1486)
+++ /trunk/MagicSoft/Mars/mhist/MHHillas.cc	(revision 1487)
@@ -148,7 +148,12 @@
     ApplyBinning(*plist, "Length", fLength);
     ApplyBinning(*plist, "Dist",   fDistC);
-    ApplyBinning(*plist, "Camera", fCenter);
     ApplyBinning(*plist, "Delta",  fDelta);
     ApplyBinning(*plist, "Size",   fSize);
+
+    const MBinning *bins = (MBinning*)plist->FindObject("BinningCamera");
+    if (!bins)
+        *fLog << warn << "Object 'BinningCamera' [MBinning] not found... no binning applied." << endl;
+    else
+        SetBinning(fCenter, bins, bins);
 
     return kTRUE;
