Changeset 1506 for trunk/MagicSoft


Ignore:
Timestamp:
08/16/02 17:06:41 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1505 r1506  
    544544    gPad->Update();
    545545
     546    TPaveText *t = (TPaveText*)gPad->FindObject("title");
     547    if (t)
     548    {
     549        t->SetName((TString)"MHTitle");     // rename object
     550        t->Clear();                         // clear old lines
     551        t->AddText((TString)" "+title+" "); // add the new title
     552        t->SetBit(kCanDelete);              // make sure object is deleted
     553
     554        //
     555        // FIXME: This is a stupid workaround to hide the redrawn
     556        // (see THistPainter::PaintTitle) title
     557        //
     558        gPad->Modified();  // indicates a change
     559        gPad->Update();    // recreates the original title
     560        t->Pop();          // bring our title on top
     561    }
     562
    546563    //
    547564    // Rename first statistics box
     
    549566    TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats");
    550567    s1.SetX1NDC(s1.GetX1NDC()-0.01);
    551     s1.SetName((TString)"Stat"+hist1.GetTitle());
     568    s1.SetName("MHStat");
    552569
    553570    //
     
    555572    //
    556573    TH1 *h2 = (TH1*)((TH1&)hist2).DrawCopy("sames");
    557 
    558574    gPad->Update();
    559575
     
    570586    const Int_t    n = s1.GetListOfLines()->GetSize();
    571587    const Double_t h = s1.GetY2NDC()-s1.GetY1NDC();
    572     TLegend &l = *new TLegend(s1.GetX1NDC(),
    573                               s1.GetY1NDC()-0.015-h*2/n,
    574                               s1.GetX2NDC(),
    575                               s1.GetY1NDC()-0.01
     588    TLegend &l = *new TLegend(s1.GetX1NDC(), s1.GetY1NDC()-0.015-h*2/n,
     589                              s1.GetX2NDC(), s1.GetY1NDC()-0.01
    576590                            );
    577591    l.AddEntry(h1, h1->GetTitle());
     
    582596    l.SetBit(kCanDelete);
    583597
    584     // FIXME: Don't change the hist title. Change TPaveText::title
    585     h1->SetTitle(" "+title+" ");
    586 
    587598    l.Draw();
    588599}
     
    599610    //
    600611    hist1.Draw();
    601     // FIXME: Don't change the hist title. Change TPaveText::title
    602     //h1->SetTitle(" "+title+" ");
    603 
    604612    gPad->Update();
     613
     614    TPaveText *t = (TPaveText*)gPad->FindObject("title");
     615    if (t)
     616    {
     617        t->SetName((TString)"MHTitle");     // rename object
     618        t->Clear();                         // clear old lines
     619        t->AddText((TString)" "+title+" "); // add the new title
     620        t->SetBit(kCanDelete);              // make sure object is deleted
     621
     622        //
     623        // FIXME: This is a stupid workaround to hide the redrawn
     624        // (see THistPainter::PaintTitle) title
     625        //
     626        gPad->Modified();  // indicates a change
     627        gPad->Update();    // recreates the original title
     628        t->Pop();          // bring our title on top
     629    }
    605630
    606631    //
Note: See TracChangeset for help on using the changeset viewer.