Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7391)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7392)
@@ -46,4 +46,12 @@
    * mpointing/MPointingPos.[h,cc]:
      - added Print function
+
+   * ganymed_onoff.rc:
+     - let the exponential fit fit all the background (decoupled
+       sclae and background-fit reagion)
+
+   * mhflux/MAlphaFitter.[h,cc]:
+     - changed the background fit in the case of a ThetaSq function
+       from a polynomial to a exponential
 
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7391)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7392)
@@ -8,7 +8,4 @@
      and where to search for the image data
        --ind=/magic/data/star
-
-   - ganymed/sponde: Calculation of the error of single size-/energy-
-     bins now uses Li/Ma (5) instead of LiMa (17)
 
    - ganymed: MSrcPosCorrect now allows overwriting of the misfocussing
@@ -23,4 +20,11 @@
      "1ES1218" were read) The source coordinates are now printed
      in addition to its name to the logging output.
+
+   - ganymed: changed the background fit in the case of a ThetaSq function
+     from a polynomial to a exponential, this should give a big improvement
+     for on-only analysis'
+
+   - ganymed/sponde: Calculation of the error of single size-/energy-
+     bins now uses Li/Ma (5) instead of LiMa (17)
 
 
Index: trunk/MagicSoft/Mars/ganymed_onoff.rc
===================================================================
--- trunk/MagicSoft/Mars/ganymed_onoff.rc	(revision 7391)
+++ trunk/MagicSoft/Mars/ganymed_onoff.rc	(revision 7392)
@@ -101,8 +101,10 @@
 
 # ---------- SETUP FOR ONOFF-MODE -----------
+MAlphaFitter.ScaleMin: 0.137
+MAlphaFitter.ScaleMax: 0.640
 MAlphaFitter.BackgroundFitMin: 0.137
-MAlphaFitter.BackgroundFitMax: 0.64
+MAlphaFitter.BackgroundFitMax: 1.000
 MAlphaFitter.PolynomOrder: 1
-MAlphaFitter.ScaleMode: Background
+MAlphaFitter.ScaleMode: OffRegion
 MAlphaFitter.SignalFunction: ThetaSq
 
Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7391)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7392)
@@ -116,16 +116,4 @@
     Double_t bgmax =fBgMax;
 
-    //*fLog << inf << "Fit: " << sigmax << " " << fSigInt << "  " << bgmin << " " << bgmax << endl;
-
-    //TF1 fFunc("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90);
-
-    //fFunc->SetParameters(fCoefficients.GetArray());
-
-    fFunc->FixParameter(1, 0);
-    if (fPolynomOrder!=1)
-        fFunc->FixParameter(4, 0);
-    fFunc->SetParLimits(2, 0, 90);
-    fFunc->SetParLimits(3, -1, 1);
-
     const Double_t alpha0 = h.GetBinContent(1);
     const Double_t alphaw = h.GetXaxis()->GetBinWidth(1);
@@ -137,6 +125,9 @@
     // First fit a polynom in the off region
     fFunc->FixParameter(0, 0);
+    fFunc->FixParameter(1, 0);
     fFunc->FixParameter(2, 1);
     fFunc->ReleaseParameter(3);
+    if (fPolynomOrder!=1)
+        fFunc->FixParameter(4, 0);
 
     for (int i=5; i<fFunc->GetNpar(); i++)
@@ -145,4 +136,7 @@
         else
             fFunc->SetParameter(i, 0);
+
+    fFunc->SetParLimits(2, 0, 90);
+    //    fFunc->SetParLimits(3, -1, 1);
 
     // options : N  do not store the function, do not draw
@@ -171,11 +165,10 @@
     //func.ReleaseParameter(1);
     fFunc->ReleaseParameter(2);
-    fFunc->FixParameter(3, fFunc->GetParameter(3));
-    fFunc->FixParameter(4, fFunc->GetParameter(4));
-    for (int i=5; i<fFunc->GetNpar(); i++)
+    for (int i=3; i<fFunc->GetNpar(); i++)
         fFunc->FixParameter(i, fFunc->GetParameter(i));
 
     // Do not allow signals smaller than the background
-    const Double_t A  = alpha0-fFunc->GetParameter(3);
+    const Double_t s  = fSignalFunc==kGauss ? fFunc->GetParameter(3) : TMath::Exp(fFunc->GetParameter(3));
+    const Double_t A  = alpha0-s;
     const Double_t dA = TMath::Abs(A);
     fFunc->SetParLimits(0, -dA*4, dA*4);
@@ -334,6 +327,6 @@
     switch (fSignalFunc)
     {
-    case kGauss:       *fLog << "gauss(x)";        break;
-    case kThetaSq:     *fLog << "gauss(sqrt(x))";  break;
+    case kGauss:       *fLog << "gauss(x)/pol" << fPolynomOrder; break;
+    case kThetaSq:     *fLog << "gauss(sqrt(x))/expo";  break;
     }
     *fLog << endl;
Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h	(revision 7391)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h	(revision 7392)
@@ -136,5 +136,12 @@
             break;
         case kThetaSq:
-            fFunc=new TF1 ("", Form("[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + pol%d(3)", fPolynomOrder));
+//            if (fPolynomOrder==0)
+//                fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + pol0(3)");
+//            else
+            //            {
+            if (fPolynomOrder>0)
+                fPolynomOrder = 1;
+            fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + expo(3)");
+//            }
             break;
         }
