CloneTree(0) problem when using TTreeReader


_ROOT Version: 6.06.00
_Platform: slc6_amd64
_Compiler: gcc530


Dear root experts,
I have met a problem in CloneTree(0), when I use TTreeReader.
I want to do some selections about my root file, and only selected entries are copied to the new tree. But when I use a TTreeReader to do those selections, only branches that in the selections have store their values for each entry correctly, for branches not used in the selections, the values are all default values (such as 0).
My code is in the attachment, I also try to use SetBranchAddress() method which is successful. I wonder know how can I use TTreeReader to save tree after selections correctly.
Best regards,
Jie
copytree.cc (8.0 KB)

Exactly the same problem, 6 days ago: TTreeReader with cloneTree

1 Like

It seems that RDataFrame can solve my problem. Thank you so much, Behrenhoff!
BTW, I just learn to use TTreeReader, but a new way appears – RDataFrame, is this the best way to handle such as TTree reading, selecting, and saving …

Hi Jie,

RDataFrame uses TTreeReader internally - these tools build on top of each other. And I agree, just like there’s screwdrivers and drills and knives, and all have their purpose, it’s sometimes a challenge to find the right tool for the job :slight_smile: But we’re here to help!

Axel.

Glad to know this. Thanks, Axel! :wink:
Jie

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.