Problem while reading from tree using SetBranchAddress()

Hi,

I’m creating a small tree from a big one in the following way: I have a list of the events that I want to put in a new tree. The event is identified from 3 number. In the attachment the list is the file “event_dump.out”

So each event in the list I loop on the tree until find the event and save it into a new tree.

But I find out that the variables that were supposed to have the values from the branches (via TTree::SetBranchAddress()) are empty

In side my tar.gz attached there is the file “MakeTreeFromDump.cc” that run all the program. The file “treefromdump.cc” creates the new tree, and also have a line code which sends the values read from the big tree to a file.

You also need the root tree that can be accessible in:

/afs/cern.ch/user/l/lsilva/public/4root/hist.root

I use root version 5.10/00 on a SLC 4

Tell me please what can be wrong?

Cheers,
Luis.

Thank you
Make_tree_from_dump.tar.gz (1.38 KB)

Any hint??

Hi,

The problem is that you have stored an object into your input tree and you are trying to retrieve it decomposed (i.e. by setting individual int and floats).
In order to do this decomposed retrieval you need to put the input TTree in MakeClass mode; however a tree in MakeClass mode can not be cloned (if it contains object).

So to do what you need, you will to go via an object either by using your original shared library or by regenarating it via TFile::MakeProject.

I am including your example modified to use TFile::MakeProject.

Cheers,
Philippe.
Make_tree_from_dump_fix.tar.gz (1.41 KB)