Belle II Software development
B2A304-B02RhoGamma-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 stdPhotons import stdPhotons
29import stdCharged as stdc
30
31# create path
32my_path = b2.create_path()
33
34# load input ROOT file
35ma.inputMdst(filename=b2.find_file('B2rhogamma_rho2pipi.root', 'examples', False),
36 path=my_path)
37
38#
39# creates "gamma:tight" ParticleList
40stdPhotons(listtype='tight', path=my_path)
41
42# creates "pi+:loose" ParticleList (and c.c.)
43stdc.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
47ma.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
54ma.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)
59ma.matchMCTruth(list_name='B0', path=my_path)
60
61# Select variables that we want to store to ntuple
62
63gamma_vars = vc.cluster + vc.mc_truth + vc.kinematics
64rho_vars = vc.cluster + vc.mc_truth + vc.kinematics + vc.inv_mass
65pi_vars = vc.pid + vc.track
66b_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
77rootOutputFile = 'B2A304-B02RhoGamma-Reconstruction.root'
78ma.variablesToNtuple(decayString='B0',
79 variables=b_vars,
80 filename=rootOutputFile,
81 treename='b0',
82 path=my_path)
83
84# Process the events
85b2.process(my_path)
86
87# print out the summary
88print(b2.statistics)