Ignore:
Timestamp:
10/29/01 11:15:53 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r888 r1003  
    4040#include "MH.h"
    4141
     42#include <TCanvas.h>
     43
    4244ClassImp(MH);
    4345
     
    5254    //   set the name and title of this object
    5355    //
    54     *fName  = name  ? name  : "MH" ;
    55     *fTitle = title ? title : "Base class for Mars histograms" ;
     56    fName  = name  ? name  : "MH" ;
     57    fTitle = title ? title : "Base class for Mars histograms" ;
    5658}
    5759
     60TCanvas *MH::MakeDefCanvas(const char *name, const char *title,
     61                           const UInt_t w, const UInt_t h)
     62{
     63    const TList *list = (TList*)gROOT->GetListOfCanvases();
     64
     65    const char *def = name ? name : gROOT->GetDefCanvasName();
     66
     67    TCanvas *c;
     68    if (list->FindObject(def))
     69    {
     70        const char *n = StrDup(Form("%s <%d>", def, list->GetSize()+1));
     71        c = new TCanvas(n, title, w, h);
     72        delete [] n;
     73    }
     74    else
     75        c = new TCanvas(def, title, w, h);
     76
     77    return c;
     78}
     79
     80TCanvas *MH::MakeDefCanvas(const TObject *obj,
     81                           const UInt_t w, const UInt_t h)
     82{
     83    return MakeDefCanvas(obj->GetName(), obj->GetTitle(), w, h);
     84}
Note: See TracChangeset for help on using the changeset viewer.