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

fix(gx2f): use temporary track container #3247

Merged
merged 3 commits into from
Jun 8, 2024
Merged
Changes from all 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
18 changes: 12 additions & 6 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Acts/EventData/TrackHelpers.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/EventData/VectorMultiTrajectory.hpp"
#include "Acts/EventData/VectorTrackContainer.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Material/MaterialSlab.hpp"
Expand Down Expand Up @@ -732,6 +733,15 @@ class Gx2Fitter {
BoundMatrix aMatrix = BoundMatrix::Zero();
BoundVector bVector = BoundVector::Zero();

// We need to create a temporary track container. We create several times a
// new track and delete it after updating the parameters. However, if we
// would work on the externally provided track container, it would be
// difficult to remove the correct track, if it contains more than one.
Acts::VectorTrackContainer trackContainerTempBackend;
Acts::VectorMultiTrajectory trajectoryTempBackend;
TrackContainer trackContainerTemp{trackContainerTempBackend,
trajectoryTempBackend};
AJPfleger marked this conversation as resolved.
Show resolved Hide resolved

// Create an index of the 'tip' of the track stored in multitrajectory. It
// is needed outside the update loop. It will be updated with each iteration
// and used for the final track
Expand Down Expand Up @@ -768,11 +778,11 @@ class Gx2Fitter {
auto propagatorState = m_propagator.makeState(params, propagatorOptions);

auto& r = propagatorState.template get<Gx2FitterResult<traj_t>>();
r.fittedStates = &trackContainer.trackStateContainer();
r.fittedStates = &trajectoryTempBackend;

// Clear the track container. It could be more performant to update the
// existing states, but this needs some more thinking.
trackContainer.clear();
trackContainerTemp.clear();

auto propagationResult = m_propagator.template propagate(propagatorState);

Expand Down Expand Up @@ -939,10 +949,6 @@ class Gx2Fitter {
auto& r = propagatorState.template get<Gx2FitterResult<traj_t>>();
r.fittedStates = &trackContainer.trackStateContainer();

// Clear the track container. It could be more performant to update the
// existing states, but this needs some more thinking.
trackContainer.clear();

m_propagator.template propagate(propagatorState);
}

Expand Down
Loading