I am trying to hadd two ttree’s , ( I am using a modified version of $ROOTSYS/tutorials/io/hadd.C) but what I would like to have at the end, is a “merged” TH1F plot what a custom binning, for example specifying that each bin should include at least n events (TAxis for example ?)… Is there any way to do that ?
you could simply post-process the result of the merging of the histograms, and combine adjacent bins until they satisfy your minimum entries requirement.
Hi,
that tutorial creates a binning with on average one entry per bin: a bin with a content of 4 gets split into four bins.
You want to merge bins and that’s different. It’s actually a common problem; I agree that it would be good to provide the optimal bin edges given a histogram - right now ROOT doesn’t. A good implementation isn’t completely trivial; I will post a script that does it once it’s ready.
TAxis *axis = new TAxis(nbins,xq);copies immediately the content of xq to the TAxis object.
Any modification to xq and yq done after this creation have no effect on the TAxis object.
[quote]it will give correctly the bins I need ?[/quote]I still don’t think so, but at least it is now because the algorithm might be wrong and not because there is no information passed to the TAxis.
I have no clue why you hav yq array that you set but do not use.
The xq array seems to ask for evenly spaced bins from 0 to 1.