Keeping folder hierarchy when using CloneTree

Dear experts,

my problem is extremely simple and yet I did not manage to find any answer so far. I have a TTree inside a TFile. That tree comes in a hierarchy, i.e. the tree called “outTree” comes in my TFile as “demo/outTree” where “demo” is the name of my folder.

I would like to copy a subset of that tree, e.g. using copytree.C in the tutorials. In those tutorial macros, the new tree is created using CloneTree()

Problem: when I use CloneTree(), the folder “demo” disappears in the new tree inside the new TFile. I would like to keep it inside the new File. How can I do that ?

Thanks a lot.

Otman

Hi Otman!

You’ll have to create the directory in the output file first. Try this:

fileOut->mkdir("demo")
fileOut->cd("demo");
origTree->CloneTree();

Cheers, Axel.

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