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
16import basf2
17from modularAnalysis import inputMdst, reconstructDecay, matchMCTruth, \
18 copyLists, variablesToNtuple
19from variables.utils import create_aliases_for_selected
20from variables import variables as vm # shorthand for the variable manager instance
21from stdCharged import stdE, stdK, stdPi
22from stdPi0s import stdPi0s
23
24mypath = basf2.create_path()
25testinput = basf2.find_file('analysis/tests/mdst.root')
26inputMdst(testinput, path=mypath)
27
28stdPi0s("all", path=mypath)
29stdE("loose", path=mypath)
30stdK("loose", path=mypath)
31stdPi("loose", path=mypath)
32
33reconstructDecay("@Xsd:0 -> K+:loose pi-:loose", "", path=mypath)
34reconstructDecay("@Xsd:1 -> K+:loose pi-:loose pi0:all", "", path=mypath)
35
36copyLists("Xsd:comb", ["Xsd:0", "Xsd:1"], path=mypath)
37# copyList("@Xsd:comb", ["Xsd:0", "Xsd:1"], path=mypath) # this can't work
38
39reconstructDecay("B0:inclusive -> Xsd:comb e+:loose e-:loose",
40 "5.2 < Mbc < 5.3", path=mypath)
41
42matchMCTruth("B0:inclusive", path=mypath)
43
44interesting_variables = ['isSignal', "Mbc", "deltaE", "isUnspecified"]
45interesting_variables += create_aliases_for_selected(
46 ["px", "py", "pz", "E", "isSignal", "mcErrors", "isUnspecified"],
47 "B0:inclusive -> ^Xsd:comb ^e+:loose ^e-:loose")
48
49vm.printAliases()
50
51variablesToNtuple("B0:inclusive", interesting_variables, path=mypath)
52
53basf2.process(mypath)