diff --git a/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp b/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp index 5d6b4dbb97c..c59a55ad533 100644 --- a/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp +++ b/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -126,8 +125,6 @@ FreeVector estimateTrackParamsFromSeed(spacepoint_range_t spRange, /// @param surface is the surface of the bottom space point. The estimated bound /// track parameters will be represented also at this surface /// @param bField is the magnetic field vector -/// @param bFieldMin is the minimum magnetic field required to trigger the -/// estimation of q/pt /// @param logger A logger instance /// /// @return optional bound parameters @@ -135,7 +132,7 @@ template std::optional estimateTrackParamsFromSeed( const GeometryContext& gctx, spacepoint_iterator_t spBegin, spacepoint_iterator_t spEnd, const Surface& surface, const Vector3& bField, - ActsScalar bFieldMin, const Acts::Logger& logger = getDummyLogger()) { + const Acts::Logger& logger = getDummyLogger()) { // Check the number of provided space points std::size_t numSP = std::distance(spBegin, spEnd); if (numSP != 3) { @@ -143,19 +140,6 @@ std::optional estimateTrackParamsFromSeed( return std::nullopt; } - // Convert bField to Tesla - ActsScalar bFieldStrength = bField.norm(); - // Check if magnetic field is too small - if (bFieldStrength < bFieldMin) { - // @todo shall we use straight-line estimation and use default q/pt in such - // case? - ACTS_WARNING( - "The magnetic field at the bottom space point: B = " - << bFieldStrength / UnitConstants::T << " T is smaller than |B|_min = " - << bFieldMin / UnitConstants::T << " T. Estimation is not performed."); - return std::nullopt; - } - // The global positions of the bottom, middle and space points std::array spGlobalPositions = {Vector3::Zero(), Vector3::Zero(), Vector3::Zero()}; @@ -252,6 +236,7 @@ std::optional estimateTrackParamsFromSeed( params[eBoundLoc1] = bottomLocalPos.y(); params[eBoundTime] = spGlobalTimes[0].value_or(0.); + ActsScalar bFieldStrength = bField.norm(); // The estimated q/pt in [GeV/c]^-1 (note that the pt is the projection of // momentum on the transverse plane of the new frame) ActsScalar qOverPt = sign / (bFieldStrength * R); diff --git a/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp index c8a30c7147d..dfb0269a56d 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp @@ -112,10 +112,16 @@ ProcessCode TrackParamsEstimationAlgorithm::execute( } 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 auto optParams = Acts::estimateTrackParamsFromSeed( ctx.geoContext, seed.sp().begin(), seed.sp().end(), *surface, field, - m_cfg.bFieldMin, logger()); + logger()); if (!optParams.has_value()) { ACTS_WARNING("Estimation of track parameters for seed " << iseed << " failed."); diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp index c8d34f71bd2..9ffe49ae460 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp @@ -154,16 +154,21 @@ ProcessCode PrototracksToParameters::execute( .geometryId(); const auto &surface = *m_cfg.geometry->findSurface(geoId); - auto field = m_cfg.magneticField->getField( + auto fieldRes = m_cfg.magneticField->getField( {bottomSP->x(), bottomSP->y(), bottomSP->z()}, bCache); - if (!field.ok()) { - ACTS_ERROR("Field lookup error: " << field.error()); + 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 is too small " << field.norm()); + continue; + } auto pars = Acts::estimateTrackParamsFromSeed( - ctx.geoContext, seed.sp().begin(), seed.sp().end(), surface, *field, - m_cfg.bFieldMin); + ctx.geoContext, seed.sp().begin(), seed.sp().end(), surface, field); if (not pars) { ACTS_WARNING("Skip track because of bad params"); diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp index cfc62ab9da9..4c09134ef20 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp @@ -10,21 +10,15 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/EventData/ParticleHypothesis.hpp" #include "Acts/Seeding/EstimateTrackParamsFromSeed.hpp" #include "Acts/Surfaces/PerigeeSurface.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/EventData/Track.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" -#include "ActsExamples/Utilities/GroupBy.hpp" -#include "ActsExamples/Utilities/Range.hpp" -#include "ActsFatras/EventData/Particle.hpp" -#include #include #include #include diff --git a/Tests/UnitTests/Core/Seeding/EstimateTrackParamsFromSeedTest.cpp b/Tests/UnitTests/Core/Seeding/EstimateTrackParamsFromSeedTest.cpp index e39a6a1a900..9aab6c1c70b 100644 --- a/Tests/UnitTests/Core/Seeding/EstimateTrackParamsFromSeedTest.cpp +++ b/Tests/UnitTests/Core/Seeding/EstimateTrackParamsFromSeedTest.cpp @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(trackparameters_estimation_test) { // Test the bound track parameters estimator auto fullParamsOpt = estimateTrackParamsFromSeed( geoCtx, spacePointPtrs.begin(), spacePointPtrs.end(), - *bottomSurface, bField, 0.1_T, *logger); + *bottomSurface, bField, *logger); BOOST_REQUIRE(fullParamsOpt.has_value()); const auto& estFullParams = fullParamsOpt.value(); BOOST_TEST_INFO(