Belle II Software development
B2A302-B02D0Pi0-D02Pi0Pi0-Reconstruction.py
1#!/usr/bin/env python3
2
3
10
11
23
24import basf2 as b2
25import modularAnalysis as ma
26import variables.collections as vc
27import variables.utils as vu
28from stdPi0s import stdPi0s
29
30# create path
31my_path = b2.create_path()
32
33# load input ROOT file
34ma.inputMdst(filename=b2.find_file('B02D0pi0_D02pi0pi0.root', 'examples', False),
35 path=my_path)
36
37
38# use standard final state particle lists
39#
40# creates "pi0:eff40_May2020Fit" ParticleList
41# see Standard Particles section at https://software.belle2.org/
42stdPi0s(listtype='eff40_May2020Fit', path=my_path)
43
44# reconstruct D0 -> pi0 pi0 decay
45# keep only candidates with 1.7 < M(pi0pi0) < 2.0 GeV
46ma.reconstructDecay(decayString='D0:pi0pi0 -> pi0:eff40_May2020Fit pi0:eff40_May2020Fit',
47 cut='1.7 < M < 2.0',
48 path=my_path)
49
50# reconstruct B0 -> D0 pi0 decay
51# keep only candidates with Mbc > 5.24 GeV
52# and -1 < Delta E < 1 GeV
53ma.reconstructDecay(decayString='B0:all -> D0:pi0pi0 pi0:eff40_May2020Fit',
54 cut='5.24 < Mbc < 5.29 and abs(deltaE) < 1.0',
55 path=my_path)
56
57# perform MC matching (MC truth association)
58ma.matchMCTruth(list_name='B0:all',
59 path=my_path)
60
61
62# Select variables that we want to store to ntuple
63B0_vars = vc.inv_mass + \
64 vc.mc_truth + \
65 vu.create_aliases_for_selected(
66 list_of_variables=vc.inv_mass + vc.mc_truth,
67 decay_string='B0 -> ^D0 ^pi0') + \
68 vu.create_aliases_for_selected(
69 list_of_variables=vc.cluster,
70 decay_string='B0 -> D0 [pi0 -> ^gamma ^gamma]')
71
72pi0_vars = vc.mc_truth + \
73 vc.kinematics + \
74 ['extraInfo(BDT)', 'decayAngle(0)', 'weightedAverageECLTime'] + \
75 vu.create_aliases_for_selected(
76 list_of_variables=vc.cluster + vc.kinematics,
77 decay_string='pi0 -> ^gamma ^gamma')
78
79# Saving variables to ntuple
80output_file = 'B2A302-B02D0Pi0-D02Pi0Pi0-Reconstruction.root'
81ma.variablesToNtuple('B0:all', B0_vars,
82 filename=output_file,
83 treename='b0',
84 path=my_path)
85ma.variablesToNtuple('pi0:eff40_May2020Fit', pi0_vars,
86 filename=output_file,
87 treename='pi0',
88 path=my_path)
89
90# Process the events
91b2.process(my_path)
92
93# print out the summary
94print(b2.statistics)