ftag.working_points#
Calculate tagger working points.
Functions#
|
Parse the input arguments into a Namespace. |
|
Get the fraction values for each tagger from the argparsed inputs. |
|
Calculate the efficiency/rejection for each flavour. |
|
Calculate the efficiency/rejection at a certain discriminant values. |
|
Load the jets from the files and setup the taggers. |
|
Calculate the working points. |
|
Calculate the efficiencies for the given jets. |
|
Main function to run working point calculation. |
Module Contents#
- ftag.working_points.parse_args(args: collections.abc.Sequence[str]) argparse.Namespace #
Parse the input arguments into a Namespace.
- Parameters:
args (Sequence[str] | None) – Sequence of string inputs to the script
- Returns:
Namespace with the parsed arguments
- Return type:
argparse.Namespace
- Raises:
ValueError – When both –effs and –disc_cuts are provided
ValueError – When neither –effs nor –disc_cuts are provided
ValueError – When the number of fraction values is not conistent
ValueError – When the sum of fraction values for a tagger is not equal to one
- ftag.working_points.get_fxs_from_args(args: argparse.Namespace, flavours: ftag.labels.LabelContainer) list #
Get the fraction values for each tagger from the argparsed inputs.
- Parameters:
args (argparse.Namespace) – Input arguments parsed by the argparser
flavours (LabelContainer) – LabelContainer instance of the labels that are used
- Returns:
List of dicts with the fraction values. Each dict is for one tagger.
- Return type:
list
- ftag.working_points.get_eff_rej(jets: numpy.ndarray, disc: numpy.ndarray, wp: float, flavours: ftag.labels.LabelContainer) dict #
Calculate the efficiency/rejection for each flavour.
- Parameters:
jets (np.ndarray) – Loaded jets
disc (np.ndarray) – Discriminant values of the jets
wp (float) – Working point that is used
flavours (LabelContainer) – LabelContainer instance of the flavours used
- Returns:
Dict with the efficiency/rejection values for each flavour
- Return type:
dict
- ftag.working_points.get_rej_eff_at_disc(jets: numpy.ndarray, tagger: str, signal: ftag.labels.Label, disc_cuts: list, flavours: ftag.labels.LabelContainer, fraction_values: dict) dict #
Calculate the efficiency/rejection at a certain discriminant values.
- Parameters:
jets (np.ndarray) – Loaded jets used
tagger (str) – Name of the tagger
signal (Label) – Label instance of the signal flavour
disc_cuts (list) – List of discriminant cut values for which the efficiency/rejection is calculated
flavours (LabelContainer) – LabelContainer instance of the flavours that are used
- Returns:
Dict with the discriminant cut values and their respective efficiencies/rejections
- Return type:
dict
- ftag.working_points.setup_common_parts(args: argparse.Namespace) tuple[numpy.ndarray, numpy.ndarray | None, ftag.labels.LabelContainer] #
Load the jets from the files and setup the taggers.
- Parameters:
args (argparse.Namespace) – Input arguments from the argparser
- Returns:
Outputs the ttbar jets, the zprime jets (if wanted, else None), and the flavours used.
- Return type:
tuple[dict, dict | None, list]
- ftag.working_points.get_working_points(args: argparse.Namespace) dict | None #
Calculate the working points.
- Parameters:
args (argparse.Namespace) – Input arguments from the argparser
- Returns:
Dict with the working points. If args.outfile is given, the function returns None and stored the resulting dict in a yaml file in args.outfile.
- Return type:
dict | None
- ftag.working_points.get_efficiencies(args: argparse.Namespace) dict | None #
Calculate the efficiencies for the given jets.
- Parameters:
args (argparse.Namespace) – Input arguments from the argparser
- Returns:
Dict with the efficiencies. If args.outfile is given, the function returns None and stored the resulting dict in a yaml file in args.outfile.
- Return type:
dict | None
- ftag.working_points.main(args: collections.abc.Sequence[str]) dict | None #
Main function to run working point calculation.
- Parameters:
args (Sequence[str] | None, optional) – Input arguments, by default None
- Returns:
The output dict with the calculated values. When –outfile was given, the return value is None
- Return type:
dict | None