Value with uncertainties

class heppy.Value(nominal, uncorr_variations={}, corr_variations={}, attributes={})

A single value with uncertainties.

Parameters:
  • nominal (float) – nominal value
  • uncorr_variations (dict of str and float) – dictionary of variations that are uncorrelated between different heppy.value objects even when they have the same key
  • corr_variations (dict of str and float) – dictionary of variations that are fully correlated between different heppy.value objects when they have the same key, and uncorrelated otherwise
  • attributes (dict) – dictionary of completely arbitrary attributes that the user can provide/change/access. E.g. information about the data sample that produced the value
to_atlasiff(attributes={}, up_suffix='__1up', down_suffix='__1down')

Returns string representation in ATLAS IFF format.

This is the XML format used by the fake-lepton background tool of the ATLAS Isolation and Fakes Forum.

Parameters:
  • attributes (str) – dictionary of attributes to put in the bin-tag
  • up_suffix – suffix in variation keys to designate an up variation
  • down_suffix – suffix in variation keys to designate an down variation

Usage example:

>>> import heppy as hp
>>> nominal = 12.3
>>> uncorr_variations = {
        'stat__1up' : 12.4,
        'stat__1down' : 12.1,
        }
>>> corr_variations={
        'efficiency__1up' : 13.1,
        'efficiency__1down' : 9.8,
        'energy_scale__1up' : 10.5,
        }
>>> v = hp.Value(nominal, uncorr_variations=uncorr_variations, corr_variations=corr_variations)
>>> v.to_atlasiff(attributes={'pt' : '[20,inf]', '|eta|' : '[0.0,0.6]'})
'<bin pt="[20,inf]" |eta|="[0.0,0.6]"> 12.3 +0.1-0.2 (stat) -1.8+0.0 (energy_scale) +0.8-2.5 (efficiency) </bin>'