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
24def add_analysis_dqm(path):
25 """Add the analysis DQM modules to the ``path``.
26 Builds a list of muons, pi0's, Kshorts and the Fox Wolfram event shape variables.
27 Also M(mumu) for nominal beam energy monitoring.
30 path (basf2.Path): modules are loaded onto this path
34 ma.fillParticleList(
'mu+:KLMDQM',
'p>1.5', path=path)
35 ma.fillParticleList(
'mu+:KLMDQM2',
'p>1.5 and abs(d0) < 2 and abs(z0) < 4', path=path)
36 ma.fillParticleList(
'gamma:physDQM',
'E > 0.15', path=path)
37 ma.fillParticleList(
'mu+:physDQM',
'pt>2. and abs(d0) < 2 and abs(z0) < 4', path=path)
38 ma.reconstructDecay(
'pi0:physDQM -> gamma:physDQM gamma:physDQM',
'0.10 < M < 0.15', 1, writeOut=
False, path=path)
40 stdV0s.stdKshorts(path=path, fitter=
'TreeFit', updateAllDaughters=
True, writeOut=
False, addSuffix=
True)
41 ma.reconstructDecay(
'Upsilon:physDQM -> mu-:physDQM mu+:physDQM',
'9 < M < 12', 1, writeOut=
False, path=path)
43 ma.fillParticleList(
'e+:physDQM',
'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
44 ma.reconstructDecay(
'Upsilon:ephysDQM -> e-:physDQM e+:physDQM',
'4 < M < 12', 1, writeOut=
False, path=path)
45 ma.fillParticleList(
'pi+:hadbphysDQM',
'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
49 ma.fillParticleList(
'pi+:evtshape',
'', path=path)
50 ma.fillParticleList(
'gamma:evtshape',
'', path=path)
53 inputListNames=[
'pi+:evtshape',
'gamma:evtshape'],
54 default_cleanup=
False,
58 harmonicMoments=
False,
63 dqm = b2.register_module(
'PhysicsObjectsDQM')
64 dqm.param(
'PI0PListName',
'pi0:physDQM')
65 dqm.param(
'KS0PListName',
'K_S0:merged_TreeFit')
66 dqm.param(
'UpsPListName',
'Upsilon:physDQM')
68 dqm.param(
'UpsBhabhaPListName',
'Upsilon:ephysDQM')
69 dqm.param(
'UpsHadPListName',
'pi+:hadbphysDQM')
74def add_mirabelle_dqm(path):
75 """Add the mirabelle DQM modules to the ``path``.
76 Runs on conditional paths depending on the software trigger results.
77 Building D*'s or dimuons on the conditional paths.
80 path (basf2.Path): modules are loaded onto this path
83 MiraBelleMumu_path = b2.create_path()
84 MiraBelleZ0_path = b2.create_path()
85 MiraBelleDst1_path = b2.create_path()
86 MiraBelleNotDst1_path = b2.create_path()
87 MiraBelleDst2_path = b2.create_path()
88 MiraBelleTau_path = b2.create_path()
90 MiraBelleBhabha_path = b2.create_path()
91 MiraBellehadronb2_path = b2.create_path()
93 trigger_skim_mumutight = path.add_module(
95 triggerLines=[
"software_trigger_cut&skim&accept_mumutight"],
98 trigger_skim_mumutight.if_value(
"==1", MiraBelleMumu_path, b2.AfterConditionPath.CONTINUE)
100 trigger_skim_singlemuon = path.add_module(
102 triggerLines=[
"software_trigger_cut&filter&single_muon"],
105 trigger_skim_singlemuon.if_value(
"==1", MiraBelleZ0_path, b2.AfterConditionPath.CONTINUE)
107 trigger_skim_dstar_1 = path.add_module(
109 triggerLines=[
"software_trigger_cut&skim&accept_dstar_1"],
112 trigger_skim_dstar_1.if_value(
"==1", MiraBelleDst1_path, b2.AfterConditionPath.CONTINUE)
114 trigger_skim_not_dstar_1 = path.add_module(
116 triggerLines=[
"software_trigger_cut&skim&accept_dstar_1"],
120 trigger_skim_not_dstar_1.if_value(
"==1", MiraBelleNotDst1_path, b2.AfterConditionPath.CONTINUE)
121 trigger_skim_dstar_2 = MiraBelleNotDst1_path.add_module(
123 triggerLines=[
"software_trigger_cut&skim&accept_dstar_2"],
126 trigger_skim_dstar_2.if_value(
"==1", MiraBelleDst2_path, b2.AfterConditionPath.CONTINUE)
127 trigger_skim_tau = path.add_module(
129 triggerLines=[
"software_trigger_cut&skim&accept_tau_2trk",
"software_trigger_cut&skim&accept_tau_Ntrk"],
134 trigger_skim_tau.if_value(
"==1", MiraBelleTau_path, b2.AfterConditionPath.CONTINUE)
136 trigger_skim_bhabhaall = path.add_module(
138 triggerLines=[
"software_trigger_cut&skim&accept_bhabha_trk_ecl"],
141 trigger_skim_bhabhaall.if_value(
"==1", MiraBelleBhabha_path, b2.AfterConditionPath.CONTINUE)
142 trigger_skim_hadronb2 = path.add_module(
144 triggerLines=[
"software_trigger_cut&skim&accept_hadronb2"],
147 trigger_skim_hadronb2.if_value(
"==1", MiraBellehadronb2_path, b2.AfterConditionPath.CONTINUE)
150 ma.fillParticleList(
'mu+:physMiraBelle',
'', path=MiraBelleMumu_path)
151 ma.reconstructDecay(
'Upsilon:physMiraBelle -> mu+:physMiraBelle mu-:physMiraBelle',
'9 < M < 12', path=MiraBelleMumu_path)
152 MiraBelleMumu = b2.register_module(
'PhysicsObjectsMiraBelle')
153 MiraBelleMumu.param(
'MuPListName',
'mu+:physMiraBelle')
154 MiraBelleMumu.param(
'MuMuPListName',
'Upsilon:physMiraBelle')
155 MiraBelleMumu_path.add_module(MiraBelleMumu)
158 ma.fillParticleList(
'mu+:physMiraBelleZ0',
'abs(dr) < 2 and abs(dz) < 5', path=MiraBelleZ0_path)
159 ma.reconstructDecay(
'Z0:physMiraBelle -> mu+:physMiraBelleZ0 mu-:physMiraBelleZ0',
160 'nCleanedTracks(abs(dr) < 2 and abs(dz) < 5) and 9 < M and M < 12', path=MiraBelleZ0_path)
161 MiraBelleModule = b2.register_module(
'PhysicsObjectsMiraBelle')
162 MiraBelleModule.param(
'Z0PListName',
'Z0:physMiraBelle')
163 MiraBelleZ0_path.add_module(MiraBelleModule)
166 ma.fillParticleList(
'pi+:MiraBelleDst1',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
167 ma.fillParticleList(
'K+:MiraBelleDst1',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
168 ma.reconstructDecay(
'D0:MiraBelleDst1_kpi -> K-:MiraBelleDst1 pi+:MiraBelleDst1',
'1.7 < M < 2.1', path=MiraBelleDst1_path)
169 ma.reconstructDecay(
'D*+:MiraBelleDst1_kpi -> D0:MiraBelleDst1_kpi pi+:MiraBelleDst1',
170 'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst1_path)
171 MiraBelleDst1 = b2.register_module(
'PhysicsObjectsMiraBelleDst')
172 MiraBelleDst1.param(
'DstListName',
'D*+:MiraBelleDst1_kpi')
173 MiraBelleDst1_path.add_module(MiraBelleDst1)
176 ma.fillParticleList(
'pi+:MiraBelleDst2',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
177 ma.fillParticleList(
'K+:MiraBelleDst2',
'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
178 stdPi0s(listtype=
'eff60_May2020', writeOut=
False, path=MiraBelleDst2_path)
180 'D0:MiraBelleDst2_kpipi0 -> K-:MiraBelleDst2 pi+:MiraBelleDst2 pi0:eff60_May2020',
182 path=MiraBelleDst2_path)
183 ma.reconstructDecay(
'D*+:MiraBelleDst2_kpipi0 -> D0:MiraBelleDst2_kpipi0 pi+:MiraBelleDst2',
184 'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst2_path)
185 MiraBelleDst2 = b2.register_module(
'PhysicsObjectsMiraBelleDst2')
186 MiraBelleDst2.param(
'DstListName',
'D*+:MiraBelleDst2_kpipi0')
187 MiraBelleDst2_path.add_module(MiraBelleDst2)
190 ma.fillParticleList(
'pi+:MiraBelleTau',
'abs(d0)<1 and abs(z0)<3', path=MiraBelleTau_path)
191 ma.fillParticleList(
'gamma:MiraBelleTau',
'0.1<E and 1.5<clusterNHits and thetaInCDCAcceptance', path=MiraBelleTau_path)
192 ParticleListForEvent = [
'pi+:MiraBelleTau',
'gamma:MiraBelleTau']
193 ma.buildEventShape(ParticleListForEvent,
194 allMoments=
False, foxWolfram=
False, cleoCones=
False,
195 sphericity=
False, jets=
False, path=MiraBelleTau_path)
196 ma.buildEventKinematics(ParticleListForEvent, path=MiraBelleTau_path)
198 vm.addAlias(
"nGoodTracks",
"nParticlesInList(pi+:MiraBelleTau)")
199 vm.addAlias(
"maxPt",
"maxPtInList(pi+:MiraBelleTau)")
200 vm.addAlias(
"E_ECLtrk",
"formula(totalECLEnergyOfParticlesInList(pi+:MiraBelleTau))")
201 vm.addAlias(
"maxOp",
"useCMSFrame(maxOpeningAngleInList(pi+:MiraBelleTau))")
203 ma.cutAndCopyLists(
'pi+:MiraBelleTau_para',
'pi+:MiraBelleTau',
'cosToThrustOfEvent>0', path=MiraBelleTau_path)
204 ma.cutAndCopyLists(
'pi+:MiraBelleTau_anti',
'pi+:MiraBelleTau',
'cosToThrustOfEvent<0', path=MiraBelleTau_path)
205 vm.addAlias(
'pionInParaThrust',
'countInList(pi+:MiraBelleTau_para)')
206 vm.addAlias(
'pionInAntiThrust',
'countInList(pi+:MiraBelleTau_anti)')
208 Tau1x1Cuts =
'[nGoodTracks == 2] and [3 < visibleEnergyOfEventCMS < 10]'
209 Tau1x1Cuts +=
'and [missingMomentumOfEvent_theta < 2.618]'
210 Tau1x1Cuts +=
'and [E_ECLtrk < 6] and [maxPt > 1] and [maxOp < 3.106686]'
211 Tau1x1Cuts +=
'and [pionInParaThrust == 1 and pionInAntiThrust == 1]'
212 ma.reconstructDecay(
'Z0:physMiraBelleTau1x1 -> pi+:MiraBelleTau pi-:MiraBelleTau',
213 f
'{Tau1x1Cuts}', path=MiraBelleTau_path)
215 Tau1x3Cuts =
'[nGoodTracks == 4] and [3 < visibleEnergyOfEventCMS < 10.5]'
216 Tau1x3Cuts +=
'and [E_ECLtrk < 6] and [maxPt > 1] and [maxOp < 3.106686]'
217 Tau1x3Cuts +=
'and [[pionInParaThrust == 1 and pionInAntiThrust == 3] or [pionInParaThrust == 3 and pionInAntiThrust == 1]]'
218 ma.reconstructDecay(
'Z0:physMiraBelleTau1x3 -> pi+:MiraBelleTau pi-:MiraBelleTau pi+:MiraBelleTau pi-:MiraBelleTau',
219 f
'{Tau1x3Cuts}', path=MiraBelleTau_path)
221 MiraBelleTau = b2.register_module(
'PhysicsObjectsMiraBelleTau')
222 MiraBelleTau.param(
'tautau1x1PListName',
'Z0:physMiraBelleTau1x1')
223 MiraBelleTau.param(
'tautau1x3PListName',
'Z0:physMiraBelleTau1x3')
224 MiraBelleTau_path.add_module(MiraBelleTau)
229 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
230 path=MiraBelleBhabha_path)
231 ma.reconstructDecay(
'Upsilon:ephysMiraBelle -> e+:physMiraBelle e-:physMiraBelle',
'4 < M < 12', path=MiraBelleBhabha_path)
232 MiraBelleBhabha = b2.register_module(
'PhysicsObjectsMiraBelleBhabha')
233 MiraBelleBhabha.param(
'ePListName',
'e+:physMiraBelle')
234 MiraBelleBhabha.param(
'bhabhaPListName',
'Upsilon:ephysMiraBelle')
235 MiraBelleBhabha_path.add_module(MiraBelleBhabha)
237 'pi+:hadb2physMiraBelle',
238 'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
239 path=MiraBellehadronb2_path)
240 MiraBellehadronb = b2.register_module(
'PhysicsObjectsMiraBelleHadron')
241 MiraBellehadronb.param(
'hadronb2piPListName',
'pi+:hadb2physMiraBelle')
242 MiraBellehadronb2_path.add_module(MiraBellehadronb)
246def get_hadB_path(path):
247 """ Selects the hadronic B decays, function returns corresponding path """
250 path_hadB = b2.create_path()
251 trigger_skim_BB = path.add_module(
253 triggerLines=[
"software_trigger_cut&skim&accept_btocharm"],
256 trigger_skim_BB.if_value(
"==1", path_hadB, b2.AfterConditionPath.CONTINUE)
258 stdPi(listtype=
'loose', path=path_hadB)
259 stdK(listtype=
'good', path=path_hadB)
260 stdPi0s(listtype=
'eff40_May2020', path=path_hadB)
262 ma.cutAndCopyList(
"pi+:hadB",
"pi+:loose",
"[abs(dz)<2.0] and [abs(dr)<0.5]", path=path_hadB)
263 ma.cutAndCopyList(
"K+:hadB",
"K+:good",
"[abs(dz)<2.0] and [abs(dr)<0.5]", path=path_hadB)
265 ma.cutAndCopyList(
"pi0:hadB",
"pi0:eff40_May2020",
"", path=path_hadB)
271 DcutLoose =
'1.7 < M < 2.1'
272 Dcut =
'1.830 < M < 1.894'
274 ma.reconstructDecay(decayString=
'D0:hadB_Kpi -> K-:hadB pi+:hadB', cut=DcutLoose, dmID=1, path=path_hadB)
275 ma.reconstructDecay(decayString=
'D0:hadB_Kpipi0 -> K-:hadB pi+:hadB pi0:hadB',
276 cut=DcutLoose, dmID=2, path=path_hadB)
277 ma.reconstructDecay(decayString=
'D0:hadB_Kpipipi -> K-:hadB pi+:hadB pi-:hadB pi+:hadB',
278 cut=DcutLoose, dmID=3, path=path_hadB)
281 vertex.kFit(list_name=
'D0:hadB_Kpi', conf_level=0.0, fit_type=
'mass', path=path_hadB)
283 vertex.kFit(list_name=
'D0:hadB_Kpipipi', conf_level=0.0, fit_type=
'mass', path=path_hadB)
285 ma.applyCuts(
"D0:hadB_Kpi", Dcut, path=path_hadB)
286 ma.applyCuts(
"D0:hadB_Kpipi0", Dcut, path=path_hadB)
287 ma.applyCuts(
"D0:hadB_Kpipipi", Dcut, path=path_hadB)
289 DStarcutLoose =
'massDifference(0) < 0.16'
292 ma.reconstructDecay(decayString=
'D*+:hadB_D0pi_Kpi -> D0:hadB_Kpi pi+:hadB', cut=DStarcutLoose, dmID=1, path=path_hadB)
293 ma.reconstructDecay(decayString=
'D*+:hadB_D0pi_Kpipi0 -> D0:hadB_Kpipi0 pi+:hadB',
294 cut=DStarcutLoose, dmID=2, path=path_hadB)
295 ma.reconstructDecay(decayString=
'D*+:hadB_D0pi_Kpipipi -> D0:hadB_Kpipipi pi+:hadB',
296 cut=DStarcutLoose, dmID=3, path=path_hadB)
298 BcutLoose =
'[ useCMSFrame(p) < 1.6 ] and [abs(dM) < 0.25]'
299 Bcut =
'[ useCMSFrame(p) < 1.2 ] and [abs(dM) < 0.05]'
302 ma.reconstructDecay(decayString=
'B0:hadB_Dstpi_D0pi_Kpi -> D*-:hadB_D0pi_Kpi pi+:hadB',
304 dmID=1, path=path_hadB)
305 ma.reconstructDecay(decayString=
'B0:hadB_Dstpi_D0pi_Kpipi0 -> D*-:hadB_D0pi_Kpipi0 pi+:hadB',
307 dmID=2, path=path_hadB)
308 ma.reconstructDecay(decayString=
'B0:hadB_Dstpi_D0pi_Kpipipi -> D*-:hadB_D0pi_Kpipipi pi+:hadB',
310 dmID=3, path=path_hadB)
312 vertex.treeFit(
'B0:hadB_Dstpi_D0pi_Kpi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
313 vertex.treeFit(
'B0:hadB_Dstpi_D0pi_Kpipi0', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
314 vertex.treeFit(
'B0:hadB_Dstpi_D0pi_Kpipipi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
321 ma.reconstructDecay(decayString=
'D-:hadB_Kpipi -> K+:hadB pi-:hadB pi-:hadB',
322 cut=DcutLoose, dmID=4, path=path_hadB)
324 vertex.kFit(list_name=
'D-:hadB_Kpipi', conf_level=0.0, fit_type=
'mass', path=path_hadB)
325 ma.applyCuts(
"D-:hadB_Kpipi",
'1.844 < M < 1.894', path=path_hadB)
328 ma.reconstructDecay(decayString=
'B0:hadB_Dpi_Kpipi -> D-:hadB_Kpipi pi+:hadB',
329 cut=BcutLoose, dmID=4, path=path_hadB)
336 ma.reconstructDecay(decayString=
'B-:hadB_D0pi_Kpi -> D0:hadB_Kpi pi-:hadB',
338 dmID=5, path=path_hadB)
339 ma.reconstructDecay(decayString=
'B-:hadB_D0pi_Kpipi0 -> D0:hadB_Kpipi0 pi-:hadB',
341 dmID=6, path=path_hadB)
342 ma.reconstructDecay(decayString=
'B-:hadB_D0pi_Kpipipi -> D0:hadB_Kpipipi pi-:hadB',
344 dmID=7, path=path_hadB)
346 vertex.treeFit(
'B-:hadB_D0pi_Kpi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
347 vertex.treeFit(
'B-:hadB_D0pi_Kpipi0', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
348 vertex.treeFit(
'B-:hadB_D0pi_Kpipipi', updateAllDaughters=
True, ipConstraint=
True, path=path_hadB)
351 outputListName=
'B0:hadB_combined',
353 'B0:hadB_Dstpi_D0pi_Kpi',
354 'B0:hadB_Dstpi_D0pi_Kpipi0',
355 'B0:hadB_Dstpi_D0pi_Kpipipi',
361 outputListName=
'B-:hadB_combined',
364 'B-:hadB_D0pi_Kpipi0',
365 'B-:hadB_D0pi_Kpipipi',
370 ma.buildRestOfEvent(target_list_name=
'B0:hadB_combined', path=path_hadB)
373 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
376 ma.appendROEMasks(list_name=
'B0:hadB_combined', mask_tuples=[cleanMask], path=path_hadB)
377 ma.buildContinuumSuppression(list_name=
'B0:hadB_combined', roe_mask=
'cleanMask', path=path_hadB)
380 ma.buildRestOfEvent(target_list_name=
'B-:hadB_combined', path=path_hadB)
383 ma.appendROEMasks(list_name=
'B-:hadB_combined', mask_tuples=[cleanMask], path=path_hadB)
384 ma.buildContinuumSuppression(list_name=
'B-:hadB_combined', roe_mask=
'cleanMask', path=path_hadB)
386 ma.applyCuts(
"B0:hadB_combined",
"[R2 < 0.3] and " + Bcut, path=path_hadB)
387 ma.applyCuts(
"B-:hadB_combined",
"[R2 < 0.3] and " + Bcut, path=path_hadB)
389 MiraBelleEcmsBB = b2.register_module(
'PhysicsObjectsMiraBelleEcmsBB')
390 MiraBelleEcmsBB.param(
'B0ListName',
'B0:hadB_combined')
391 MiraBelleEcmsBB.param(
'BmListName',
'B-:hadB_combined')
392 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)