11from basf2
import register_module
18 fitterEngine='NewFitterGSL',
19 constraint='HardBeam',
21 addUnmeasuredPhoton=False,
23 decayStringForDirectionOnlyParticles="",
24 decayStringForAlternateMassParticles="",
25 alternateMassHypos=[],
26 decayStringForNeutronVsAntiNeutron="",
30 Perform a 4C momentum constraint kinematic fit for particles
in the given ParticleList.
32 @param list_name name of the input ParticleList
33 @param fitterEngine which fitter engine to use?
'NewFitterGSL' or 'OPALFitterGSL'
34 @param constraint HardBeam
or RecoilMass
35 @param daughtersUpdate make copy of the daughters
and update them after the vertex fit
36 @param addUnmeasuredPhoton add one unmeasured photon (uses up three constraints)
37 @param variablePrefix prepended to fit variables stored
in extra info. Required
if
38 ParticleKinematicFitter
is run multiple times
39 @param decayStringForDirectionOnlyParticles DecayString specifying the particles
40 to use only direction information
in the fit
41 @param decayStringForAlternateMassParticles DecayString specifying the particles
42 where an alternate mass hypothesis
is used
43 @param alternateMassHypos list of pdg values (
or particle names)
for particles where
44 different mass hypothesis
is used
in the fit
45 @param decayStringForNeutronVsAntiNeutron DecayString specifying the charged particle
46 used to tag whether n
or nbar. When tag particle has negative charge, PDG sign of n/nbar
47 is flipped
from default given
in alternateMassHypos
48 @param path modules are added to this path
51 orca = register_module('ParticleKinematicFitter')
52 orca.set_name(
'ParticleKinematicFitter_' + list_name)
53 orca.param(
'debugFitter',
False)
54 orca.param(
'orcaTracer',
'None')
55 orca.param(
'orcaFitterEngine', fitterEngine)
56 orca.param(
'orcaConstraint', constraint)
57 orca.param(
'listName', list_name)
58 orca.param(
'updateDaughters', daughtersUpdate)
59 orca.param(
'addUnmeasuredPhoton', addUnmeasuredPhoton)
60 orca.param(
'variablePrefix', variablePrefix)
61 orca.param(
'decayStringForDirectionOnlyParticles', decayStringForDirectionOnlyParticles)
62 orca.param(
'decayStringForAlternateMassParticles', decayStringForAlternateMassParticles)
63 orca.param(
'decayStringForNeutronVsAntiNeutron', decayStringForNeutronVsAntiNeutron)
64 orca.param(
'alternateMassHypos',
pdg.from_names(alternateMassHypos))
68def UnmeasuredfitKinematic1C(
70 fitterEngine='NewFitterGSL',
71 constraint='HardBeam',
74 decayStringForDirectionOnlyParticles="",
75 decayStringForAlternateMassParticles="",
76 alternateMassHypos=[],
77 decayStringForNeutronVsAntiNeutron="",
81 Perform 1C momentum constraint kinematic fit with one unmeasured photon
for particles
in the given ParticleList.
83 @param list_name name of the input ParticleList
84 @param fitterEngine which fitter engine to use?
'NewFitterGSL' or 'OPALFitterGSL'
85 @param constraint HardBeam
or RecoilMass
86 @param daughtersUpdate make copy of the daughters
and update them after the vertex fit
87 @param variablePrefix prepended to fit variables stored
in extra info. Required
if ParticleKinematicFitter
is run multiple times
88 @param decayStringForDirectionOnlyParticles DecayString specifying the particles
89 to use only direction information
in the fit
90 @param decayStringForAlternateMassParticles DecayString specifying the particles
91 where an alternate mass hypothesis
is used
92 @param alternateMassHypos list of pdg values (
or particle names)
for particles where
93 different mass hypothesis
is used
in the fit
94 @param decayStringForNeutronVsAntiNeutron DecayString specifying the charged particle
95 used to tag whether n
or nbar. When tag particle has negative charge, PDG sign of n/nbar
96 is flipped
from default given
in alternateMassHypos
97 @param path modules are added to this path
100 orca = register_module('ParticleKinematicFitter')
101 orca.set_name(
'ParticleKinematicFitter_' + list_name)
102 orca.param(
'debugFitter',
False)
103 orca.param(
'orcaTracer',
'None')
104 orca.param(
'orcaFitterEngine', fitterEngine)
105 orca.param(
'orcaConstraint', constraint)
106 orca.param(
'listName', list_name)
107 orca.param(
'updateDaughters', daughtersUpdate)
108 orca.param(
'addUnmeasuredPhoton',
True)
109 orca.param(
'variablePrefix', variablePrefix)
110 orca.param(
'decayStringForDirectionOnlyParticles', decayStringForDirectionOnlyParticles)
111 orca.param(
'decayStringForAlternateMassParticles', decayStringForAlternateMassParticles)
112 orca.param(
'decayStringForNeutronVsAntiNeutron', decayStringForNeutronVsAntiNeutron)
113 orca.param(
'alternateMassHypos',
pdg.from_names(alternateMassHypos))
114 path.add_module(orca)
119 fitterEngine='NewFitterGSL',
120 constraint='HardBeam',
121 daughtersUpdate=True,
122 addUnmeasuredPhoton=False,
125 decayStringForDirectionOnlyParticles="",
126 decayStringForAlternateMassParticles="",
127 alternateMassHypos=[],
128 decayStringForNeutronVsAntiNeutron="",
132 Perform 3C momentum constraint kinematic fit with one photon
with unmeasured energy
for particles
133 in the given ParticleList, the first daughter should be the energy unmeasured Photon.
135 @param list_name name of the input ParticleList
136 @param fitterEngine which fitter engine to use?
'NewFitterGSL' or 'OPALFitterGSL'
137 @param constraint HardBeam
or RecoilMass
138 @param daughtersUpdate make copy of the daughters
and update them after the vertex fit
139 @param addUnmeasuredPhoton add one unmeasured photon (uses up three constraints)
140 @param add3CPhoton add one photon
with unmeasured energy (uses up a constraint)
141 @param variablePrefix prepended to fit variables stored
in extra info. Required
if ParticleKinematicFitter
is run multiple times
142 @param decayStringForDirectionOnlyParticles DecayString specifying the particles
143 to use only direction information
in the fit
144 @param decayStringForAlternateMassParticles DecayString specifying the particles
145 where an alternate mass hypothesis
is used
146 @param alternateMassHypos list of pdg values (
or particle names)
for particles where
147 different mass hypothesis
is used
in the fit
148 @param decayStringForNeutronVsAntiNeutron DecayString specifying the charged particle
149 used to tag whether n
or nbar. When tag particle has negative charge, PDG sign of n/nbar
150 is flipped
from default given
in alternateMassHypos
151 @param path modules are added to this path
154 orca = register_module('ParticleKinematicFitter')
155 orca.set_name(
'ParticleKinematicFitter_' + list_name)
156 orca.param(
'debugFitter',
False)
157 orca.param(
'orcaTracer',
'None')
158 orca.param(
'orcaFitterEngine', fitterEngine)
159 orca.param(
'orcaConstraint', constraint)
160 orca.param(
'listName', list_name)
161 orca.param(
'updateDaughters', daughtersUpdate)
162 orca.param(
'addUnmeasuredPhoton', addUnmeasuredPhoton)
163 orca.param(
'add3CPhoton', add3CPhoton)
164 orca.param(
'variablePrefix', variablePrefix)
165 orca.param(
'decayStringForDirectionOnlyParticles', decayStringForDirectionOnlyParticles)
166 orca.param(
'decayStringForAlternateMassParticles', decayStringForAlternateMassParticles)
167 orca.param(
'decayStringForNeutronVsAntiNeutron', decayStringForNeutronVsAntiNeutron)
168 orca.param(
'alternateMassHypos',
pdg.from_names(alternateMassHypos))
169 path.add_module(orca)
174 fitterEngine='NewFitterGSL',
175 constraint='HardBeam',
176 daughtersUpdate=True,
177 addUnmeasuredPhotonAlongBeam="",
179 decayStringForDirectionOnlyParticles="",
180 decayStringForAlternateMassParticles="",
181 alternateMassHypos=[],
182 decayStringForNeutronVsAntiNeutron="",
186 Perform 2C momentum constraint kinematic fit. The photon with unmeasured energy
and theta
187 has to be the first particle
in the decay string. If
'addUnmeasuredPhotonAlongBeam' is set to
188 'HER' or 'LER', both phi
and theta (treated
as measured) of this photon are then used. Concurrently,
189 an additional unmeasured photon along HER/LER will be taken into account
in the fit, which means
190 the momentum
is only constrained
in the plane perpendicular to one of the beams.
192 @param list_name name of the input ParticleList
193 @param fitterEngine which fitter engine to use?
'NewFitterGSL' or 'OPALFitterGSL'
194 @param constraint HardBeam
or RecoilMass
195 @param daughtersUpdate make copy of the daughters
and update them after the vertex fit
196 @param addUnmeasuredPhotonAlongBeam add an unmeasured photon along beam
if 'HER' or 'LER' is set
197 @param variablePrefix prepended to fit variables stored
in extra info. Required
if ParticleKinematicFitter
is run multiple times
198 @param decayStringForDirectionOnlyParticles DecayString specifying the particles
199 to use only direction information
in the fit
200 @param decayStringForAlternateMassParticles DecayString specifying the particles
201 where an alternate mass hypothesis
is used
202 @param alternateMassHypos list of pdg values (
or particle names)
for particles where
203 different mass hypothesis
is used
in the fit
204 @param decayStringForNeutronVsAntiNeutron DecayString specifying the charged particle
205 used to tag whether n
or nbar. When tag particle has negative charge, PDG sign of n/nbar
206 is flipped
from default given
in alternateMassHypos
207 @param path modules are added to this path
211 assert addUnmeasuredPhotonAlongBeam
in [
"",
"LER",
"HER"]
213 orca = register_module(
'ParticleKinematicFitter')
214 orca.set_name(
'ParticleKinematicFitter_' + list_name)
215 orca.param(
'debugFitter',
False)
216 orca.param(
'orcaTracer',
'None')
217 orca.param(
'orcaFitterEngine', fitterEngine)
218 orca.param(
'orcaConstraint', constraint)
219 orca.param(
'listName', list_name)
220 orca.param(
'updateDaughters', daughtersUpdate)
221 orca.param(
'add3CPhoton',
True)
222 if addUnmeasuredPhotonAlongBeam ==
"":
223 orca.param(
'liftPhotonTheta',
True)
225 orca.param(
'addUnmeasuredPhoton',
True)
226 if addUnmeasuredPhotonAlongBeam ==
"HER":
227 orca.param(
'fixUnmeasuredToHER',
True)
229 orca.param(
'fixUnmeasuredToLER',
True)
230 orca.param(
'variablePrefix', variablePrefix)
231 orca.param(
'decayStringForDirectionOnlyParticles', decayStringForDirectionOnlyParticles)
232 orca.param(
'decayStringForAlternateMassParticles', decayStringForAlternateMassParticles)
233 orca.param(
'decayStringForNeutronVsAntiNeutron', decayStringForNeutronVsAntiNeutron)
234 orca.param(
'alternateMassHypos',
pdg.from_names(alternateMassHypos))
235 path.add_module(orca)
238def MassfitKinematic1CRecoil(
241 fitterEngine='NewFitterGSL',
242 constraint='RecoilMass',
243 daughtersUpdate=True,
245 decayStringForDirectionOnlyParticles="",
246 decayStringForAlternateMassParticles="",
247 alternateMassHypos=[],
248 decayStringForNeutronVsAntiNeutron="",
252 Perform recoil mass kinematic fit for particles
in the given ParticleList.
254 @param list_name name of the input ParticleList
255 @param fitterEngine which fitter engine to use?
'NewFitterGSL' or 'OPALFitterGSL'
256 @param constraint HardBeam
or RecoilMass
257 @param recoilMass RecoilMass (GeV)
258 @param daughtersUpdate make copy of the daughters
and update them after the vertex fit
259 @param variablePrefix prepended to fit variables stored
in extra info. Required
if ParticleKinematicFitter
is run multiple times
260 @param decayStringForDirectionOnlyParticles DecayString specifying the particles
261 to use only direction information
in the fit
262 @param decayStringForAlternateMassParticles DecayString specifying the particles
263 where an alternate mass hypothesis
is used
264 @param alternateMassHypos list of pdg values (
or particle names)
for particles where
265 different mass hypothesis
is used
in the fit
266 @param decayStringForNeutronVsAntiNeutron DecayString specifying the charged particle
267 used to tag whether n
or nbar. When tag particle has negative charge, PDG sign of n/nbar
268 is flipped
from default given
in alternateMassHypos
269 @param path modules are added to this path
272 orca = register_module('ParticleKinematicFitter')
273 orca.set_name(
'ParticleKinematicFitter_' + list_name)
274 orca.param(
'debugFitter',
False)
275 orca.param(
'orcaTracer',
'None')
276 orca.param(
'orcaFitterEngine', fitterEngine)
277 orca.param(
'orcaConstraint', constraint)
278 orca.param(
'recoilMass', recoilMass)
279 orca.param(
'listName', list_name)
280 orca.param(
'updateDaughters', daughtersUpdate)
281 orca.param(
'addUnmeasuredPhoton',
False)
282 orca.param(
'variablePrefix', variablePrefix)
283 orca.param(
'decayStringForDirectionOnlyParticles', decayStringForDirectionOnlyParticles)
284 orca.param(
'decayStringForAlternateMassParticles', decayStringForAlternateMassParticles)
285 orca.param(
'decayStringForNeutronVsAntiNeutron', decayStringForNeutronVsAntiNeutron)
286 orca.param(
'alternateMassHypos',
pdg.from_names(alternateMassHypos))
287 path.add_module(orca)
290def MassfitKinematic1C(
293 fitterEngine='NewFitterGSL',
295 daughtersUpdate=True,
297 decayStringForDirectionOnlyParticles="",
298 decayStringForAlternateMassParticles="",
299 alternateMassHypos=[],
300 decayStringForNeutronVsAntiNeutron="",
304 Perform recoil mass kinematic fit for particles
in the given ParticleList.
306 @param list_name name of the input ParticleList
307 @param fitterEngine which fitter engine to use?
'NewFitterGSL' or 'OPALFitterGSL'
308 @param constraint HardBeam
or RecoilMass
or Mass
309 @param invMass Invariant Mass (GeV)
310 @param daughtersUpdate make copy of the daughters
and update them after the vertex fit
311 @param variablePrefix prepended to fit variables stored
in extra info. Required
if ParticleKinematicFitter
is run multiple times
312 @param decayStringForDirectionOnlyParticles DecayString specifying the particles
313 to use only direction information
in the fit
314 @param decayStringForAlternateMassParticles DecayString specifying the particles
315 where an alternate mass hypothesis
is used
316 @param alternateMassHypos list of pdg values (
or particle names)
for particles where
317 different mass hypothesis
is used
in the fit
318 @param decayStringForNeutronVsAntiNeutron DecayString specifying the charged particle
319 used to tag whether n
or nbar. When tag particle has negative charge, PDG sign of n/nbar
320 is flipped
from default given
in alternateMassHypos
321 @param path modules are added to this path
324 orca = register_module('ParticleKinematicFitter')
325 orca.set_name(
'ParticleKinematicFitter_' + list_name)
326 orca.param(
'debugFitter',
False)
327 orca.param(
'orcaTracer',
'None')
328 orca.param(
'orcaFitterEngine', fitterEngine)
329 orca.param(
'orcaConstraint', constraint)
330 orca.param(
'invMass', invMass)
331 orca.param(
'listName', list_name)
332 orca.param(
'updateDaughters', daughtersUpdate)
333 orca.param(
'addUnmeasuredPhoton',
False)
334 orca.param(
'variablePrefix', variablePrefix)
335 orca.param(
'decayStringForDirectionOnlyParticles', decayStringForDirectionOnlyParticles)
336 orca.param(
'decayStringForAlternateMassParticles', decayStringForAlternateMassParticles)
337 orca.param(
'decayStringForNeutronVsAntiNeutron', decayStringForNeutronVsAntiNeutron)
338 orca.param(
'alternateMassHypos',
pdg.from_names(alternateMassHypos))
339 path.add_module(orca)
342if __name__ ==
'__main__':
344 pretty_print_module(__name__,
"kinfit")