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