15 Wrapper around the variable manager class.
16 This is necessary for avoiding to import ROOT globally when 'variables' is imported.
22 Return an instance to the variable manager.
25 instance = ROOT.Belle2.Variable.Manager.Instance()
30 Wrapper around Manager::getVariable(std::string name) and
31 Manager::getVariable(const std::string& functionName, const std::vector<std::string>& functionArguments).
33 instance = PythonVariableManager._instance()
34 return instance.getVariable(*args)
38 Wrapper around Manager::getVariables(const std::vector<std::string>& variables) and
39 Manager::getVariables().
41 instance = PythonVariableManager._instance()
42 return instance.getVariables(*args)
46 Wrapper around Manager::addAlias(const std::string& alias, const std::string& variable).
48 instance = PythonVariableManager._instance()
49 assert(instance.addAlias(alias, variable))
53 Wrapper around Manager::printAliases().
55 instance = PythonVariableManager._instance()
56 instance.printAliases()
60 Wrapper around Manager::clearAliases().
62 instance = PythonVariableManager._instance()
63 instance.clearAliases()
67 Wrapper around Manager::addCollection(const std::string& collection, const std::vector<std::string>& variables)
69 instance = PythonVariableManager._instance()
70 assert(instance.addCollection(*args))
74 Wrapper around Manager::getCollection(const std::string& collection).
76 instance = PythonVariableManager._instance()
77 return instance.getCollection(collection)
81 Wrapper around Manager::resolveCollections(const std::vector<std::string>& variables).
83 instance = PythonVariableManager._instance()
84 return instance.resolveCollections(*args)
88 Wrapper around Manager::checkDeprecatedVariable(const std::string& name).
90 instance = PythonVariableManager._instance()
91 instance.checkDeprecatedVariable(variable)
95 Wrapper around Manager::evaluate(const std::string& varName, const Particle* p).
97 instance = PythonVariableManager._instance()
98 return instance.evaluate(variable, particle)
102 Wrapper around Manager::getNames().
104 instance = PythonVariableManager._instance()
105 return instance.getNames()
109 Wrapper around Manager::getAliasNames().
111 instance = PythonVariableManager._instance()
112 return instance.getAliasNames()
116 Wrapper around Manager::assertValidName(const std::string& name).
118 instance = PythonVariableManager._instance()
119 instance.assertValidName(variable)
126 def std_vector(*args):
128 Creates an std::vector which can be passed to pyROOT
131 v = ROOT.std.vector(type(args[0]))()
137 def getCommandLineOptions():
138 """ Parses the command line options and returns the corresponding arguments. """
139 parser = argparse.ArgumentParser()
140 parser.add_argument(
'--no-pager', dest=
'pager', default=
True, action=
'store_false',
141 help=
'Use a pager to show output or print to terminal.')
142 args = parser.parse_args()
146 def printVars(changedVariableNames=None):
148 Print list of all available variables.
151 if changedVariableNames:
152 print(changedVariableNames)
153 print(
'Available variables in Variable::Manager:')
154 allVars = variables.getVariables()
157 vars.append((v.group, v.name, v.description))
161 for (group, name, description)
in sorted(vars):
162 if current_group != group:
163 current_group = group
165 rows.append([name, description])
166 b2utils.pretty_print_description_list(rows)
169 def getAllTrgNames():
171 Return all PSNM trigger bit names
174 bits = ROOT.Belle2.PyDBObj(
'TRGGDLDBFTDLBits')
175 evt = ROOT.Belle2.EventMetaData()
176 ROOT.Belle2.DBStore.Instance().update(evt)
177 size = ROOT.Belle2.TRGSummary.c_ntrgWords * ROOT.Belle2.TRGSummary.c_trgWordSize
178 return [bits.getoutbitname(i)
for i
in range(size)
if bits.getoutbitname(i) !=
'']
def evaluate(self, variable, particle)
def assertValidName(self, variable)
def addAlias(self, alias, variable)
def addCollection(self, *args)
def getCollection(self, collection)
def getVariables(self, *args)
def checkDeprecatedVariable(self, variable)
def getVariable(self, *args)
def resolveCollections(self, *args)