Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3580)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3581)
@@ -139,4 +139,11 @@
        deprecated MMcEvt. Use MPointingPosCalc to copy the
        pointing position from MMcEvt to MPointingPos
+
+   * mbase/MMath.[h,cc]:
+     - added, which currently only implements calculation of
+       significance and Li/Ma significance
+
+   * mbase/Makefile, mbase/BaseLinkDef.h:
+     - added MMath
 
 
Index: trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 3580)
+++ trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 3581)
@@ -20,4 +20,5 @@
 
 // Basic Tools
+#pragma link C++ class MMath+;
 #pragma link C++ class MIter+;
 #pragma link C++ class MDirIter+;
Index: trunk/MagicSoft/Mars/mbase/MMath.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 3581)
+++ trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 3581)
@@ -0,0 +1,72 @@
+/* ======================================================================== *\
+!
+! *
+! * 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  3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MMath
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MMath.h"
+
+ClassImp(MMath);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Calculate Significance as
+// significance = (s-b)/sqrt(s+k*k*b) mit k=s/b
+//
+// s: total number of events in signal region
+// b: number of background events in signal region
+// 
+Double_t MMath::Significance(Double_t s, Double_t b)
+{
+    const Double_t k = b==0 ? 0 : s/b;
+    const Double_t f = s+k*k*b;
+
+    return f==0 ? 0 : (s-b)/TMath::Sqrt(f);
+}
+
+// --------------------------------------------------------------------------
+//
+//  calculates the significance according to Li & Ma
+//  ApJ 272 (1983) 317, Formula 17
+//
+//  s                    // s: number of on events
+//  b                    // b: number of off events
+//  alpha = t_on/t_off;  // t: observation time
+//
+Double_t MMath::SignificanceLiMa(Double_t s, Double_t b, Double_t alpha)
+{
+    const Double_t sum = s+b;
+
+    if (sum<=0 || alpha<=0)
+        return 0;
+
+    const Double_t l = s*TMath::Log(s/sum*(alpha+1)/alpha);
+    const Double_t m = b*TMath::Log(b/sum*(alpha+1)      );
+
+    return TMath::Sqrt((l+m)*2);
+}
Index: trunk/MagicSoft/Mars/mbase/MMath.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.h	(revision 3581)
+++ trunk/MagicSoft/Mars/mbase/MMath.h	(revision 3581)
@@ -0,0 +1,17 @@
+#ifndef MARS_MMath
+#define MARS_MMath
+
+#ifndef ROOT_TMath
+#include <TMath.h>
+#endif
+
+class MMath : public TMath
+{
+public:
+    Double_t Significance(Double_t s, Double_t b);
+    Double_t SignificanceLiMa(Double_t s, Double_t b, Double_t alpha=1);
+
+    ClassDef(MMath, 0)
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbase/Makefile	(revision 3580)
+++ trunk/MagicSoft/Mars/mbase/Makefile	(revision 3581)
@@ -36,4 +36,5 @@
 SRCFILES = MLogo.cc \
            MArgs.cc \
+           MMath.cc \
 	   MLog.cc \
            MLogManip.cc \
