Add a branch to an existing Tree and save it in a file root

Hi everyone, i am trying to add a branch to an existing tree. In my branch there are just graphs. I don’t understand how to copy them inside the original file root.

Hi,

did you give a try to TDataFrame? You can easily Define new columns and Snapshot the dataset in a ttree in a file.
This is a tutorial showing these features: https://root.cern/doc/master/tdf007__snapshot_8C.html
In principle, supposing you have two branches in your tree, a and b. Suppose you want c, which is the sum of these two. Suppose you also want in the end to save the dataset:

ROOT::Experimental::TDataFrame d("mytree", "myfilee.root");
d.Define("c", "a + b").Snapshot("mytree","myNewFile.root");

Cheers,
D

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