Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8990)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8991)
@@ -93,4 +93,19 @@
      - removed all the obsolste and confusing projections of the 
        individual sectors and camera halves
+
+   * mhflux/MHAlpha.cc:
+     - replaced EventsExcess/SignificanceExc by just ErrorEvents
+     - for the moment do not propagate Excesses<=0 to the pads 
+       (not to spoil the logarithmic display, this still needs a fix)
+     - replaced -1 in ProjectionZ by the bin numbers (including
+       under- and overflow bins), otherwise it won't work with
+       root 5.20/00
+     - propagate all result to the timing histogram (it is not
+       logarithmic anyway)
+     - made Paint also work with the new implementation of ProjectionZ
+       via Project3D in root 5.20/00 (it won't reuse the correct
+       histogram from the pad :( )
+     - replaced kFullDotMedium by 0 (no marker) where appropriate
+     - changed the rule not to display the time-histogram
 
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 8990)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 8991)
@@ -7,4 +7,7 @@
    * should work now with root 5.20/00
 
+   * Sequences and Datasets are now stored as "MDataSet" and "MSequence"
+     instead of the base name of the file. This makes them easier to 
+     access from the code
 
 
Index: /trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 8990)
+++ /trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 8991)
@@ -164,11 +164,12 @@
             continue;
 
-        if (fit.GetSignificanceExc()<=0)
+        // FIXME: Calculate UL!
+        if (fit.GetEventsExcess()<=0)
             continue;
 
         fHEnergy.SetBinContent(i, fit.GetEventsExcess());
-        fHEnergy.SetBinError(i, fit.GetEventsExcess()/fit.GetSignificanceExc());
-
-        mean += fit.GetSignificanceExc()*fit.GetSignificanceExc();
+        fHEnergy.SetBinError(i, fit.GetErrorExcess());
+
+        mean += fit.GetEventsExcess()*fit.GetEventsExcess()/fit.GetErrorExcess()/fit.GetErrorExcess();
         num++;
     }
@@ -190,9 +191,10 @@
             continue;
 
-        if (fit.GetSignificanceExc()<=0)
+        // FIXME: Calculate UL!
+        if (fit.GetEventsExcess()<=0)
             continue;
 
         fHTheta.SetBinContent(i, fit.GetEventsExcess());
-        fHTheta.SetBinError(i, fit.GetEventsExcess()/fit.GetSignificanceExc());
+        fHTheta.SetBinError(i, fit.GetErrorExcess());
     }
 }
@@ -400,6 +402,7 @@
     MAlphaFitter fit(fFit);
 
-    TH1D *h = fOffData ? fOffData->ProjectionZ("ProjTimeTemp", -1, -1, -1, -1, "E") : 0;
+    TH1D *h = fOffData ? fOffData->ProjectionZ("ProjTimeTemp", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1, "E") : 0;
     const Bool_t rc = fit.ScaleAndFit(fHistTime, h);
+
     if (h)
         delete h;
@@ -418,7 +421,4 @@
         time->Plus1ns();
 
-    // Get number of bins
-    const Int_t n = fHTime.GetNbinsX();
-
     // Enhance binning
     MBinning bins;
@@ -430,11 +430,11 @@
     // Fill histogram
     //
-    if (fit.GetSignificanceExc()>0)
-    {
-        fHTime.SetBinContent(n+1, fit.GetEventsExcess());
-        fHTime.SetBinError(n+1, fit.GetEventsExcess()/fit.GetSignificanceExc());
-    }
-
-    *fLog << all << *fTimeEffOn << ": " << fit.GetEventsExcess() << endl;
+    // Get number of bins
+    const Int_t n = fHTime.GetNbinsX();
+
+    fHTime.SetBinContent(n, fit.GetEventsExcess());
+    fHTime.SetBinError(n,   fit.GetErrorExcess());
+
+    *fLog << all << *fTimeEffOn << " (" << n << "): " << fit.GetEventsExcess() << endl;
 
     fNumRebin = fNumTimeBins;
@@ -549,4 +549,5 @@
 
     TString o(opt);
