Belle II Software  release-08-01-10
reconstructMCDecay.py
1 #!/usr/bin/env python3
2 
3 
10 
11 # Doxygen should skip this script
12 # @cond
13 
14 """
15 An example script to find a specific decay chain at MC level.
16 """
17 
18 import basf2
19 from modularAnalysis import fillParticleListFromMC, inputMdst, reconstructMCDecay, variablesToNtuple
20 from variables import variables as vm # shorthand for the variable manager instance
21 
22 basf2.set_log_level(basf2.LogLevel.DEBUG)
23 
24 mypath = basf2.create_path()
25 testinput = basf2.find_file('analysis/tests/mdst.root')
26 inputMdst(testinput, path=mypath)
27 
28 fillParticleListFromMC('K+:primaryMC', 'mcPrimary', path=mypath)
29 fillParticleListFromMC('pi+:primaryMC', 'mcPrimary', path=mypath)
30 fillParticleListFromMC('e+:primaryMC', 'mcPrimary', path=mypath)
31 fillParticleListFromMC('nu_e:primaryMC', 'mcPrimary', path=mypath)
32 fillParticleListFromMC('gamma:primaryMC', 'mcPrimary', path=mypath)
33 
34 reconstructMCDecay('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 
53 interesting_variables = ['isSignal', "Mbc", "deltaE", "mcErrors"]
54 
55 vm.printAliases()
56 
57 variablesToNtuple("B+:DstENu", interesting_variables, path=mypath)
58 
59 basf2.process(mypath)
60 print(basf2.statistics)
61 
62 # @endcond