Index: /trunk/MagicSoft/Mars/macros/estfit.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/estfit.C	(revision 2123)
+++ /trunk/MagicSoft/Mars/macros/estfit.C	(revision 2124)
@@ -33,6 +33,10 @@
 
 // --------------------------------------------------------------------------
-
-void estfit(Bool_t evalenergy=kFALSE)
+//
+//  0: fit impact parameter only
+//  1: fit energy only
+//  2: fit all parameters with respect to the energy resolution
+//
+void estfit(Int_t evalenergy=0)
 {
     //
@@ -48,5 +52,5 @@
     eest.InitMapping(&matrix);
 
-    MReadTree read("Events", "~/ct1/MC_ON2.root");
+    MReadTree read("Events", "MC_ON2_short.root");
     read.DisableAutoScheme();
 
@@ -92,19 +96,48 @@
     //
     TArrayD fA(5);
-    fA[0] = -3907.74; //4916.4;    //-2414.75;
-    fA[1] = 1162.3;   //149.549;   // 1134.28;
-    fA[2] = 199.351;  //-558.209;  // 132.932;
-    fA[3] = 0.403192; //0.270725;  //0.292845;
-    fA[4] = 121.921;  //107.001;   // 107.001;
-
     TArrayD fB(7);
-    fB[0] = -100;
-    fB[1] = 10;
-    fB[2] = 0.1;
-    fB[3] = 10;
-    fB[4] = -1;
-    fB[5] = -0.1;
-    fB[6] = -0.1;
-
+    fA[0] =  392957;
+    fA[1] =  135;
+    fA[2] =  -37449;
+    fA[3] =  0.3464;
+    fA[4] =  1;
+    fB[0] =  1;
+    fB[1] =  1;
+    fB[2] =  1;
+    fB[3] =  1;
+    fB[4] =  1;
+    fB[5] =  1;
+    fB[6] =  1;
+     /*
+     fA[0] = 6122.97;
+     fA[1] = 144.889;
+     fA[2] = -601.256;
+     fA[3] = 0.00171985;
+     fA[4] = 116.451;
+     fB[0] =  -2368.21;
+     fB[1] =  1186.26;
+     fB[2] =  0.147235;
+     fB[3] =  144.49;
+     fB[4] =  42.7681;
+     fB[5] = -0.757817;
+     fB[6] =  0.182482;
+     */
+    /*
+     TArrayD fA(5);
+    fA[0] = 6122.97;
+    fA[1] = 144.889;
+    fA[2] = -601.256;
+    fA[3] = 0.00171985;
+    fA[4] = 116.451;
+
+    TArrayD fB(7);
+    fB[0] =  -10445.5;
+    fB[1] =  2172.05;
+    fB[2] =  0.69;
+    fB[3] =  491.2;
+    fB[4] =  4.71444;
+    fB[5] = -0.0331926;
+    fB[6] = -0.014833;
+    */
     // Set starting values and step sizes for parameters
     for (Int_t i=0; i<fA.GetSize(); i++)
@@ -120,6 +153,9 @@
 
         Bool_t rc = minuit.DefineParameter(i, name, vinit, step, limlo, limup);
-        if (evalenergy)
+        if (evalenergy==1)
+        {
             minuit.FixParameter(i);
+            cout << "Fixed Parameter #" << i << endl;
+        }
 
         if (!rc)
@@ -142,6 +178,9 @@
 
         Bool_t rc = minuit.DefineParameter(i+fA.GetSize(), name, vinit, step, limlo, limup);
-        if (!evalenergy)
+        if (evalenergy==0)
+        {
             minuit.FixParameter(i+fA.GetSize());
+            cout << "Fixed Parameter #" << i+fA.GetSize() << endl;
+        }
 
         if (!rc)
@@ -156,4 +195,6 @@
     //
     minuit.SetObjectFit(&evtloop);
+
+    cout << endl << "Fitting procedure running..." << endl;
 
     TStopwatch clock;
@@ -164,5 +205,4 @@
     Bool_t rc = minuit.Migrad();
     gLog.SetNullOutput(kFALSE);
-
     if (rc)
     {
@@ -176,5 +216,6 @@
     cout << endl;
 
-    for (Int_t i=(evalenergy?fA.GetSize():0); i<(evalenergy?fA.GetSize()+fB.GetSize():fA.GetSize()); i++)
+    for (Int_t i=(evalenergy==1?fA.GetSize():0); i<(evalenergy>0?fA.GetSize()+fB.GetSize():fA.GetSize()); i++)
+    //for (Int_t i=0; i<fA.GetSize()+fB.GetSize(); i++)
     {
         Double_t val;
@@ -182,8 +223,5 @@
 
         if (!minuit.GetParameter(i, val, er))
-        {
             cout << "Error getting parameter #" << i << endl;
-            return;
-        }
 
         cout << i << ":  " << val << "  +-  " << er << endl;
Index: /trunk/MagicSoft/Mars/macros/multidimdist2.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/multidimdist2.C	(revision 2123)
+++ /trunk/MagicSoft/Mars/macros/multidimdist2.C	(revision 2124)
@@ -66,6 +66,8 @@
     //   Here you give the trainings sample(s) for
     //                 the gammas
+    //      If you have only _one_ single Theta
+    //            remove MMcEvt.fTheta!
     // ---------------------------------------------
-    MReadMarsFile readg("Events", "star_gammas.root");
+    MReadMarsFile readg("Events", "star_gammas0.root");
     readg.DisableAutoScheme();
     tlistg.AddToList(&readg);
@@ -95,11 +97,11 @@
     // --- Create and set up the eventloop (gammas) ---
     //
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
+    MEvtLoop evtloop1;
+    evtloop1.SetParList(&plist);
 
     //
     // --- Execute matrix buildup (gammas) ---
     //
-    if (!evtloop.Eventloop())
+    if (!evtloop1.Eventloop())
         return;
 
@@ -119,5 +121,5 @@
     //                 the hadrons
     // ---------------------------------------------
-    MReadMarsFile  readh("Events", "star_protons.root");
+    MReadMarsFile  readh("Events", "star_protons0.root");
     readh.DisableAutoScheme();
     tlisth.AddToList(&readh);
@@ -135,15 +137,15 @@
     // Create and set up the eventloop (protons)
     //
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
+    MEvtLoop evtloop2;
+    evtloop2.SetParList(&plist);
 
     //
     // Execute matrix buildup (hadrons)
     //
-    if (!evtloop.Eventloop())
+    if (!evtloop2.Eventloop())
         return;
 
     //  sum up in log
-    tlistg.PrintStatistics();
+    tlisth.PrintStatistics();
 
     matrix.Print("size");
@@ -165,6 +167,6 @@
     //          and one gamma file available
     // ----------------------------------------------------
-    MReadMarsFile read2("Events", "star_protons.root");
-    read2.AddFile("star_gammas.root");
+    MReadMarsFile read2("Events", "star_gammas0.root");
+    read2.AddFile("star_protons0.root");
     read2.DisableAutoScheme();
     tlist2.AddToList(&read2);
@@ -190,9 +192,9 @@
     //
     MProgressBar bar;
-    MEvtLoop evtloop;
-    evtloop.SetProgressBar(&bar);
-    evtloop.SetParList(&plist);
-
-    if (!evtloop.Eventloop())
+    MEvtLoop evtloop3;
+    evtloop3.SetProgressBar(&bar);
+    evtloop3.SetParList(&plist);
+
+    if (!evtloop3.Eventloop())
         return;
 
Index: /trunk/MagicSoft/Mars/macros/star.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/star.C	(revision 2123)
+++ /trunk/MagicSoft/Mars/macros/star.C	(revision 2124)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Thomas Bretz, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -66,6 +66,5 @@
 
     // ------------- user change -----------------
-    read.AddFile("data/Gamma_z*.root");
-    //read.AddFile("Gam*.root");
+    read.AddFile("magictest/test/Gamma_z*.root");
 
     MMcPedestalCopy   pcopy;
@@ -76,4 +75,5 @@
     blind.SetUseInterpolation();
 
+    MSigmabarCalc     sgcal;
     MImgCleanStd      clean;
     MHillasCalc       hcalc;
@@ -81,10 +81,11 @@
 
     // ------------- user change -----------------
-    MWriteRootFile write("data/star_protons.root");
+    MWriteRootFile write("starfile.root");
+    write.AddContainer("MMcEvt",        "Events");
+    write.AddContainer("MSigmabar",     "Events");
     write.AddContainer("MHillas",       "Events");
     write.AddContainer("MHillasExt",    "Events");
+    write.AddContainer("MHillasSrc",    "Events");
     write.AddContainer("MNewImagePar",  "Events");
-    write.AddContainer("MMcEvt",        "Events");
-    write.AddContainer("MHillasSrc",    "Events");
     write.AddContainer("MRawRunHeader", "RunHeaders");
     write.AddContainer("MMcRunHeader",  "RunHeaders");
@@ -96,4 +97,5 @@
     tlist.AddToList(&ncalc);
     tlist.AddToList(&blind);
+    tlist.AddToList(&sgcal);
     tlist.AddToList(&clean);
     tlist.AddToList(&hcalc);
Index: /trunk/MagicSoft/Mars/macros/status.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/status.C	(revision 2123)
+++ /trunk/MagicSoft/Mars/macros/status.C	(revision 2124)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Thomas Bretz, 4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2003
@@ -61,8 +61,4 @@
     plist.AddToList(&src);
 
-    // Use MHillasExt instead of MHillas
-    MHillasExt hext;
-    plist.AddToList(&hext);
-
     //
     // The geometry container must be created by yourself to make sure
@@ -80,6 +76,5 @@
 
     // ------------- user change -----------------
-    read.AddFile("data/Pro*.root");
-    read.AddFile("data/Gam*.root");
+    read.AddFile("magictest/test/Gamma_z*.root");
 
     MMcPedestalCopy   pcopy;
@@ -90,4 +85,5 @@
     blind.SetUseInterpolation();
 
+    MSigmabarCalc     sgcal;
     MImgCleanStd      clean;
     MHillasCalc       hcalc;
@@ -97,6 +93,6 @@
     // -------------------------------------------
     MFillH hfill1("MHHillas", "MHillas");
-    MFillH hfill2("MHHillasExt [MHHillasExt]");
-    MFillH hfill3("MHHillasExtSrc [MHHillasExt]");
+    MFillH hfill2("MHHillasExt");
+    MFillH hfill3("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
     MFillH hfill4("MHHillasSrc","MHillasSrc");
     MFillH hfill4("MHNewImagePar","MNewImagePar");
@@ -104,16 +100,16 @@
     MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt");
     MFillH hfill7("MHHadronness", "MHadronness");
+    MFillH hfill8("MHSigmaTheta");
 
     tlist.AddToList(&read);
     tlist.AddToList(&pcopy);
     tlist.AddToList(&pnsb);
-
     tlist.AddToList(&ncalc);
     tlist.AddToList(&blind);
+    tlist.AddToList(&sgcal);
     tlist.AddToList(&clean);
     tlist.AddToList(&hcalc);
     tlist.AddToList(&scalc);
     tlist.AddToList(&calc1);
-    tlist.AddToList(&hfill7);
     tlist.AddToList(&hfill1);
     tlist.AddToList(&hfill2);
@@ -122,4 +118,6 @@
     tlist.AddToList(&hfill5);
     tlist.AddToList(&hfill6);
+    tlist.AddToList(&hfill7);
+    tlist.AddToList(&hfill8);
 
     MEvtLoop evtloop;
@@ -142,5 +140,5 @@
     {
         // Save data in a postscriptfile (status.ps)
-       // d->SaveAsPS();
+        d->SaveAsPS();
         /*
          * ----------- Write status to a root file ------------
Index: /trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 2123)
+++ /trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 2124)
@@ -49,4 +49,5 @@
 
 #pragma link C++ class MCT1SupercutsCalc+;
+#pragma link C++ class MFiltercutsCalc+;
 
 #endif
Index: /trunk/MagicSoft/Mars/manalysis/MFiltercutsCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MFiltercutsCalc.cc	(revision 2124)
+++ /trunk/MagicSoft/Mars/manalysis/MFiltercutsCalc.cc	(revision 2124)
@@ -0,0 +1,144 @@
+/* ======================================================================== *\
+!
+! *
+! * 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, 05/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                        
+//   MFiltercutsCalc                                                    
+//                                                                      
+/////////////////////////////////////////////////////////////////////////////
+#include "MFiltercutsCalc.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MF.h"
+#include "MFDataChain.h"
+#include "MParList.h"
+#include "MFilterList.h"
+#include "MHadronness.h"
+
+ClassImp(MFiltercutsCalc);
+
+// --------------------------------------------------------------------------
+//
+MFiltercutsCalc::MFiltercutsCalc(const char *name, const char *title)
+    : fHadronnessName("MHadronness")
+{
+    fName  = name  ? name  : "MFiltercutsCalc";
+    fTitle = title ? title : "Class to evaluate the Supercuts";
+
+    fList = new MFilterList;
+    fList->SetOwner();
+}
+
+MFiltercutsCalc::~MFiltercutsCalc()
+{
+    delete fList;
+}
+
+void MFiltercutsCalc::AddToList(MFilter *f)
+{
+    f->SetName(f->GetRule());
+    fList->AddToList(f);
+}
+
+void MFiltercutsCalc::Print(Option_t *opt) const
+{
+    *fLog << all << underline << GetDescriptor() << ":" << endl;
+    fList->Print();
+    *fLog << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+// There is MUCH space for speed improvement!
+// Add MF(lo<name && name<up) to the filter list (&&),
+// for more details see MF::MF(), too.
+//
+void MFiltercutsCalc::AddCut(const char *name, Double_t lo, Double_t up)
+{
+    AddToList(new MFDataChain(name, '>', lo));
+    AddToList(new MFDataChain(name, '<', up));
+}
+
+// --------------------------------------------------------------------------
+//
+// There is MUCH space for speed improvement!
+// Add MF(fabs(name)<val) to the filter list (&&),
+// for more details see MF::MF(), too.
+//
+void MFiltercutsCalc::AddCut(const char *name, Double_t val)
+{
+    AddToList(new MFDataChain(Form("fabs(%s)", name), '<', val));
+}
+
+// --------------------------------------------------------------------------
+//
+// There is MUCH space for speed improvement!
+// Add 'cut' as MF(cut) to the filter list (&&),
+// for more details see MF::MF(), too.
+//
+void MFiltercutsCalc::AddCut(const char *cut)
+{
+    AddToList(new MF(cut));
+}
+
+// --------------------------------------------------------------------------
+//
+// There is MUCH space for speed improvement!
+// Add cut to filter list (&&), for more details see MF::MF(), too.
+//
+void MFiltercutsCalc::AddCut(MFilter *f)
+{
+    AddToList(f);
+}
+
+// --------------------------------------------------------------------------
+//
+Bool_t MFiltercutsCalc::PreProcess(MParList *pList)
+{
+    if (!fList->PreProcess(pList))
+        return kFALSE;
+
+    fHadronness = (MHadronness*)pList->FindCreateObj("MHadronness", fHadronnessName);
+    if (!fHadronness)
+        return kFALSE;
+
+    return kTRUE;
+}
+
+Bool_t MFiltercutsCalc::Process()
+{
+    if (!fList->Process())
+        return kFALSE;
+
+    if (fList->IsExpressionTrue())
+        fHadronness->SetHadronness(0.25);
+    else
+        fHadronness->SetHadronness(0.75);
+
+    fHadronness->SetReadyToSave();
+
+    return kTRUE;
+}
Index: /trunk/MagicSoft/Mars/manalysis/MFiltercutsCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MFiltercutsCalc.h	(revision 2124)
+++ /trunk/MagicSoft/Mars/manalysis/MFiltercutsCalc.h	(revision 2124)
@@ -0,0 +1,48 @@
+#ifndef MARS_MFiltercutsCalc
+#define MARS_MFiltercutsCalc
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MFiltercutsCalc                                                         //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef MARS_MFilter
+#include "MFilter.h"
+#endif
+
+class MParList;
+class MFilterList;
+class MHadronness;
+
+
+class MFiltercutsCalc : public MTask
+{
+private:
+    MFilterList *fList;       //->
+    MHadronness *fHadronness; //!
+    TString     fHadronnessName;  // name of container to store hadronness
+
+    Bool_t PreProcess(MParList *pList);
+    Bool_t Process();
+
+    void AddToList(MFilter *f);
+
+public:
+    MFiltercutsCalc(const char *name=NULL, const char *title=NULL);
+    ~MFiltercutsCalc();
+
+    void SetHadronnessName(const TString name) { fHadronnessName = name; }
+    TString GetHadronnessName() const { return fHadronnessName; }
+
+    void AddCut(const char *name, Double_t lo, Double_t up);
+    void AddCut(const char *name, Double_t val);
+    void AddCut(const char *cut);
+    void AddCut(MFilter *f);
+
+    void Print(Option_t *opt=NULL) const;
+
+    ClassDef(MFiltercutsCalc, 0) // A class to evaluate Filtercuts
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/Makefile	(revision 2123)
+++ /trunk/MagicSoft/Mars/manalysis/Makefile	(revision 2124)
@@ -22,5 +22,5 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../mmc -I../mraw -I../mgeom \
+INCLUDES = -I. -I../mbase -I../mmc -I../mraw -I../mgeom -I../mfilter \
 	   -I../mdata -I../mhist -I../mgui -I../mimage -I../mhistmc
 
@@ -57,5 +57,6 @@
 	   MMcTriggerLvl2.cc \
 	   MMcTriggerLvl2Calc.cc \
-           MCT1SupercutsCalc.cc 
+           MCT1SupercutsCalc.cc \
+           MFiltercutsCalc.cc
 
 SRCS    = $(SRCFILES)
