It’s the first time that I am trying to create a TTree and I am a bit confused…
The idea is the following : I have a root file that contains histograms. I want to loop over them in order to make some calculations and store those in variables (say x, y, z), in a new root file.
This new root file will contain one TTree and some TBranches, each one corresponding to the aforementioned variables(i.e. x, y, z).
The thing is that I see that there are several cases on how to construct TBranches ( root.cern.ch/doc/master/classTTree.html ), but I am very confused on how to fill them.
For instance TBranch *branch = tree->Branch(branchname, &p_object, bufsize, splitlevel) how can I choose the address, or the bufsize?
From the “tree tutorials on the web”, see:
bill.C
cernbuild.C
circular.C
clonesA_Event.C
drawsparse.C
htest.C
hvector.C
jets.C
tree0.C
tree3.C
treefriend.C
tv3.C
Note that the tree tutorials on the web have a better look here: root.cern.ch/doc/master/group__ … _tree.html as the macro are executed when the doc is built every night and their output are shown.
Olivier gives links to ROOT 6 tutorials while I give ROOT 5. There is no guarantee that ROOT 6 tutorials work with ROOT 5 while the opposite should be the case (in principle, you should be able to find ROOT tutorials for your own version in your “${ROOTSYS}/tutorials” subdirectory).
In that particular case the tutorials are the same. The ROOT 6 version on the web, showing the output, makes them easier to scan to find what you are looking for. (and they are guarantied to work with 6 as they are run every night to generate the doc). As Pepe said you can find all of them as .C files in ${ROOTSYS}/tutorials/tree.