BTagScaleFactor

class coffea.btag_tools.BTagScaleFactor(filename, workingpoint, methods='comb,comb,incl', keep_df=False)[source]

Bases: object

A class holding one complete BTag scale factor for a given working point

Parameters:
  • filename (str) – The BTag-formatted CSV file to read (accepts .csv, .csv.gz, etc.) See pandas read_csv for all supported compressions.

  • workingpoint (str or int) – The working point, one of LOOSE, MEDIUM, TIGHT, or RESHAPE (0-3, respectively)

  • methods (str, optional) – The scale factor derivation method to use for each flavor, ‘b,c,light’ respectively. Defaults to ‘comb,comb,incl’

  • keep_df (bool, optional) – If set true, keep the parsed dataframe as an attribute (.df) for later inspection

Attributes Summary

FLAV_B

FLAV_C

FLAV_UDSG

LOOSE

MEDIUM

RESHAPE

TIGHT

Methods Summary

__call__(systematic, flavor, eta, pt[, ...])

Call self as a function.

eval(systematic, flavor, eta, pt[, discr, ...])

Evaluate this scale factor as a function of jet properties

readcsv(filename)

Reads a BTag-formmated CSV file into a pandas dataframe

Attributes Documentation

FLAV_B = 0
FLAV_C = 1
FLAV_UDSG = 2
LOOSE = 0
MEDIUM = 1
RESHAPE = 3
TIGHT = 2

Methods Documentation

__call__(systematic, flavor, eta, pt, discr=None, ignore_missing=False)[source]

Call self as a function.

eval(systematic, flavor, eta, pt, discr=None, ignore_missing=False)[source]

Evaluate this scale factor as a function of jet properties

Parameters:
  • systematic (str) – Which systematic to evaluate. Nominal correction is ‘central’, the options depend on the scale factor and method

  • flavor (numpy.ndarray or awkward.Array) – The generated jet hadron flavor, following the enumeration: 0: uds quark or gluon, 4: charm quark, 5: bottom quark

  • eta (numpy.ndarray or awkward.Array) – The jet pseudorapitiy

  • pt (numpy.ndarray or awkward.Array) – The jet transverse momentum

  • discr (numpy.ndarray or awkward.Array, optional) – The jet tagging discriminant value (default None), optional for all scale factors except the reshaping scale factor

  • ignore_missing (bool, optional) – If set true, any values that have no correction will return 1. instead of throwing an exception. Out-of-bounds values are always clipped to the nearest bin.

Returns:

out – An array with shape matching pt, containing the per-jet scale factor

Return type:

numpy.ndarray or awkward.Array

classmethod readcsv(filename)[source]

Reads a BTag-formmated CSV file into a pandas dataframe

This function also merges the bin min and max into a tuple representing the bin

Parameters:

filename (str) – The file to open

Returns:

  • df (pandas.DataFrame) – A dataframe containing all info in the file

  • discriminator (str) – The name of the discriminator the correction map is for