12This module defines functions to add analysis DQM modules.
16from stdPi0s
import stdPi0s
17from stdCharged
import stdPi, stdK
18import modularAnalysis
as ma
21from variables
import variables
as vm
25def add_analysis_dqm(path):
26 """Add the analysis DQM modules to the ``path``.
27 Builds a list of muons, pi0's, Kshorts and the Fox Wolfram event shape variables.
28 Also M(mumu) for nominal beam energy monitoring.
31 path (basf2.Path): modules are loaded onto this path
35 ma.fillParticleList(
'mu+:KLMDQM',
'p>1.5', path=path)
36 ma.fillParticleList(
'mu+:KLMDQM2',
'p>1.5 and abs(d0) < 2 and abs(z0) < 4', path=path)
37 ma.fillParticleList(
'gamma:physDQM',
'E > 0.15', path=path)
38 ma.fillParticleList(
'mu+:physDQM',
'pt>2. and abs(d0) < 2 and abs(z0) < 4', path=path)
39 ma.reconstructDecay(
'pi0:physDQM -> gamma:physDQM gamma:physDQM',
'0.10 < M < 0.15', 1, writeOut=
False, path=path)
41 stdV0s.stdKshorts(path=path, fitter=
'TreeFit', updateAllDaughters=
True, writeOut=
False, addSuffix=
True)
42 ma.reconstructDecay(
'Upsilon:physDQM -> mu-:physDQM mu+:physDQM',
'9 < M < 12', 1, writeOut=
False, path=path)
44 ma.fillParticleList(
'e+:physDQM',
'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
45 ma.reconstructDecay(
'Upsilon:ephysDQM -> e-:physDQM e+:physDQM',
'4 < M < 12', 1, writeOut=
False, path=path)
46 ma.fillParticleList(
'pi+:hadbphysDQM',
'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
50 ma.fillParticleList(
'pi+:evtshape',
'', path=path)
51 ma.fillParticleList(
'gamma:evtshape',
'', path=path)
54 inputListNames=[
'pi+:evtshape',
'gamma:evtshape'],
55 default_cleanup=
False,
59 harmonicMoments=
False,
64 dqm = b2.register_module(
'PhysicsObjectsDQM')
65 dqm.param(
'PI0PListName',
'pi0:physDQM')
66 dqm.param(
'KS0PListName',
'K_S0:merged_TreeFit')
67 dqm.param(
'UpsPListName',
'Upsilon:physDQM')
69 dqm.param(
'UpsBhabhaPListName',
'Upsilon:ephysDQM')
70 dqm.param(
'UpsHadPListName',
'pi+:hadbphysDQM')
75def add_mirabelle_dqm(path):
76 """Add the mirabelle DQM modules to the ``path``.
77 Runs on conditional paths depending on the software trigger results.
78 Building D*'s or dimuons on the conditional paths.
81 path (basf2.Path): modules are loaded onto this path
84 MiraBelleMumu_path = b2.create_path()
85 MiraBelleZ0_path = b2.create_path()
86 MiraBelleDst1_path = b2.create_path()
87 MiraBelleNotDst1_path = b2.create_path()
88 MiraBelleDst2_path = b2.create_path()
89 MiraBelleTau_path = b2.create_path()
91 MiraBelleBhabha_path = b2.create_path()
92 MiraBellehadronb2_path = b2.create_path()
94 trigger_skim_mumutight = path.add_module(
96 triggerLines=[
"software_trigger_cut&skim&accept_mumutight"],
99 trigger_skim_mumutight.if_value(
"==1", MiraBelleMumu_path, b2.AfterConditionPath.CONTINUE)
101 trigger_skim_singlemuon = path.add_module(
103 triggerLines=[
"software_trigger_cut&filter&single_muon"],
106 trigger_skim_singlemuon.if_value(
"==1", MiraBelleZ0_path, b2.AfterConditionPath.CONTINUE)
108 trigger_skim_dstar_1 = path.add_module(
110 triggerLines=[
"software_trigger_cut&skim&accept_dstar_1"],
113 trigger_skim_dstar_1.if_value(
"==1", MiraBelleDst1_path, b2.AfterConditionPath.CONTINUE)
115 trigger_skim_not_dstar_1 = path.add_module(
117 triggerLines=[
"software_trigger_cut&skim&accept_dstar_1"],
121 trigger_skim_not_dstar_1.if_value(
"==1", MiraBelleNotDst1_path, b2.AfterConditionPath.CONTINUE)
122 trigger_skim_dstar_2 = MiraBelleNotDst1_path.add_module(
124 triggerLines=[
"software_trigger_cut&skim&accept_dstar_2"],
127 trigger_skim_dstar_2.if_value(
"==1", MiraBelleDst2_path, b2.AfterConditionPath.CONTINUE)
128 trigger_skim_tau = path.add_module(
130 triggerLines=[
"software_trigger_cut&skim&accept_tau_2trk",
"software_trigger_cut&skim&accept_tau_Ntrk"],
135 trigger_skim_tau.if_value(
"==1", MiraBelleTau_path, b2.AfterConditionPath.CONTINUE)
137 trigger_skim_bhabhaall = path.add_module(
139 triggerLines=[
"software_trigger_cut&skim&accept_bhabha_trk_ecl"],
142 trigger_skim_bhabhaall.if_value(
"==1", MiraBelleBhabha_path, b2.AfterConditionPath.CONTINUE)
143 trigger_skim_hadronb2 = path.add_module(
145 triggerLines=[
"software_trigger_cut&skim&accept_hadronb2"],
148 trigger_skim_hadronb2.if_value(
"==1", MiraBellehadronb2_path, b2.AfterConditionPath.CONTINUE)
151 ma.fillParticleList(
'mu+:physMiraBelle',
'', path=MiraBelleMumu_path)
152 ma.reconstructDecay(
'Upsilon:physMiraBelle -> mu+:physMiraBelle mu-:physMiraBelle',
'9 < M < 12', path=MiraBelleMumu_path)
153 MiraBelleMumu = b2.register_module(
'PhysicsObjectsMiraBelle')
154 MiraBelleMumu.param(
'MuPListName',
'mu+:physMiraBelle')
155 MiraBelleMumu.param(
'MuMuPListName',
'Upsilon:physMiraBelle')
156 MiraBelleMumu_path.add_module(MiraBelleMumu)
159 ma.fillParticleList(
'mu+:physMiraBelleZ0',
'abs(dr) < 2 and abs(dz) < 5', path=MiraBelleZ0_path)
160 ma.reconstructDecay(
'Z0:physMiraBelle -> mu+:physMiraBelleZ0 mu-:physMiraBelleZ0',
161 'nCleanedTracks(abs(dr) < 2 and abs(dz) < 5) and 9 < M and M < 12', path=MiraBelleZ0_path)
162 MiraBelleModule = b2.register_module(
'PhysicsObjectsMiraBelle')
163 MiraBelleModule.param(
'Z0PListName',
'Z0:physMiraBelle')
164 MiraBelleZ0_path.add_module(MiraBelleModule)
167 ma.fillParticleList(
'pi+:MiraBelleDst1',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
168 ma.fillParticleList(
'K+:MiraBelleDst1',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
169 ma.reconstructDecay(
'D0:MiraBelleDst1_kpi -> K-:MiraBelleDst1 pi+:MiraBelleDst1',
'1.7 < M < 2.1', path=MiraBelleDst1_path)
170 ma.reconstructDecay(
'D*+:MiraBelleDst1_kpi -> D0:MiraBelleDst1_kpi pi+:MiraBelleDst1',
171 'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst1_path)
172 MiraBelleDst1 = b2.register_module(
'PhysicsObjectsMiraBelleDst')
173 MiraBelleDst1.param(
'DstListName',
'D*+:MiraBelleDst1_kpi')
174 MiraBelleDst1_path.add_module(MiraBelleDst1)
177 ma.fillParticleList(
'pi+:MiraBelleDst2',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
178 ma.fillParticleList(
'K+:MiraBelleDst2',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
179 stdPi0s(listtype=
'eff60_May2020', writeOut=
False, path=MiraBelleDst2_path)
181 'D0:MiraBelleDst2_kpipi0 -> K-:MiraBelleDst2 pi+:MiraBelleDst2 pi0:eff60_May2020',
183 path=MiraBelleDst2_path)
184 ma.reconstructDecay(
'D*+:MiraBelleDst2_kpipi0 -> D0:MiraBelleDst2_kpipi0 pi+:MiraBelleDst2',
185 'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst2_path)
186 MiraBelleDst2 = b2.register_module(
'PhysicsObjectsMiraBelleDst2')
187 MiraBelleDst2.param(
'DstListName',
'D*+:MiraBelleDst2_kpipi0')
188 MiraBelleDst2_path.add_module(MiraBelleDst2)
194 ma.fillParticleList(
'pi+:MiraBelleTau',
'abs(d0)<1 and abs(z0)<3', path=MiraBelleTau_path)
195 ma.fillParticleList(
'gamma:MiraBelleTau',
'E>0.1 and clusterNHits>1.5 and thetaInCDCAcceptance', path=MiraBelleTau_path)
196 ParticleListForEvent = [
'pi+:MiraBelleTau',
'gamma:MiraBelleTau']
197 ma.buildEventShape(ParticleListForEvent,
198 allMoments=
False, foxWolfram=
False, cleoCones=
False,
199 sphericity=
False, jets=
False, path=MiraBelleTau_path)
200 ma.buildEventKinematics(ParticleListForEvent, path=MiraBelleTau_path)
202 vm.addAlias(
"nGoodTracks",
"nParticlesInList(pi+:MiraBelleTau)")
203 vm.addAlias(
"maxPt",
"maxPtInList(pi+:MiraBelleTau)")
204 vm.addAlias(
"E_ECLtrk",
"formula(totalECLEnergyOfParticlesInList(pi+:MiraBelleTau))")
205 vm.addAlias(
"maxOp",
"useCMSFrame(maxOpeningAngleInList(pi+:MiraBelleTau))")
207 ma.cutAndCopyLists(
'pi+:MiraBelleTau_para',
'pi+:MiraBelleTau',
'cosToThrustOfEvent>0', path=MiraBelleTau_path)
208 ma.cutAndCopyLists(
'pi+:MiraBelleTau_anti',
'pi+:MiraBelleTau',
'cosToThrustOfEvent<0', path=MiraBelleTau_path)
209 vm.addAlias(
'pionInParaThrust',
'countInList(pi+:MiraBelleTau_para)')
210 vm.addAlias(
'pionInAntiThrust',
'countInList(pi+:MiraBelleTau_anti)')
212 PmissTheta_Threshold = math.radians(150)
213 maxOp_Threshold = math.radians(178)
214 Tau1x1Cuts =
'[nGoodTracks == 2] and [3 < visibleEnergyOfEventCMS < 10]'
215 Tau1x1Cuts += f
'and [missingMomentumOfEvent_theta < {PmissTheta_Threshold}]'
216 Tau1x1Cuts += f
'and [E_ECLtrk < 6] and [maxPt > 1] and [maxOp < {maxOp_Threshold}]'
217 Tau1x1Cuts +=
'and [pionInParaThrust == 1 and pionInAntiThrust == 1]'
218 ma.reconstructDecay(
'Z0:physMiraBelleTau1x1 -> pi+:MiraBelleTau pi-:MiraBelleTau',
219 f
'{Tau1x1Cuts}', path=MiraBelleTau_path)
221 Tau1x3Cuts =
'[nGoodTracks == 4] and [3 < visibleEnergyOfEventCMS < 10.5]'
222 Tau1x3Cuts += f
'and [E_ECLtrk < 6] and [maxPt > 1] and [maxOp < {maxOp_Threshold}]'
223 Tau1x3Cuts +=
'and [[pionInParaThrust == 1 and pionInAntiThrust == 3] or [pionInParaThrust == 3 and pionInAntiThrust == 1]]'
224 ma.reconstructDecay(
'Z0:physMiraBelleTau1x3 -> pi+:MiraBelleTau pi-:MiraBelleTau pi+:MiraBelleTau pi-:MiraBelleTau',
225 f
'{Tau1x3Cuts}', path=MiraBelleTau_path)
227 MiraBelleTau = b2.register_module(
'PhysicsObjectsMiraBelleTau')
228 MiraBelleTau.param(
'tautau1x1PListName',
'Z0:physMiraBelleTau1x1')
229 MiraBelleTau.param(
'tautau1x3PListName',
'Z0:physMiraBelleTau1x3')
230 MiraBelleTau_path.add_module(MiraBelleTau)
235 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
236 path=MiraBelleBhabha_path)
237 ma.reconstructDecay(
'Upsilon:ephysMiraBelle -> e+:physMiraBelle e-:physMiraBelle',
'4 < M < 12', path=MiraBelleBhabha_path)
238 MiraBelleBhabha = b2.register_module(
'PhysicsObjectsMiraBelleBhabha')
239 MiraBelleBhabha.param(
'ePListName',
'e+:physMiraBelle')
240 MiraBelleBhabha.param(
'bhabhaPListName',
'Upsilon:ephysMiraBelle')
241 MiraBelleBhabha_path.add_module(MiraBelleBhabha)
243 'pi+:hadb2physMiraBelle',
244 'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
245 path=MiraBellehadronb2_path)
246 MiraBellehadronb = b2.register_module(
'PhysicsObjectsMiraBelleHadron')
247 MiraBellehadronb.param(
'hadronb2piPListName',
'pi+:hadb2physMiraBelle')
248 MiraBellehadronb2_path.add_module(MiraBellehadronb)
252def get_hadB_path(path):
253 """ Selects the hadronic B decays, function returns corresponding path """
256 path_hadB = b2.create_path()
257 trigger_skim_BB = path.add_module(
259 triggerLines=[
"software_trigger_cut&skim&accept_btocharm"],
262 trigger_skim_BB.if_value(
"==1", path_hadB, b2.AfterConditionPath.CONTINUE)
264 stdPi(listtype=
'loose', path=path_hadB)
265 stdK(listtype=
'good', path=path_hadB)
266 stdPi0s(listtype=
'eff40_May2020', path=path_hadB)
268 ma.cutAndCopyList(
"pi+:hadB",
"pi+:loose",
"[abs(dz)<2.0] and [abs(dr)<0.5]", path=path_hadB)
269 ma.cutAndCopyList(
"K+:hadB",
"K+:good",
"[abs(dz)<2.0] and [abs(dr)<0.5]", path=path_hadB)
271 ma.cutAndCopyList(
"pi0:hadB",
"pi0:eff40_May2020",
"", path=path_hadB)
277 DcutLoose =
'1.7 < M < 2.1'
278 Dcut =
'1.830 < M < 1.894'
280 ma.reconstructDecay(decayString=
'D0:hadB_Kpi -> K-:hadB pi+:hadB', cut=DcutLoose, dmID=1, path=path_hadB)
281 ma.reconstructDecay(decayString=
'D0:hadB_Kpipi0 -> K-:hadB pi+:hadB pi0:hadB',
282 cut=DcutLoose, dmID=2, path=path_hadB)
283 ma.reconstructDecay(decayString=
'D0:hadB_Kpipipi -> K-:hadB pi+:hadB pi-:hadB pi+:hadB',
284 cut=DcutLoose, dmID=3, path=path_hadB)
287 vertex.kFit(list_name=
'D0:hadB_Kpi', conf_level=0.0, fit_type=
'mass', path=path_hadB)
289 vertex.kFit(list_name=
'D0:hadB_Kpipipi', conf_level=0.0, fit_type=
'mass', path=path_hadB)
291 ma.applyCuts(
"D0:hadB_Kpi", Dcut, path=path_hadB)
292 ma.applyCuts(
"D0:hadB_Kpipi0", Dcut, path=path_hadB)
293 ma.applyCuts(
"D0:hadB_Kpipipi", Dcut, path=path_hadB)
295 DStarcutLoose =
'massDifference(0) < 0.16'
298 ma.reconstructDecay(decayString=
'D*+:hadB_D0pi_Kpi -> D0:hadB_Kpi pi+:hadB', cut=DStarcutLoose, dmID=1, path=path_hadB)
299 ma.reconstructDecay(decayString=
'D*+:hadB_D0pi_Kpipi0 -> D0:hadB_Kpipi0 pi+:hadB',
300 cut=DStarcutLoose, dmID=2, path=path_hadB)
301 ma.reconstructDecay(decayString=
'D*+:hadB_D0pi_Kpipipi -> D0:hadB_Kpipipi pi+:hadB',
302 cut=DStarcutLoose, dmID=3, path=path_hadB)
304 BcutLoose =
'[ useCMSFrame(p) < 1.6 ] and [abs(dM) < 0.25]'
305 Bcut =
'[ useCMSFrame(p) < 1.2 ] and [abs(dM) < 0.05]'
308 ma.reconstructDecay(decayString=
'B0:hadB_Dstpi_D0pi_Kpi -> D*-:hadB_D0pi_Kpi pi+:hadB',
310 dmID=1, path=path_hadB)
311 ma.reconstructDecay(decayString=
'B0:hadB_Dstpi_D0pi_Kpipi0 -> D*-:hadB_D0pi_Kpipi0 pi+:hadB',
313 dmID=2, path=path_hadB)
314 ma.reconstructDecay(decayString=
'B0:hadB_Dstpi_D0pi_Kpipipi -> D*-:hadB_D0pi_Kpipipi pi+:hadB',
316 dmID=3, path=path_hadB)
318 vertex.treeFit(
'B0:hadB_Dstpi_D0pi_Kpi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
319 vertex.treeFit(
'B0:hadB_Dstpi_D0pi_Kpipi0', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
320 vertex.treeFit(
'B0:hadB_Dstpi_D0pi_Kpipipi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
327 ma.reconstructDecay(decayString=
'D-:hadB_Kpipi -> K+:hadB pi-:hadB pi-:hadB',
328 cut=DcutLoose, dmID=4, path=path_hadB)
330 vertex.kFit(list_name=
'D-:hadB_Kpipi', conf_level=0.0, fit_type=
'mass', path=path_hadB)
331 ma.applyCuts(
"D-:hadB_Kpipi",
'1.844 < M < 1.894', path=path_hadB)
334 ma.reconstructDecay(decayString=
'B0:hadB_Dpi_Kpipi -> D-:hadB_Kpipi pi+:hadB',
335 cut=BcutLoose, dmID=4, path=path_hadB)
342 ma.reconstructDecay(decayString=
'B-:hadB_D0pi_Kpi -> D0:hadB_Kpi pi-:hadB',
344 dmID=5, path=path_hadB)
345 ma.reconstructDecay(decayString=
'B-:hadB_D0pi_Kpipi0 -> D0:hadB_Kpipi0 pi-:hadB',
347 dmID=6, path=path_hadB)
348 ma.reconstructDecay(decayString=
'B-:hadB_D0pi_Kpipipi -> D0:hadB_Kpipipi pi-:hadB',
350 dmID=7, path=path_hadB)
352 vertex.treeFit(
'B-:hadB_D0pi_Kpi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
353 vertex.treeFit(
'B-:hadB_D0pi_Kpipi0', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
354 vertex.treeFit(
'B-:hadB_D0pi_Kpipipi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
357 outputListName=
'B0:hadB_combined',
359 'B0:hadB_Dstpi_D0pi_Kpi',
360 'B0:hadB_Dstpi_D0pi_Kpipi0',
361 'B0:hadB_Dstpi_D0pi_Kpipipi',
367 outputListName=
'B-:hadB_combined',
370 'B-:hadB_D0pi_Kpipi0',
371 'B-:hadB_D0pi_Kpipipi',
376 ma.buildRestOfEvent(target_list_name=
'B0:hadB_combined', path=path_hadB)
379 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
382 ma.appendROEMasks(list_name=
'B0:hadB_combined', mask_tuples=[cleanMask], path=path_hadB)
383 ma.buildContinuumSuppression(list_name=
'B0:hadB_combined', roe_mask=
'cleanMask', path=path_hadB)
386 ma.buildRestOfEvent(target_list_name=
'B-:hadB_combined', path=path_hadB)
389 ma.appendROEMasks(list_name=
'B-:hadB_combined', mask_tuples=[cleanMask], path=path_hadB)
390 ma.buildContinuumSuppression(list_name=
'B-:hadB_combined', roe_mask=
'cleanMask', path=path_hadB)
392 ma.applyCuts(
"B0:hadB_combined",
"[R2 < 0.3] and " + Bcut, path=path_hadB)
393 ma.applyCuts(
"B-:hadB_combined",
"[R2 < 0.3] and " + Bcut, path=path_hadB)
395 MiraBelleEcmsBB = b2.register_module(
'PhysicsObjectsMiraBelleEcmsBB')
396 MiraBelleEcmsBB.param(
'B0ListName',
'B0:hadB_combined')
397 MiraBelleEcmsBB.param(
'BmListName',
'B-:hadB_combined')
398 path_hadB.add_module(MiraBelleEcmsBB)
stdKshorts(prioritiseV0=True, fitter="TreeFit", path=None, updateAllDaughters=False, writeOut=False, addSuffix=False)
treeFit(list_name, conf_level=0.001, massConstraint=[], ipConstraint=False, updateAllDaughters=False, massConstraintDecayString='', massConstraintMassValues=[], customOriginConstraint=False, customOriginVertex=[0.001, 0, 0.0116], customOriginCovariance=[0.0048, 0, 0, 0, 0.003567, 0, 0, 0, 0.0400], originDimension=3, treatAsInvisible='', ignoreFromVertexFit='', path=None)
kFit(list_name, conf_level, fit_type='vertex', constraint='', daughtersUpdate=False, decay_string='', massConstraint=[], recoilMass=0, smearing=0, path=None)