Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 9302)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 9303)
@@ -46,11 +46,8 @@
 #include "MHAlpha.h"
 
-#include <TF1.h>
-#include <TGraph.h>
 #include <TStyle.h>
 #include <TLatex.h>
 #include <TCanvas.h>
 #include <TPaveStats.h>
-#include <TStopwatch.h>
 
 #include "MSrcPosCam.h"
@@ -82,5 +79,5 @@
 MHAlpha::MHAlpha(const char *name, const char *title)
     : fNameParameter("MHillasSrc"), fParameter(0),
-    fOffData(0), fResult(0), fEnergy(0), fBin(0),
+    fOffData(0), fResult(0), fSigma(0), fEnergy(0), fBin(0),
     fPointPos(0), fTimeEffOn(0), fTime(0), fNumTimeBins(10),
     fHillas(0), fMatrix(0), fSkipHistTime(kFALSE), fSkipHistTheta(kFALSE),
@@ -100,4 +97,5 @@
     fHist.SetDirectory(NULL);
     fHist.UseCurrentStyle();
+    fHist.Sumw2();
 
     // Main histogram
@@ -107,5 +105,5 @@
     fHistTime.UseCurrentStyle();
     fHistTime.SetDirectory(NULL);
-
+    fHistTime.Sumw2();
 
     fHEnergy.SetName("Excess");
@@ -115,4 +113,5 @@
     fHEnergy.SetDirectory(NULL);
     fHEnergy.UseCurrentStyle();
+    fHEnergy.Sumw2();
 
     fHTheta.SetName("ExcessTheta");
@@ -123,4 +122,5 @@
     fHTheta.UseCurrentStyle();
     fHTheta.SetMinimum(0);
+    fHTheta.Sumw2();
 
     // effective on time versus time
@@ -1024,20 +1024,13 @@
     pave->SetLabel(title);
 
-    char txt[1000];
-    TText *ptxt;
-    sprintf(txt, " ");
-    ptxt = pave->AddText(txt);
+    TText *ptxt = pave->AddText(" ");
     ptxt->SetTextAlign(23);
 
-    //sprintf(txt, "Significance %.1f\\sigma,  off-scale %.2f  (\\omega=%.2f\\circ)",
-    //        fFit.GetSignificance(), fFit.GetScaleFactor(), fFit.GetGausSigma());
-    sprintf(txt, "Significance %.1f\\sigma,  off-scale %.2f",
-            fit.GetSignificance(), fit.GetScaleFactor());
-    ptxt = pave->AddText(txt);
+    ptxt = pave->AddText(MString::Format("Significance %.1f\\sigma,  off-scale %.2f",
+                                         fit.GetSignificance(), fit.GetScaleFactor()));
     ptxt->SetTextAlign(23);
 
-    sprintf(txt, "%.1f excess events,  %.1f background events",
-            fit.GetEventsExcess(), fit.GetEventsBackground());
-    ptxt = pave->AddText(txt);
+    ptxt = pave->AddText(MString::Format("%.1f excess events,  %.1f background events",
+                                         fit.GetEventsExcess(), fit.GetEventsBackground()));
     ptxt->SetTextAlign(23);
     pave->SetBit(kCanDelete);
@@ -1062,15 +1055,15 @@
     if (!fSkipHistEnergy)
     {
-        *fLog << inf << "Processing energy bins..." << endl;
+        *fLog << inf3 << "Processing energy bins..." << endl;
         FitEnergyBins();
     }
     if (!fSkipHistTheta)
     {
-        *fLog << inf << "Processing theta bins..." << endl;
+        *fLog << inf3 << "Processing theta bins..." << endl;
         FitThetaBins();
     }
     if (!fSkipHistTime)
     {
-        *fLog << inf << "Processing time bins..." << endl;
+        *fLog << inf3 << "Processing time bins..." << endl;
         UpdateAlphaTime(kTRUE);
         MH::RemoveFirstBin(fHTime);
@@ -1164,2 +1157,8 @@
     return gPad->GetPad(1)->DistancetoPrimitive(px,py)==0 ? 0 : 9999;
 }
+
+void MHAlpha::RecursiveRemove(TObject *obj)
+{
+    if (obj==fOffData)
+        fOffData = 0;
+}
Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.h	(revision 9302)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.h	(revision 9303)
@@ -152,4 +152,5 @@
     void Paint(Option_t *opt="");
     void Draw(Option_t *option="");
