Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9280)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9281)
@@ -18,4 +18,17 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2009/01/29 Thomas Bretz
+
+   * melectronics/MPulseShape.cc:
+     - changed spline range from -25/25 to -8/8
+
+   * mhflux/MAlphaFitter.cc, mhflux/MHAlpha.cc, mhflux/MHDisp.cc:
+     - for sanity (thread safety) replaced Form by MString::Format
+
+   * mhflux/MHDisp.cc:
+     - initialize fHalf as suggested by valgrind
+
+
 
  2009/01/27 Thomas Bretz
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 9280)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 9281)
@@ -121,4 +121,6 @@
    * If the source position is more than 1deg away from the camera
      center an error is raised now.
+
+   * Hopefully fixed the bug ''ganymed crashes when resized''
 
  ;sponde
Index: /trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 9280)
+++ /trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 9281)
@@ -63,4 +63,5 @@
 
 #include "MMath.h"
+#include "MString.h"
 
 #include "MLogManip.h"
@@ -413,9 +414,9 @@
     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_{L/M}=%%.1f  \\omega=%%.%df\\circ  E=%%d B=%%d  x<%%.%df  \\tilde\\chi_{b}=%%.1f  \\tilde\\chi_{s}=%%.1f  c=%%.1f  f=%%.2f",
-                             l1<1?1:l1+1, l2<1?1:l2+1);
-    const TString txt = Form(fmt.Data(), fSignificance, w, (int)fEventsExcess,
-                             (int)fEventsBackground, m, fChiSqBg, fChiSqSignal,
-                             fCoefficients[3], fScaleFactor);
+    const TString fmt = MString::Format("\\sigma_{L/M}=%%.1f  \\omega=%%.%df\\circ  E=%%d B=%%d  x<%%.%df  \\tilde\\chi_{b}=%%.1f  \\tilde\\chi_{s}=%%.1f  c=%%.1f  f=%%.2f",
+                                        l1<1?1:l1+1, l2<1?1:l2+1);
+    const TString txt = MString::Format(fmt.Data(), fSignificance, w, (int)fEventsExcess,
+                                        (int)fEventsBackground, m, fChiSqBg, fChiSqSignal,
+                                        fCoefficients[3], fScaleFactor);
 
     // This is totaly weired but the only way to get both options
@@ -525,5 +526,5 @@
 Bool_t MAlphaFitter::FitEnergy(const TH3D &hon, UInt_t bin, Bool_t paint)
 {
-    const TString name(Form("TempAlphaEnergy%06d", gRandom->Integer(1000000)));
+    const TString name(MString::Format("TempAlphaEnergy%06d", gRandom->Integer(1000000)));
     TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, bin, bin, "E");
     h->SetDirectory(0);
