Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7970)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7971)
@@ -18,4 +18,17 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2006/09/26 Thomas Bretz
+
+   * mbase/MMath.h:
+     - added new function ModF
+
+   * mhist/MHRate.cc, mhist/MHWeather.cc, mhvstime/MHPixVsTime.cc,
+     mhvstime/MHSectorVsTime.cc, mhvstime/MHVsTime.cc,
+     mpointing/MHPointing.cc:
+     - made the update of the axis ranges work again
+
+
+
  2006/09/26 Daniela Dorner
 
Index: trunk/MagicSoft/Mars/mbase/MMath.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.h	(revision 7970)
+++ trunk/MagicSoft/Mars/mbase/MMath.h	(revision 7971)
@@ -52,4 +52,6 @@
     TArrayD LeastSqFitPowerLaw(Int_t n, Double_t *x, Double_t *y);
 
+    inline Int_t ModF(Double_t dbl, Double_t &frac) { Double_t rc; frac = modf(dbl, &rc); return TMath::Nint(rc); }
+
     inline Double_t Sgn(Double_t d) { return d<0 ? -1 : 1; }
 }
Index: trunk/MagicSoft/Mars/mhist/MHRate.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRate.cc	(revision 7970)
+++ trunk/MagicSoft/Mars/mhist/MHRate.cc	(revision 7971)
@@ -182,7 +182,21 @@
 void MHRate::DrawGraph(TGraph &g, const char *y) const
 {
+    // If this is set to early the plot remains empty in root 5.12/00
+    if (g.GetN()>0)
+        g.SetMinimum(0);
+
+    // This is not done automatically anymore since root 5.12/00
+    // and it is necessary to force a proper update of the axis.
     TH1 *h = g.GetHistogram();
     if (h)
     {
+        delete h;
+        g.SetHistogram(0);
+        h = g.GetHistogram();
+    }
+
+    if (h)
+    {
+        cout << "Y";
         TAxis *axe = h->GetXaxis();
         axe->SetLabelSize(0.033);
@@ -287,8 +301,4 @@
 void MHRate::Paint(Option_t *o)
 {
-    // If this is set to early the plot remains empty in root 5.12/00
-    if (fRateTime.GetN()>0)
-        fRateTime.SetMinimum(0);
-
     DrawGraph(fRateTime, "f [Hz]");
     /*
Index: trunk/MagicSoft/Mars/mhist/MHWeather.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHWeather.cc	(revision 7970)
+++ trunk/MagicSoft/Mars/mhist/MHWeather.cc	(revision 7971)
@@ -160,4 +160,10 @@
     if (h)
     {
+        delete h;
+        g.SetHistogram(0);
+        h = g.GetHistogram();
+    }
+    if (h)
+    {
         TAxis *axe = h->GetXaxis();
         axe->SetLabelSize(0.033);
Index: trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc	(revision 7970)
+++ trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc	(revision 7971)
@@ -224,5 +224,13 @@
     TString str(opt);
 
+    // This is not done automatically anymore since root 5.12/00
+    // and it is necessary to force a proper update of the axis.
     TH1 *h = fGraph->GetHistogram();
+    if (h)
+    {
+        delete h;
+        fGraph->SetHistogram(0);
+        h = fGraph->GetHistogram();
+    }
 
     h->SetXTitle("Time");
Index: trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc	(revision 7970)
+++ trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc	(revision 7971)
@@ -291,5 +291,13 @@
     }
 
+    // This is not done automatically anymore since root 5.12/00
+    // and it is necessary to force a proper update of the axis.
     TH1 *h = fGraph->GetHistogram();
+    if (h)
+    {
+        delete h;
+        fGraph->SetHistogram(0);
+        h = fGraph->GetHistogram();
+    }
 
     h->SetXTitle("Time");
Index: trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc	(revision 7970)
+++ trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc	(revision 7971)
@@ -264,5 +264,4 @@
      while ((obj=Next())) *fLog << obj << " " << obj->GetName() << " " << obj->ClassName() << " " << Next.GetOption() << endl;
      */
-
     if (!fGraph)
         return;
@@ -284,13 +283,26 @@
     }
 
-    // SetPoint deletes the histogram!
-    if (fUseEventNumber)
-        fGraph->GetHistogram()->SetXTitle("Event Number");
-    else
-    {
-        fGraph->GetHistogram()->SetXTitle("Time");
-        fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
-        fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
-        fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
+    // This is not done automatically anymore since root 5.12/00
+    // and it is necessary to force a proper update of the axis.
+    TH1 *h = fGraph->GetHistogram();
+    if (h)
+    {
+        delete h;
+        fGraph->SetHistogram(0);
+        h = fGraph->GetHistogram();
+    }
+    if (h)
+    {
+        TAxis *axe = h->GetXaxis();
+        // SetPoint deletes the histogram!
+        if (fUseEventNumber)
+            axe->SetTitle("Event Number");
+        else
+        {
+            axe->SetTitle("Time");
+            axe->SetLabelSize(0.033);
+            axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
+            axe->SetTimeDisplay(1);
+        }
     }
 
@@ -300,6 +312,6 @@
     // This is a workaround if the TGraph has only one point.
     // Otherwise MStatusDisplay::Update hangs.
-    gPad->GetListOfPrimitives()->Remove(fGraph);
-    fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
+//    gPad->GetListOfPrimitives()->Remove(fGraph);
+//    fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
     //gPad->GetListOfPrimitives()->Add(fGraph, fGraph->GetN()<2 ? "A" : opt);
     //    AppendPad(str);
@@ -319,4 +331,6 @@
     pad->SetBorderMode(0);
     AppendPad(opt);
+
+    fGraph->Draw("A");
 }
 
Index: trunk/MagicSoft/Mars/mpointing/MHPointing.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MHPointing.cc	(revision 7970)
+++ trunk/MagicSoft/Mars/mpointing/MHPointing.cc	(revision 7971)
@@ -214,5 +214,13 @@
 void MHPointing::DrawGraph(TGraph &g, const char *y) const
 {
+    // This is not done automatically anymore since root 5.12/00
+    // and it is necessary to force a proper update of the axis.
     TH1 *h = g.GetHistogram();
+    if (h)
+    {
+        delete h;
+        g.SetHistogram(0);
+        h = g.GetHistogram();
+    }
     if (h)
     {
