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
15# Doxygen should skip this script
16# @cond
17
18import basf2
19from modularAnalysis import fillParticleListFromMC, inputMdst, reconstructMCDecay, variablesToNtuple
20from variables import variables as vm # shorthand for the variable manager instance
21
22basf2.set_log_level(basf2.LogLevel.DEBUG)
23
24mypath = basf2.create_path()
25testinput = basf2.find_file('analysis/tests/mdst.root')
26inputMdst(testinput, path=mypath)
27
28fillParticleListFromMC('K+:primaryMC', 'mcPrimary', path=mypath)
29fillParticleListFromMC('pi+:primaryMC', 'mcPrimary', path=mypath)
30fillParticleListFromMC('e+:primaryMC', 'mcPrimary', path=mypath)
31fillParticleListFromMC('nu_e:primaryMC', 'mcPrimary', path=mypath)
32fillParticleListFromMC('gamma:primaryMC', 'mcPrimary', path=mypath)
33
34reconstructMCDecay('pi0:gg =direct=> gamma:primaryMC gamma:primaryMC', '', path=mypath)
36 'B+:DstENu =direct=> [anti-D*0 =direct=> [anti-D0 =direct=> K+:primaryMC pi-:primaryMC pi0:gg] pi0:gg ]\
37 e+:primaryMC nu_e:primaryMC ',
38 '',
39 path=mypath)
40
41
42# One can directly reconstruct pi0:gg in same decay string as following.
43# But in this case, one has to write sub-decay only once. Otherwise same particles are registered twice.
44#
45# reconstructMCDecay(
46# 'B+:DstENu =direct=>\
47# [anti-D*0 =direct=> [anti-D0 =direct=> K+:primaryMC pi-:primaryMC [pi0:gg =direct=> gamma:primaryMC gamma:primaryMC]] pi0:gg ]\
48# e+:primaryMC nu_e:primaryMC ',
49# '',
50# path=mypath)
51
52
53interesting_variables = ['isSignal', "Mbc", "deltaE", "mcErrors"]
54
55vm.printAliases()
56
57variablesToNtuple("B+:DstENu", interesting_variables, path=mypath)
58
59basf2.process(mypath)
60print(basf2.statistics)
61
62# @endcond