cms-analysis / CombineHarvester

CMSSW package for the creation, editing and analysis of combine datacards and workspaces
cms-analysis.github.io/CombineHarvester/
15 stars 180 forks source link

Added options in plotGof.py for custom range and bin numbers #270

Closed vicha-w closed 2 years ago

vicha-w commented 2 years ago

Hi,

I have added several options to plotGof.py to make plotting goodness-of-fit test statistics a bit more flexible. Previously when we plot with a JSON file containing all test statistic values, the script will plot a histogram with its range based on the highest and lowest value of the test statistic in that JSON file. This may cause problems when the JSON file contains an outlier.

For example, here is a goodness-of-fit plot with default options: gof_plot_default

As you may not notice, there is a very small outlier bump around 4400, and this causes the whole distribution to be skewed sharply to the left.

I have added options --range and --bins allowing users to change histogram range and bins to better display the distribution of test statistics, regardless of outliers.

Here is the same distribution plotted with --range and --bins options applied: gof_plot_range gof_plot_rangeandbin

The changes I am proposing would require changing the plotting functions in CombineTools/python/plotting.py, but it should not break existing code. Please let me know if you would like me to make any further changes.

Thanks, Vichayanun

adewit commented 2 years ago

Sorry, I think we didn't deal with this PR in the end. It's fine with me as this can indeed be useful and the default behaviour is unchanged