Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7038)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7064)
@@ -293,10 +293,13 @@
 {
     const Double_t w  = GetGausSigma();
-    const Int_t    l  = w<=0 ? 0 : (Int_t)TMath::Ceil(-TMath::Log10(w));
-    const TString fmt = Form("\\sigma_{Li/Ma}=%%.1f  \\omega=%%.%df\\circ  E=%%d  (\\alpha<%%.1f\\circ)  (\\chi_{b}^{2}/ndf=%%.1f  \\chi_{s}^{2}/ndf=%%.1f  c_{0}=%%.1f)",
-                             l<1?1:l);
+    const Double_t m  = fIntegralMax;
+
+    const Int_t    l1 = w<=0 ? 0 : (Int_t)TMath::Ceil(-TMath::Log10(w));
+    const Int_t    l2 = m<=0 ? 0 : (Int_t)TMath::Ceil(-TMath::Log10(m));
+    const TString fmt = Form("\\sigma_{Li/Ma}=%%.1f  \\omega=%%.%df\\circ  E=%%d  B=%%d  (x<%%.%df)  (\\chi_{b}^{2}/ndf=%%.1f  \\chi_{s}^{2}/ndf=%%.1f  c_{0}=%%.1f)",
+                             l1<1?1:l1+1, l2<1?1:l2+1);
 
     TLatex text(x, y, Form(fmt.Data(), fSignificance, w, (int)fEventsExcess,
-                           fIntegralMax, fChiSqBg, fChiSqSignal,
+                           fEventsBackground, m, fChiSqBg, fChiSqSignal,
                            fCoefficients[3]));
 
Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h	(revision 7038)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h	(revision 7064)
@@ -109,4 +109,6 @@
         fCoefficients.Set(3+s+1); fCoefficients.Reset(); }
 
+    Double_t GetSignalIntegralMax() const  { return fSigInt; }
+
     Double_t GetEventsExcess() const       { return fEventsExcess; }
     Double_t GetEventsSignal() const       { return fEventsSignal; }
Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 7038)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 7064)
@@ -148,9 +148,4 @@
 }
 
-Double_t MHAlpha::GetVal() const
-{
-    return static_cast<const MHillasSrc*>(fParameter)->GetAlpha();
-}
-
 Float_t MHAlpha::FitEnergyBins(Bool_t paint)
 {
@@ -206,4 +201,21 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Return the value from fParemeter which should be filled into the plots
+//
+Double_t MHAlpha::GetVal() const
+{
+    return static_cast<const MHillasSrc*>(fParameter)->GetAlpha();
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Store the pointer to the parameter container storing the plotted value
+// (here MHillasSrc) in fParameter.
+//
+// return whether it was found or not.
+//
 Bool_t MHAlpha::GetParameter(const MParList &pl)
 {
@@ -921,2 +933,12 @@
     return rc;
 }
+
+Int_t MHAlpha::DistancetoPrimitive(Int_t px, Int_t py)
+{
+    // If pad has no subpad return (we are in one of the subpads)
+    if (gPad->GetPad(1)==NULL)
+        return 9999;
+
+    // If pad has a subpad we are in the main pad. Check its value.
+    return gPad->GetPad(1)->DistancetoPrimitive(px,py)==0 ? 0 : 9999;
+}
Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.h	(revision 7038)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.h	(revision 7064)
@@ -34,9 +34,9 @@
     MParContainer *fParameter;  //!
 
-private:
     const TH3D *fOffData;
 
     MAlphaFitter fFit;          // SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT)
 
+private:
     TH1D fHEnergy;              // excess events vs energy
     TH1D fHTheta;               // excess events vs theta
@@ -74,5 +74,5 @@
     void PaintText(Double_t val, Double_t error) const;
 
-    Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
+    Int_t DistancetoPrimitive(Int_t px, Int_t py);
 
     virtual Bool_t      GetParameter(const MParList &pl);
Index: trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc	(revision 7038)
+++ trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc	(revision 7064)
@@ -29,4 +29,7 @@
 // This is a MHAlpha using "ThetaSquared [MParameterD]" as 'alpha'
 //
+// The default binning is determined from the integration range set in
+// MAlphaFitter.
+//
 // For more detailes see MHAlpha.
 //
@@ -39,4 +42,6 @@
 #include "MBinning.h"
 #include "MParList.h"
+#include "MTaskList.h"
+#include "MParameters.h"
 
 #include "MLog.h"
@@ -88,4 +93,51 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Overwrites the binning in Alpha (ThetaSq) with a binning for which
+// the upper edge of the 5th bin (bin=5) fit the signal integration window.
+// In total 75 bins are setup.
+//
+// In case of fOffData!=NULL the binnings are taken later from fOffData anyhow.
+//
+Bool_t MHThetaSq::SetupFill(const MParList *pl)
+{
+    // Default is from default fitter
+    // if a user defined fitter is in the parlist: use this range
+    MAlphaFitter *fit = (MAlphaFitter*)pl->FindObject("MAlphaFitter");
+    if (!fit)
+        fit = &fFit;
+
+    MParameterD *cut = (MParameterD*)pl->FindObject("ThetaSquaredCut", "MParameterD");
+    if (cut)
+        fit->SetSignalIntegralMax(cut->GetVal());
+
+    // Get Histogram binnings
+    MBinning binst, binse;
+    binst.SetEdges(fHist, 'x');
+    binse.SetEdges(fHist, 'y');
+
+    // Calculate bining which fits alpha-cut
+    const Double_t intmax = fit->GetSignalIntegralMax();
+    const UInt_t   nbins  = 75;
+    const UInt_t   nsig   =  5;
+
+    MBinning binsa(nbins, 0, nbins*intmax/nsig);
+
+    // Apply binning
+    binsa.Apply(fHistTime);
+    MH::SetBinning(&fHist, &binst, &binse, &binsa);
+
+    // Remark: Binnings might be overwritten in MHAlpha::SetupFill
+    return MHAlpha::SetupFill(pl);
+}
+
+// --------------------------------------------------------------------------
+//
+// Store the pointer to the parameter container storing the plotted value
+// (here ThetaSq) in fParameter.
+//
+// return whether it was found or not.
+//
 Bool_t MHThetaSq::GetParameter(const MParList &pl)
 {
@@ -98,4 +150,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Return the value from fParemeter which should be filled into the plots
+//
 Double_t MHThetaSq::GetVal() const
 {
Index: trunk/MagicSoft/Mars/mhflux/MHThetaSq.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThetaSq.h	(revision 7038)
+++ trunk/MagicSoft/Mars/mhflux/MHThetaSq.h	(revision 7064)
@@ -6,8 +6,10 @@
 #endif
 
+class MTaskList;
+
 class MHThetaSq : public MHAlpha
 {
 private:
-    MParameterD  *fThetaSq;     //!
+    MParameterD  *fThetaSq; //!
 
     Bool_t      GetParameter(const MParList &pl);
@@ -18,4 +20,6 @@
     }
 
+    Bool_t SetupFill(const MParList *pl);
+
 public:
     MHThetaSq(const char *name=NULL, const char *title=NULL);
