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
▼
Belle II Software
►
Modules
►
Namespaces
►
Classes
▼
Files
►
File List
►
File Members
formulaVariablesExample.py
1
#!/usr/bin/env python3
2
3
10
11
# An example/test of using the formula() metavariable
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
basf2
17
from
modularAnalysis
import
inputMdstList
18
from
stdCharged
import
stdPi
19
20
mypath = basf2.Path()
# create a path
21
22
# add input data and ParticleLoader modules to the path
23
inputMdstList([basf2.find_file(
'analysis/tests/mdst.root'
)], path=mypath)
24
stdPi(
'95eff'
, path=mypath)
# grab the standard pions list
25
26
# you can (and should) make this into something more sensible
27
nonsense_formula =
'formula(p+nTracks)'
28
29
# Add the VariablesToNtuple module explicitly
30
# this will write out one row per candidate in the pi+ list and evaluate
31
# the nonsense formula for all of them
32
mypath.add_module(
33
'VariablesToNtuple'
,
34
particleList=
'pi+:95eff'
,
35
variables=[
'nTracks'
,
'p'
, nonsense_formula],
36
fileName=
'formulaTest.root'
37
)
38
39
# process the data
40
basf2.process(mypath)
41
print(basf2.statistics)
analysis
examples
VariableManager
formulaVariablesExample.py
Generated on Wed Apr 9 2025 02:34:17 for Belle II Software by
1.9.6