Home | News | Documentation | Download

How do I copy a leaf from many ROOT files into one?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

I have several hundred ROOT files, all with the same Tree structure. They all have a leaf, let’s call it “myNum”. I want to iterate over all of the files, and put all of these “myNum” leaf values into one ROOT file. I’m seems that somehow I could use CloneTree() or CopyTree() to do this, but I’m entirely new to ROOT and I’m not sure how. What’s the most efficient way?


For copying only some leafs into a new tree, have a look at the copytree.C tutorial. Instead of a single input tree, you can concatenate several trees using a TChain.