I have a pyroot script wich renames a TTree. The part of it which does that I copied here:
for file in files:
for i,tree in enumerate(oldTrees):
if not t:
print 'Could not find tree '+oldTrees[i]+'. Skipping...'
print 'Renamed trees for '+file+'.'
Everything seems to work fine, but when I subsequently use hadd to merge the root files, suddenly the old Trees appear again (together with the new trees). For example I am calling the useless command
I would expect x.root and y.root being exactly the same, but unfortunately this is not the case. I guess I am not properly deleting the trees in my root file but I don’t know what I am doing wrong.
Any help is much appreciated. Thanks.