Belle II Software
light-2406-ragdoll
variableManager.py
1
#!/usr/bin/env python3
2
3
10
11
# The variableManager provides helpful tools for managing your variables.
12
#
13
# For full documentation please refer to https://software.belle2.org
14
# Anything unclear? Ask questions at https://questions.belle2.org
15
16
import
ROOT
17
import
variables
18
from
variables
import
variables
as
vm
# shorthand name for the VariableManager instance
19
20
# Get information about a variable:
21
var = vm.getVariable(
'M'
)
22
print(
"Name and Description of Variable M"
)
23
print(var.name)
24
print(var.description)
25
26
# Also see variablesToExtraInfo.py
27
vm.addAlias(
'sigProb'
,
'extraInfo(SignalProbability)'
)
28
var = vm.getVariable(
'sigProb'
)
29
print(
"Real name of sigProb: "
, var.name)
30
31
# We can also define collections of variables. For more on this, see usingCollections.py
32
vm.addCollection(
'Kinematics'
,
variables.std_vector
(
'px'
,
'py'
,
'pz'
))
33
var = vm.getCollection(
'Kinematics'
)
34
print(
"Collection named Kinematics: "
, list(var))
35
36
result = vm.evaluate(
'constant(123)'
, ROOT.nullptr)
37
print(
"Result of evaluating the variable 'constant(123)' "
, result)
38
39
# the variable names can contain special characters like (,:
40
# Therefore we have to escape the variable names before putting them into ROOT files.
41
# You can get the branch-names outputted by modules like VariablesToHistogram, VariablesToNtuple and
42
# VariablesToTree using the makeROOTCompatible function
43
var =
"extraInfo(SignalProbability)"
44
print(
"Root Compatible name of "
, var,
" is "
, ROOT.Belle2.MakeROOTCompatible.makeROOTCompatible(var))
45
46
print(
"You can get a full list of all available variables using 'basf2 variables.py'"
)
variables.std_vector
def std_vector(*args)
Definition:
__init__.py:135
analysis
examples
VariableManager
variableManager.py
Generated on Tue Jul 9 2024 23:26:30 for Belle II Software by
1.9.6