qpym2.io.staging#

input output related to staging data.

Module Contents#

Functions#

create_rdf_m2mc

Create the RDataFrame from the MC files for M2 analysis.

read_hist

Read a ROOT file and return the histogram. Implements the branch definitions and filters.

read_evlist

Read a ROOT file and return the event list. Implements the branch definitions and filters.

API#

qpym2.io.staging.create_rdf_m2mc(fname, mcpath, out_fname='', read_config={}, write_config={}, filters=[])#

Create the RDataFrame from the MC files for M2 analysis.

Args:

fname (str): mc file name (from the mctable, e.g. ‘0vbb.root’) mcpath (str): path to the MC files. out_fname (str): path to the output file. If empty, use the default

as write_config[‘outpath’]/fname.

read_config (dict): configuration for the read_rdf function.
Default is {

‘treename’: ‘outTree’, ‘evar’: ‘Energy’, ‘esum_var’: ‘TotalEnergy’, ‘ch1’: ‘Channel’, ‘ch2’: ‘Multiplet[1]’

}.

write_config (dict): configuration for the create_rdf function.
Default is {

‘outpath’: ‘output’, ‘treename’: ‘uvtree’, ‘out_cols’: [‘u’, ‘v’, ‘ch1’, ‘ch2’]

}.

filters (list of string): list of filters. Multiplicity==2 added by default.

Returns:

RDataFrame: the RDataFrame object.

TODO:
  • see if we need ` && cutsTree.Included && cutsTree.FullMultiplet`

qpym2.io.staging.read_hist(fpath, hm, treename='uvtree', defs=[], filters=[], rtype='numpy')#

Read a ROOT file and return the histogram. Implements the branch definitions and filters.

Args:

fpath (str): path to the ROOT file. hm (hist_model): hist model treename (str): name of the tree. Defaults to ‘uvtree’. defs (list of (alias, def)): list of branch definitions. filters (list of string): list of filters. Default is None. 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)

qpym2.io.staging.read_evlist(fpath, treename, defs=[], filters=[], rtype='numpy')#

Read a ROOT file and return the event list. Implements the branch definitions and filters.

Args:

fpath (str): path to the ROOT file. treename (str): name of the tree. defs (list of (alias, def)): list of branch definitions. filters (list of string): list of filters. Default is None. rtype (str): return type. Default is ‘numpy’, others not implementd.

Returns:

event list: (u, v) numpy array