what is the actual difference between the results of a TObject->Clone() and TObject->Copy() ?
As far as I can see the new objects behind the pointers I get with
TH1D *hCopy = new TH1D();
hOriginal->Copy(*hCopy);
or
are both ‘independent’ objects from the original.
At the moment the only reason I see to prefer Copy() to Clone() is that I have to create an onject before and do not have to care for cleaning up the memory allocated in Clone->CloneObject() afterwards.
[quote]what is the actual difference between the results of a TObject->Clone() and TObject->Copy() ?[/quote]The difference is the interface (one create a new object, the other update an existing object).
[quote]do not have to care for cleaning up the memory allocated in Clone->CloneObject() afterwards.[/quote]What do you mean? {As far as I can tell the 2 lines with Copy or the 1 line with Clone have exactly the same side effect (create a new object with similar state/content as your original).
Sorry for the confusion on the (dis)advantage…
I copied from my test actually the lines when I used Copy() with a pointer; I actually meant the more direct version