Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Nov 22, 2024
1 parent e5b7a35 commit f8c2490
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 28 deletions.
8 changes: 4 additions & 4 deletions Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/Definitions/Units.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Zip.hpp"

Expand Down Expand Up @@ -65,7 +65,7 @@ Result<BoundVector> estimateTrackParamsFromSeedAtSurface(
const Surface& surface, const Vector3& sp0, const Vector3& sp1,
const Vector3& sp2,
const std::shared_ptr<const MagneticFieldProvider>& bField,
const std::shared_ptr<const BasePropagator>& propagator,
const std::shared_ptr<const BasePropagator>& propagator = nullptr,
const Acts::Logger& logger = getDummyLogger());

/// Estimate the full track parameters from three space points
Expand Down Expand Up @@ -141,11 +141,11 @@ FreeVector estimateTrackParamsFromSeed(spacepoint_range_t spRange,
///
/// @return bound parameters
template <std::ranges::range spacepoint_range_t>
Result<BoundVector> estimateTrackParamsFromSeed(
Result<BoundVector> estimateTrackParamsFromSeedAtSurface(
const GeometryContext& gctx, const MagneticFieldContext& mctx,
const Surface& surface, spacepoint_range_t spRange,
const std::shared_ptr<const MagneticFieldProvider>& bField,
const std::shared_ptr<const BasePropagator>& propagator,
const std::shared_ptr<const BasePropagator>& propagator = nullptr,
const Acts::Logger& logger = getDummyLogger()) {
// Check the number of provided space points
if (spRange.size() != 3) {
Expand Down
12 changes: 8 additions & 4 deletions Core/src/Seeding/EstimateTrackParamsFromSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class EstimateTrackParamsFromSeedErrorCategory : public std::error_category {

} // namespace

std::error_code Acts::make_error_code(Acts::PropagatorError e) {
std::error_code Acts::make_error_code(
Acts::EstimateTrackParamsFromSeedError e) {
static EstimateTrackParamsFromSeedErrorCategory c;
return {static_cast<int>(e), c};
}
Expand Down Expand Up @@ -195,8 +196,9 @@ Acts::Result<Acts::BoundVector> Acts::estimateTrackParamsFromSeedAtSurface(
if (!lpResult.ok()) {
// no cov transport matrix is needed here
// particle hypothesis does not matter here
CurvilinearTrackParameters estimatedParams(
origin, direction, qOverPt, std::nullopt, ParticleHypothesis::pion());
CurvilinearTrackParameters estimatedParams(freeParams.segment<4>(eFreePos0),
direction, qOverPt, std::nullopt,
ParticleHypothesis::pion());

auto surfaceIntersection =
surface.intersect(gctx, origin, direction).closest();
Expand All @@ -221,7 +223,9 @@ Acts::Result<Acts::BoundVector> Acts::estimateTrackParamsFromSeedAtSurface(
? propagator->propagateToSurface(estimatedParams, surface,
propagatorOptions)
: Propagator(EigenStepper<>(bField), VoidNavigator(),
logger().cloneWithSuffix("Propagator"));
logger().cloneWithSuffix("Propagator"))
.propagateToSurface(estimatedParams, surface,
propagatorOptions);
if (!result.ok()) {
ACTS_INFO("The propagation failed.");
return Result<BoundVector>::failure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "ActsExamples/TrackFinding/TrackParamsEstimationAlgorithm.hpp"

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/Seed.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
Expand Down Expand Up @@ -101,24 +100,10 @@ ProcessCode TrackParamsEstimationAlgorithm::execute(
continue;
}

// Get the magnetic field at the bottom space point
auto fieldRes = m_cfg.magneticField->getField(
{bottomSP->x(), bottomSP->y(), bottomSP->z()}, bCache);
if (!fieldRes.ok()) {
ACTS_ERROR("Field lookup error: " << fieldRes.error());
return ProcessCode::ABORT;
}
Acts::Vector3 field = *fieldRes;

if (field.norm() < m_cfg.bFieldMin) {
ACTS_WARNING("Magnetic field at seed " << iseed << " is too small "
<< field.norm());
continue;
}

// Estimate the track parameters from seed
const auto paramsResult = Acts::estimateTrackParamsFromSeed(
ctx.geoContext, seed.sp(), *surface, field);
const auto paramsResult = Acts::estimateTrackParamsFromSeedAtSurface(
ctx.geoContext, ctx.magFieldContext, *surface, seed.sp(),
m_cfg.magneticField);
if (!paramsResult.ok()) {
ACTS_WARNING("Skip track because param estimation failed "
<< paramsResult.error());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ BOOST_AUTO_TEST_CASE(trackparameters_estimation_test) {
BOOST_CHECK(!estFreeParams.hasNaN());

// Test the bound track parameters estimator
auto estFullParamsResult = estimateTrackParamsFromSeed(
geoCtx, spacePointPtrs, *bottomSurface, bField);
auto estFullParamsResult = estimateTrackParamsFromSeedAtSurface(
geoCtx, magCtx, *bottomSurface, spacePointPtrs, field);
BOOST_CHECK(estFullParamsResult.ok());
const auto& estFullParams = estFullParamsResult.value();
BOOST_TEST_INFO(
Expand Down

0 comments on commit f8c2490

Please sign in to comment.