Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Nov 20, 2024
1 parent 7d0a43c commit 55b37cc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
14 changes: 6 additions & 8 deletions Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ FreeVector estimateTrackParamsFromSeed(spacepoint_range_t spRange,
///
/// @return bound parameters
template <std::ranges::range spacepoint_range_t>
BoundVector estimateTrackParamsFromSeed(const GeometryContext& gctx,
spacepoint_range_t spRange,
const Surface& surface,
const Vector3& bField) {
Result<BoundVector> estimateTrackParamsFromSeed(const GeometryContext& gctx,
spacepoint_range_t spRange,
const Surface& surface,
const Vector3& bField) {
FreeVector freeParams = estimateTrackParamsFromSeed(spRange, bField);

const auto* sp0 = *spRange.begin();
Expand All @@ -143,17 +143,15 @@ BoundVector estimateTrackParamsFromSeed(const GeometryContext& gctx,
// surface
auto lpResult = surface.globalToLocal(gctx, origin, direction);
if (!lpResult.ok()) {
throw std::runtime_error(
"Failed to transform the space point to local coordinates of the "
"surface.");
return Result<BoundVector>::failure(lpResult.error());
}
Vector2 bottomLocalPos = lpResult.value();
// The estimated loc0 and loc1
params[eBoundLoc0] = bottomLocalPos.x();
params[eBoundLoc1] = bottomLocalPos.y();
params[eBoundTime] = sp0->t().value_or(0);

return params;
return Result<BoundVector>::success(params);
}

/// Configuration for the estimation of the covariance matrix of the track
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,14 @@ ProcessCode TrackParamsEstimationAlgorithm::execute(
}

// Estimate the track parameters from seed
const auto params = Acts::estimateTrackParamsFromSeed(
const auto paramsResult = Acts::estimateTrackParamsFromSeed(
ctx.geoContext, seed.sp(), *surface, field);
if (!paramsResult.ok()) {
ACTS_WARNING("Skip track because param estimation failed "
<< paramsResult.error());
continue;
}
const auto& params = *paramsResult;

Acts::EstimateTrackParamCovarianceConfig config{
.initialSigmas =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,17 @@ ProcessCode PrototracksToParameters::execute(
continue;
}

auto pars = Acts::estimateTrackParamsFromSeed(ctx.geoContext, seed.sp(),
surface, field);

if (not pars) {
auto parsResult = Acts::estimateTrackParamsFromSeed(
ctx.geoContext, seed.sp(), surface, field);
if (!parsResult.ok()) {
ACTS_WARNING("Skip track because of bad params");
}
const auto &pars = *parsResult;

seededTracks.push_back(track);
seeds.emplace_back(std::move(seed));
parameters.push_back(Acts::BoundTrackParameters(
surface.getSharedPtr(), *pars, m_covariance, m_cfg.particleHypothesis));
surface.getSharedPtr(), pars, m_covariance, m_cfg.particleHypothesis));
}

if (skippedTracks > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ BOOST_AUTO_TEST_CASE(trackparameters_estimation_test) {
BOOST_CHECK(!estFreeParams.hasNaN());

// Test the bound track parameters estimator
auto estFullParams = estimateTrackParamsFromSeed(
auto estFullParamsResult = estimateTrackParamsFromSeed(
geoCtx, spacePointPtrs, *bottomSurface, bField);
BOOST_CHECK(estFullParamsResult.ok());
const auto& estFullParams = estFullParamsResult.value();
BOOST_TEST_INFO(
"The estimated full track parameters at the bottom space point: "
"\n"
Expand Down

0 comments on commit 55b37cc

Please sign in to comment.