Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 3573)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 3574)
@@ -124,4 +124,7 @@
      - added support for new condition type
      - adapted Print and GetRule
+
+   * mimage/MNewImagePar.[h,cc]:
+     - added some comments
 
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 3573)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 3574)
@@ -3,5 +3,5 @@
   
    - added support in MF for expressiond like 
-     "MHillas.fWidth<2*MHillas.fLength"
+     "MHillas.fWidth<2*<MHillas.fLength"
 
    - MDataChain is now able to support variables like [0], [1], ...
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 3573)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 3574)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -24,14 +24,32 @@
 
 //////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-// MParContainer                                                            //
-//                                                                          //
-// The MParContainer class is the base class for all MARS parameter         //
-// containers. At the moment it is almost the same than ROOT's TNamed.      //
-// A TNamed contains the essential elements (name, title)                   //
-// to identify a derived object in lists like our MParList or MTaskList.    //
-// The main difference is that the name and title isn't stored and read     //
-// to and from root files ("//!")                                           //
-//                                                                          //
+//
+// MParContainer
+//
+// The MParContainer class is the base class for all MARS parameter
+// containers. At the moment it is almost the same than ROOT's TNamed.
+// A TNamed contains the essential elements (name, title)
+// to identify a derived object in lists like our MParList or MTaskList.
+// The main difference is that the name and title isn't stored and read
+// to and from root files ("//!")
+//
+// MParContainer has several enhancements compared to TNamed:
+//  - GetDescriptor():        returns name and class type
+//  - GetUniqueName():        returns a unique name (used in StreamPrimitive)
+//  - SetLogStream(MLog *lg): Set a logging stream to which loggingis stored
+//  - Reset():                Reset content of class in an eventloop
+//  - IsReadyToSave():        The contents are ready to be saved to a file
+//  - IsSavedAsPrimitive():   A unique name for this instance is already
+//                            existing
+//  - SetVariables():         Can be overloaded if the containers stores
+//                            coefficients (to be used in fits)
+//  - SetDisplay():           Set a display for redirecting graphical output
+//  - GetNames():             Get Name/Title from instance and store it in
+//                            a TObjArray (used to store the names of the
+//                            conteiners in a file
+//  - SetNames():             vice versa
+//  - ReadEnv(), WriteEnv():  Function which is used for automatical setup
+//    IsEnvDefined()          from a TEnv file
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MParContainer.h"
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 3573)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 3574)
@@ -25,4 +25,5 @@
 
 class TEnv;
+class TArrayD;
 class TDataMember;
 class TMethodCall;
@@ -83,11 +84,11 @@
     virtual Bool_t        IsSortable() const    { return kTRUE; }
 
-    virtual void        SetName(const char *name); // *MENU*
-    virtual void        SetObject(const char *name, const char *title);
-    virtual void        SetTitle(const char *title=""); // *MENU*
-    virtual void        ls(Option_t *option="") const;
-    virtual void        Print(Option_t *option="") const;
-    virtual Int_t       Sizeof() const;
-    virtual void        SavePrimitive(ofstream &out, Option_t *o="");
+    virtual void   SetName(const char *name); // *MENU*
+    virtual void   SetObject(const char *name, const char *title);
+    virtual void   SetTitle(const char *title=""); // *MENU*
+    virtual void   ls(Option_t *option="") const;
+    virtual void   Print(Option_t *option="") const;
+    virtual Int_t  Sizeof() const;
+    virtual void   SavePrimitive(ofstream &out, Option_t *o="");
 
     virtual MParContainer *New() const;
@@ -99,4 +100,5 @@
     virtual void   EnableGraphicalOutput(Bool_t flag=kTRUE) { flag ? SetBit(kEnableGraphicalOutput) : ResetBit(kEnableGraphicalOutput);}
     virtual Bool_t IsGraphicalOutputEnabled() const  { return TestBit(kEnableGraphicalOutput); }
+    virtual void   SetVariables(const TArrayD &)     { AbstractMethod("SetVariables(const TArrayD&)"); }
 
     virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; }
Index: /trunk/MagicSoft/Mars/mhist/MHFalseSource.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHFalseSource.cc	(revision 3573)
+++ /trunk/MagicSoft/Mars/mhist/MHFalseSource.cc	(revision 3574)
@@ -625,148 +625,4 @@
     gPad->cd();
 }
