Ignore:
Timestamp:
07/01/08 15:04:01 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r8988 r8989  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.40 2008-06-30 09:36:35 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.41 2008-07-01 14:03:58 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    172172//
    173173// Return Li/Ma (5) for the error of the excess, under the assumption that
    174 // the existance of a signal is already known.
    175 //
    176 Double_t MMath::SignificanceLiMaExc(Double_t s, Double_t b, Double_t alpha)
    177 {
    178     Double_t Ns = s - alpha*b;
    179     Double_t sN = s + alpha*alpha*b;
    180 
    181     if (Ns<0 || sN<0)
     174// the existance of a signal is already known. (basically signal/error
     175// calculated by error propagation)
     176//
     177Double_t MMath::SignificanceExc(Double_t s, Double_t b, Double_t alpha)
     178{
     179    const Double_t error = ErrorExc(s, b, alpha);
     180    if (error==0)
    182181        return 0;
    183182
    184     if (Ns==0 && sN==0)
    185         return 0;
    186 
    187     return Ns/TMath::Sqrt(sN);
     183    const Double_t Ns = s - alpha*b;
     184
     185    return Ns/error;
     186}
     187
     188// --------------------------------------------------------------------------
     189//
     190// Calculate the error of s-alpha*b by error propagation
     191//
     192Double_t MMath::ErrorExc(Double_t s, Double_t b, Double_t alpha)
     193{
     194    const Double_t sN = s + alpha*alpha*b;
     195    return sN<0 ? 0 : TMath::Sqrt(sN);
    188196}
    189197
  • trunk/MagicSoft/Mars/mbase/MMath.h

    r8978 r8989  
    3737    Double_t SignificanceLiMa(Double_t s, Double_t b, Double_t alpha=1);
    3838    Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1);
    39     Double_t SignificanceLiMaExc(Double_t s, Double_t b, Double_t alpha=1);
     39    Double_t SignificanceExc(Double_t s, Double_t b, Double_t alpha=1);
     40    Double_t ErrorExc(Double_t s, Double_t b, Double_t alpha=1);
    4041
    4142    void ReducePrecision(Float_t &val);
Note: See TracChangeset for help on using the changeset viewer.