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

Tool to analyze impact of individual nuisances on process shapes #269

Open pkausw opened 2 years ago

pkausw commented 2 years ago

This PR introduces a new function to the CombineHarvester that returns the templates for the processes in the harvester instance after setting the individual nuisance parameters to their post-fit values, respectively. (The idea is very similar to PR #268 ) The templates are saved as a map of the format

map[param_name] = TH1F

where param_name is the name of the nuisance parameter. The map also contains the prefit shape and the complete post-fit shape when considering all nuisance parameters simultaneously. The PR also introduces the bindings for the python interface, where this information is accessible as a python dictionary.

This information can be used to further analyze and understand how individual nuisances impact certain processes, e.g. by looping through the bins and processes:

for b in bins:
    bin_harv = harvester.cp().bin([b])
    for p in processes:
        proc_harvester = bin_harv.cp().process([p])
        these_procs = proc_harvester.process_set()
        if len(these_procs) == 0:
            print(("Could not load any processes with '{}' for bin '{}'"
                        .format(p, b)))
            continue
        total_shape_dict = proc_harvester.ShapeEvolution(fit)

The templates can be used e.g. to create figures such as this: postfit_shapes_ttH_2016_ljets_ge4j_ge4t_ttH_ttmb_ratioObservable_ttbb

These plots were used in the analysis HIG-19-011 to better understand and validate the statistical model and might be interesting for other analyses