Ignore:
Timestamp:
03/03/08 14:59:12 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhflux
Files:
2 edited

Legend:

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

    r8787 r8879  
    884884}
    885885
    886 void MHAlpha::DrawNicePlot(Bool_t newc, const char *title, const char *watermark)
     886void MHAlpha::DrawNicePlot(Bool_t newc, const char *title, const char *watermark, Int_t binlo, Int_t binhi)
    887887{
    888888    if (!newc && !fDisplay)
     
    909909
    910910    // Get on-data
    911     TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", -1, 9999, -1, 9999, "E");
     911    TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", -1, 9999, binlo, binhi, "E");
    912912    hon->SetDirectory(NULL);
    913913    hon->SetBit(kCanDelete);
     
    921921    if (fOffData)
    922922    {
    923         hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", -1, 9999, -1, 9999, "E");
     923        hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", -1, 9999, binlo, binhi, "E");
    924924        hoff->SetDirectory(NULL);
    925925        hoff->SetBit(kCanDelete);
     
    947947
    948948    // scale off-data
    949     fFit.Scale(*hoff, *hon);
     949
     950    MAlphaFitter fit(fFit);
     951    fit.ScaleAndFit(*hon, hoff);
    950952
    951953    hon->SetMinimum(0);
     
    971973    text.SetTextSize(0.07);
    972974    text.SetTextAngle(2.5);
    973     if (watermark)
    974         text.DrawLatex(0.45, 0.2, watermark);
     975
     976    TString wm(watermark);
     977    if (binlo>=1 || binhi<hon->GetNbinsX())
     978    {
     979        wm += wm.IsNull() ? "(" : " (";
     980        if (binlo>=1)
     981            wm += Form("%.1fGeV", fHist.GetYaxis()->GetBinLowEdge(binlo));
     982        wm += "-";
     983        if (binhi<hon->GetNbinsX())
     984            wm += Form("%.1fGeV", fHist.GetYaxis()->GetBinLowEdge(binhi+1));
     985        wm += ")";
     986    }
     987    if (!wm.IsNull())
     988        text.DrawLatex(0.45, 0.2, wm);
    975989    //enum { kTextNDC = BIT(14) };
    976990
     
    9951009    //        fFit.GetSignificance(), fFit.GetScaleFactor(), fFit.GetGausSigma());
    9961010    sprintf(txt, "Significance %.1f\\sigma,  off-scale %.2f",
    997             fFit.GetSignificance(), fFit.GetScaleFactor());
     1011            fit.GetSignificance(), fit.GetScaleFactor());
    9981012    ptxt = pave->AddText(txt);
    9991013    ptxt->SetTextAlign(23);
    10001014
    10011015    sprintf(txt, "%.1f excess events,  %.1f background events",
    1002             fFit.GetEventsExcess(), fFit.GetEventsBackground());
     1016            fit.GetEventsExcess(), fit.GetEventsBackground());
    10031017    ptxt = pave->AddText(txt);
    10041018    ptxt->SetTextAlign(23);
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.h

    r8775 r8879  
    139139    }
    140140
    141     void DrawNicePlot(const char *title="MAGIC Telescope observation", const char *watermark="preliminary") { DrawNicePlot(kTRUE, title, watermark); } //*MENU*
    142     void DrawNicePlot(Bool_t newc, const char *title=0, const char *watermark=0);
     141    void DrawNicePlot(const char *title="MAGIC Telescope observation", const char *watermark="preliminary", Int_t binlo=-1, Int_t binhi=9999) { DrawNicePlot(kTRUE, title, watermark, binlo, binhi); } //*MENU*
     142    void DrawNicePlot(Bool_t newc, const char *title=0, const char *watermark=0, Int_t binlo=-1, Int_t binhi=9999);
    143143    void DrawAll() { DrawAll(kTRUE); } //*MENU*
    144144    void DrawAll(Bool_t newc);
Note: See TracChangeset for help on using the changeset viewer.