-/*
-Double_t fcn(Double_t *arg, Double_t *p)
-{
-    const Double_t x = arg[0];
-
-    const Double_t dx = (x-p[1])/p[2];
-
-    const Double_t f1 = p[0]*TMath::Exp(-0.5*dx*dx);
-    const Double_t f2 = p[3] + p[5]*x*x;
-
-    return f1 + f2;
-}
-
-Double_t FcnI1(Double_t x, Double_t *p)
-{
-    return (p[5]*x*x/3+p[3])*x;
-}
-Double_t FcnI2(Double_t x, Double_t *p)
-{
-    static const Double_t sqrt2   = TMath::Sqrt(2.);
-    static const Double_t sqrt2pi = TMath::Sqrt(TMath::TwoPi());
-
-    const Double_t dx = (x-p[1])/p[2];
-
-    const Double_t f2 = p[0]*p[2]*sqrt2pi*TMath::Erf(dx/sqrt2)/2;
-
-    return f2;
-}
-*/
-/*
-class MHSignificance : public MH
-{
-private:
-    TH1D fHist;
-
-    MParameterD *fParam;
-
-public:
-    MHSignificance() : fParam(0)
-    {
-        fHist.SetName("Alpha");
-        fHist.SetTitle("Distribution of \\alpha");
-        fHist.SetXTitle("\\alpha [\\circ]");
-        fHist.SetYTitle("Counts");
-    }
-    Int_t SetupFill(MParList *p)
-    {
-        fHist.Reset();
-
-        fParam = (MParameterD*)p->FindCreateObj("Significance", "MParameterD");
-        if (fParam)
-            return kFALSE;
-
-        return kTRUE;
-    }
-    Int_t Process(MParContainer *p, Double_t w=1)
-    {
-        MHillasSrc *hil = dynamic_cast<MHillasSrc*>(p);
-        if (!hil)
-        {
-            *fLog << err << dbginf << "Got no MHillasSrc as argument of Fill()..." << endl;
-            return kFALSE;
-        }
-
-        fHist->Fill(hil->GetAlpha(), w);
-
-        return kTRUE;
-    }
-    Int_t Finalize()
-    {
-        if (fHist.GetEntries()==0)
-        {
-            *fLog << err << "Histogram empty." << endl;
-            return kFALSE;
-        }
-
-        Float_t sigmax=15;
-        Float_t bgmin =45;
-        Float_t bgmax =80;
-
-        fHist.SetNameTitle("Significance",
-                           Form("Fit Region: Signal<%.1f\\circ, %.1f\\circ<Bg<%.1f\\circ",
-                                sigmax, bgmin, bgmax));
-
-        // Implementing the function yourself is not faster at all!
-        TF1 func("gaus(0) + pol2(3)", fcn, 0, 90, 6);
-        TArrayD maxpar(func.GetNpar());
-
-        func.FixParameter(1, 0);
-        func.FixParameter(4, 0);
-        func.SetParLimits(3, -1, 1);
-
-        const Double_t alpha0 = fHist.GetBinContent(1);
-
-        // First fit a polynom in the off region
-        func.FixParameter(0, 0);
-        func.FixParameter(2, 1);
-        func.ReleaseParameter(3);
-        func.ReleaseParameter(5);
-
-        h->Fit(&func, "N0Q", "", bgmin, bgmax);
-
-        // Now fit a gaus in the on region on top of the polynom
-        func.SetParameter(0, alpha0-func.GetParameter(4));
-        func.SetParameter(2, sigmax*0.75);
-
-        func.ReleaseParameter(0);
-        func.ReleaseParameter(2);
-        func.FixParameter(3, func.GetParameter(3));
-        func.FixParameter(5, func.GetParameter(5));
-
-        func.SetParLimits(2, 0, 80);
-        h->Fit(&func, "N0Q", "", 0, sigmax);
-
-        TArrayD p(func.GetNpar(), func.GetParameters());
-
-        Double_t sig=0;
-
-        const Int_t n = hist->GetBin(ix+1, iy+1);
-        if (!(func.GetParameter(0)>alpha0*2 ||
-              func.GetParameter(2)<2.5      ||
-              func.GetParameter(2)>70))
-        {
-            // Implementing the integral as analytical function
-            // gives the same result in the order of 10e-5
-            // and it is not faster at all...
-            const Double_t s = func.Integral(0, 15);
-
-            func.SetParameter(0, 0);
-            func.SetParameter(2, 1);
-
-            const Double_t b = func.Integral(0, 15);
-
-            sig = Significance(s, b);
-        }
-
-        fParam->SetValue(sig);
-        fParam->SetReadyToSave();
-        return kTRUE;
-    }
-    ClassDef(MHSignificance, 0)
-};
-*/
-
 
 // --------------------------------------------------------------------------
@@ -843,4 +699,6 @@
     histb->SetYTitle(fHist.GetXaxis()->GetTitle());
 
+    const Double_t w = fHist.GetZaxis()->GetBinWidth(1);
+
     //                      xmin, xmax, npar
     //TF1 func("MyFunc", fcn, 0, 90, 6);
@@ -889,5 +747,4 @@
 
             const Double_t alpha0 = h->GetBinContent(1);
-            const Double_t alphaw = h->GetXaxis()->GetBinWidth(1);
 
             // Check for the regios which is not filled...
@@ -959,10 +816,14 @@
             */
 
-            const Double_t s = func.Integral(0, sigint);
+            // The fitted function returned units of
+            // counts bin binwidth. To get the correct number
+            // of events we must adapt the functions by dividing
+            // the result of the integration by the bin-width
+            const Double_t s = func.Integral(0, sigint)/w;
 
             func.SetParameter(0, 0);
             func.SetParameter(2, 1);
 
-            const Double_t b   = func.Integral(0, sigint);
+            const Double_t b   = func.Integral(0, sigint)/w;
             const Double_t sig = Significance(s, b);
 
Index: /trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 3573)
+++ /trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 3574)
@@ -41,4 +41,7 @@
 // ----------
 //  - added fNumHGSaturatedPixels
+//  - added fInnerLeakage1
+//  - added fInnerLeakage2
+//  - added fInnerSize
 // 
 /////////////////////////////////////////////////////////////////////////////
Index: /trunk/MagicSoft/Mars/mimage/MNewImagePar.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 3573)
+++ /trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 3574)
@@ -15,7 +15,7 @@
     Float_t fLeakage1;           // (photons in most outer ring of pixels) over fSize
     Float_t fLeakage2;           // (photons in the 2 outer rings of pixels) over fSize
-    Float_t fInnerLeakage1;           // (photons in most outer rings of inner pixels) over fInnerSize
-    Float_t fInnerLeakage2;           // (photons in the 2 outer rings of inner pixels) over fInnerSize
-    Float_t fInnerSize;
+    Float_t fInnerLeakage1;      // (photons in most outer rings of inner pixels) over fInnerSize
+    Float_t fInnerLeakage2;      // (photons in the 2 outer rings of inner pixels) over fInnerSize
+    Float_t fInnerSize;          //
 
     Float_t fConc;               // [ratio] concentration ratio: sum of the two highest pixels / fSize
