Direct copy of a histogram

Christoph Borgmeier (borg@mail.desy.de)
Thu, 4 Feb 1999 19:43:22 +0100 (MET)


Hello,

I just ran into the same problem as Wei Xie did last year: 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).

Fons Rademakers wrote on 25 Jun 1998:
> use either the histogram TH1::operator=() or the TH1::Copy()
> or the TObject::Clone() methods.
>
> Cheers, Fons.
>
> Wei Xie wrote:
> >
> > Dear ROOTers'
> >
> > Is there a way to copy one histogram directly to another
> > histogram ?
[...]

As far as I understand it,

* TH1::operator does not copy the entire object (no polymorphism
possible),

* TH1::Copy() is protected,

* TObject::Clone() creates a new object in a different memory location.

Do I miss the point here? Do I have to use memcpy (*shudder*)?

Thank you for your answer
Christoph

-- 
 Christoph Borgmeier    Mail:  DESY F15/HERA-B, Geb. 61/117
                               Notkestr. 85, 22607 Hamburg
 Humboldt Univ Berlin   Phone: +49 40 8998 4850
                        Email: Christoph.Borgmeier@desy.de