evaluator#
- class coffea.lookup_tools.evaluator(names, types, primitives)[source]#
Bases:
objectThe evaluator class serves as a single point of entry for looking up values of histograms and other functions read in with the extractor class. Stored look ups can be indexed by name and then called through an overloaded __call__ function.
Example:
#assuming 'eta' and 'pt' are array like objects wgts = "testSF2d scalefactors_Tight_Electron tests/samples/testSF2d.histo.root" extractor.add_weight_sets([wgts]) extractor.finalize(reduce_list=['testSF2d']) evaluator = extractor.make_evaluator() out = evaluator["testSF2d"](eta, pt)
The returned value has the same shape as the input arguments.
lookup_typesis a map of possible constructors for extracted data. The arguments used when calling the evaluator depend on which named weight is being used (eg. in the above example, the “testSF2d” weight requiresetaandptbe passed when calling the evaluator).It is recommended to construct an evaluator from an extractor, so ensure that inputs to the constructor are properly ordered and formatted.
- Parameters:
names (
dict[str,int]) – A dictionary mapping the names of weights to the index of that weight inprimitives.types (
list[str]) – A list of the types of weights, ordered in the same way asprimitives.primitives (
list[Varies]) – A list of primitives, whose type and structure depend on types. Should be order in the same way asprimitives.
Methods Summary
keys()returns the available functions
Methods Documentation