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