2 import modularAnalysis
as ma
6 import stdCharged
as stdc
10 from basf2
import conditions
11 from variables
import variables
12 from ROOT
import Belle2
13 from ROOT
import TFile
14 from ROOT
import TNtuple
16 variables.addAlias(
'TubeX',
'extraInfo(TubePosX)')
17 variables.addAlias(
'TubeY',
'extraInfo(TubePosY)')
18 variables.addAlias(
'TubeZ',
'extraInfo(TubePosZ)')
19 variables.addAlias(
'Tube00',
'extraInfo(TubeCov00)')
20 variables.addAlias(
'Tube01',
'extraInfo(TubeCov01)')
21 variables.addAlias(
'Tube02',
'extraInfo(TubeCov02)')
22 variables.addAlias(
'Tube10',
'extraInfo(TubeCov10)')
23 variables.addAlias(
'Tube11',
'extraInfo(TubeCov11)')
24 variables.addAlias(
'Tube12',
'extraInfo(TubeCov12)')
25 variables.addAlias(
'Tube20',
'extraInfo(TubeCov20)')
26 variables.addAlias(
'Tube21',
'extraInfo(TubeCov21)')
27 variables.addAlias(
'Tube22',
'extraInfo(TubeCov22)')
29 variables.addAlias(
'avf00',
'extraInfo(prod_vtx_cov00)')
30 variables.addAlias(
'avf01',
'extraInfo(prod_vtx_cov01)')
31 variables.addAlias(
'avf02',
'extraInfo(prod_vtx_cov02)')
32 variables.addAlias(
'avf10',
'extraInfo(prod_vtx_cov10)')
33 variables.addAlias(
'avf11',
'extraInfo(prod_vtx_cov11)')
34 variables.addAlias(
'avf12',
'extraInfo(prod_vtx_cov12)')
35 variables.addAlias(
'avf20',
'extraInfo(prod_vtx_cov20)')
36 variables.addAlias(
'avf21',
'extraInfo(prod_vtx_cov21)')
37 variables.addAlias(
'avf22',
'extraInfo(prod_vtx_cov22)')
39 variables.addAlias(
'avfPx',
'extraInfo(Px_after_avf)')
40 variables.addAlias(
'avfPy',
'extraInfo(Py_after_avf)')
41 variables.addAlias(
'avfPz',
'extraInfo(Pz_after_avf)')
42 variables.addAlias(
'avfE',
'extraInfo(E_after_avf)')
44 variables.addAlias(
'mcPxCms',
'useCMSFrame(mcPX)')
45 variables.addAlias(
'mcPyCms',
'useCMSFrame(mcPY)')
46 variables.addAlias(
'mcPzCms',
'useCMSFrame(mcPZ)')
47 variables.addAlias(
'mcECms',
'useCMSFrame(mcE)')
49 variables.addAlias(
'tube_dir_X',
'extraInfo(TubeDirX)')
50 variables.addAlias(
'tube_dir_Y',
'extraInfo(TubeDirY)')
51 variables.addAlias(
'tube_dir_Z',
'extraInfo(TubeDirZ)')
53 variables.addAlias(
'truex',
'matchedMC(x)')
54 variables.addAlias(
'truey',
'matchedMC(y)')
55 variables.addAlias(
'truez',
'matchedMC(z)')
57 my_path = b2.create_path()
61 ma.inputMdst(
'default',
65 stdc.stdPi(listtype=
'all', path=my_path)
66 stdc.stdPi(listtype=
'good', path=my_path)
67 stdc.stdK(listtype=
'all', path=my_path)
68 stdc.stdK(listtype=
'good', path=my_path)
69 stdc.stdMu(listtype=
'all', path=my_path)
70 stdc.stdMu(listtype=
'good', path=my_path)
72 ma.reconstructDecay(
'D0:kpi -> K-:good pi+:good',
'', path=my_path)
73 ma.matchMCTruth(
'D0:kpi', path=my_path)
74 ma.applyCuts(
'D0:kpi',
'abs(mcPDG)==421', path=my_path)
75 vx.raveFit(
'D0:kpi', 0.0, path=my_path)
77 ma.reconstructDecay(
'J/psi:mumu -> mu+:good mu-:good',
'', path=my_path)
78 vx.raveFit(
'J/psi:mumu', 0.0, path=my_path)
81 ma.reconstructDecay(
'B+:tag -> anti-D0:kpi pi+:all',
'', path=my_path)
82 ma.matchMCTruth(
'B+:tag', path=my_path)
83 ma.applyCuts(
'B+:tag',
'isSignalAcceptMissingNeutrino>0.5', path=my_path)
84 vx.raveFit(
'B+:tag', 0.0, path=my_path)
87 ma.reconstructDecay(
'B-:sigT -> J/psi:mumu K-:good pi+:good pi-:good',
'', path=my_path)
88 ma.matchMCTruth(
'B-:sigT', path=my_path)
89 ma.applyCuts(
'B-:sigT',
'abs(mcPDG)==521', path=my_path)
91 ma.reconstructDecay(
'Upsilon(4S):sig -> B+:tag B-:sigT',
'', path=my_path)
93 mytestmodule2 = ma.register_module(
'BtubeCreator')
97 my_path.add_module(mytestmodule2, listName=
'Upsilon(4S):sig', decayString=
'Upsilon(4S):sig -> ^B+:tag B-:sigT')
98 vx.raveFit(
'B-:sigT', 0.0, constraint=
'btube', path=my_path)
100 output_file =
'test.root'
101 true_vars = [
'truex',
'truey',
'truez']
102 avf_vars = [
'avf00',
'avf01',
'avf02',
'avf10',
'avf11',
'avf12',
'avf20',
'avf21',
'avf22',
'avfPx',
'avfPy',
'avfPz',
'avfE']
120 common_vars = vc.kinematics + vc.vertex + vc.mc_vertex + vc.mc_truth + \
121 vc.mc_kinematics + [
'InvM',
'mcPxCms',
'mcPyCms',
'mcPzCms',
'mcECms']
122 D_vars_tagside = vu.create_aliases_for_selected(
123 list_of_variables=common_vars,
124 decay_string=
'B+:tag -> ^anti-D0:kpi pi+:all',
126 U4S_vars_sig = vu.create_aliases_for_selected(
127 list_of_variables=common_vars + tube_vars + true_vars,
128 decay_string=
'Upsilon(4S):sig -> B+:tag ^B-:sigT',
130 U4S_vars_tag = vu.create_aliases_for_selected(
131 list_of_variables=common_vars + avf_vars + true_vars,
132 decay_string=
'Upsilon(4S):sig -> ^B+:tag B-:sigT',
134 U4S_vars = common_vars + U4S_vars_tag + U4S_vars_sig + D_vars_tagside
135 ma.variablesToNtuple(
'Upsilon(4S):sig', U4S_vars,
136 filename=output_file, treename=
'u4stree', path=my_path)
137 ma.variablesToNtuple(
'B+:tag', common_vars,
138 filename=output_file, treename=
'tagtree', path=my_path)