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)
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 …
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 But we’re here to help!