Histogramming modules
Analysis Objects
This module defines the API with the so-called Analysis objects. These are objects
that an analyser would interact with when doing their analysis.
They are observables, regions, systematics. The user interacts
with pythium.histogramming.objects.Observable , pythium.histogramming.objects.Region and
pythium.histogramming.objects.Systematic sub-classes through the configuration file.
- class pythium.histogramming.objects.Observable(var, name, binning, dataset, weights=1.0, label='', samples=None, exclude_samples=None, regions=None, exclude_regions=None, *, obs_build=None)
This class defines an observable that will be retrieved from all samples entering a given region, and constructed with the given binning.
- binning
The chosen binning for this observable
- Type
pythium.histogramming.binning._Binning
- dataset
The equivalent of a TTree in ROOT files. It is the parent group for the observable in the input file (e.g. nominal tree in a ROOT file)
- Type
- obs_build
An instance of
pythium.common.functor.Functorwhich defines how to build the observable from existing data- Type
pythium.common.functor.Functor
- classmethod fromFunc(var, func, args, *obs_args, **obs_kwargs)
Alternative “constructor” for
pythium.histogramming.objects.Observableclass which takes a function and function args instrad of var to compute a new observable from existing data- Parameters
var (
str) – The name to be given to the new observablefunc (
Union[Callable,List[Callable]]) – The function that defines how the variable should be computedargs (
Union[List[Union[str,int,float,Dict]],List[List[Union[str,int,float,Dict]]]]) – The argument to be passed to func to compute the observable
- Return type
TypeVar(TObservable, bound= Observable)- Returns
pythium.histogramming.objects.Observableclass instance with anpythium.histogramming.objects.ObservableBuilder
- classmethod fromStr(name, string_op, *obs_args, **obs_kwargs)
Alternative “constructor” for
pythium.histogramming.objects.Observableclass which takes a function and function args instrad of var to compute a new observable from existing data- Parameters
name (
str) – The name to be given to the new observablestring – The string that should be parsed to compute new observable
- Return type
TypeVar(TObservable, bound= Observable)- Returns
pythium.histogramming.objects.Observableclass instance with anpythium.histogramming.objects._ObservableBuilder
- class pythium.histogramming.objects.Region(name, selection, title=None, samples=None, exclude_samples=None, observables=None, exclude_observables=None, **kwargs)
This class defines a phase-space region object that the user will need
- name
The name given to the region
- selection
The
pythium.common.selection.Selectioninstance to be evaluated for all samples that enter this region
- samples
The list of
pythium.common.samples.Sampleinstances that should be included in this region
- exclude
The list of
pythium.common.samples.Sampleinstances that should be excluded from this region
Histogramming Utils
- class pythium.histogramming.binning.RegBin(low, high, nbins, axis=None)
Inherits from
pythium.histogramming.objects._Binningbut constructs uniform binning between given limits- low
The lower edge of histogram
- high
The higher edge of histogram
- nbins
The number of bins to build within the low and high
- class pythium.histogramming.binning.VarBin(binning, axis=None)
Inherits from
pythium.histogramming.objects._Binning
Configuration
Processing
This is where that steers that handles that booking-keeping for histogramming tasks
- class pythium.histogramming.processor.Processor(config, scheduler)
Class which sorts through the user configuration and makes transactions with the managers in order to run a histogramming chain
- create()
High-level function through which the user can start the constrction of the histogramming task-graph. No computation happens at this point
- cross_product(samples, regions, systematics, observables)
Make all cross-products from the user-provided configurations, skipping cross-products that aren’t needed.
- run()
Method to compute the histograms
- save(hists_dict)
Method to save the histograms into output pickle files :param hists_dict: Mapping of observable -> sample_region_syst_template -> histogram :type hists_dict: Dict
Task Managing
This is where manage different parts of the histogramming stage