Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7617)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7618)
@@ -34,4 +34,12 @@
    * ganymed.rc, ganymed_onoff.rc, ganymed_wobble.rc:
      - added example how to change the new scale parameters in MHDisp
+
+   * mhflux/MAlphaFitter.[h,cc]:
+     - implemented the strategy for optimization which is suggested
+       by the Berlin people for weak sources "weaksource"
+
+   * mhflux/MHPhi.[h,cc]:
+     - moved the AppendPad for the text-paint into all sub-pads which
+       need it. Otherwise they are not always properly updated.
 
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7617)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7618)
@@ -23,4 +23,8 @@
      remove events triggered by car-light (rate changing on a short
      time-scale) are missing.
+
+   - macros: optimonoff.C, optimwobble.C: implemented a new strategy
+     for optimization (kWeakSource) which is suggested by the Berlin
+     people for weak sources.
 
    - ganymed: In the second loop the MHNewImagePar histograms disapeared.
Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7617)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7618)
@@ -36,5 +36,5 @@
 // Version 2:
 // ----------
-//  +Double_t fSignificanceExc;  // significance of excess
+//  + Double_t fSignificanceExc;  // significance of a known excess
 //
 //
@@ -276,4 +276,7 @@
     f.SetMuStep(0.05);
     f.SetMuMax(100);
+    f.SetMuMin(0);
+    f.SetCL(90);
+
     return f.CalculateUpperLimit(fEventsSignal, fEventsBackground);
 }
@@ -587,4 +590,6 @@
     case kGaussSigma:
         return GetGausSigma();
+    case kWeakSource:
+        return GetEventsBackground()<1 ? -GetEventsExcess() : -GetEventsExcess()/TMath::Sqrt(GetEventsBackground());
     }
     return 0;
@@ -649,4 +654,6 @@
         if (txt==(TString)"gausssigma" || txt==(TString)"gaussigma")
             fStrategy = kGaussSigma;
+        if (txt==(TString)"weaksource")
+            fStrategy = kWeakSource;
         rc = kTRUE;
     }
Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h	(revision 7617)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h	(revision 7618)
@@ -35,5 +35,6 @@
         kSignificanceExcess,
         kExcess,
-        kGaussSigma
+        kGaussSigma,
+        kWeakSource
     };
     enum SignalFunc_t {
Index: trunk/MagicSoft/Mars/mhflux/MHPhi.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHPhi.cc	(revision 7617)
+++ trunk/MagicSoft/Mars/mhflux/MHPhi.cc	(revision 7618)
@@ -297,4 +297,6 @@
     h1->Draw("same");
 
+    AppendPad("result1");
+
     // --------------------------
 
@@ -341,8 +343,7 @@
     h1->Draw("same");
 
+    AppendPad("result4");
+
     // --------------------------
-
-    pad->cd();
-    AppendPad("result");
 }
 
@@ -454,17 +455,4 @@
 }
 
-void MHPhi::PaintResult() const
-{
-    TVirtualPad *pad = gPad;
-
-    pad->cd(1);
-    PaintText(fHPhi);
-
-    pad->cd(4);
-    TH1D *res = gPad ? dynamic_cast<TH1D*>(gPad->FindObject("Result")) : NULL;
-    if (res)
-        PaintText(*res);
-}
-
 void MHPhi::Paint(Option_t *o)
 {
@@ -472,6 +460,12 @@
     if (opt=="update")
         PaintUpdate();
-    if (opt=="result")
-        PaintResult();
+    if (opt=="result1")
+        PaintText(fHPhi);
+    if (opt=="result4")
+    {
+        TH1D *res = gPad ? dynamic_cast<TH1D*>(gPad->FindObject("Result")) : NULL;
+        if (res)
+            PaintText(*res);
+    }
 }
 
Index: trunk/MagicSoft/Mars/mhflux/MHPhi.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHPhi.h	(revision 7617)
+++ trunk/MagicSoft/Mars/mhflux/MHPhi.h	(revision 7618)
@@ -37,5 +37,4 @@
     // Paint
     void PaintUpdate() const;
-    void PaintResult() const;
     void PaintText(const TH1D &res) const;
 
