Re: [ROOT] TObject::Clone and TH1F question

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Oct 01 2001 - 17:39:24 MEST


Hi Thomas,

By default, when the TH1 constructor is called, it registers the object
to gDirectory->GetList(). You get the warning in case there is already
an histogram with teh same name in this list.
You can disable the default behaviour of registration by calling teh 
static function  TH1::AddDirectory(kFALSE);

Rene Brun

Thomas Bretz wrote:
> 
> Hello,
> 
> I have an object (derived from TObject) which containes some histograms,
> like:
> class A {
> TH1F *hist1;
> TH1F *hist2;
> }
> 
> The histograms are instantiated in the constructor. After constructing
> an object of Type A with
> A* a;
> I'm going to 'clone' it using something like:
> A* b = (A*)a->Clone();
> 
> Now I get many many warnings like (the object contains about 1000
> histograms)
> Warning in <TH1::Build>: Replacing existing histogram: HiGain000
> 
> Is there a simple way to get rid of this warnings when cloning my object
> (more than once)?
> 
> Thanks in advance,
> Thomas.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:01 MET