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