174 {
176
177
178 const auto& sp_collection =
seed.sp();
179 const std::size_t nSp = sp_collection.size();
180 if (nSp < 3) return {std::nullopt, kNoSeedRefit};
181
182
183 const auto sp_collection_extract = std::views::transform([&sp_collection, useTopSp](std::size_t i) {
184 return sp_collection.at(useTopSp ? sp_collection.size() - i - 1 : i);
185 });
186
187
189
191 const auto spacePointIndicesFun2 = [](std::size_t nSp) -> std::array<std::size_t, 3> {
192 return {0, nSp / 2ul, nSp - 1};
193 };
194 const Acts::FreeVector freeParams2 = estimateTrackParamsFromSeed(spacePointIndicesFun2(nSp) | sp_collection_extract, bField,
m_stripCalibrationIterations);
195 ATH_MSG_DEBUG(
"update seed p = " << 1.0 / freeParams[Acts::eFreeQOverP] <<
" to " << 1.0 / freeParams2[Acts::eFreeQOverP]);
196 freeParams[Acts::eFreeQOverP] = freeParams2[Acts::eFreeQOverP];
197 }
198
199 if (useTopSp) {
200
201 freeParams = Acts::reflectFreeParameters(freeParams);
202 }
203
204
205 Acts::BoundTrackParameters curvilinearParams = Acts::BoundTrackParameters::createCurvilinear(
206 freeParams.segment<4>(Acts::eFreePos0),
207 freeParams.segment<3>(Acts::eFreeDir0),
208 freeParams[Acts::eFreeQOverP],
209 std::nullopt,
210 Acts::ParticleHypothesis::pion());
211
212
213 Acts::PropagatorPlainOptions propOptions(geoContext, magFieldContext);
214 propOptions.direction = Acts::Direction::fromScalarZeroAsPositive(
215 surface.intersect(
216 geoContext,
217 freeParams.segment<3>(Acts::eFreePos0),
218 freeParams.segment<3>(Acts::eFreeDir0)
219 ).closest().pathLength());
220
221 std::optional<Acts::BoundTrackParameters> boundParams;
222 auto boundParamsResult =
223 m_extrapolator->propagateToSurface(curvilinearParams, surface, propOptions);
224
225 if (!boundParamsResult.ok()) {
226 ATH_MSG_DEBUG(
"Extrapolation from " <<
seed.sp().size() <<
"-SP seed (" << (useTopSp ?
"top" :
"bottom") <<
" start) failed - "
229
230 boundParams = curvilinearParams;
231 } else {
232 return {std::nullopt, kNoSeedRefit};
233 }
234 } else {
235 boundParams = *boundParamsResult;
236 }
237
238
239 Acts::EstimateTrackParamCovarianceConfig covarianceEstimationConfig = {
243 .noTimeVarInflation = 1.0,
244 };
245 boundParams->covariance() = Acts::estimateTrackParamCovariance(
246 covarianceEstimationConfig,
247 boundParams->parameters(),
248 false);
249
251 ATH_MSG_DEBUG(
"estimateTrackParams from " <<
seed.sp().size() <<
"-SP seed (" << (useTopSp ?
"top" :
"bottom") <<
" start) succeeded");
252 return {boundParams, kNoSeedRefit};
253 }
254
255 auto refitResult =
doRefit(seed, *boundParams, geoContext, magFieldContext, calContext, reverseSearch);
256 ATH_MSG_DEBUG(
"Refit " <<
seed.sp().size() <<
"-SP seed (" << (reverseSearch ?
"top" :
"bottom") <<
" start) " << (refitResult ?
"succeeded" :
"failed"));
257 if (refitResult) {
259
260 const auto refitErrInflation = Eigen::Map<const Acts::BoundVector>(
m_refitErrInflation.value().data());
261 refitResult->covariance()->array().colwise() *= refitErrInflation.array();
262 refitResult->covariance()->array().rowwise() *= refitErrInflation.transpose().array();
263 }
264 return {refitResult, kSeedRefitSuccess};
265 } else {
266 return {boundParams, kSeedRefitFailed};
267 }
268
269 }
#define ATH_MSG_DEBUG(x,...)