Belle II Software
release-05-01-25
formulaVariablesExample.py
1
#!/usr/bin/env python3
2
3
# An example/test of using the formula() metavariable
4
#
5
# James Kahn and Sam Cunliffe
6
#
7
# For full documentation please refer to https://software.belle2.org
8
# Anything unclear? Ask questions at https://questions.belle2.org
9
10
import
basf2
11
from
modularAnalysis
import
inputMdstList
12
from
stdCharged
import
stdPi
13
14
mypath = basf2.Path()
# create a path
15
16
# add input data and ParticleLoader modules to the path
17
inputMdstList(
'default'
, [basf2.find_file(
'analysis/tests/mdst.root'
)], path=mypath)
18
stdPi(
'95eff'
, path=mypath)
# grab the standard pions list
19
20
# you can (and should) make this into something more sensible
21
nonsense_formula =
'formula(p+nTracks)'
22
23
# Add the VariablesToNtuple module explicitly
24
# this will write out one row per candidate in the pi+ list and evaluate
25
# the nonsense formula for all of them
26
mypath.add_module(
27
'VariablesToNtuple'
,
28
particleList=
'pi+:95eff'
,
29
variables=[
'nTracks'
,
'p'
, nonsense_formula],
30
fileName=
'formulaTest.root'
31
)
32
33
# process the data
34
basf2.process
(mypath)
35
print(basf2.statistics)
basf2.process
def process(path, max_event=0)
Definition:
__init__.py:25
analysis
examples
VariableManager
formulaVariablesExample.py
Generated on Fri Nov 5 2021 03:45:28 for Belle II Software by
1.8.17