Belle II Software development
inclusiveReconstruction.py
1#!/usr/bin/env python3
2
3
10
11"""
12An example script to reconstruct unspecified particles and the use of MC
13matching tools for inclusive analyses with sum-of-exclusive method.
14"""
15
16# Doxygen should skip this script
17# @cond
18
19import basf2
20from modularAnalysis import inputMdst, reconstructDecay, matchMCTruth, \
21 copyLists, variablesToNtuple
22from variables.utils import create_aliases_for_selected
23from variables import variables as vm # shorthand for the variable manager instance
24from stdCharged import stdE, stdK, stdPi
25from stdPi0s import stdPi0s
26
27mypath = basf2.create_path()
28testinput = basf2.find_file('analysis/tests/mdst.root')
29inputMdst(testinput, path=mypath)
30
31stdPi0s("all", path=mypath)
32stdE("loose", path=mypath)
33stdK("loose", path=mypath)
34stdPi("loose", path=mypath)
35
36reconstructDecay("@Xsd:0 -> K+:loose pi-:loose", "", path=mypath)
37reconstructDecay("@Xsd:1 -> K+:loose pi-:loose pi0:all", "", path=mypath)
38
39copyLists("Xsd:comb", ["Xsd:0", "Xsd:1"], path=mypath)
40# copyList("@Xsd:comb", ["Xsd:0", "Xsd:1"], path=mypath) # this can't work
41
42reconstructDecay("B0:inclusive -> Xsd:comb e+:loose e-:loose",
43 "5.2 < Mbc < 5.3", path=mypath)
44
45matchMCTruth("B0:inclusive", path=mypath)
46
47interesting_variables = ['isSignal', "Mbc", "deltaE", "isUnspecified"]
48interesting_variables += create_aliases_for_selected(
49 ["px", "py", "pz", "E", "isSignal", "mcErrors", "isUnspecified"],
50 "B0:inclusive -> ^Xsd:comb ^e+:loose ^e-:loose")
51
52vm.printAliases()
53
54variablesToNtuple("B0:inclusive", interesting_variables, path=mypath)
55
56basf2.process(mypath)
57print(basf2.statistics)
58
59# @endcond