+    void RecursiveRemove(TObject *obj);
 
     // MParContainer
Index: trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc	(revision 9302)
+++ trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc	(revision 9303)
@@ -280,4 +280,5 @@
 
 #include "MTime.h"
+#include "MString.h"
 #include "MParameters.h"
 #include "MPointingPos.h"
@@ -609,5 +610,5 @@
 
     // Use a random name to make sure the object is unique
-    const TString name = Form("CalcTheta%d", (UInt_t)gRandom->Uniform(999999999));
+    const TString name = MString::Format("CalcTheta%d", (UInt_t)gRandom->Uniform(999999999));
 
     // nbins = number of Theta bins
@@ -795,9 +796,9 @@
     text.SetTextSize(0.04);
 
-    TString txt = Form("T_{eff} = %.1fs \\pm %.1fs", val, error);
+    TString txt = MString::Format("T_{eff} = %.1fs \\pm %.1fs", val, error);
     if (range>0)
-        txt += Form("     T_{axe} = %.1fs", range);
+        txt += MString::Format("     T_{axe} = %.1fs", range);
     if (fTotalTime>0)
-        txt += Form("     T_{max} = %.1fs", fTotalTime);
+        txt += MString::Format("     T_{max} = %.1fs", fTotalTime);
 
     text.SetText(0.35, 0.94, txt);
@@ -807,6 +808,6 @@
 void MHEffectiveOnTime::PaintText(Double_t *res) const
 {
-    TLatex text(0.27, 0.94, Form("T_{eff}=%.1fs\\pm%.1fs  \\lambda=%.1f\\pm%.1fHz  p=%.1f%%  \\chi^{2}/%d=%.1f",
-                                 res[0], res[1], res[3], res[4], res[2], (int)res[5], res[6]/res[5]));
+    TLatex text(0.27, 0.94, MString::Format("T_{eff}=%.1fs\\pm%.1fs  \\lambda=%.1f\\pm%.1fHz  p=%.1f%%  \\chi^{2}/%d=%.1f",
+                                            res[0], res[1], res[3], res[4], res[2], (int)res[5], res[6]/res[5]));
     text.SetBit(TLatex::kTextNDC);
     text.SetTextSize(0.04);
@@ -828,5 +829,5 @@
         return;
 
-    TLatex text(0.47, 0.94, Form("\\bar{p} = %.1f%%", sum/n));
+    TLatex text(0.47, 0.94, MString::Format("\\bar{p} = %.1f%%", sum/n));
     text.SetBit(TLatex::kTextNDC);
     text.SetTextSize(0.04);
Index: trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 9302)
+++ trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 9303)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHFalseSource.cc,v 1.24 2009-02-07 16:11:57 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHFalseSource.cc,v 1.25 2009-02-07 20:47:33 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -243,8 +243,8 @@
     fMm2Deg = geom->GetConvMm2Deg();
 
-    const TString off(Form("%sOff", fName.Data()));
+    const TString off(MString::Format("%sOff", fName.Data()));
     if (fName!=off && fHistOff==NULL)
     {
-        const TString desc(Form("%s [%s] found... using ", off.Data(), ClassName()));
+        const TString desc(MString::Format("%s [%s] found... using ", off.Data(), ClassName()));
         MHFalseSource *hoff = (MHFalseSource*)plist->FindObject(off, ClassName());
         if (!hoff)
@@ -1143,7 +1143,7 @@
     if (maxx>0 && maxy>0)
     {
-        const char *title = MString::Format(" \\alpha for x=%.2f y=%.2f (S_{max}=%.1f\\sigma) ",
-                                            hist->GetXaxis()->GetBinCenter(maxx),
-                                            hist->GetYaxis()->GetBinCenter(maxy), maxs);
+        const TString title = MString::Format(" \\alpha for x=%.2f y=%.2f (S_{max}=%.1f\\sigma) ",
+                                              hist->GetXaxis()->GetBinCenter(maxx),
+                                              hist->GetYaxis()->GetBinCenter(maxy), maxs);
 
         h = fHist.ProjectionZ("AlphaFit", maxx, maxx, maxy, maxy);
