cp3-llbb / CommonTools

Utilities to mass create histograms, flat trees, and more
2 stars 9 forks source link

[HistFactory] add support for sample weights #108

Closed blinkseb closed 8 years ago

blinkseb commented 8 years ago

The weights expressions must be defined in the python configuration, through the sample_weights dictionnary. The key is an identifier, and the value the expression of the weight.

In the sample json, one can use one of the key defined in the python configuration for the new sample-weight option. The weight evaluated from the expression will be used to scale all the histograms. If set to none or not specified, a default weight of 1 is applied.

Example:

In python, one can do

sample_weights = {
    'cluster_1': 'getWeightForCluster(1)',
    'cluster_2': 'getWeightForCluster(2)'
}

In the sample json, you can apply a given sample weight using the sample-weight option. It can be either cluster_1, or cluster_2.

{
    "TT_TuneCUETP8M1_13TeV-powheg-pythia8_MiniAODv2_v1.0.0+7415_TTAnalysis_12d3865": {
        "tree_name": "t",
        "files": [],
        "db_name": "TT_TuneCUETP8M1_13TeV-powheg-pythia8_MiniAODv2_v1.0.0+7415_TTAnalysis_12d3865",
        "sample-weight": "cluster_1"
    }
}
blinkseb commented 8 years ago

PR updated. The sample weight is now applied only on MC and disable on data.

swertz commented 8 years ago

Thanks! Let's reweight those babies!