159 {
160
161 const auto& sp_collection =
seed.sp();
162 const std::size_t nSp = sp_collection.size();
163 if (nSp < 3) return std::nullopt;
164
165
166 const auto sp_collection_extract = std::views::transform([&sp_collection, useTopSp](std::size_t i) {
167 return sp_collection.at(useTopSp ? sp_collection.size() - i - 1 : i);
168 });
169
170
172
174 const auto spacePointIndicesFun2 = [](std::size_t nSp) -> std::array<std::size_t, 3> {
175 return {0, nSp / 2ul, nSp - 1};
176 };
177 const Acts::FreeVector freeParams2 = estimateTrackParamsFromSeed(spacePointIndicesFun2(nSp) | sp_collection_extract, bField,
m_stripCalibrationIterations);
178 ATH_MSG_DEBUG(
"update seed p = " << 1.0 / freeParams[Acts::eFreeQOverP] <<
" to " << 1.0 / freeParams2[Acts::eFreeQOverP]);
179 freeParams[Acts::eFreeQOverP] = freeParams2[Acts::eFreeQOverP];
180 }
181
182 if (useTopSp) {
183
184 freeParams = Acts::reflectFreeParameters(freeParams);
185 }
186
187
188 Acts::BoundTrackParameters curvilinearParams = Acts::BoundTrackParameters::createCurvilinear(
189 freeParams.segment<4>(Acts::eFreePos0),
190 freeParams.segment<3>(Acts::eFreeDir0),
191 freeParams[Acts::eFreeQOverP],
192 std::nullopt,
193 Acts::ParticleHypothesis::pion());
194
195
196 Acts::PropagatorPlainOptions propOptions(geoContext, magFieldContext);
197 propOptions.direction = Acts::Direction::fromScalarZeroAsPositive(
198 surface.intersect(
199 geoContext,
200 freeParams.segment<3>(Acts::eFreePos0),
201 freeParams.segment<3>(Acts::eFreeDir0)
202 ).closest().pathLength());
203
204 std::optional<Acts::BoundTrackParameters> boundParams;
205 auto boundParamsResult =
206 m_extrapolator->propagateToSurface(curvilinearParams, surface, propOptions);
207
208 if (!boundParamsResult.ok()) {
211
212 ATH_MSG_DEBUG(
"Using curvilinear parameters due to propagation failure");
213 boundParams = curvilinearParams;
214 } else {
215 return std::nullopt;
216 }
217 } else {
218 boundParams = *boundParamsResult;
219 }
220
221
222
223 Acts::EstimateTrackParamCovarianceConfig covarianceEstimationConfig = {
227 .noTimeVarInflation = 1.0,
228 };
229 boundParams->covariance() = Acts::estimateTrackParamCovariance(
230 covarianceEstimationConfig,
231 boundParams->parameters(),
232 false);
233
234 return boundParams;
235 }