11 from basf2
import B2ERROR
12 import modularAnalysis
as ma
13 from stdCharged
import stdPi, stdPr
17 def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None):
19 Load a combined list of the Kshorts list from V0 objects merged with
20 a list of particles combined using the analysis ParticleCombiner module.
22 The ParticleList is named ``K_S0:merged``. A vertex fit is performed and only
23 candidates with an invariant mass in the range :math:`0.450 < M < 0.550~GeV`,
24 and for which the vertex fit did not fail, are kept.
26 The vertex fitter can be selected among ``TreeFit``, ``KFit``, and ``Rave``.
29 prioritiseV0 (bool): should the V0 mdst objects be prioritised when merging?
30 fitter (str): vertex fitter name, valid options are ``TreeFit``, ``KFit``, and ``Rave``.
31 path (basf2.Path): the path to load the modules
34 ma.fillParticleList(
'K_S0:V0 -> pi+ pi-',
'',
True, path=path)
35 ma.cutAndCopyList(
'K_S0:V0_MassWindow',
'K_S0:V0',
'0.3 < M < 0.7', path=path)
37 if fitter ==
'TreeFit':
39 elif fitter ==
'KFit':
40 vertex.kFit(
'K_S0:V0_MassWindow', conf_level=0.0, path=path)
41 elif fitter ==
'Rave':
42 vertex.raveFit(
'K_S0:V0_MassWindow', conf_level=0.0, path=path, silence_warning=
True)
44 B2ERROR(
"Valid fitter options for Kshorts are 'TreeFit', 'KFit', and 'Rave'. However, the latter is not recommended.")
45 ma.applyCuts(
'K_S0:V0_MassWindow',
'0.450 < M < 0.550', path=path)
47 stdPi(
'all', path=path)
48 ma.reconstructDecay(
'K_S0:RD -> pi+:all pi-:all',
'0.3 < M < 0.7', 1,
True, path=path)
50 if fitter ==
'TreeFit':
52 elif fitter ==
'KFit':
54 elif fitter ==
'Rave':
55 vertex.raveFit(
'K_S0:RD', conf_level=0.0, path=path, silence_warning=
True)
56 ma.applyCuts(
'K_S0:RD',
'0.450 < M < 0.550', path=path)
58 ma.mergeListsWithBestDuplicate(
'K_S0:merged', [
'K_S0:V0_MassWindow',
'K_S0:RD'],
59 variable=
'particleSource', preferLowest=prioritiseV0, path=path)
62 def goodBelleKshort(path):
64 Load the Belle goodKshort list. Creates a ParticleList named
65 ``K_S0:legacyGoodKS``. A vertex fit is performed and only candidates that
66 satisfy the :b2:var:`goodBelleKshort` criteria, with an invariant mass in the range
67 :math:`0.468 < M < 0.528~GeV`, and for which the vertex fit did not fail, are kept
70 path (basf2.Path): the path to load the modules
72 ma.fillParticleList(
'K_S0:legacyGoodKS -> pi+ pi-',
'0.3 < M < 0.7',
True, path=path)
73 vertex.kFit(
'K_S0:legacyGoodKS', conf_level=0.0, path=path)
74 ma.applyCuts(
'K_S0:legacyGoodKS',
'0.468 < M < 0.528 and goodBelleKshort==1', path=path)
77 def scaleErrorKshorts(prioritiseV0=True, fitter='TreeFit',
78 scaleFactors_V0=[1.125927, 1.058803, 1.205928, 1.066734, 1.047513],
79 scaleFactorsNoPXD_V0=[1.125927, 1.058803, 1.205928, 1.066734, 1.047513],
80 d0Resolution_V0=[0.001174, 0.000779],
81 z0Resolution_V0=[0.001350, 0.000583],
84 scaleFactors_RD=[1.149631, 1.085547, 1.151704, 1.096434, 1.086659],
85 scaleFactorsNoPXD_RD=[1.149631, 1.085547, 1.151704, 1.096434, 1.086659],
86 d0Resolution_RD=[0.00115328, 0.00134704],
87 z0Resolution_RD=[0.00124327, 0.0013272],
92 Reconstruct K_S0 applying helix error correction to K_S0 daughters given by ``modularAnalysis.scaleError``.
93 The ParticleList is named ``K_S0:scaled``
95 Considering the difference of multiple scattering through the beam pipe,
96 different parameter sets are used for K_S0 decaying outside/inside the beam pipe (``K_S0:V0/RD``).
98 Only for TDCPV analysis.
100 @param prioritiseV0 If True K_S0 from V0 object is prioritised over RD when merged.
101 @param fitter Vertex fitter option. Choose from ``TreeFit``, ``KFit`` and ``Rave``.
102 @param scaleFactors_V0 List of five constants to be multiplied to each of helix errors (for tracks with a PXD hit)
103 @param scaleFactorsNoPXD_V0 List of five constants to be multiplied to each of helix errors (for tracks without a PXD hit)
104 @param d0Resolution_V0 List of two parameters, (a [cm], b [cm/(GeV/c)]),
105 defining d0 best resolution as sqrt{ a**2 + (b / (p*beta*sinTheta**1.5))**2 }
106 @param z0Resolution_V0 List of two parameters, (a [cm], b [cm/(GeV/c)]),
107 defining z0 best resolution as sqrt{ a**2 + (b / (p*beta*sinTheta**2.5))**2 }
108 @param d0MomThr_V0 d0 best resolution is kept constant below this momentum
109 @param z0MomThr_V0 z0 best resolution is kept constant below this momentum
110 @param scaleFactors_RD List of five constants to be multiplied to each of helix errors (for tracks with a PXD hit)
111 @param scaleFactorsNoPXD_RD List of five constants to be multiplied to each of helix errors (for tracks without a PXD hit)
112 @param d0Resolution_RD List of two parameters, (a [cm], b [cm/(GeV/c)]),
113 defining d0 best resolution as sqrt{ a**2 + (b / (p*beta*sinTheta**1.5))**2 }
114 @param z0Resolution_RD List of two parameters, (a [cm], b [cm/(GeV/c)]),
115 defining z0 best resolution as sqrt{ a**2 + (b / (p*beta*sinTheta**2.5))**2 }
116 @param d0MomThr_RD d0 best resolution is kept constant below this momentum
117 @param z0MomThr_RD z0 best resolution is kept constant below this momentum
120 from basf2
import register_module
122 ma.fillParticleList(
'K_S0:V0 -> pi+ pi-',
'',
True, path=path)
123 scaler_V0 = register_module(
"HelixErrorScaler")
124 scaler_V0.set_name(
'ScaleError_' +
'K_S0:V0')
125 scaler_V0.param(
'inputListName',
'K_S0:V0')
126 scaler_V0.param(
'outputListName',
'K_S0:V0_scaled')
127 scaler_V0.param(
'scaleFactors_PXD', scaleFactors_V0)
128 scaler_V0.param(
'scaleFactors_noPXD', scaleFactorsNoPXD_V0)
129 scaler_V0.param(
'd0ResolutionParameters', d0Resolution_V0)
130 scaler_V0.param(
'z0ResolutionParameters', z0Resolution_V0)
131 scaler_V0.param(
'd0MomentumThreshold', d0MomThr_V0)
132 scaler_V0.param(
'z0MomentumThreshold', z0MomThr_V0)
133 path.add_module(scaler_V0)
135 ma.applyCuts(
'K_S0:V0_scaled',
'0.3 < M < 0.7', path=path)
137 if fitter ==
'TreeFit':
139 elif fitter ==
'KFit':
140 vertex.kFit(
'K_S0:V0_scaled', conf_level=0.0, path=path)
141 elif fitter ==
'Rave':
142 vertex.raveFit(
'K_S0:V0_scaled', conf_level=0.0, path=path, silence_warning=
True)
144 B2ERROR(
"Valid fitter options for Kshorts are 'TreeFit', 'KFit', and 'Rave'. However, the latter is not recommended.")
145 ma.applyCuts(
'K_S0:V0_scaled',
'0.450 < M < 0.550', path=path)
148 stdPi(
'all', path=path)
149 ma.scaleError(
'pi+:scaled',
'pi+:all',
150 scaleFactors=scaleFactors_RD,
151 scaleFactorsNoPXD=scaleFactorsNoPXD_RD,
152 d0Resolution=d0Resolution_RD,
153 z0Resolution=z0Resolution_RD,
154 d0MomThr=d0MomThr_RD,
155 z0MomThr=z0MomThr_RD,
158 ma.reconstructDecay(
'K_S0:RD_scaled -> pi+:scaled pi-:scaled',
'0.3 < M < 0.7', 1,
True, path=path)
160 if fitter ==
'TreeFit':
162 elif fitter ==
'KFit':
163 vertex.kFit(
'K_S0:RD_scaled', conf_level=0.0, path=path)
164 elif fitter ==
'Rave':
165 vertex.raveFit(
'K_S0:RD_scaled', conf_level=0.0, path=path, silence_warning=
True)
166 ma.applyCuts(
'K_S0:RD_scaled',
'0.450 < M < 0.550', path=path)
168 ma.mergeListsWithBestDuplicate(
'K_S0:scaled', [
'K_S0:V0_scaled',
'K_S0:RD_scaled'],
169 variable=
'particleSource', preferLowest=prioritiseV0, path=path)
172 def stdLambdas(prioritiseV0=True, fitter='TreeFit', path=None):
174 Load a combined list of the Lambda list from V0 objects merged with
175 a list of particles combined using the analysis ParticleCombiner module.
177 The ParticleList is named ``Lambda0:merged``. A vertex fit is performed and only
178 candidates with an invariant mass in the range :math:`1.10 < M < 1.13~GeV`,
179 and for which the vertex fit did not fail, are kept.
181 The vertex fitter can be selected among ``TreeFit``, ``KFit``, and ``Rave``.
184 prioritiseV0 (bool): should the V0 mdst objects be prioritised when merging?
185 fitter (str): vertex fitter name, valid options are ``TreeFit``, ``KFit``, and ``Rave``.
186 path (basf2.Path): the path to load the modules
189 ma.fillParticleList(
'Lambda0:V0 -> p+ pi-',
'',
True, path=path)
190 ma.cutAndCopyList(
'Lambda0:V0_MassWindow',
'Lambda0:V0',
'0.9 < M < 1.3', path=path)
192 if fitter ==
'TreeFit':
193 vertex.treeFit(
'Lambda0:V0_MassWindow', conf_level=0.0, path=path)
194 elif fitter ==
'KFit':
195 vertex.kFit(
'Lambda0:V0_MassWindow', conf_level=0.0, path=path)
196 elif fitter ==
'Rave':
197 vertex.raveFit(
'Lambda0:V0_MassWindow', conf_level=0.0, path=path, silence_warning=
True)
199 B2ERROR(
"Valid fitter options for Lambdas are 'TreeFit', 'KFit', and 'Rave'. However, the latter is not recommended.")
200 ma.applyCuts(
'Lambda0:V0_MassWindow',
'1.10 < M < 1.13', path=path)
202 ma.markDuplicate(
'Lambda0:V0_MassWindow',
False, path=path)
203 ma.applyCuts(
'Lambda0:V0_MassWindow',
'extraInfo(highQualityVertex)', path=path)
205 stdPi(
'all', path=path)
206 stdPr(
'all', path=path)
207 ma.reconstructDecay(
'Lambda0:RD -> p+:all pi-:all',
'0.9 < M < 1.3', 1,
True, path=path)
209 if fitter ==
'TreeFit':
211 elif fitter ==
'KFit':
212 vertex.kFit(
'Lambda0:RD', conf_level=0.0, path=path)
213 elif fitter ==
'Rave':
214 vertex.raveFit(
'Lambda0:RD', conf_level=0.0, path=path, silence_warning=
True)
215 ma.applyCuts(
'Lambda0:RD',
'1.10 < M < 1.13', path=path)
217 ma.markDuplicate(
'Lambda0:RD',
False, path=path)
218 ma.applyCuts(
'Lambda0:RD',
'extraInfo(highQualityVertex)', path=path)
219 ma.mergeListsWithBestDuplicate(
'Lambda0:merged', [
'Lambda0:V0_MassWindow',
'Lambda0:RD'],
220 variable=
'particleSource', preferLowest=prioritiseV0, path=path)
def raveFit(list_name, conf_level, fit_type='vertex', decay_string='', constraint='', daughtersUpdate=False, path=None, silence_warning=False)
def kFit(list_name, conf_level, fit_type='vertex', constraint='', daughtersUpdate=False, decay_string='', massConstraint=[], recoilMass=0, smearing=0, path=None)
def treeFit(list_name, conf_level=0.001, massConstraint=[], ipConstraint=False, updateAllDaughters=False, customOriginConstraint=False, customOriginVertex=[0.001, 0, 0.0116], customOriginCovariance=[0.0048, 0, 0, 0, 0.003567, 0, 0, 0, 0.0400], originDimension=3, treatAsInvisible='', path=None)