Belle II Software  release-05-01-25
arich.py
1 # !/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 This module defines wrapper functions around the arich modules.
6 """
7 
8 from basf2 import register_module, create_path
9 from basf2 import B2INFO, B2WARNING, B2ERROR, B2FATAL
10 import variables.utils as vu
11 
12 
13 def arichVariablesToNtuple(decayString, variables, arichSelector, treename='variables', filename='ntuple.root', path=None):
14  """
15  Creates and fills a flat ntuple with the specified variables from the VariableManager.
16  If a decayString is provided, then there will be one entry per candidate (for particle in list of candidates).
17  If an empty decayString is provided, there will be one entry per event (useful for trigger studies, etc).
18 
19  Parameters:
20  decayString (str): specifies type of Particles and determines the name of the ParticleList
21  variables (list(str)): the list of variables (which must be registered in the VariableManager)
22  arichSelector (str): decay string that marks the particles to which arich info should be appended
23  treename (str): name of the ntuple tree
24  filename (str): which is used to store the variables
25  path (basf2.Path): the basf2 path where the analysis is processed
26  """
27 
28  arich_vars = vu.create_aliases_for_selected(['arich'],
29  decay_string=arichSelector)
30 
31  output = register_module('arichToNtuple')
32  output.set_name('arichToNtuple_' + decayString)
33  output.param('particleList', decayString)
34  output.param('variables', variables)
35  output.param('arichVariables', arich_vars)
36  output.param('arichSelector', arichSelector)
37  output.param('fileName', filename)
38  output.param('treeName', treename)
39  path.add_module(output)
variables.utils
Definition: utils.py:1