Ignore:
Timestamp:
01/19/05 13:17:09 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r5776 r5901  
    6565    fChiSqBg=0;
    6666    fIntegralMax=0;
     67    fScaleFactor=1;
    6768
    6869    fCoefficients.Reset();
     
    210211}
    211212
    212 Bool_t MAlphaFitter::Fit(TH1D &hon, TH1D &hof, Bool_t paint)
     213Bool_t MAlphaFitter::Fit(TH1D &hon, TH1D &hof, Double_t alpha, Bool_t paint)
    213214{
    214215    /*
     
    224225    fit.SetPolynomOrder(1);
    225226
    226     if (!fit.Fit(h, paint))
     227    if (alpha<=0 || !fit.Fit(h, paint))
    227228        return kFALSE;
    228229
     
    237238    fEventsSignal     = hon.Integral(0, bin);
    238239    fEventsExcess     = fEventsSignal-fEventsBackground;
    239     fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground);
     240    fScaleFactor      = alpha;
     241    fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground/alpha, alpha);
    240242
    241243    if (fEventsExcess<0)
     
    399401    h0->SetDirectory(0);
    400402
    401     Scale(*h0, *h1);
    402 
    403     const Bool_t rc = Fit(*h1, *h0, paint);
     403    const Bool_t rc = ScaleAndFit(*h1, h0, paint);
    404404
    405405    delete h0;
     
    419419    h0->SetDirectory(0);
    420420
    421     Scale(*h0, *h1);
    422 
    423     const Bool_t rc = Fit(*h1, *h0, paint);
     421    const Bool_t rc = ScaleAndFit(*h1, h0, paint);
    424422
    425423    delete h0;
     
    439437    h0->SetDirectory(0);
    440438
    441     Scale(*h0, *h1);
    442 
    443     const Bool_t rc = Fit(*h1, *h0, paint);
     439    const Bool_t rc = ScaleAndFit(*h1, h0, paint);
    444440
    445441    delete h0;
     
    449445}
    450446
    451 void MAlphaFitter::Scale(TH1D &of, const TH1D &on) const
     447Double_t MAlphaFitter::Scale(TH1D &of, const TH1D &on) const
    452448{
    453449    Float_t scaleon = 1;
     
    456452    {
    457453    case kNone:
    458         return;
     454        return 1;
    459455
    460456    case kEntries:
     
    481477        break;
    482478
     479        // This is just to make some compiler happy
    483480    default:
    484         return;
     481        return 1;
    485482    }
    486483
    487484    if (scaleof!=0)
     485    {
    488486        of.Scale(scaleon/scaleof);
     487        return scaleon/scaleof;
     488    }
    489489    else
     490    {
    490491        of.Reset();
    491 }
     492        return 0;
     493    }
     494}
Note: See TracChangeset for help on using the changeset viewer.