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