Hello,
I have a 2D histogram (Response Matrix). It has equidistant binning. the x-axis is the reconstructed level, and the y-axis is the generator level.
Now I want to create a custom binning from the histogram.
Requisite:
Starting at the smallest values of a histogram, the neighboring bin (both on reco and gen axes) is merged into the current bin until both the purity and stability of the current bin exceed a threshold of 50%. The purity is defined as the fraction of entries in that (reco, gen) bin relative to all entries in that reco bin, while the stability is defined as the fraction of entries in that (reco, gen) bin relative to all entries in that gen bin. Once this threshold has been met, a new bin is started, and the bin-collating procedure is repeated until the end of the axis has been reached. And finally, print the final bin-edges of the merged histogram.
Could anyone suggest or give a script for doing this bin-collating procedure?
Thanks,
Soumyadip