Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Remove CovarianceTransport #2781

Merged
merged 7 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Core/src/Propagator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
target_sources(
ActsCore
PRIVATE
CovarianceTransport.cpp
EigenStepperError.cpp
MultiStepperError.cpp
PropagatorError.cpp
Expand Down
120 changes: 0 additions & 120 deletions Core/src/Propagator/CovarianceTransport.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "Acts/EventData/detail/TransformationBoundToFree.hpp"
#include "Acts/EventData/detail/TransformationFreeToBound.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Propagator/CovarianceTransport.hpp"
#include "Acts/Surfaces/PerigeeSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Logger.hpp"
Expand Down
45 changes: 18 additions & 27 deletions Plugins/EDM4hep/src/EDM4hepUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "Acts/Plugins/EDM4hep/EDM4hepUtil.hpp"

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/Definitions/Units.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/MultiTrajectoryHelpers.hpp"
Expand Down Expand Up @@ -115,14 +117,8 @@ Parameters convertTrackParametersToEdm4hep(const Acts::GeometryContext& gctx,

std::shared_ptr<const Acts::Surface> refSurface =
params.referenceSurface().getSharedPtr();

Acts::BoundVector targetPars = params.parameters();
std::optional<Acts::FreeVector> freePars;

auto makeFreePars = [&]() {
return Acts::detail::transformBoundToFreeParameters(
params.referenceSurface(), gctx, params.parameters());
};
std::optional<Acts::BoundSquareMatrix> targetCov = params.covariance();

// If the reference surface is a perigee surface, we use that. Otherwise
// we create a new perigee surface at the global position of the track
Expand All @@ -133,36 +129,31 @@ Parameters convertTrackParametersToEdm4hep(const Acts::GeometryContext& gctx,
// We need to convert to the target parameters
// Keep the free parameters around we might need them for the covariance
// conversion
freePars = makeFreePars();
targetPars = Acts::detail::transformFreeToBoundParameters(freePars.value(),
Acts::FreeVector freePars = Acts::detail::transformBoundToFreeParameters(
params.referenceSurface(), gctx, params.parameters());
targetPars = Acts::detail::transformFreeToBoundParameters(freePars,
*refSurface, gctx)
.value();

if (targetCov) {
// We need to convert the covariance as well
Acts::BoundToFreeMatrix boundToFree =
params.referenceSurface().boundToFreeJacobian(gctx, targetPars);
Acts::FreeToBoundMatrix freeToBound =
refSurface->freeToBoundJacobian(gctx, freePars);
Acts::BoundSquareMatrix boundToBound = freeToBound * boundToFree;
targetCov = boundToBound * targetCov.value() * boundToBound.transpose();
}
}

Parameters result;
result.surface = refSurface;

// Only run covariance conversion if we have a covariance input
if (params.covariance()) {
auto boundToFree =
refSurface->boundToFreeJacobian(gctx, params.parameters());
Acts::FreeMatrix freeCov =
boundToFree * params.covariance().value() * boundToFree.transpose();

// ensure we have free pars
if (!freePars.has_value()) {
freePars = makeFreePars();
}

Acts::CovarianceCache covCache{freePars.value(), freeCov};
auto [varNewCov, varNewJac] = Acts::transportCovarianceToBound(
gctx, *refSurface, freePars.value(), covCache);
auto targetCov = std::get<Acts::BoundSquareMatrix>(varNewCov);

if (targetCov) {
Acts::ActsSquareMatrix<6> J = jacobianToEdm4hep(
targetPars[eBoundTheta], targetPars[eBoundQOverP], Bz);
Acts::ActsSquareMatrix<6> cIn = targetCov.template topLeftCorner<6, 6>();
result.covariance = J * cIn * J.transpose();
result.covariance = J * targetCov.value() * J.transpose();
andiwand marked this conversation as resolved.
Show resolved Hide resolved
}

result.values[0] = targetPars[Acts::eBoundLoc0];
Expand Down
1 change: 0 additions & 1 deletion Tests/Benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ endmacro()
add_benchmark(AtlasStepper AtlasStepperBenchmark.cpp)
add_benchmark(BoundaryCheck BoundaryCheckBenchmark.cpp)
add_benchmark(BinUtility BinUtilityBenchmark.cpp)
add_benchmark(CovarianceTransport CovarianceTransportBenchmark.cpp)
add_benchmark(EigenStepper EigenStepperBenchmark.cpp)
add_benchmark(SolenoidField SolenoidFieldBenchmark.cpp)
add_benchmark(SurfaceIntersection SurfaceIntersectionBenchmark.cpp)
Expand Down
92 changes: 0 additions & 92 deletions Tests/Benchmarks/CovarianceTransportBenchmark.cpp

This file was deleted.

1 change: 0 additions & 1 deletion Tests/UnitTests/Core/Propagator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ add_unittest(AtlasStepper AtlasStepperTests.cpp)
add_unittest(Auctioneer AuctioneerTests.cpp)
add_unittest(ConstrainedStep ConstrainedStepTests.cpp)
add_unittest(CovarianceEngine CovarianceEngineTests.cpp)
add_unittest(CovarianceTransport CovarianceTransportTests.cpp)
add_unittest(DirectNavigator DirectNavigatorTests.cpp)
add_unittest(Extrapolator ExtrapolatorTests.cpp)
add_unittest(Jacobian JacobianTests.cpp)
Expand Down
Loading
Loading