Index: trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 5299)
+++ trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 5300)
@@ -632,5 +632,8 @@
     // gcc 3.2:
     char *txt = (char*)"logXXXXXX";
-    fOut = fname ? new ofstream(fname) : new ofstream(/*mkstemp(*/txt/*)*/);
+
+    TString n(fname ? fname : txt);
+    gSystem->ExpandPathName(n);
+    fOut = new ofstream(n.Data());
     fOutAllocated = kTRUE;
 }
Index: trunk/MagicSoft/Mars/mfbase/MF.cc
===================================================================
--- trunk/MagicSoft/Mars/mfbase/MF.cc	(revision 5299)
+++ trunk/MagicSoft/Mars/mfbase/MF.cc	(revision 5300)
@@ -48,4 +48,6 @@
 //   "{log10(MHillas.fSize)}>3"
 //
+// For more details on available functions and expressions see MDataChain!
+//
 // The allowed logigal conditionals are:
 //   &&: logical and
Index: trunk/MagicSoft/Mars/mhbase/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 5299)
+++ trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 5300)
@@ -478,45 +478,31 @@
 
     // FIXME: Do it in Paint()
-    if (str.Contains("COL", TString::kIgnoreCase))
+    /*
+     if (str.Contains("COL", TString::kIgnoreCase))
+    {
         SetColors();
-
-    if (fHist->TestBit(kIsLogx) && fHist->GetEntries()>0) gPad->SetLogx();
-    if (fHist->TestBit(kIsLogy) && fHist->GetEntries()>0) gPad->SetLogy();
-    if (fHist->TestBit(kIsLogz) && fHist->GetEntries()>0) gPad->SetLogz();
-
-    // Set pretty color palette
-    gStyle->SetPalette(1, 0);
-
-    TVirtualPad *padsave = gPad;
-
-    TProfile* h0;
-    if ((h0 = (TProfile*)gPad->FindObject(fNameProfX)))
-    {
-        // Get projection for range
-        TProfile *p = ((TH2*)fHist)->ProfileX(fNameProfX, -1, 9999, "s");
-
-        // Move contents from projection to h3
-        h0->Reset();
-        h0->Add(p);
-        delete p;
-
-        // Set Minimum as minimum value Greater Than 0
-        //h0->SetMinimum(GetMinimumGT(*h0));
-    }
-    if ((h0 = (TProfile*)gPad->FindObject(fNameProfY)))
-    {
-        // Get projection for range
-        TProfile *p = ((TH2*)fHist)->ProfileY(fNameProfY, -1, 9999, "s");
-
-        // Move contents from projection to h3
-        h0->Reset();
-        h0->Add(p);
-        delete p;
-
-        // Set Minimum as minimum value Greater Than 0
-        //h0->SetMinimum(GetMinimumGT(*h0));
-    }
-
-    gPad = padsave;
+        return;
+    }
+    */
+
+    if (str.Contains("log", TString::kIgnoreCase))
+    {
+        if (fHist->TestBit(kIsLogx) && fHist->GetEntries()>0) gPad->SetLogx();
+        if (fHist->TestBit(kIsLogy) && fHist->GetEntries()>0) gPad->SetLogy();
+        if (fHist->TestBit(kIsLogz) && fHist->GetEntries()>0) gPad->SetLogz();
+    }
+
+    if (str.Contains("upd", TString::kIgnoreCase))
+    {
+
+        // Set pretty color palette
+        // gStyle->SetPalette(1, 0);
+
+        TProfile* h0;
+        if ((h0 = (TProfile*)gPad->FindObject(fNameProfX)))
+            ((TH2*)fHist)->ProfileX(fNameProfX, -1, 9999, "s");
+        if ((h0 = (TProfile*)gPad->FindObject(fNameProfY)))
+            ((TH2*)fHist)->ProfileY(fNameProfY, -1, 9999, "s");
+    }
 }
 
@@ -550,4 +536,6 @@
     if (!only)
         fHist->Draw(str);
+
+    AppendPad("upd");
 
     if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2)
@@ -562,4 +550,5 @@
     {
         TProfile *p = ((TH2*)fHist)->ProfileY(fNameProfY, -1, 9999, "s");
+        p->UseCurrentStyle();
         p->SetLineColor(kBlue);
         p->Draw(only?"":"same");
@@ -568,5 +557,5 @@
     }
 
-    AppendPad("");
+    AppendPad("log");
 }
 
Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 5299)
+++ 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 5299)
+++ 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
Index: trunk/MagicSoft/Mars/star.cc
===================================================================
--- trunk/MagicSoft/Mars/star.cc	(revision 5299)
+++ trunk/MagicSoft/Mars/star.cc	(revision 5300)
@@ -105,4 +105,5 @@
         arg.Print("options");
         gLog << endl;
+        return -1;
     }
 
