ftag.fraction_optimization#
Functions#
|
Convert the fraction values from dict to array or vice versa. |
|
Get the normalisation dict for the background flavours. |
|
Calculate the sum of the normalised rejections. |
|
Calculate the best fraction values for a given tagger and working point. |
Module Contents#
- ftag.fraction_optimization.convert_dict(fraction_values: dict | numpy.ndarray, backgrounds: ftag.labels.LabelContainer) numpy.ndarray | dict #
Convert the fraction values from dict to array or vice versa.
- Parameters:
fraction_values (dict | np.ndarray) – Dict of array with the fraction values
backgrounds (LabelContainer) – LabelContainer with the background flavours
- Returns:
Array or dict with the fraction values
- Return type:
np.ndarray | dict
- Raises:
TypeError – If the type of the input was wrong
- ftag.fraction_optimization.get_bkg_norm_dict(jets: numpy.ndarray, tagger: str, signal: ftag.labels.Label, flavours: ftag.labels.LabelContainer, working_point: float) dict #
Get the normalisation dict for the background flavours.
- Parameters:
jets (np.ndarray) – Loaded jets
tagger (str) – Name of the tagger
signal (Label) – Label instance of the signal
flavours (LabelContainer) – LabelContainer instance with all flavours used
working_point (float) – Working point that is to be used
- Returns:
Background normalisation dict
- Return type:
dict
- ftag.fraction_optimization.calculate_rejection_sum(fraction_dict: dict | numpy.ndarray, jets: numpy.ndarray, tagger: str, signal: ftag.labels.Label, flavours: ftag.labels.LabelContainer, working_point: float, bkg_norm_dict: dict, rejection_weights: dict) float #
Calculate the sum of the normalised rejections.
- Parameters:
fraction_dict (dict | np.ndarray) – Dict/Array with the fraction values
jets (np.ndarray) – Loaded jets
tagger (str) – Name of the tagger
signal (Label) – Label instance of the signal
flavours (LabelContainer) – LabelContainer with all flavours
working_point (float) – Working point that is used
bkg_norm_dict (dict) – Backgroud normalisation dict
rejection_weights (dict) – Weights for the rejections
- Returns:
Sum of the normalised rejections
- Return type:
float
- ftag.fraction_optimization.calculate_best_fraction_values(jets: numpy.ndarray, tagger: str, signal: ftag.labels.Label, flavours: ftag.labels.LabelContainer, working_point: float, rejection_weights: dict | None = None, optimizer_method: str = 'Powell') dict #
Calculate the best fraction values for a given tagger and working point.
- Parameters:
jets (np.ndarray) – Loaded jets
tagger (str) – Name of the tagger
signal (Label) – Label instance of the signal
flavours (LabelContainer) – LabelContainer with all flavours
working_point (float) – Working point that is used
rejection_weights (dict | None, optional) – Rejection weights for the background classes, by default None
optimizer_method (str, optional) – Optimizer method for the minimization, by default “Powell”
- Returns:
Dict with the best fraction values
- Return type:
dict