Ignore:
Timestamp:
06/16/03 15:13:21 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MH.cc

    r2173 r2180  
    733733    // Rename first statistics box
    734734    //
    735     TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats");
    736     const Double_t x1 = s1.GetX1NDC()-0.01;
    737     s1.SetName((TString)"Stat"+hist1.GetTitle());
    738     s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC()));
    739     s1.SetX2NDC(x1);
     735    // Where to get the TPaveStats depends on the root version
     736    TPaveStats *s1 = (TPaveStats*)gPad->FindObject("stats");
     737    if (!s1)
     738        s1 = (TPaveStats*)hist1.GetListOfFunctions()->FindObject("stats");
     739    else
     740        s1->SetName((TString)"Stat"+hist1.GetTitle());
     741
     742    if (s1)
     743    {
     744        const Double_t x1 = s1->GetX1NDC()-0.01;
     745        s1->SetX1NDC(x1-(s1->GetX2NDC()-s1->GetX1NDC()));
     746        s1->SetX2NDC(x1);
     747    }
    740748
    741749    //
     
    748756    // Draw Legend
    749757    //
    750     TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats");
    751     TLegend &l = *new TLegend(s2.GetX1NDC(),
    752                               s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2,
    753                               s2.GetX2NDC(),
    754                               s2.GetY1NDC()-0.01
    755                              );
    756     l.AddEntry(&hist1, hist1.GetTitle());
    757     l.AddEntry(&hist2, hist2.GetTitle());
    758     l.SetTextSize(s2.GetTextSize());
    759     l.SetTextFont(s2.GetTextFont());
    760     l.SetBorderSize(s2.GetBorderSize());
    761     l.SetBit(kCanDelete);
    762     l.Draw();
     758    // Where to get the TPaveStats depends on the root version
     759    TPaveStats *s2 = (TPaveStats*)gPad->FindObject("stats");
     760    if (!s2)
     761        s2 = (TPaveStats*)hist2.GetListOfFunctions()->FindObject("stats");
     762
     763    if (s2)
     764    {
     765        TLegend &l = *new TLegend(s2->GetX1NDC(),
     766                                  s2->GetY1NDC()-0.015-(s2->GetY2NDC()-s2->GetY1NDC())/2,
     767                                  s2->GetX2NDC(),
     768                                  s2->GetY1NDC()-0.01
     769                                 );
     770        l.AddEntry(&hist1, hist1.GetTitle());
     771        l.AddEntry(&hist2, hist2.GetTitle());
     772        l.SetTextSize(s2->GetTextSize());
     773        l.SetTextFont(s2->GetTextFont());
     774        l.SetBorderSize(s2->GetBorderSize());
     775        l.SetBit(kCanDelete);
     776        l.Draw();
     777    }
    763778}
    764779
  • trunk/MagicSoft/Mars/mhist/MHHadronness.cc

    r2173 r2180  
    9393    fGraph = new TGraph;
    9494    fGraph->SetTitle("Acceptance Gammas vs. Hadrons");
    95     fGraph->SetMaximum(1);
    9695    fGraph->SetMarkerStyle(kFullDotSmall);
    9796
     
    474473        h->SetXTitle("Acceptance Hadrons");
    475474        h->SetYTitle("Acceptance Gammas");
     475        fGraph->SetMaximum(1);
    476476        fGraph->Draw("P");
    477477        gPad->Modified();
Note: See TracChangeset for help on using the changeset viewer.