@@ -536,5 +537,5 @@
 Bool_t MAlphaFitter::FitTheta(const TH3D &hon, UInt_t bin, Bool_t paint)
 {
-    const TString name(Form("TempAlphaTheta%06d", gRandom->Integer(1000000)));
+    const TString name(MString::Format("TempAlphaTheta%06d", gRandom->Integer(1000000)));
     TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E");
     h->SetDirectory(0);
@@ -562,5 +563,5 @@
 Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, Bool_t paint)
 {
-    const TString name(Form("TempAlpha%06d", gRandom->Integer(1000000)));
+    const TString name(MString::Format("TempAlpha%06d", gRandom->Integer(1000000)));
     TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
     h->SetDirectory(0);
@@ -573,6 +574,6 @@
 Bool_t MAlphaFitter::FitEnergy(const TH3D &hon, const TH3D &hof, UInt_t bin, Bool_t paint)
 {
-    const TString name1(Form("TempAlpha%06d_on",  gRandom->Integer(1000000)));
-    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
+    const TString name1(MString::Format("TempAlpha%06d_on",  gRandom->Integer(1000000)));
+    const TString name0(MString::Format("TempAlpha%06d_off", gRandom->Integer(1000000)));
 
     TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
@@ -591,6 +592,6 @@
 Bool_t MAlphaFitter::FitTheta(const TH3D &hon, const TH3D &hof, UInt_t bin, Bool_t paint)
 {
-    const TString name1(Form("TempAlpha%06d_on",  gRandom->Integer(1000000)));
-    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
+    const TString name1(MString::Format("TempAlpha%06d_on",  gRandom->Integer(1000000)));
+    const TString name0(MString::Format("TempAlpha%06d_off", gRandom->Integer(1000000)));
 
     TH1D *h1 = hon.ProjectionZ(name1, bin, bin, 0, hon.GetNbinsY()+1, "E");
@@ -633,6 +634,6 @@
 Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, const TH3D &hof, Bool_t paint)
 {
-    const TString name1(Form("TempAlpha%06d_on",  gRandom->Integer(1000000)));
-    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
+    const TString name1(MString::Format("TempAlpha%06d_on",  gRandom->Integer(1000000)));
+    const TString name0(MString::Format("TempAlpha%06d_off", gRandom->Integer(1000000)));
 
     TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
@@ -651,6 +652,6 @@
 Bool_t MAlphaFitter::ApplyScaling(const TH3D &hon, TH3D &hof, UInt_t bin) const
 {
-    const TString name1(Form("TempAlpha%06d_on",  gRandom->Integer(1000000)));
-    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
+    const TString name1(MString::Format("TempAlpha%06d_on",  gRandom->Integer(1000000)));
+    const TString name0(MString::Format("TempAlpha%06d_off", gRandom->Integer(1000000)));
 
     TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
Index: /trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 9280)
+++ /trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 9281)
@@ -65,4 +65,5 @@
 #include "MHMatrix.h"
 
+#include "MString.h"
 #include "MBinning.h"
 #include "MParList.h"
@@ -234,8 +235,8 @@
     fHTime.Reset();
 
-    const TString off(Form("%sOff", fName.Data()));
+    const TString off(MString::Format("%sOff", fName.Data()));
     if (fName!=off && fOffData==NULL)
     {
-        const TString desc(Form("%s [%s] found... using ", off.Data(), ClassName()));
+        const TString desc(MString::Format("%s [%s] found... using ", off.Data(), ClassName()));
         MHAlpha *hoff = (MHAlpha*)pl->FindObject(off, ClassName());
         if (!hoff)
@@ -325,5 +326,5 @@
                 binse.SetEdges(*pl, "BinningSize");
 
-        binsa.SetEdges(*pl, Form("Binning%s", ClassName()+2));
+        binsa.SetEdges(*pl, MString::Format("Binning%s", ClassName()+2));
     }
     else
@@ -513,5 +514,5 @@
 void MHAlpha::PaintText(Double_t val, Double_t error) const
 {
-    TLatex text(0.45, 0.94, Form("N_{exc} = %.1f \\pm %.1f", val, error));
+    TLatex text(0.45, 0.94, MString::Format("N_{exc} = %.1f \\pm %.1f", val, error));
     text.SetBit(TLatex::kTextNDC);
     text.SetTextSize(0.04);
@@ -577,5 +578,5 @@
         if (hon)
         {
-            TH1D *dum = fHist.ProjectionZ("dum", 0, fHist.GetNbinsX()+1, 0, fHist.GetNbinsY()+1);
+            TH1D *dum = fHist.ProjectionZ("dumab", 0, fHist.GetNbinsX()+1, 0, fHist.GetNbinsY()+1);
             dum->SetDirectory(0);
             hon->Reset();
@@ -588,5 +589,5 @@
                 if (hoff)
                 {
-                    TH1D *dum = fOffData->ProjectionZ("dum", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1);
+                    TH1D *dum = fOffData->ProjectionZ("dumxy", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1);
                     dum->SetDirectory(0);
                     hoff->Reset();
@@ -612,4 +613,5 @@
                         hon->SetMinimum(min<0 ? min : 0);
                     }
+
                 }
             }
@@ -641,5 +643,5 @@
     if (o==(TString)"theta")
     {
-        TH1 *h = (TH1*)gPad->FindObject(Form("%s_x", fHist.GetName()));
+        TH1 *h = (TH1*)gPad->FindObject(MString::Format("%s_x", fHist.GetName()));
         if (h)
         {
@@ -656,5 +658,5 @@
     if (o==(TString)"energy")
     {
-        TH1 *h = (TH1*)gPad->FindObject(Form("%s_y", fHist.GetName()));
+        TH1 *h = (TH1*)gPad->FindObject(MString::Format("%s_y", fHist.GetName()));
         if (h)
         {
@@ -1001,8 +1003,8 @@
         wm += wm.IsNull() ? "(" : " (";
         if (binlo>=1)
-            wm += Form("%.1fGeV", fHist.GetYaxis()->GetBinLowEdge(binlo));
+            wm += MString::Format("%.1fGeV", fHist.GetYaxis()->GetBinLowEdge(binlo));
         wm += "-";
         if (binhi<hon->GetNbinsX())
-            wm += Form("%.1fGeV", fHist.GetYaxis()->GetBinLowEdge(binhi+1));
+            wm += MString::Format("%.1fGeV", fHist.GetYaxis()->GetBinLowEdge(binhi+1));
         wm += ")";
     }
Index: /trunk/MagicSoft/Mars/mhflux/MHDisp.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/MHDisp.cc	(revision 9280)
+++ /trunk/MagicSoft/Mars/mhflux/MHDisp.cc	(revision 9281)
@@ -51,4 +51,5 @@
 
 #include "MMath.h"
+#include "MString.h"
 #include "MBinning.h"
 
@@ -70,6 +71,6 @@
 //
 MHDisp::MHDisp(const char *name, const char *title)
-    : fDisp(0), fDeviation(0), fSrcAnti(0), fSmearing(-1), fWobble(kFALSE),
-    fScaleMin(0.325), fScaleMax(0.475)
+    : fDisp(0), fDeviation(0), fSrcAnti(0), fHalf(kFALSE), fSmearing(-1),
+    fWobble(kFALSE), fScaleMin(0.325), fScaleMax(0.475)
 {
     //
@@ -645,5 +646,5 @@
 
     // ----- Pad number 4 -----
-    TString name = Form("%s_4", pad->GetName());
+    TString name = MString::Format("%s_4", pad->GetName());
     TPad *p = new TPad(name,name, 0.525/*0.5025*/, 0.3355, 0.995, 0.995, col, 0, 0);
     p->SetNumber(4);
@@ -665,5 +666,5 @@
     // ----- Pad number 1 -----
     pad->cd();
-    name = Form("%s_1", pad->GetName());
+    name = MString::Format("%s_1", pad->GetName());
     p = new TPad(name,name, 0.005, 0.3355, 0.475/*0.4975*/, 0.995, col, 0, 0);
     p->SetNumber(1);
@@ -685,5 +686,5 @@
     // ----- Pad number 2 -----
     pad->cd();
-    name = Form("%s_2", pad->GetName());
+    name = MString::Format("%s_2", pad->GetName());
     p = new TPad(name,name, 0.005, 0.005, 0.2485, 0.3315, col, 0, 0);
     p->SetNumber(2);
@@ -694,5 +695,5 @@
     // ----- Pad number 3 -----
     pad->cd();
-    name = Form("%s_3", pad->GetName());
+    name = MString::Format("%s_3", pad->GetName());
     p = new TPad(name,name, 0.2525, 0.005, 0.4985, 0.3315, col, 0, 0);
     p->SetNumber(3);
@@ -714,5 +715,5 @@
     // ----- Pad number 5 -----
     pad->cd();
-    name = Form("%s_5", pad->GetName());
+    name = MString::Format("%s_5", pad->GetName());
     p = new TPad(name,name, 0.5025, 0.005, 0.7485, 0.3315, col, 0, 0);
     p->SetNumber(5);
@@ -730,5 +731,5 @@
     // ----- Pad number 6 -----
     pad->cd();
-    name = Form("%s_6", pad->GetName());
+    name = MString::Format("%s_6", pad->GetName());
     p = new TPad(name,name, 0.7525, 0.005, 0.9995, 0.3315, col, 0, 0);
     p->SetNumber(6);
