Belle II Software  release-08-01-10
B2A304-B02RhoGamma-Reconstruction.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
23 
24 import basf2 as b2
25 import modularAnalysis as ma
26 import variables.collections as vc
27 import variables.utils as vu
28 from stdPhotons import stdPhotons
29 import stdCharged as stdc
30 
31 # create path
32 my_path = b2.create_path()
33 
34 # load input ROOT file
35 ma.inputMdst(filename=b2.find_file('B2rhogamma_rho2pipi.root', 'examples', False),
36  path=my_path)
37 
38 #
39 # creates "gamma:tight" ParticleList
40 stdPhotons(listtype='tight', path=my_path)
41 
42 # creates "pi+:loose" ParticleList (and c.c.)
43 stdc.stdPi(listtype='loose', path=my_path)
44 
45 # reconstruct rho -> pi+ pi- decay
46 # keep only candidates with 0.6 < M(pi+pi-) < 1.0 GeV
47 ma.reconstructDecay(decayString='rho0 -> pi+:loose pi-:loose',
48  cut='0.6 < M < 1.0',
49  path=my_path)
50 
51 # reconstruct B0 -> rho0 gamma decay
52 # keep only candidates with Mbc > 5.2 GeV
53 # and -2 < Delta E < 2 GeV
54 ma.reconstructDecay(decayString='B0 -> rho0 gamma:tight',
55  cut='5.2 < Mbc < 5.29 and abs(deltaE) < 2.0',
56  path=my_path)
57 
58 # perform MC matching (MC truth association)
59 ma.matchMCTruth(list_name='B0', path=my_path)
60 
61 # Select variables that we want to store to ntuple
62 
63 gamma_vars = vc.cluster + vc.mc_truth + vc.kinematics
64 rho_vars = vc.cluster + vc.mc_truth + vc.kinematics + vc.inv_mass
65 pi_vars = vc.pid + vc.track
66 b_vars = vc.kinematics + \
67  vc.deltae_mbc + \
68  vc.mc_truth + \
69  vu.create_aliases_for_selected(list_of_variables=gamma_vars,
70  decay_string='B0 -> rho0 ^gamma') + \
71  vu.create_aliases_for_selected(list_of_variables=rho_vars,
72  decay_string='B0 -> ^rho0 gamma') + \
73  vu.create_aliases_for_selected(list_of_variables=pi_vars,
74  decay_string='B0 -> [rho0 -> ^pi+ ^pi-] gamma')
75 
76 # Saving variables to ntuple
77 rootOutputFile = 'B2A304-B02RhoGamma-Reconstruction.root'
78 ma.variablesToNtuple(decayString='B0',
79  variables=b_vars,
80  filename=rootOutputFile,
81  treename='b0',
82  path=my_path)
83 
84 # Process the events
85 b2.process(my_path)
86 
87 # print out the summary
88 print(b2.statistics)