Belle II Software development
reconstructMCDecay.py
1#!/usr/bin/env python3
2
3
10
11"""
12An example script to find a specific decay chain at MC level.
13"""
14
15import basf2
16from modularAnalysis import fillParticleListFromMC, inputMdst, reconstructMCDecay, variablesToNtuple
17from variables import variables as vm # shorthand for the variable manager instance
18
19basf2.set_log_level(basf2.LogLevel.DEBUG)
20
21mypath = basf2.create_path()
22testinput = basf2.find_file('analysis/tests/mdst.root')
23inputMdst(testinput, path=mypath)
24
25fillParticleListFromMC('K+:primaryMC', 'mcPrimary', path=mypath)
26fillParticleListFromMC('pi+:primaryMC', 'mcPrimary', path=mypath)
27fillParticleListFromMC('e+:primaryMC', 'mcPrimary', path=mypath)
28fillParticleListFromMC('nu_e:primaryMC', 'mcPrimary', path=mypath)
29fillParticleListFromMC('gamma:primaryMC', 'mcPrimary', path=mypath)
30
31reconstructMCDecay('pi0:gg =direct=> gamma:primaryMC gamma:primaryMC', '', path=mypath)
33 'B+:DstENu =direct=> [anti-D*0 =direct=> [anti-D0 =direct=> K+:primaryMC pi-:primaryMC pi0:gg] pi0:gg ]\
34 e+:primaryMC nu_e:primaryMC ',
35 '',
36 path=mypath)
37
38
39# One can directly reconstruct pi0:gg in same decay string as following.
40# But in this case, one has to write sub-decay only once. Otherwise same particles are registered twice.
41#
42# reconstructMCDecay(
43# 'B+:DstENu =direct=>\
44# [anti-D*0 =direct=> [anti-D0 =direct=> K+:primaryMC pi-:primaryMC [pi0:gg =direct=> gamma:primaryMC gamma:primaryMC]] pi0:gg ]\
45# e+:primaryMC nu_e:primaryMC ',
46# '',
47# path=mypath)
48
49
50interesting_variables = ['isSignal', "Mbc", "deltaE", "mcErrors"]
51
52vm.printAliases()
53
54variablesToNtuple("B+:DstENu", interesting_variables, path=mypath)
55
56basf2.process(mypath)