Systematics module
This module contains the systematics functions for the FAIR Challenge. Originally written by David Rousseau, and Victor Estrade.
- systematics.all_bkg_weight_norm(weights, label, systBkgNorm)
Apply a scaling to the weight.
- Args:
weights (array-like): The weights to be scaled label (array-like): The labels systBkgNorm (float): The scaling factor
- Returns:
array-like: The scaled weights
- systematics.diboson_bkg_weight_norm(weights, detailedlabel, systBkgNorm)
Apply a scaling to the weight. For Diboson background
- Args:
weights (array-like): The weights to be scaled
detailedlabel (array-like): The detailed labels
systBkgNorm (float): The scaling factor
- Returns:
array-like: The scaled weights
- systematics.get_bootstrapped_dataset(test_set, mu=1.0, seed=31415, ttbar_scale=None, diboson_scale=None, bkg_scale=None, poisson=True)
Generate a bootstrapped dataset
- Args:
test_set (dict): The original test dataset
mu (float): The scaling factor for htautau background
seed (int): The random seed
ttbar_scale (float): The scaling factor for ttbar background
diboson_scale (float): The scaling factor for diboson background
bkg_scale (float): The scaling factor for other backgrounds
- Returns:
pandas.DataFrame: The bootstrapped dataset
- systematics.get_systematics_dataset(data, tes=1.0, jes=1.0, soft_met=0.0)
- systematics.make_unweighted_set(data_set)
- systematics.mom4_manipulate(data, systTauEnergyScale, systJetEnergyScale, soft_met, seed=31415)
Manipulate primary inputs : the PRI_had_pt PRI_jet_leading_pt PRI_jet_subleading_pt and recompute the others values accordingly.
- Args:
data (pandas.DataFrame): The dataset to be manipulated
systTauEnergyScale (float): The factor applied to PRI_had_pt
systJetEnergyScale (float): The factor applied to all jet pt
soft_met (float): The additional soft MET energy
seed (int): The random seed
- Returns:
pandas.DataFrame: The manipulated dataset
- systematics.postprocess(data)
Select the events with the following conditions: * PRI_had_pt > 26 * PRI_jet_leading_pt > 26 * PRI_jet_subleading_pt > 26 * PRI_lep_pt > 20
This is applied to the dataset after the systematics are applied
- Args:
data (pandas.DataFrame): The manipulated dataset
- Returns:
pandas.DataFrame: The postprocessed dataset
- systematics.repeat_rows_by_weight(data_set, seed=31415)
- systematics.systematics(data_set=None, tes=1.0, jes=1.0, soft_met=0.0, seed=31415, ttbar_scale=None, diboson_scale=None, bkg_scale=None, dopostprocess=True)
Apply systematics to the dataset
- Args:
data_set (dict): The dataset to apply systematics to
tes (float): The factor applied to PRI_had_pt
jes (float): The factor applied to all jet pt
soft_met (float): The additional soft MET energy
seed (int): The random seed
ttbar_scale (float): The scaling factor for ttbar background
diboson_scale (float): The scaling factor for diboson background
bkg_scale (float): The scaling factor for other backgrounds
- Returns:
dict: The dataset with applied systematics
- systematics.ttbar_bkg_weight_norm(weights, detailedlabel, systBkgNorm)
Apply a scaling to the weight. For ttbar background
- Args:
weights (array-like): The weights to be scaled
detailedlabel (array-like): The detailed labels
systBkgNorm (float): The scaling factor
- Returns:
array-like: The scaled weights