Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 5143)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 5300)
@@ -299,5 +299,5 @@
         return;
 
-    const Int_t steps = 6;
+    const Int_t steps = 10;
 
     static int rebin = steps;
@@ -398,5 +398,5 @@
 void MHAlpha::PaintText(Double_t val, Double_t error) const
 {
-    TLatex text(0.45, 0.94, Form("N_{exc} = %.1fs \\pm %.1fs", val, error));
+    TLatex text(0.45, 0.94, Form("N_{exc} = %.1f \\pm %.1f", val, error));
     text.SetBit(TLatex::kTextNDC);
     text.SetTextSize(0.04);
@@ -463,5 +463,5 @@
     if (o==(TString)"energy")
     {
-        if (fHEnergy.GetEntries()>10)
+        if (fHEnergy.GetMaximum()>1)
         {
             gPad->SetLogx();
@@ -542,4 +542,5 @@
     // Store the final result in fFit
     TH1D *h = fHAlpha.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E");
+    h->SetDirectory(0);
     fFit.Print();
     Bool_t rc = fFit.Fit(*h);
Index: trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 5143)
+++ trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 5300)
@@ -120,4 +120,5 @@
 #include <TStyle.h>
 #include <TCanvas.h>
+#include <TRandom.h>
 #include <TPaveText.h>
 #include <TStopwatch.h>
@@ -146,4 +147,6 @@
 using namespace std;
 
+class MHillasExt;
+
 // --------------------------------------------------------------------------
 //
@@ -152,5 +155,5 @@
 MHFalseSource::MHFalseSource(const char *name, const char *title)
     : fTime(0), fPointPos(0), fObservatory(0), fMm2Deg(-1), fAlphaCut(12.5),
-    fBgMean(55), fMinDist(-1), fMaxDist(-1), fMinLD(-1), fMaxLD(-1)
+    fBgMean(55), fMinDist(-1), fMaxDist(-1), fMinDW(-1), fMaxDW(-1)
 {
     //
@@ -244,5 +247,6 @@
 //
 // Also search for MTime, MObservatory and MPointingPos
-// 
+//
+MHillasExt *ext=0;
 Bool_t MHFalseSource::SetupFill(const MParList *plist)
 {
@@ -251,4 +255,10 @@
     {
         *fLog << err << "MGeomCam not found... aborting." << endl;
+        return kFALSE;
+    }
+    ext = (MHillasExt*)plist->FindObject("MHillasExt");
+    if (!ext)
+    {
+        *fLog << err << "MHillasExt not found... aborting." << endl;
         return kFALSE;
     }
@@ -355,5 +365,5 @@
 
             // Source dependant hillas parameters
-            if (hsrc.Calc(*hil)>0)
+            if (hsrc.Calc(*hil, ext)>0)
             {
                 *fLog << warn << "Calculation of MHillasSrc failed for x=" << cx[ix] << " y=" << cy[iy] << endl;
@@ -369,7 +379,7 @@
                 continue;
 
-            if (fMaxLD>0 && hil->GetLength()>fMaxLD*hsrc.GetDist())
+            if (fMaxDW>0 && hsrc.GetDist()>fMaxDW*hil->GetWidth())
                 continue;
-            if (fMinLD>0 && hil->GetLength()<fMinLD*hsrc.GetDist())
+            if (fMinDW<0 && hsrc.GetDist()<fMinDW*hil->GetWidth())
                 continue;
 
@@ -462,5 +472,6 @@
 
     // Get projection for range
-    TH2D *p = (TH2D*)fHist.Project3D("yx_all");
+    TH2D *p = (TH2D*)fHist.Project3D(Form("yx_%d", gRandom->Uniform(999999)));
+    p->SetDirectory(0);
 
     // Move contents from projection to h3
