Belle II Software  release-06-01-15
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(environmentType='default',
36  filename=b2.find_file('B2rhogamma_rho2pipi.root', 'examples', False),
37  path=my_path)
38 
39 #
40 # creates "gamma:tight" ParticleList
41 stdPhotons(listtype='tight', path=my_path)
42 
43 # creates "pi+:loose" ParticleList (and c.c.)
44 stdc.stdPi(listtype='loose', path=my_path)
45 
46 # reconstruct rho -> pi+ pi- decay
47 # keep only candidates with 0.6 < M(pi+pi-) < 1.0 GeV
48 ma.reconstructDecay(decayString='rho0 -> pi+:loose pi-:loose',
49  cut='0.6 < M < 1.0',
50  path=my_path)
51 
52 # reconstruct B0 -> rho0 gamma decay
53 # keep only candidates with Mbc > 5.2 GeV
54 # and -2 < Delta E < 2 GeV
55 ma.reconstructDecay(decayString='B0 -> rho0 gamma:tight',
56  cut='5.2 < Mbc < 5.29 and abs(deltaE) < 2.0',
57  path=my_path)
58 
59 # perform MC matching (MC truth association)
60 ma.matchMCTruth(list_name='B0', path=my_path)
61 
62 # Select variables that we want to store to ntuple
63 
64 gamma_vars = vc.cluster + vc.mc_truth + vc.kinematics
65 rho_vars = vc.cluster + vc.mc_truth + vc.kinematics + vc.inv_mass
66 pi_vars = vc.pid + vc.track
67 b_vars = vc.kinematics + \
68  vc.deltae_mbc + \
69  vc.mc_truth + \
70  vu.create_aliases_for_selected(list_of_variables=gamma_vars,
71  decay_string='B0 -> rho0 ^gamma') + \
72  vu.create_aliases_for_selected(list_of_variables=rho_vars,
73  decay_string='B0 -> ^rho0 gamma') + \
74  vu.create_aliases_for_selected(list_of_variables=pi_vars,
75  decay_string='B0 -> [rho0 -> ^pi+ ^pi-] gamma')
76 
77 # Saving variables to ntuple
78 rootOutputFile = 'B2A304-B02RhoGamma-Reconstruction.root'
79 ma.variablesToNtuple(decayString='B0',
80  variables=b_vars,
81  filename=rootOutputFile,
82  treename='b0',
83  path=my_path)
84 
85 # Process the events
86 b2.process(my_path)
87 
88 # print out the summary
89 print(b2.statistics)