Hi,
I am using ROOT files as input and output of a simulation.
I need to copy a tree from my input file (“a0.root”) to my output file (“a.root”), just 1 to 1, without making any change on it.
I thought that something like this would work:
a0->ls();
TTree *tinput = (TTree*)a0->Get("tinput");
a -> cd();
tinput->CloneTree()->Write();
But it does not. The file “a.root” contains a “tinput”, but it is empty.
I know that defining all branches and their addresses it would probably work, but I would prefer to avoid this because the structure of my tinput is not always the same (depends on which kind of input is coming to the simulation).
Can somebody tell me how to copy one tree from one file to another without the need of defining all the branches?
Thanks in advance,
Estela.