Belle II Software
development
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 Tue Nov 12 2024 02:32:13 for Belle II Software by
1.9.6