Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 7249)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 7250)
@@ -54,4 +54,7 @@
        - 1.40 (MExtractTimeAndChargeDigitalFilter)
      This is important mainly for timing studies.
+
+   - callisto: added new plot (MHPhi) as described in
+     http://www.astro.uni-wuerzburg.de/results/ringmethod/
 
    - callisto: Changed limits in MHCalibrationChargeCalc from
Index: /trunk/MagicSoft/Mars/mhflux/FluxLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/FluxLinkDef.h	(revision 7249)
+++ /trunk/MagicSoft/Mars/mhflux/FluxLinkDef.h	(revision 7250)
@@ -7,6 +7,8 @@
 #pragma link C++ class MAlphaFitter+;
 
+#pragma link C++ class MHPhi+;
 #pragma link C++ class MHDisp+;
 #pragma link C++ class MHAlpha+;
+//#pragma link C++ class MHAlphaTime+;
 #pragma link C++ class MHThetaSq+;
 #pragma link C++ class MHEnergyEst+;
@@ -17,7 +19,3 @@
 #pragma link C++ class MMcSpectrumWeight+;
 
-//#pragma link C++ class MMatrixHist+;
-//#pragma link C++ class MMatrixUnfold+;
-//#pragma link C++ class MUnfoldBert+;
-
 #endif
