qpym2.hists#

Module Contents#

Functions#

get_h2proj

Return the projection of a 2D histogram along the specified axis

get_sum_hist

Return the sum histogram from the components and their norms

get_hist_settings

Return the nbins and range parameters for histogram according to the model

get_empty_hist

Return an empty histogram according to hm

smooth_nph2

create_hist_m2sum

create a 1D histogram of esum (m2sum)

create_hist_m2diff

create a 1D histogram of ediss (v*sqrt(2))

create_hist_m2e2

create a 1D histogram of e2

create_hist_h2ee

create a 2D histogram of e1 vs e2

create_hist_h2esumediff

create 2D histogram of ediff vs esum (scaled u,v)

create_hist_h2esume2

create 2D histogram of e2 vs esum

create_hist_h2uv

create 2D histogram of u vs v

get_hist_from_rdf

Return a histogram according to hm. Assumes ‘u’ and ‘v’ branches are present in rdf.

Data#

API#

qpym2.hists.HistType = None#
qpym2.hists.get_h2proj(h2, axis=0)#

Return the projection of a 2D histogram along the specified axis

h2numpy.ndarray

The 2D histogram.

axisint

The axis along which to project. Default is 0 (x-axis).

h1numpy.ndarray

The 1D histogram.

qpym2.hists.get_sum_hist(comps, norms)#

Return the sum histogram from the components and their norms

compspandas.DataFrame

The components table.

normslist

The list of norms.

sum_histnumpy.ndarray

The sum histogram.

qpym2.hists.get_hist_settings(hm)#

Return the nbins and range parameters for histogram according to the model

Args:

hm (hist_model): hist model

Raises:

TypeError: if the hist_type is not supported

Returns:

nbins, range: numbr of bins per axis and range (min, max) per axis

TODO: clean w/ copilot

qpym2.hists.get_empty_hist(hm, return_numpy=True)#

Return an empty histogram according to hm

TODO: clean with copilot

qpym2.hists.smooth_nph2(h2, smooth=(1, 'k5b'))#
qpym2.hists.create_hist_m2sum(rdf, hm, rtype='numpy')#

create a 1D histogram of esum (m2sum)

qpym2.hists.create_hist_m2diff(rdf, hm, rtype='numpy')#

create a 1D histogram of ediss (v*sqrt(2))

qpym2.hists.create_hist_m2e2(rdf, hm, rtype='numpy')#

create a 1D histogram of e2

qpym2.hists.create_hist_h2ee(rdf, hm, rtype='numpy')#

create a 2D histogram of e1 vs e2

qpym2.hists.create_hist_h2esumediff(rdf, hm, rtype='numpy')#

create 2D histogram of ediff vs esum (scaled u,v)

qpym2.hists.create_hist_h2esume2(rdf, hm, rtype='numpy')#

create 2D histogram of e2 vs esum

qpym2.hists.create_hist_h2uv(rdf, hm, rtype='numpy')#

create 2D histogram of u vs v

qpym2.hists.get_hist_from_rdf(rdf, hm, rtype='numpy')#

Return a histogram according to hm. Assumes ‘u’ and ‘v’ branches are present in rdf.

Args:

rdf (RDataFrame): RDataFrame object hm (hist_model): hist model rtype (str): return type. ‘numpy’ or ‘root’. Default is ‘numpy’.

Returns:

histogram: (histo, xedges, yedges) if return_numpy is True. otherwise return a THist variant (ROOT)

TODO: there must be a better version than if-else with enum