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