+
     if (o==(TString)"proj")
     {
@@ -572,29 +573,48 @@
 
         padsave->cd(1);
-        TH1D *hon = fHist.ProjectionZ("Proj");
-        if (fOffData)
-        {
-            TH1D *hoff = fOffData->ProjectionZ("ProjOff");
-            const Double_t alpha = fFit.Scale(*hoff, *hon);
-
-            hon->SetMaximum();
-            hon->SetMaximum(TMath::Max(hon->GetMaximum(), hoff->GetMaximum())*1.05);
-
-            // BE CARFEULL: This is a really weird workaround!
-            hoff->SetMaximum(alpha);
-
-            // For some reason the line-color is resetted
-            hoff->SetLineColor(kRed);
-
-            if ((h0=(TH1D*)gPad->FindObject("ProjOnOff")))
+
+        TH1D *hon = (TH1D*)gPad->FindObject("Proj");
+        if (hon)
+        {
+            TH1D *dum = fHist.ProjectionZ("dum", 0, fHist.GetNbinsX()+1, 0, fHist.GetNbinsY()+1);
+            dum->SetDirectory(0);
+            hon->Reset();
+            hon->Add(dum);
+            delete dum;
+
+            if (fOffData)
             {
-                h0->Reset();
-                h0->Add(hoff, hon, -1);
-                const Float_t min = h0->GetMinimum()*1.05;
-                hon->SetMinimum(min<0 ? min : 0);
+                TH1D *hoff = (TH1D*)gPad->FindObject("ProjOff");
+                if (hoff)
+                {
+                    TH1D *dum = fOffData->ProjectionZ("dum", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1);
+                    dum->SetDirectory(0);
+                    hoff->Reset();
+                    hoff->Add(dum);
+                    delete dum;
+
+                    const Double_t alpha = fFit.Scale(*hoff, *hon);
+
+                    hon->SetMaximum();
+                    hon->SetMaximum(TMath::Max(hon->GetMaximum(), hoff->GetMaximum())*1.05);
+
+                    // BE CARFEULL: This is a really weird workaround!
+                    hoff->SetMaximum(alpha);
+
+                    // For some reason the line-color is resetted
+                    hoff->SetLineColor(kRed);
+
+                    if ((h0=(TH1D*)gPad->FindObject("ProjOnOff")))
+                    {
+                        h0->Reset();
+                        h0->Add(hoff, hon, -1);
+                        const Float_t min = h0->GetMinimum()*1.05;
+                        hon->SetMinimum(min<0 ? min : 0);
+                    }
+                }
             }
-        }
-        else
-            hon->SetMinimum(0);
+            else
+                hon->SetMinimum(0);
+        }
         FitEnergyBins();
         FitThetaBins();
@@ -617,5 +637,5 @@
 
     if (o==(TString)"time")
-        PaintText(fHTime);//.Integral(), 0);
+        PaintText(fHTime);
 
     if (o==(TString)"theta")
@@ -631,5 +651,5 @@
             delete h2;
         }
-        PaintText(fHTheta);//.Integral(), 0);
+        PaintText(fHTheta);
     }
 
@@ -646,5 +666,5 @@
             delete h2;
         }
-        PaintText(fHEnergy);//.Integral(), 0);
+        PaintText(fHEnergy);
 
         if (fHEnergy.GetMaximum()>1)
@@ -686,5 +706,5 @@
     gPad->SetBorderMode(0);
 
-    h = fHist.ProjectionZ("Proj", -1, 9999, -1, 9999, "E");
+    h = fHist.ProjectionZ("Proj", 0, fHist.GetNbinsX()+1, 0, fHist.GetNbinsY()+1, "E");
     h->SetBit(TH1::kNoTitle);
     h->SetStats(kTRUE);
@@ -692,5 +712,5 @@
     h->SetYTitle("Counts");
     h->SetDirectory(NULL);
-    h->SetMarkerStyle(kFullDotMedium);
+    h->SetMarkerStyle(0);
     h->SetBit(kCanDelete);
     h->Draw("");
@@ -702,10 +722,10 @@
         //h->SetLineColor(kGreen);
 
-        h = fOffData->ProjectionZ("ProjOff", -1, 9999, -1, 9999, "E");
+        h = fOffData->ProjectionZ("ProjOff", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1, "E");
         h->SetBit(TH1::kNoTitle);
         h->SetXTitle(fHist.GetZaxis()->GetTitle());
         h->SetYTitle("Counts");
         h->SetDirectory(NULL);
-        h->SetMarkerStyle(kFullDotMedium);
+        h->SetMarkerStyle(0);
         h->SetBit(kCanDelete);
         h->SetMarkerColor(kRed);
@@ -714,10 +734,12 @@
         h->Draw("same"/*"bar same"*/);
 
-        h = (TH1D*)h->Clone("ProjOnOff");
+        // This is the only way to make it work...
+        // Clone and copy constructor give strange crashes :(
+        h = fOffData->ProjectionZ("ProjOnOff", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1, "E");
         h->SetBit(TH1::kNoTitle);
         h->SetXTitle(fHist.GetZaxis()->GetTitle());
         h->SetYTitle("Counts");
         h->SetDirectory(NULL);
