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