Ignore:
Timestamp:
05/08/03 18:00:03 (22 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

    r2052 r2098  
    630630    // Draw second histogram
    631631    //
    632     ((TH1&)hist2).DrawCopy("sames");
     632    TH1 *h2 = ((TH1&)hist2).DrawCopy("sames");
    633633    gPad->Update();
    634634
     
    642642                              s2.GetY1NDC()-0.01
    643643                             );
    644     l.AddEntry((TH1*)&hist1, hist1.GetTitle());
    645     l.AddEntry((TH1*)&hist2, hist2.GetTitle());
     644    l.AddEntry(h1, h1->GetTitle());
     645    l.AddEntry(h2, h2->GetTitle());
    646646    l.SetTextSize(s2.GetTextSize());
    647647    l.SetTextFont(s2.GetTextFont());
     
    749749// --------------------------------------------------------------------------
    750750//
     751// Encapsulate the TObject::Clone such, that a cloned TH1 (or derived)
     752// object is not added to the current directory, when cloned.
     753//
     754TObject *MH::Clone(const char *name) const
     755{
     756    Bool_t store = TH1::AddDirectoryStatus();
     757    TH1::AddDirectory(kFALSE);
     758
     759    TObject *o = MParContainer::Clone(name);
     760
     761    TH1::AddDirectory(store);
     762
     763    return o;
     764}
     765
     766// --------------------------------------------------------------------------
     767//
    751768// If the opt string contains 'nonew' or gPad is not given a new canvas
    752769// with size w/h is created. Otherwise the object is cloned and drawn
     
    763780    gROOT->SetSelectedPad(NULL);
    764781
    765     Bool_t store = TH1::AddDirectoryStatus();
    766     TH1::AddDirectory(kFALSE);
    767 
    768782    TObject *o = MParContainer::DrawClone(opt);
    769783    o->SetBit(kCanDelete);
    770 
    771     TH1::AddDirectory(store);
    772 
    773784    return o;
    774785}
  • trunk/MagicSoft/Mars/mhist/MH.h

    r2043 r2098  
    6161    static void Draw(TH1 &hist1, TH1 &hist2, const TString title);
    6262
     63    TObject *Clone(const char *name="") const;
     64
    6365    void Draw(Option_t *o="") { MParContainer::Draw(o); }
    6466    TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const;
Note: See TracChangeset for help on using the changeset viewer.