Belle II Software
development
Toggle main menu visibility
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
Enumerator
c
d
f
p
t
v
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
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:142
analysis
examples
VariableManager
variableManager.py
Generated on Wed Apr 9 2025 02:34:18 for Belle II Software by
1.9.6