I have several root files which contains one tree with the same name. I would like to create an unique root file which contains several root files.
For instance, I have the following files with the same name tree “my_tree”:
And I would like merge this 3 files in one root file called run.root
How to create this run.root file which contains a tree called my_tree with the data of the three previous files?
I tried with CloneTree, CopyTree but I am not sure about syntax.
The easiest is to use the command hadd from the shell prompt
hadd run.root run1.root run2.root run3.root
For example of the use of CloneTree see $ROOTSYS/tutorials/tree/copytree*.C
Thanks, it seems to work.
However, I noted something.
When I run, for example, hadd run.root run1.root run2.root run3.root
I have the following message
[quote]Target file: run.root
Source file 1: run1.root
Source file 2: run2.root
Source file 3: run3.root
Target path: run.root:/
run1.root tree:my_tree entries=1234567890
run2.root tree:my_tree entries=1234567890
run3.root tree:my_tree entries=1234567890[/quote]
I do not understand what mean 1234567890. It is always the same number for each chain I create
[quote]I do not understand what mean 1234567890. It is always the same number for each chain I create[/quote]This is a special number indicates that at the time the information is printed the actual size of the TTree in the chain is not yet known. This happens because we do not open the file until we have too and thus when printing this information before the chain has been actually walked we do not know the actual size of the TTree.