Hi,
I have been trying to make a macro which loops over all branches of two trees with identical structures, and plots the branch contents for both files on the same canvas so that the results can be compared.
Obviously, the default binning is not always the same due to outliers etc, and so I use the “>>hist” option to create a new histogram from what is drawn by TTree:Draw, get the nxbins, xmin, xmax from “hist”, and make the second histogram I want to plot using “>>hist1(nxbins,xmin,max)” so that the binning of hist & hist1 is the same, and they can be meaningfully compared.
However, once I set the binning of hist1, the binning of hist on the next branch seems to be changed. For instance, the nxbins for “hist” for the first few branches should be [3,101,4,4,11], but if I set the binning of “hist1” to be the same, the nxbins of “hist” becomes [3,4,6,6,8].
If I use a binning of “hist1>>(100,xmin,xmax)” then the I get the nxbins for “hist” to be [3,101,4,4,11] as it should be, but with “hist1>>(10,xmin,xmax)” I get [3,11,4,4,15].
I delete hist & hist1 at the end of the loop, so I think it is some environment variable being set that causes the problem. If so, is there some way I can reset it?
I have attached the macro. I am using root version 5.26.00e
Thanks,
Nick.
plotBranches.C (3.53 KB)