Index: /trunk/MagicSoft/Mars/mhflux/MHPhi.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/MHPhi.cc	(revision 7250)
+++ /trunk/MagicSoft/Mars/mhflux/MHPhi.cc	(revision 7250)
@@ -0,0 +1,205 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 07/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2005
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MHPhi
+//
+// Plot delta phi the angle between the reconstructed shower origin and
+// the source position.
+//
+////////////////////////////////////////////////////////////////////////////
+#include "MHPhi.h"
+
+#include <TCanvas.h>
+#include <TVector2.h>
+#include <TLatex.h>
+#include <TLine.h>
+#include <TMarker.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+
+#include "MHillas.h"
+#include "MSrcPosCam.h"
+#include "MParameters.h"
+#include "MGeomCam.h"
+#include "MBinning.h"
+#include "MMath.h"
+
+ClassImp(MHPhi);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Setup histograms 
+//
+MHPhi::MHPhi(const char *name, const char *title)
+: fHillas(0), fSrcPos(0), fDisp(0)
+{
+    fName  = name  ? name  : "MHPhi";
+    fTitle = title ? title : "Graphs for rate data";
+
+    // Init Graphs
+    fHPhi.SetNameTitle("Phi", "Distribution of \\Delta\\Phi");
+
+    fHPhi.SetXTitle("\\Delta\\Phi [\\circ]");
+    fHPhi.SetYTitle("Counts");
+
+    fHPhi.SetMinimum(0);
+    fHPhi.SetDirectory(0);
+    fHPhi.Sumw2();
+    fHPhi.SetBit(TH1::kNoStats);
+    fHPhi.SetMarkerStyle(kFullDotMedium);
+
+    fHPhi.GetYaxis()->SetTitleOffset(1.2);
+}
+
+// --------------------------------------------------------------------------
+//
+// Setup the Binning for the histograms automatically if the correct
+// instances of MBinning
+//
+Bool_t MHPhi::SetupFill(const MParList *plist)
+{
+    fHillas = (MHillas*)plist->FindObject("MHillas");
+    if (!fHillas)
+    {
+        *fLog << err << "MHillas not found... abort." << endl;
+        return kFALSE;
+    }
+    fSrcPos = (MSrcPosCam*)plist->FindObject("MSrcPosCam");
+    if (!fSrcPos)
+    {
+        *fLog << err << "MSrcPosCam not found... abort." << endl;
+        return kFALSE;
+    }
+    fDisp = (MParameterD*)plist->FindObject("Disp", "MParameterD");
+    if (!fDisp)
+    {
+        *fLog << err << "Disp [MParameterD] not found... abort." << endl;
+        return kFALSE;
+    }
+
+    MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
+    if (!geom)
+    {
+        *fLog << err << "MGeomCam not found... abort." << endl;
+        return kFALSE;
+    }
+
+    fConvMm2Deg = geom->GetConvMm2Deg();
+
+    fNumBinsSignal = 2;
+    fThetaCut      = 0.21/1.2;
+    fDistSrc       = 0.4;
+
+    const Double_t w  = TMath::ATan(fThetaCut/fDistSrc);
+    const Float_t  sz = TMath::RadToDeg()*w/fNumBinsSignal;
+    const Int_t    n  = TMath::Nint(TMath::Ceil(180/sz));
+
+    MBinning(n, 0, n*sz).Apply(fHPhi);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill the histograms with data from a MMuonCalibPar and
+// MMuonSearchPar container.
+//
+Bool_t MHPhi::Fill(const MParContainer *par, const Stat_t weight)
+{
+    const TVector2 pos = fHillas->GetMean()*fConvMm2Deg - fHillas->GetNormAxis()*fDisp->GetVal();
+    const TVector2 src = fSrcPos->GetXY()*fConvMm2Deg;
+
+    const Double_t d = pos.Mod() - src.Mod();
+
+    if (d<-fThetaCut*0.913 || d>fThetaCut)
+        return kTRUE;
+
+    const Double_t delta = src.DeltaPhi(pos)*TMath::RadToDeg();
+
+    fHPhi.Fill(TMath::Abs(delta), weight);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// This displays the TGraph like you expect it to be (eg. time on the axis)
+// It should also make sure, that the displayed time always is UTC and
+// not local time...
+//
+void MHPhi::Draw(Option_t *opt)
+{
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
+
+    fHPhi.Draw();
+
+    AppendPad();
+}
+
+void MHPhi::Paint(Option_t *o)
+{
+    const Double_t sig = fHPhi.Integral(1, fNumBinsSignal);
+    const Double_t bg  = fHPhi.Integral(1+fNumBinsSignal, fHPhi.GetNbinsX());
+
+    const Double_t cut = fHPhi.GetBinLowEdge(fNumBinsSignal+1);
+
+    const Double_t f   = cut/(180-cut);
+
+    const Double_t S0  = MMath::SignificanceLiMaSigned(sig, bg*f);
+    const Double_t S   = MMath::SignificanceLiMaSigned(sig, bg, f);
+
+    const TString  fmt = Form("\\sigma_{L/M}=%.1f (\\sigma_{0}=%.1f)  \\Delta\\Phi<%.1f\\circ  E=%.0f  B=%.0f  f=%.2f",
+                              S, S0, cut, sig-bg*f, bg*f, f);
+
+    const Double_t b = bg             *f/fNumBinsSignal;
+    const Double_t e = TMath::Sqrt(bg)*f/fNumBinsSignal;
+
+    TLatex text(0.33, 0.94, fmt);
+    text.SetBit(TLatex::kTextNDC);
+    text.SetTextSize(0.035);
+    text.Paint();
+
+    TLine line;
+    line.SetLineColor(14);
+    line.PaintLine(cut, gPad->GetUymin(), cut, gPad->GetUymax());
+    line.SetLineColor(kBlue);
+    line.PaintLine(0, b, cut, b);
+    line.PaintLine(cut/2, b-e, cut/2, b+e);
+    line.SetLineStyle(kDashed);
+    line.PaintLine(cut, b, fHPhi.GetXaxis()->GetXmax(), b);
+
+    TMarker m;
+    m.SetMarkerColor(kBlue);
+    m.SetMarkerStyle(kFullDotMedium);
+    m.PaintMarker(cut/2, b);
+
+}
Index: /trunk/MagicSoft/Mars/mhflux/MHPhi.h
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/MHPhi.h	(revision 7250)
+++ /trunk/MagicSoft/Mars/mhflux/MHPhi.h	(revision 7250)
@@ -0,0 +1,44 @@
+#ifndef MARS_MHPhi
+#define MARS_MHPhi
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TH1
+#include <TH1.h>
+#endif
+
+class MHillas;
+class MSrcPosCam;
+class MParameterD;
+
+class MHPhi : public MH
+{
+private:
+    TH1D fHPhi;
+
+    MHillas     *fHillas;  //!
+    MSrcPosCam  *fSrcPos;  //!
+    MParameterD *fDisp;    //!
+
+    Double_t fConvMm2Deg;  //!
+
+    Int_t   fNumBinsSignal;
+    Float_t fThetaCut;
+    Float_t fDistSrc;
+
+public:
+    MHPhi(const char *name=NULL, const char *title=NULL);
+
+    Bool_t SetupFill(const MParList *plist);
+    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
+
+    void Draw(Option_t *opt="");
+    void Paint(Option_t *opt="");
+
+    ClassDef(MHPhi, 1) // Histogram to display information about rate
+};
+
+#endif
+
+
Index: /trunk/MagicSoft/Mars/mhflux/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mhflux/Makefile	(revision 7249)
+++ /trunk/MagicSoft/Mars/mhflux/Makefile	(revision 7250)
@@ -25,13 +25,13 @@
 
 SRCFILES = MAlphaFitter.cc \
-	   MHEnergyEst.cc \
 	   MHAlpha.cc \
            MHThetaSq.cc \
-           MHEnergyEst.cc \
+           MHPhi.cc \
+           MHDisp.cc \
+           MHFalseSource.cc \
+	   MHEnergyEst.cc \
 	   MHEffectiveOnTime.cc \
            MHCollectionArea.cc \
            MHThreshold.cc \
-           MHFalseSource.cc \
-           MHDisp.cc \
            MMcSpectrumWeight.cc
 
