20 import modularAnalysis
as ma
21 from stdCharged
import stdMu
22 from stdKlongs
import stdKlongs
25 from variables
import variables
26 from vertex
import TagV, kFit
29 main = basf2.create_path()
31 ma.inputMdstList([basf2.find_file(
'B02JpsiKL_Jpsi2mumu.root',
'examples',
False)], path=main)
34 main.add_module(
'ProgressBar')
36 stdMu(
'loose', path=main)
39 ma.reconstructDecay(
'J/psi:mumu -> mu-:loose mu+:loose', cut=
'3.08 < M < 3.12 and 1.45 < useCMSFrame(p) < 1.95', path=main)
41 pcalc = basf2.register_module(
'KlongMomentumCalculatorExpert')
42 pcalc.set_name(
'KlongMomentumCalculatorExpert_' +
'B0 -> J/psi:mumu K_L0:allklm')
43 pcalc.param(
'decayString',
'B0 -> J/psi:mumu K_L0:allklm')
44 pcalc.param(
'cut',
'')
45 pcalc.param(
'decayMode', 0)
46 pcalc.param(
'writeOut',
False)
47 pcalc.param(
'recoList',
"_reco")
48 main.add_module(pcalc)
50 rmake = basf2.register_module(
'KlongDecayReconstructorExpert')
51 rmake.set_name(
'KlongDecayReconstructorExpert_' +
'B0 -> J/psi:mumu K_L0:allklm')
52 rmake.param(
'decayString',
'B0 -> J/psi:mumu K_L0:allklm')
53 rmake.param(
'cut',
'M > 0')
54 rmake.param(
'decayMode', 0)
55 rmake.param(
'writeOut',
False)
56 rmake.param(
'recoList',
"_reco")
57 main.add_module(rmake)
59 ma.buildRestOfEvent(
'B0', path=main)
60 ma.matchMCTruth(
'B0', path=main)
62 kFit(list_name=
'B0', conf_level=-1, fit_type=
'vertex', constraint=
'iptube',
63 decay_string=
'B0 -> [J/psi -> ^mu- ^mu+] K_L0',
64 daughtersUpdate=
False,
69 ma.updateKlongKinematicsExpert(
'B0', path=main)
71 TagV(
'B0', constraintType=
'tube', confidenceLevel=0.0001, path=main)
73 commonVariables = vc.inv_mass + vc.mc_truth
74 commonVariables += vc.kinematics + vc.mc_kinematics
75 commonVariables += vc.vertex + vc.mc_vertex
77 variableList = [var
for var
in commonVariables]
78 variableList += vc.deltae_mbc + vc.tag_vertex + vc.mc_tag_vertex + vc.reco_stats
79 variableList += vu.create_aliases(commonVariables,
'daughter(0, {variable})',
'Jpsi')
80 variableList += vu.create_aliases(commonVariables,
'daughter(1, {variable})',
'KL0')
81 variableList += vu.create_aliases(vc.kinematics,
'useCMSFrame({variable})',
'CMS')
82 variableList += vu.create_aliases(vc.kinematics,
'daughter(0, useCMSFrame({variable}))',
'Jpsi_CMS')
83 variableList += vu.create_aliases(vc.kinematics,
'daughter(1, useCMSFrame({variable}))',
'KL0_CMS')
84 variables.addAlias(
'dmID',
'extraInfo(decayModeID)')
85 variableList += [
'dmID']
87 ma.variablesToNtuple(
'B0', variables=variableList, filename=
"Reconstruct_jpsi_kl_example.root", treename=
'tree', path=main)
93 print(basf2.statistics)