-        h->SetMarkerStyle(kFullDotMedium);
+        h->SetMarkerStyle(0);
         h->SetBit(kCanDelete);
         h->SetMarkerColor(kBlue);
@@ -749,5 +771,5 @@
         h->SetYTitle("Counts");
         h->SetDirectory(NULL);
-        h->SetMarkerStyle(kFullDotMedium);
+        h->SetMarkerStyle(kFullDotSmall);
         h->SetBit(kCanDelete);
         h->SetMarkerColor(kCyan);
@@ -758,5 +780,5 @@
         delete pad->GetPad(2);
 
-    if (fTimeEffOn && fTime || fHTime.GetNbinsX()>1 || fHTime.GetBinContent(1)>0)
+    if (fTimeEffOn && fTime || fHTime.GetNbinsX()>1 || fHTime.GetBinContent(1)!=0)
     {
         pad->cd(3);
@@ -785,5 +807,5 @@
         h->SetYTitle("Counts");
         h->SetDirectory(NULL);
-        h->SetMarkerStyle(kFullDotMedium);
+        h->SetMarkerStyle(kFullDotSmall);
         h->SetBit(kCanDelete);
         h->SetMarkerColor(kCyan);
@@ -817,5 +839,5 @@
         gPad->SetFrameBorderMode(0);
 
-        TH1D *hon = fHist.ProjectionZ("Proj", -1, 9999, i, i, "E");
+        TH1D *hon = fHist.ProjectionZ("Proj", 0, fHist.GetNbinsX()+1, i, i, "E");
         hon->SetBit(TH1::kNoTitle);
         hon->SetStats(kTRUE);
@@ -823,5 +845,5 @@
         hon->SetYTitle("Counts");
         hon->SetDirectory(NULL);
-        hon->SetMarkerStyle(kFullDotMedium);
+        hon->SetMarkerStyle(0);
         hon->SetBit(kCanDelete);
         hon->Draw("");
@@ -834,10 +856,10 @@
             hon->SetMarkerColor(kGreen);
 
-            hof = fOffData->ProjectionZ("ProjOff", -1, 9999, i, i, "E");
+            hof = fOffData->ProjectionZ("ProjOff", 0, fOffData->GetNbinsX()+1, i, i, "E");
             hof->SetBit(TH1::kNoTitle|TH1::kNoStats);
             hof->SetXTitle(fHist.GetZaxis()->GetTitle());
             hof->SetYTitle("Counts");
             hof->SetDirectory(NULL);
-            hof->SetMarkerStyle(kFullDotMedium);
+            hof->SetMarkerStyle(0);
             hof->SetBit(kCanDelete);
             hof->SetMarkerColor(kRed);
@@ -856,5 +878,5 @@
             diff->SetYTitle("Counts");
             diff->SetDirectory(NULL);
-            diff->SetMarkerStyle(kFullDotMedium);
+            diff->SetMarkerStyle(0);
             diff->SetBit(kCanDelete);
             diff->SetMarkerColor(kBlue);
@@ -871,5 +893,5 @@
         if (hof ? fit.Fit(*hon, *hof, alpha) : fit.Fit(*hon))
         {
-            *fLog << dbg << "Bin " << i << ": sigmaexc=" << fit.GetSignificanceExc() << " omega=" << fit.GetGausSigma() << " events=" << fit.GetEventsExcess() << " scale=" << fit.GetScaleFactor() << endl;
+            *fLog << dbg << "Bin " << i << ": sigmaexc=" << fit.GetEventsExcess()/fit.GetErrorExcess() << " omega=" << fit.GetGausSigma() << " events=" << fit.GetEventsExcess() << " scale=" << fit.GetScaleFactor() << endl;
             fit.DrawResult();
         }
@@ -909,5 +931,5 @@
 
     // Get on-data
-    TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", -1, 9999, binlo, binhi, "E");
+    TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", 0, fHist.GetNbinsX()+1, binlo, binhi, "E");
     hon->SetDirectory(NULL);
     hon->SetBit(kCanDelete);
@@ -921,5 +943,5 @@
     if (fOffData)
     {
-        hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", -1, 9999, binlo, binhi, "E");
+        hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", 0, fHist.GetNbinsX()+1, binlo, binhi, "E");
         hoff->SetDirectory(NULL);
         hoff->SetBit(kCanDelete);
