Belle II Software
release-05-01-25
variablesToHistogram.py
1
#!/usr/bin/env python3
2
3
# The VariablesToHistogram module saves variables from the VariableManager
4
# to TH1F and TH2F here is an example of how to use it.
5
#
6
# Thomas Keck and Sam Cunliffe
7
#
8
# For full documentation please refer to https://software.belle2.org
9
# Anything unclear? Ask questions at https://questions.belle2.org
10
11
import
basf2
12
import
modularAnalysis
as
ma
# a shorthand for the analysis tools namespace
13
14
mypath = basf2.Path()
# create a new path
15
16
# add input data and ParticleLoader modules to the path
17
ma.inputMdstList(
'default'
, [basf2.find_file(
'analysis/tests/mdst.root'
)], path=mypath)
18
ma.fillParticleLists([(
'K-'
,
'kaonID > 0.2'
), (
'pi+'
,
'pionID > 0.2'
)], path=mypath)
19
ma.reconstructDecay(
'D0 -> K- pi+'
,
'1.750 < M < 1.95'
, path=mypath)
20
ma.matchMCTruth(
'D0'
, path=mypath)
21
22
# add the VariablesToHistogram module explicitly
23
mypath.add_module(
'VariablesToHistogram'
,
24
particleList=
'D0'
,
25
variables=[(
'dM'
, 100, -2.0, 2.0),
26
(
'isSignal'
, 2, -0.5, 1.5),
27
(
'mcErrors'
, 1025, -0.5, 1024.5),
28
(
'p'
, 1000, 0.0, 5.0),
29
(
'E'
, 1000, 0.0, 5.0),
30
(
'daughter(0, kaonID)'
, 100, 0.0, 1.0),
31
(
'daughter(1, pionID)'
, 100, 0.0, 1.0)],
32
variables_2d=[(
'dM'
, 100, -2.0, 2.0,
'isSignal'
, 2, -0.5, 1.5),
33
(
'p'
, 100, -2.0, 2.0,
'isSignal'
, 2, -0.5, 1.5),
34
(
'dM'
, 100, -2.0, 2.0,
'mcErrors'
, 1025, -0.5, 1024.5)])
35
36
# you might also like to uncomment the following, and read the help for the
37
# convenient wrapper function:
38
# print(help(ma.variablesToHistogram))
39
40
# process the data
41
basf2.process
(mypath)
42
print(basf2.statistics)
basf2.process
def process(path, max_event=0)
Definition:
__init__.py:25
analysis
examples
VariableManager
variablesToHistogram.py
Generated on Fri Nov 5 2021 03:45:29 for Belle II Software by
1.8.17