Weights
- class coffea.processor.Weights(size, storeIndividual=False)[source]
Bases:
object
Container for event weights and associated systematic shifts
This container keeps track of correction factors and systematic effects that can be encoded as multiplicative modifiers to the event weight. All weights are stored in vector form.
- Parameters:
Attributes Summary
List of available modifiers
Methods Summary
add
(name, weight[, weightUp, weightDown, shift])Add a new weight
partial_weight
([include, exclude])Partial event weight vector
weight
([modifier])Current event weight vector
Attributes Documentation
- variations
List of available modifiers
Methods Documentation
- add(name, weight, weightUp=None, weightDown=None, shift=False)[source]
Add a new weight
Adds a named correction to the event weight, and optionally also associated systematic uncertainties.
- Parameters:
name (str) – name of correction
weight (numpy.ndarray) – the nominal event weight associated with the correction
weightUp (numpy.ndarray, optional) – weight with correction uncertainty shifted up (if available)
weightDown (numpy.ndarray, optional) – weight with correction uncertainty shifted down. If
weightUp
is supplied, and the correction uncertainty is symmetric, this can be set to None to auto-calculate the down shift as1 / weightUp
.shift (bool, optional) – if True, interpret weightUp and weightDown as a realtive difference (additive) to the nominal value
Note
weightUp
andweightDown
are assumed to be rvalue-like and may be modified in-place by this function
- partial_weight(include=[], exclude=[])[source]
Partial event weight vector
Return a partial weight by multiplying a subset of all weights. Can be operated either by specifying weights to include or weights to exclude, but not both at the same time. The method can only be used if the individual weights are stored via the
storeIndividual
argument in theWeights
initializer.- Parameters:
- Returns:
weight – The weight vector, corresponding to only the effect of the corrections specified.
- Return type:
- weight(modifier=None)[source]
Current event weight vector
- Parameters:
modifier (str, optional) – if supplied, provide event weight corresponding to a particular systematic uncertainty shift, of form
str(name + 'Up')
or (Down)- Returns:
weight – The weight vector, possibly modified by the effect of a given systematic variation.
- Return type: