Re: Direct copy of a histogram

Christoph Borgmeier (borg@mail.desy.de)
Fri, 26 Feb 1999 18:30:40 +0100 (MET)


On Fri, 5 Feb 1999, Rene Brun wrote:

> Christoph Borgmeier wrote:
>
> > [...] An existing
> > histogram has to be overwritten. I do not want to delete it and copy
> > constuct a new one, since it is attached to lists. I have only a TH1
> > pointer, while the histogram is of type TH1F or TH2F (or maybe something
> > else).
> >
>
> Hi Christoph,
> What do you want to do exactly?
> You can do all sorts of operations with an histogram:
> TH1::Reset()
> TH1::Add to replace its contents by another histogram contents
>
> Also note that you can detach an histogram from a directory by calling
> TH1::SetDirectory(0)
[...]

Hi Rene,

thank you for your answer. I noticed now that I do not understand it
completely. Looking into the sources, I find that TH1::Reset does not
reset the bin contents. What is it supposed to do?

My solution is now: TH1* a = ..., *b = ...; a->Add(b,b,1,0); It looks a
little bit funny. Is this the preferred solution?

Kind regards
Christoph