Tree copy after hadd

Hello !!!

I have a stupid question concerning hadd…

I do not understand why, after using hadd with two files (each containing a single tree), the resulting file contains two trees, one being the copy of one of the two original trees and the second being the result of adding both. The “copied” tree is the one within the file passed as first argument to hadd.

I am attaching an example macro that creates two files, f0.root and f1.root, each containing a tree.

If then I do hadd f.root f0.root f1.root f.root will have two trees, one being a copy of the tree found in f0.root and the second corresponding to the addition of the trees within f0.root and f1.root.

It’s not a real issue, but I’d like to understand why this behaviour, and if possible, how to manage to get just a single tree instead of two.

Thanks in advance !!!

Cheers, Sergio
t.C (301 Bytes)

Everything is fine (i.e. you have a single tree in your “f.root” file).
See [url]Aux;1 aux;2 aux3;

Hi,

thanks a lot for the info. I understand then that there is no other way rather than deleting the object with the cycle numbers I want to discard… or leave it as it is since cint will retrieve the object with highest cycle number…

I still feel I am missing an option somehow so that is done automatically within hadd…

Cheers, Sergio

If it ain’t broke, don’t fix it. :mrgreen:
http://root.cern.ch/root/html/TDirectoryFile.html#TDirectoryFile:Purge