Belle II Software development
analysisDQM.py
1# !/usr/bin/env python3
2
3
10
11"""
12This module defines functions to add analysis DQM modules.
13"""
14
15import basf2 as b2
16from stdPi0s import stdPi0s
17import modularAnalysis as ma
18
19
20def add_analysis_dqm(path):
21 """Add the analysis DQM modules to the ``path``.
22 Builds a list of muons, pi0's, Kshorts and the Fox Wolfram event shape variables. Also M(mumu) for nominal beam energy monitoring.
23
24 Parameters:
25 path (basf2.Path): modules are loaded onto this path
26 """
27
28 # muons, Kshorts and pi0s
29 ma.fillParticleList('mu+:KLMDQM', 'p>1.5', path=path)
30 ma.fillParticleList('gamma:physDQM', 'E > 0.15', path=path)
31 ma.fillParticleList('pi+:physDQM', 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4', path=path)
32 ma.fillParticleList('mu+:physDQM', 'pt>2. and abs(d0) < 2 and abs(z0) < 4', path=path)
33 ma.reconstructDecay('pi0:physDQM -> gamma:physDQM gamma:physDQM', '0.10 < M < 0.15', 1, True, path)
34 ma.reconstructDecay('K_S0:physDQM -> pi-:physDQM pi+:physDQM', '0.48 < M < 0.52', 1, True, path)
35 ma.reconstructDecay('Upsilon:physDQM -> mu-:physDQM mu+:physDQM', '9 < M < 12', 1, True, path)
36 # bhabha,hadrons
37 ma.fillParticleList('e+:physDQM', 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
38 ma.reconstructDecay('Upsilon:ephysDQM -> e-:physDQM e+:physDQM', '4 < M < 12', 1, True, path)
39 ma.fillParticleList('pi+:hadbphysDQM', 'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
40
41 # have to manually create "all" lists of pi+ and photons to use inside buildEventShape
42 # to avoid loading the photons' beamBackgroundMVA variable on the DQM
43 ma.fillParticleList('pi+:evtshape', '', path=path)
44 ma.fillParticleList('gamma:evtshape', '', path=path)
45 ma.buildEventShape(
46 path=path,
47 inputListNames=['pi+:evtshape', 'gamma:evtshape'],
48 default_cleanup=False, # do not want any clean up
49 foxWolfram=True,
50 cleoCones=False,
51 collisionAxis=False,
52 harmonicMoments=False,
53 jets=False,
54 sphericity=False,
55 thrust=False)
56
57 dqm = b2.register_module('PhysicsObjectsDQM')
58 dqm.param('PI0PListName', 'pi0:physDQM')
59 dqm.param('KS0PListName', 'K_S0:physDQM')
60 dqm.param('UpsPListName', 'Upsilon:physDQM')
61 # bhabha,hadrons
62 dqm.param('UpsBhabhaPListName', 'Upsilon:ephysDQM')
63 dqm.param('UpsHadPListName', 'pi+:hadbphysDQM')
64
65 path.add_module(dqm)
66
67
68def add_mirabelle_dqm(path):
69 """Add the mirabelle DQM modules to the ``path``.
70 Runs on conditional paths depending on the software trigger results.
71 Building D*'s or dimuons on the conditional paths.
72
73 Parameters:
74 path (basf2.Path): modules are loaded onto this path
75 """
76 # Software Trigger to divert the path
77 MiraBelleMumu_path = b2.create_path()
78 MiraBelleDst1_path = b2.create_path()
79 MiraBelleNotDst1_path = b2.create_path()
80 MiraBelleDst2_path = b2.create_path()
81 # bhabha,hadrons
82 MiraBelleBhabha_path = b2.create_path()
83 MiraBellehadronb2_path = b2.create_path()
84
85 trigger_skim_mumutight = path.add_module(
86 "TriggerSkim",
87 triggerLines=["software_trigger_cut&skim&accept_mumutight"],
88 resultOnMissing=0,
89 )
90 trigger_skim_mumutight.if_value("==1", MiraBelleMumu_path, b2.AfterConditionPath.CONTINUE)
91
92 trigger_skim_dstar_1 = path.add_module(
93 "TriggerSkim",
94 triggerLines=["software_trigger_cut&skim&accept_dstar_1"],
95 resultOnMissing=0,
96 )
97 trigger_skim_dstar_1.if_value("==1", MiraBelleDst1_path, b2.AfterConditionPath.CONTINUE)
98
99 trigger_skim_not_dstar_1 = path.add_module(
100 "TriggerSkim",
101 triggerLines=["software_trigger_cut&skim&accept_dstar_1"],
102 expectedResult=0,
103 resultOnMissing=0,
104 )
105 trigger_skim_not_dstar_1.if_value("==1", MiraBelleNotDst1_path, b2.AfterConditionPath.CONTINUE)
106 trigger_skim_dstar_2 = MiraBelleNotDst1_path.add_module(
107 "TriggerSkim",
108 triggerLines=["software_trigger_cut&skim&accept_dstar_2"],
109 resultOnMissing=0,
110 )
111 trigger_skim_dstar_2.if_value("==1", MiraBelleDst2_path, b2.AfterConditionPath.CONTINUE)
112 # bhabha,hadrons
113 trigger_skim_bhabhaall = path.add_module(
114 "TriggerSkim",
115 triggerLines=["software_trigger_cut&skim&accept_bhabha_all"],
116 resultOnMissing=0,
117 )
118 trigger_skim_bhabhaall.if_value("==1", MiraBelleBhabha_path, b2.AfterConditionPath.CONTINUE)
119 trigger_skim_hadronb2 = path.add_module(
120 "TriggerSkim",
121 triggerLines=["software_trigger_cut&skim&accept_hadronb2"],
122 resultOnMissing=0,
123 )
124 trigger_skim_hadronb2.if_value("==1", MiraBellehadronb2_path, b2.AfterConditionPath.CONTINUE)
125
126 # MiraBelle di-muon path
127 ma.fillParticleList('mu+:physMiraBelle', '', path=MiraBelleMumu_path)
128 ma.reconstructDecay('Upsilon:physMiraBelle -> mu+:physMiraBelle mu-:physMiraBelle', '9 < M < 12', path=MiraBelleMumu_path)
129 MiraBelleMumu = b2.register_module('PhysicsObjectsMiraBelle')
130 MiraBelleMumu.param('MuPListName', 'mu+:physMiraBelle')
131 MiraBelleMumu.param('MuMuPListName', 'Upsilon:physMiraBelle')
132 MiraBelleMumu_path.add_module(MiraBelleMumu)
133
134 # MiraBelle D* (followed by D0 -> K pi) path
135 ma.fillParticleList('pi+:MiraBelleDst1', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
136 ma.fillParticleList('K+:MiraBelleDst1', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
137 ma.reconstructDecay('D0:MiraBelleDst1_kpi -> K-:MiraBelleDst1 pi+:MiraBelleDst1', '1.7 < M < 2.1', path=MiraBelleDst1_path)
138 ma.reconstructDecay('D*+:MiraBelleDst1_kpi -> D0:MiraBelleDst1_kpi pi+:MiraBelleDst1',
139 'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst1_path)
140 MiraBelleDst1 = b2.register_module('PhysicsObjectsMiraBelleDst')
141 MiraBelleDst1.param('DstListName', 'D*+:MiraBelleDst1_kpi')
142 MiraBelleDst1_path.add_module(MiraBelleDst1)
143
144 # MiraBelle D* (followed by D0 -> K pi pi0) path
145 ma.fillParticleList('pi+:MiraBelleDst2', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
146 ma.fillParticleList('K+:MiraBelleDst2', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
147 stdPi0s(listtype='eff60_May2020', path=MiraBelleDst2_path)
148 ma.reconstructDecay(
149 'D0:MiraBelleDst2_kpipi0 -> K-:MiraBelleDst2 pi+:MiraBelleDst2 pi0:eff60_May2020',
150 '1.7 < M < 2.1',
151 path=MiraBelleDst2_path)
152 ma.reconstructDecay('D*+:MiraBelleDst2_kpipi0 -> D0:MiraBelleDst2_kpipi0 pi+:MiraBelleDst2',
153 'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst2_path)
154 MiraBelleDst2 = b2.register_module('PhysicsObjectsMiraBelleDst2')
155 MiraBelleDst2.param('DstListName', 'D*+:MiraBelleDst2_kpipi0')
156 MiraBelleDst2_path.add_module(MiraBelleDst2)
157 # bhabha,hadrons
158 ma.fillParticleList(
159 'e+:physMiraBelle',
160 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
161 path=MiraBelleBhabha_path)
162 ma.reconstructDecay('Upsilon:ephysMiraBelle -> e+:physMiraBelle e-:physMiraBelle', '4 < M < 12', path=MiraBelleBhabha_path)
163 MiraBelleBhabha = b2.register_module('PhysicsObjectsMiraBelleBhabha')
164 MiraBelleBhabha.param('ePListName', 'e+:physMiraBelle')
165 MiraBelleBhabha.param('bhabhaPListName', 'Upsilon:ephysMiraBelle')
166 MiraBelleBhabha_path.add_module(MiraBelleBhabha)
167 ma.fillParticleList(
168 'pi+:hadb2physMiraBelle',
169 'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
170 path=MiraBellehadronb2_path)
171 MiraBellehadronb = b2.register_module('PhysicsObjectsMiraBelleHadron')
172 MiraBellehadronb.param('hadronb2piPListName', 'pi+:hadb2physMiraBelle')
173 MiraBellehadronb2_path.add_module(MiraBellehadronb)
174