Changeset 7221 for trunk/MagicSoft


Ignore:
Timestamp:
07/26/05 10:23:12 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7220 r7221  
    2121                                                 -*-*- END OF LINE -*-*-
    2222
    23  2005/07/22 Daniela Dorner
     23 2005/07/26 Thomas Bretz
     24
     25   * mhflux/MHDisp.cc:
     26     - improved scaling for significance plot, so that significances
     27     similar to the ThetaSq plot come out
     28
     29
     30
     31 2005/07/25 Daniela Dorner
    2432
    2533   * datacenter/macros/fillstar.C, setupdb.C:
  • trunk/MagicSoft/Mars/mhflux/MHDisp.cc

    r7217 r7221  
    403403            if (rmax<TMath::Hypot(px, py))
    404404                h2.SetBinContent(bin, 0);
    405             else
    406                 if (h2.GetBinContent(bin)==0)
    407                     h2.SetBinContent(bin, 1e-10);
     405            //else
     406            //    if (h2.GetBinContent(bin)==0)
     407            //        h2.SetBinContent(bin, 1e-10);
    408408        }
    409409}
     
    418418    const TAxis &axey = *s.GetYaxis();
    419419
     420    const Int_t nx = axex.GetNbins();
     421    const Int_t ny = axey.GetNbins();
     422
    420423    const Int_t n = TMath::Nint(0.2/axex.GetBinWidth(1));
    421424
    422     for (int x=1+n; x<=axex.GetNbins()-n; x++)
    423         for (int y=1+n; y<=axey.GetNbins()-n; y++)
    424         {
    425             Double_t sig=0;
    426             Double_t bg =0;
    427 
    428             for (int dx=-n; dx<=n; dx++)
    429                 for (int dy=-n; dy<=n; dy++)
    430                 {
    431                     if (TMath::Hypot((float)dx, (float)dy)>n)
    432                         continue;
    433 
    434                     const Int_t  bin = s.GetBin(x+dx,y+dy);
    435 
    436                     sig += h1.GetBinContent(bin);
    437                     bg  += h2.GetBinContent(bin);
    438                 }
    439 
    440             const Double_t S = sig>0 ? MMath::SignificanceLiMaSigned(sig, bg, TMath::Abs(scale)) : 0;
    441 
    442             const Int_t bin = s.GetBin(x,y);
    443             s.SetBinContent(bin, S);
     425    const Double_t sc = h2.GetEntries()/fHistOff->GetEntries();
     426
     427    for (int x=1; x<=nx; x++)
     428        for (int y=1; y<=ny; y++)
     429        {
     430            Double_t S=0;
     431
     432            // Only calculate significances for pixels far enough
     433            // from the border to get all expected pixels.
     434            if (TMath::Hypot((float)x-0.5*nx, (float)y-0.5*ny)<0.5*axex.GetNbins()-n)
     435            {
     436                Double_t sig=0;
     437                Double_t bg =0;
     438
     439                // Integral a region of n pixels around x/y
     440                for (int dx=-n; dx<=n; dx++)
     441                    for (int dy=-n; dy<=n; dy++)
     442                    {
     443                        if (TMath::Hypot((float)dx, (float)dy)>n)
     444                            continue;
     445
     446                        const Int_t  bin = s.GetBin(x+dx,y+dy);
     447
     448                        sig += h1.GetBinContent(bin);
     449                        bg  += h2.GetBinContent(bin);
     450                    }
     451
     452                // Scale such, that the statistical error corresponds to
     453                // the amount of off-data used to determin the background
     454                // model, not to the background itself. This gives
     455                // significances as calculated from the theta-sq plot.
     456                S = sig>0 ? MMath::SignificanceLiMaSigned(sig, bg*scale/sc, sc) : 0;
     457            }
     458
     459            s.SetBinContent(x, y, S);
    444460        }
    445461}
     
    456472    hrc->Reset();
    457473
     474    //const_cast<TH2&>(h).SetMaximum();
    458475    const Double_t max = h.GetMaximum();
    459476
    460     MBinning(50, -max*1.1, max*1.1).Apply(*hrc);
     477    MBinning(51, -max*1.1, max*1.1).Apply(*hrc);
    461478
    462479    for (int x=1; x<=h.GetXaxis()->GetNbins(); x++)
     
    525542        {
    526543            hx->SetContour(99);
    527             MakeSignificance(*hx, *h1, fHistBg, scale);
     544            MakeSignificance(*hx, *h1, fHistBg, TMath::Abs(scale));
    528545            MakeDot(*hx);
    529546            MakeSymmetric(hx);
Note: See TracChangeset for help on using the changeset viewer.