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