Index: trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 8136)
+++ trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 8185)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHFalseSource.cc,v 1.20 2006-10-17 17:16:00 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHFalseSource.cc,v 1.21 2006-11-01 08:29:45 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -121,8 +121,10 @@
 #include <TF2.h>
 #include <TH2.h>
+#include <TLatex.h>
 #include <TGraph.h>
 #include <TStyle.h>
 #include <TCanvas.h>
 #include <TRandom.h>
+#include <TEllipse.h>
 #include <TPaveText.h>
 #include <TStopwatch.h>
@@ -640,7 +642,7 @@
 // source plot.
 //
-TObject *MHFalseSource::GetCatalog()
-{
-    const Double_t maxr = 0.98*TMath::Abs(fHist.GetBinCenter(1));
+TObject *MHFalseSource::GetCatalog() const
+{
+    const Double_t maxr = TMath::Abs(fHist.GetBinLowEdge(1))*TMath::Sqrt(2);
 
     // Create catalog...
@@ -1251,2 +1253,178 @@
     }
 }
+
+void MHFalseSource::DrawNicePlot() const
+{
+    Int_t newc = kTRUE;
+    Float_t zoom = 0.95;
+    Int_t col = kBlue+180;
+
+    if (!newc && !fDisplay)
+        return;
+
+    TH1 *h = dynamic_cast<TH1*>(FindObjectInPad("Alpha_yx_on"));
+    if (!h)
+        return;
+
+    // Open and setup canvas/pad
+    TCanvas &c = newc ? *new TCanvas("Excess", "Excess Plot", TMath::Nint(500.), TMath::Nint(500*0.77/0.89)) : fDisplay->AddTab("ThetsSq");
+
+    //c.SetPad(0.15, 0, 0.90, 1);
+
+    c.SetBorderMode(0);
+    c.SetFrameBorderMode(0);
+    c.SetFillColor(kWhite);
+
+    c.SetLeftMargin(0.11);
+    c.SetRightMargin(0.12);
+    c.SetBottomMargin(0.10);
+    c.SetTopMargin(0.01);
+
+    TH1 *h1 = (TH1*)h->Clone("");
+    h1->SetDirectory(0);
+    h1->SetTitle("");
+    h1->SetContour(99);
+    h1->SetBit(TH1::kNoStats);
+    h1->SetBit(TH1::kCanDelete);
+
+    if (h1->FindObject("stats"))
+        delete h1->FindObject("stats");
+
+    TAxis &x = *h1->GetXaxis();
+    TAxis &y = *h1->GetYaxis();
+    TAxis &z = *h1->GetZaxis();
+
+    x.SetRangeUser(-zoom, zoom);
+    y.SetRangeUser(-zoom, zoom);
+
+    x.SetTitleOffset(1.1);
+    y.SetTitleOffset(1.3);
+
+    x.SetTickLength(0.025);
+    y.SetTickLength(0.025);
+
+    x.SetAxisColor(kWhite);
+    y.SetAxisColor(kWhite);
+
+    x.CenterTitle();
+    y.CenterTitle();
+
+    x.SetTitle("Offset [#circ]");
+    y.SetTitle("Offset [#circ]");
+
+    x.SetDecimals();
+    y.SetDecimals();
+    z.SetDecimals();
+
+    MH::SetPalette("glowsym", 99);
+
+    const Float_t max = TMath::Max(h1->GetMinimum(), h1->GetMaximum());
+
+    h1->SetMinimum(-max);
+    h1->SetMaximum(max);
+
+    h1->Draw("colz");
+
+    // ------
+    // Convert pave coordinates from NDC to Pad coordinates.
+
+    gPad->Update();
+
+    Float_t x0 = 0.80;
+    Float_t y0 = 0.88;
+
+    Double_t dx  = gPad->GetX2() - gPad->GetX1();
+    Double_t dy  = gPad->GetY2() - gPad->GetY1();
+
+    // Check if pave initialisation has been done.
+    // This operation cannot take place in the Pave constructor because
+    // the Pad range may not be known at this time.
+    Float_t px = gPad->GetX1() + x0*dx;
+    Float_t py = gPad->GetY1() + y0*dy;
+    // -------
+
+    TEllipse *el = new TEllipse(px, py, 0.12, 0.12, 0, 360, 0);
+    el->SetFillStyle(4100);
+    el->SetFillColor(kBlack);
+    el->SetLineWidth(2);
+    el->SetLineColor(kWhite);
+    el->SetBit(kCanDelete);
+    el->Draw();
+
+    TString str1("el.SetX1(gPad->GetX1()+0.9*(gPad->GetX2()-gPad->GetX1()));");
+    TString str2("el.SetY1(gPad->GetY1()+0.9*(gPad->GetY2()-gPad->GetY1()));");
+
+    str1.ReplaceAll("el.", Form("((TEllipse*)%p)->", el));
+    str2.ReplaceAll("el.", Form("((TEllipse*)%p)->", el));
+
+    str1.ReplaceAll("0.9", Form("%f", x0));
+    str2.ReplaceAll("0.9", Form("%f", y0));
+
+    TLatex tex;
+    tex.SetBit(TText::kTextNDC);
+    tex.SetTextColor(kWhite);
+    tex.SetTextAlign(22);
+    tex.SetTextSize(0.04);
+    tex.SetTextAngle(0);
+    tex.DrawLatex(x0, y0, "psf");
+
+    TPad *pad = new TPad("pad", "Catalog Pad",
+                         c.GetLeftMargin(), c.GetBottomMargin(),
+                         1-c.GetRightMargin(), 1-c.GetTopMargin());
+
+    pad->SetFillStyle(4000);
+    pad->SetFillColor(kBlack);
+    pad->SetBorderMode(0);
+    pad->SetFrameBorderMode(0);
+    pad->SetBit(kCanDelete);
+    pad->Draw();
+
+    pad->Range(x.GetBinLowEdge(x.GetFirst()),
+               y.GetBinLowEdge(y.GetFirst()),
+               x.GetBinLowEdge(x.GetLast()+1),
+               y.GetBinLowEdge(y.GetLast()+1));
+
+    TString str3("pad->Range(x.GetBinLowEdge(x.GetFirst()),"
+                 "y.GetBinLowEdge(y.GetFirst()),"
+                 "x.GetBinLowEdge(x.GetLast()+1),"
+                 "y.GetBinLowEdge(y.GetLast()+1));");
+
+    str3.ReplaceAll("x.", Form("((TAxis*)%p)->", &x));
+    str3.ReplaceAll("y.", Form("((TAxis*)%p)->", &y));
+    // str3.ReplaceAll("pad", Form("((TPad*)(%p))", pad));
+
+    c.AddExec("SetPosX", str1);
+    c.AddExec("SetPosY", str2);
+    c.AddExec("Resize",  str3);
+
+    pad->cd();
+    gROOT->SetSelectedPad(0);
+
+    MAstroCatalog *cat = (MAstroCatalog*)GetCatalog();
+
+    cat->GetAttLineSky().SetLineColor(col);
+    cat->GetAttLineSky().SetLineWidth(2);
+    cat->GetAttLineSky().SetLineStyle(7);
+
+    cat->GetList()->Clear();
+    cat->SetBit(kCanDelete);
+    //    cat->AddObject(MAstro::Hms2Hor(12,17,52)*TMath::Pi()/12, TMath::DegToRad()*MAstro::Dms2Deg(30,7,0),   6, "1ES1215+303");
+    //    cat->AddObject(MAstro::Hms2Hor(12,18,27)*TMath::Pi()/12, TMath::DegToRad()*MAstro::Dms2Deg(29,48,46), 6, "Mrk766");
+
+    cat->Draw("mirror same");
+
+    /*
+     Int_t col = kBlue+180;
+
+     TLatex tex;
+     tex.SetTextColor(col);
+     tex.SetTextAlign(21);
+     tex.SetTextSize(0.04);
+     tex.DrawLatex(-0.79, -0.8, "43.0\\circ");
+     tex.DrawLatex(-0.78,  0.2, "42.0\\circ");
+
+     tex.SetTextAngle(-90);
+     tex.DrawLatex(-0.45, -0.55, "22.00h");
+     tex.DrawLatex( 0.30, -0.55, "22.07h");
+     */
+}
Index: trunk/MagicSoft/Mars/mhflux/MHFalseSource.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHFalseSource.h	(revision 8136)
+++ trunk/MagicSoft/Mars/mhflux/MHFalseSource.h	(revision 8185)
@@ -46,5 +46,5 @@
     Double_t fDec;
 
-    TObject *GetCatalog();
+    TObject *GetCatalog() const;
     void MakeSymmetric(TH1 *h);
 
@@ -87,4 +87,6 @@
     }
 
+    void DrawNicePlot() const; //*MENU*
+
     // MParContainer
     Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
