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

Multiple context references are in flight for track fitters and finder #3383

Open
andiwand opened this issue Jul 15, 2024 · 3 comments
Open
Labels

Comments

@andiwand
Copy link
Contributor

andiwand commented Jul 15, 2024

After #3181 we have multiple context references in flight for track fitting and finding as they are bound in the algorithm options and propagation options.

KalmanFitterOptions(const GeometryContext& gctx,
const MagneticFieldContext& mctx,
std::reference_wrapper<const CalibrationContext> cctx,
KalmanFitterExtensions<traj_t> extensions_,
const PropagatorPlainOptions& pOptions,

(context if part of KalmanFitterOptions and PropagatorPlainOptions)

This is not necessarily bad as it consumed little space but might be a source of errors as users could provide two different context objects for a single track fit.

A proposed solution is to decouple the options from the context and always provide context references explicitly as a parameters and never bind to them inside options. This also has the benefit of not making the options non-copyable (in case of a reference) or non-movable (in case of a reference wrapper) or to deal with potentially uninitialized pointers to context objects. A series of PRs are open to showcase these proposed changes:

One downside of this solution is that we potentially end up with a bunch of function parameters. This could be mitigated by binding multiple context objects into a tuple-like struct.

Apart from that it becomes very clear which parts of the code require a context and how this is passed down.

@paulgessinger
Copy link
Member

We could introduce a non-null pointer wrapper that is both movable and copyable.

Copy link

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

@github-actions github-actions bot added the Stale label Aug 14, 2024
@AJPfleger AJPfleger removed the Stale label Aug 27, 2024
Copy link

This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.

@github-actions github-actions bot added the Stale label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants