Belle II Software development
BtagBsigReconstruction.py
1#!/usr/bin/env python3
2
3
10
11import basf2
12import modularAnalysis as ma
13from variables import variables as vm
14import variables.collections as vc
15import variables.utils as vu
16
17
18myMain = basf2.create_path()
19
20# Y(4S) -> B0:tag B0:sig
21# anti-B0:tag -> D*+ pi-; D*+ -> D0 pi+; D0 -> K- pi+
22# B0:sig -> anti-D0 pi0; anti-D0 -> K+ pi-
23ma.inputMdst(filename=basf2.find_file('B02pi0D0_D2kpi_B2Dstarpi_Dstar2Dpi_D2kpi.root', 'examples', False),
24 path=myMain)
25
26
27# create final state particle lists
28kaons = ('K-', '')
29pions = ('pi+', '')
30photons = ('gamma', '')
31
32ma.fillParticleLists([kaons, pions, photons], path=myMain)
33
34# reconstruct pi0 -> gamma gamma decay
35ma.reconstructDecay('pi0 -> gamma gamma', '0.05 < M < 1.7', path=myMain)
36
37# reconstruct D0 -> K- pi+ decay (and c.c.)
38ma.reconstructDecay('D0 -> K- pi+', '1.800 < M < 1.900', path=myMain)
39
40# reconstruct D*+ -> D0 pi+ (and c.c.)
41ma.reconstructDecay('D*+ -> D0 pi+', '0.0 <= Q < 0.02', path=myMain)
42
43# reconstruct Btag -> D*+ pi- (and c.c.)
44ma.reconstructDecay('anti-B0:tag -> D*+ pi-', '5.000 < M < 6.000', path=myMain)
45
46# reconstruct Bsig -> D0 pi0 (and c.c.)
47ma.reconstructDecay('B0:sig -> anti-D0 pi0', '0.000 < M < 6.000', path=myMain)
48
49# reconstruct Y(4S) -> Btag Bsig
50ma.reconstructDecay('Upsilon(4S):B0barB0 -> anti-B0:tag B0:sig', '0.000 < M < 11.000', dmID=1, path=myMain)
51ma.reconstructDecay('Upsilon(4S):B0B0 -> B0:tag B0:sig', '0.000 < M < 11.000', dmID=2, path=myMain)
52ma.copyLists('Upsilon(4S):all', ['Upsilon(4S):B0barB0', 'Upsilon(4S):B0B0'], path=myMain)
53
54# perform MC matching
55ma.matchMCTruth('Upsilon(4S):all', myMain)
56
57# create and fill RestOfEvent for Btag and Y(4S) particles
58ma.buildRestOfEvent('B0:tag', path=myMain)
59ma.buildRestOfEvent('Upsilon(4S):all', path=myMain)
60
61# define variables for Btag ntuple
62commonVariables = vc.mc_truth + vc.deltae_mbc
63BvariableList = commonVariables + vc.roe_multiplicities
64
65# define variables for Upsilon(4S) ntuple
66Y4SvariableList = vc.mc_truth + vc.roe_multiplicities + vc.recoil_kinematics + vc.extra_energy
67vm.addAlias('dmID', 'extraInfo(decayModeID)')
68Y4SvariableList += ['dmID']
69Y4SvariableList += vu.create_aliases(commonVariables, 'daughter(0, {variable})', 'Btag')
70Y4SvariableList += vu.create_aliases(commonVariables, 'daughter(1, {variable})', 'Bsig')
71
72# write flat ntuples
73ma.variablesToNtuple('B0:tag', variables=BvariableList, filename='ROE_BtagBsig.root', treename='btag', path=myMain)
74ma.variablesToNtuple('Upsilon(4S):all', variables=Y4SvariableList, filename='ROE_BtagBsig.root', treename='btagbsig', path=myMain)
75
76basf2.process(myMain)
77print(basf2.statistics)