Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1353)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1354)
@@ -1,4 +1,10 @@
                                                                   -*-*- END -*-*-
  2002/06/10: Thomas Bretz
+
+   * macros/plot.C:
+     - added
+
+   * macros/plot2.C:
+     - added
 
    * manalysis/MHillas.cc:
Index: /trunk/MagicSoft/Mars/macros/plot2.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/plot2.C	(revision 1354)
+++ /trunk/MagicSoft/Mars/macros/plot2.C	(revision 1354)
@@ -0,0 +1,127 @@
+/* ======================================================================== *\
+!
+! *
+! * 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, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+void plot2()
+{
+    //
+    // This is a demonstration program which calculates the Hillas
+    // parameter out of a Magic root file.
+
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MParList  plist;
+
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    //
+    // Now setup the tasks and tasklist:
+    // ---------------------------------
+    //
+    // The first argument is the tree you want to read.
+    //   Events:     Cosmic ray events
+    //   PedEvents:  Pedestal Events
+    //   CalEvents:  Calibration Events
+    //
+    MReadMarsFile  read("Events", "star.root");
+    read.DisableAutoScheme();
+    tlist.AddToList(&read);
+
+    MFParticleId fgamma("MMcEvt", '=', kGAMMA);
+    tlist.AddToList(&fgamma);
+
+    MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
+    tlist.AddToList(&fhadrons);
+
+    // -------------------------------------------------------
+    //
+    // set the name of the variable to plot and the binning
+    //
+    MGeomCamMagic cam;
+    plist.AddToList(&cam);
+
+    TString vary("MHillas.fWidth*MGeomCam.fConvMm2Deg");
+    TString varx("MHillas.fLength*MGeomCam.fConvMm2Deg");
+
+    MBinning binsy("BinningMH3Y");
+    MBinning binsx("BinningMH3X");
+    binsy.SetEdges(11, 0, 0.3);
+    binsx.SetEdges(11, 0, 0.6);
+
+    //
+    // -------------------------------------------------
+
+    MH3 h3g(varx, vary);
+    MH3 h3h(varx, vary);
+
+    plist.AddToList(&h3g);
+    plist.AddToList(&h3h);
+
+    plist.AddToList(&binsx);
+    plist.AddToList(&binsy);
+
+    MFillH fillg(&h3g);
+    fillg.SetFilter(&fgamma);
+    tlist.AddToList(&fillg);
+
+    MFillH fillh(&h3h);
+    fillh.SetFilter(&fhadrons);
+    tlist.AddToList(&fillh);
+
+    //
+    // Create and setup the eventloop
+    //
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    //
+    // Execute your analysis
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+
+    MH::MakeDefCanvas("Plot");
+    h3h.GetHist().SetMarkerColor(kRed);
+    h3h.GetHist().SetLineColor(kRed);
+    h3h.GetHist().SetFillStyle(4000);
+    h3h.GetHist().DrawCopy("cont3");
+    h3g.GetHist().DrawCopy("cont3same");
+
+    return;
+
+    TProfile *p = ((TH2&)h3g.GetHist()).ProfileX();
+    p->Draw("same");
+    p->SetBit(kCanDelete);
+
+    TProfile *p = ((TH2&)h3h.GetHist()).ProfileX();
+    p->SetLineColor(kRed);
+    p->SetFillStyle(4000);
+    p->Draw("same");
+    p->SetBit(kCanDelete);
+}
Index: /trunk/MagicSoft/Mars/mhist/MHHadroness.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHHadroness.cc	(revision 1353)
+++ /trunk/MagicSoft/Mars/mhist/MHHadroness.cc	(revision 1354)
@@ -266,4 +266,5 @@
     *fLog << "Hadroness histograms:" << endl;
     *fLog << "---------------------" << endl;
+    *fLog << "Used " << fGhness->GetEntries() << " Gammas and " << fPhness->GetEntries() << " Hadrons." << endl;
     *fLog << "Acc Gammas at  1% Hadron-acc: " << Form("%3.0f", GetGammaAcceptance(0.01)*100) << "%" << endl;
     *fLog << "Acc Gammas at  2% Hadron-acc: " << Form("%3.0f", GetGammaAcceptance(0.02)*100) << "%" << endl;
Index: /trunk/MagicSoft/Mars/mhist/MHMatrix.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1353)
+++ /trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1354)
@@ -45,6 +45,4 @@
 #include "MHMatrix.h"
 
-#include <math.h>     // fabs on Alpha
-
 #include <TList.h>
 #include <TArrayD.h>
@@ -353,5 +351,5 @@
         d2 *= m;
 
-        dists[i] = fabs(d2*d);
+        dists[i] = d2*d; // square of distance
     }
 
@@ -365,5 +363,5 @@
         res += dists[idx[i]];
 
-    return res/n;
+    return sqrt(res)/n;
 }
 
