Error reading Trees from a Chain

Hi all,

I am seeing the same behavior as reported in this thread,
root.cern.ch/root/roottalk/roottalk03/1792.html

i.e. the error message ’ Error reading Trees from a Chain ’

The solution in this thread, by Rene, was to create the TFile to write and then create the tree/chain you want to write:

-create the output file z
-create the Tree red
-loop on entries of the input Tree
-red->Fill(); as you do now
-red->Write();

The problem is, in this way, there is also a tree (which is my original tree, not the one I made after looping over the original and selecting only few entries) in the file. How do I prevent the original tree from being written into the file I create?
I can prevent this creation of the old tree if I do it in the order

-create the Tree red
-loop on entries of the input Tree
-red->Fill(); as you do now
-create the output file z
-red->Write();

but then I get the error I reported.
Any ideas?

Regards
Fatima Soomro

Hi Fatima,

[quote]. How do I prevent the original tree from being written into the file I create?[/quote]In the synopsis you gave there is {b]no[/b] reason for this to happen! I.e. there is some operation that you are executing on the ‘original tree’ that you have not described and that leads to this behavior. If you send us a complete running example showing the behavior you see, we should be able to pinpoint what the issue is.

Cheers,
Philippe.