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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r8780 r8989  
    1818!   Author(s): Thomas Bretz, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2008
    2121!
    2222!
     
    4242//  + TArrayD fErrors;  // errors of coefficients
    4343//
     44// Version 4:
     45// ----------
     46//  + Double_t fErrorExcess;
     47//  - Double_t fSignificanceExc;
     48//
    4449//
    4550//////////////////////////////////////////////////////////////////////////////
     
    6873{
    6974    fSignificance=0;
    70     fSignificanceExc=0;
     75    fErrorExcess=0;
    7176    fEventsExcess=0;
    7277    fEventsSignal=0;
     
    168173    fEventsExcess     = fEventsSignal-fEventsBackground;
    169174    fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground);
    170     fSignificanceExc  = MMath::SignificanceLiMaExc(fEventsSignal, fEventsBackground);
     175    fErrorExcess      = MMath::ErrorExc(fEventsSignal, fEventsBackground);
    171176
    172177    // !Finitite includes IsNaN
    173178    if (!TMath::Finite(fSignificance))
    174179        fSignificance=0;
    175 
    176     if (fEventsExcess<0)
    177         fEventsExcess=0;
    178180}
    179181
     
    282284    const Int_t bin = hon.GetXaxis()->FindFixBin(fSigInt*0.999);
    283285
    284 
    285286    MAlphaFitter fit(*this);
    286287    fit.EnableBackgroundFit();
     
    290291    // off-source in the off-source region and the on-data in the source-region
    291292    TH1D h(hof);
     293    h.SetDirectory(0);
    292294    h.Add(&hon);
    293295    h.Scale(0.5);
     
    342344{
    343345    TH1D h(hon);
     346    h.SetDirectory(0);
    344347    h.Add(&hof, -1); // substracts also number of entries!
    345348    h.SetEntries(hon.GetEntries());
     
    354357    fCoefficients = fit.GetCoefficients();
    355358    fErrors       = fit.GetErrors();
    356 
    357359
    358360    // ----------------------------------------------------------------------------
     
    372374    fScaleFactor      = alpha;
    373375    fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground/alpha, alpha);
    374     fSignificanceExc  = MMath::SignificanceLiMaExc(fEventsSignal, fEventsBackground/alpha, alpha);
     376    fErrorExcess      = MMath::ErrorExc(fEventsSignal, fEventsBackground/alpha, alpha);
    375377
    376378    // !Finitite includes IsNaN
    377379    if (!TMath::Finite(fSignificance))
    378380        fSignificance=0;
    379     if (fEventsExcess<0)
    380         fEventsExcess=0;
    381381
    382382    return kTRUE;
     
    461461    // Result
    462462    f.fSignificance     = fSignificance;
    463     f.fSignificanceExc  = fSignificanceExc;
     463    f.fErrorExcess      = fErrorExcess;
    464464    f.fEventsExcess     = fEventsExcess;
    465465    f.fEventsSignal     = fEventsSignal;
     
    526526{
    527527    const TString name(Form("TempAlphaEnergy%06d", gRandom->Integer(1000000)));
    528     TH1D *h = hon.ProjectionZ(name, -1, -1, bin, bin, "E");
     528    TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, bin, bin, "E");
    529529    h->SetDirectory(0);
    530530
     
    537537{
    538538    const TString name(Form("TempAlphaTheta%06d", gRandom->Integer(1000000)));
    539     TH1D *h = hon.ProjectionZ(name, bin, bin, -1, -1, "E");
     539    TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E");
    540540    h->SetDirectory(0);
    541541
     
    563563{
    564564    const TString name(Form("TempAlpha%06d", gRandom->Integer(1000000)));
    565     TH1D *h = hon.ProjectionZ(name, -1, -1, -1, -1, "E");
     565    TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
    566566    h->SetDirectory(0);
    567567
     
    576576    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    577577
    578     TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");
    579     TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");
     578    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
     579    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E");
    580580    h1->SetDirectory(0);
    581581    h0->SetDirectory(0);
     
    594594    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    595595
    596     TH1D *h1 = hon.ProjectionZ(name1, bin, bin, -1, -1, "E");
    597     TH1D *h0 = hof.ProjectionZ(name0, bin, bin, -1, -1, "E");
     596    TH1D *h1 = hon.ProjectionZ(name1, bin, bin, 0, hon.GetNbinsY()+1, "E");
     597    TH1D *h0 = hof.ProjectionZ(name0, bin, bin, 0, hof.GetNbinsY()+1, "E");
    598598    h1->SetDirectory(0);
    599599    h0->SetDirectory(0);
     
    636636    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    637637
    638     TH1D *h1 = hon.ProjectionZ(name1, -1, -1, -1, -1, "E");
    639     TH1D *h0 = hof.ProjectionZ(name0, -1, -1, -1, -1, "E");
     638    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
     639    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, 0, hof.GetNbinsY()+1, "E");
    640640    h1->SetDirectory(0);
    641641    h0->SetDirectory(0);
     
    654654    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    655655
    656     TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");
    657     TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");
     656    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
     657    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E");
    658658    h1->SetDirectory(0);
    659659    h0->SetDirectory(0);
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r8780 r8989  
    5656    // Result
    5757    Double_t fSignificance;     // significance of an unknown signal (Li/Ma 17)
    58     Double_t fSignificanceExc;  // significance of a known excess    (Li/Ma 5)
     58    Double_t fErrorExcess;      // Simple error propagation
    5959    Double_t fEventsExcess;     // calculated number of excess events (signal-bg)
    6060    Double_t fEventsSignal;     // calculated number of signal events
     
    179179
    180180    Double_t GetSignificance() const       { return fSignificance; }
    181     Double_t GetSignificanceExc() const    { return fSignificanceExc; }
     181    Double_t GetErrorExcess() const        { return fErrorExcess; }
    182182    Double_t GetChiSqSignal() const        { return fChiSqSignal; }
    183183    Double_t GetChiSqBg() const            { return fChiSqBg; }
     
    253253    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    254254
    255     ClassDef(MAlphaFitter, 3)
     255    ClassDef(MAlphaFitter, 4)
    256256};
    257257
Note: See TracChangeset for help on using the changeset viewer.