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

feat: Add Propagator::propagateToSurface with FreeVector as starting parameters #3909

Conversation

andiwand
Copy link
Contributor

@andiwand andiwand commented Nov 26, 2024

Similar to the existing propagateToSurface method for bound parameters, this adds another one for FreeVector inputs.

Summary by CodeRabbit

  • New Features

    • Introduced a new method for propagation from a FreeVector to a target surface, expanding the range of input types.
    • Enhanced the propagator interface to accommodate additional parameter types while maintaining existing functionality.
  • Documentation

    • Updated comments to clarify the purpose and limitations of the new propagation method.

@andiwand andiwand added this to the next milestone Nov 26, 2024
Copy link

coderabbitai bot commented Nov 26, 2024

Walkthrough

A new method, propagateToSurface, added to BasePropagator and BasePropagatorHelper classes. This method allows propagation from a FreeVector to a target surface, expanding the functionality of the propagator interface. The BasePropagatorHelper class is updated to implement this new method, which converts FreeVector into CurvilinearTrackParameters. Documentation clarifies that covariance transport is not performed and the particle hypothesis is not meaningful in results.

Changes

File Path Change Summary
Core/include/Acts/Propagator/Propagator.hpp - Added method: virtual Result<BoundTrackParameters> propagateToSurface(const FreeVector& start, const Surface& target, const Options& options) const = 0; in BasePropagator.
- Updated method signature: Result<BoundTrackParameters> propagateToSurface(const BoundTrackParameters& start, const Surface& target, const Options& options) const override; in BasePropagatorHelper.
Core/include/Acts/Propagator/Propagator.ipp - Added include directives for Acts/Definitions/TrackParametrization.hpp and Acts/Surfaces/CurvilinearSurface.hpp.
- Defined new method: Acts::Result<Acts::BoundTrackParameters> Acts::detail::BasePropagatorHelper<derived_t>::propagateToSurface(const FreeVector& start, const Surface& target, const Options& options) const.

Poem

In the realm of tracks, a new path we find,
From FreeVector's grace, to surfaces aligned.
Propagation enhanced, with methods anew,
A dance of parameters, in a journey so true.
Yoda smiles wide, as changes unfold,
In the heart of the code, new stories are told. 🌌✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@andiwand
Copy link
Contributor Author

cc @benjaminhuth

@github-actions github-actions bot added the Component - Core Affects the Core module label Nov 26, 2024
Copy link

📊: Physics performance monitoring for e6446e4

Full contents

physmon summary

@andiwand andiwand changed the title feat: Add Propagator::propagateToSurface for FreeVector as start feat: Add Propagator::propagateToSurface with FreeVector as starting parameters Nov 27, 2024
@andiwand andiwand marked this pull request as ready for review November 28, 2024 12:57
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
Core/include/Acts/Propagator/Propagator.ipp (1)

389-402: Documentation improvements needed, they are!

Missing documentation about the expected structure of the FreeVector input, I see. Add Doxygen comments explaining the vector layout and required dimensions, you must.

Add this documentation above the method:

+/**
+ * @brief Propagate using free parameters to a target surface
+ * 
+ * @param start Free parameters vector with structure:
+ *   - [0-3]: 4D position (x,y,z,t)
+ *   - [4-6]: 3D direction
+ *   - [7]: q/p (charge divided by momentum)
+ * @param target The target surface to propagate to
+ * @param options The propagation options
+ * 
+ * @note The particle hypothesis (pion) used in the conversion is not meaningful
+ *       as propagation occurs without interactions
+ */
Core/include/Acts/Propagator/Propagator.hpp (1)

Line range hint 52-78: Strong with the Force, this design pattern is

Template method pattern, well utilized it is. Abstraction for both bound and free vector propagation, elegantly unified it has become. Extensible architecture, maintained it is.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a0aed8c and e6446e4.

📒 Files selected for processing (2)
  • Core/include/Acts/Propagator/Propagator.hpp (2 hunks)
  • Core/include/Acts/Propagator/Propagator.ipp (2 hunks)
🔇 Additional comments (5)
Core/include/Acts/Propagator/Propagator.ipp (3)

9-9: Approve these includes, I do!

Necessary for the new functionality, these headers are. Well-placed and following conventions, they remain.

Also applies to: 16-16


394-396: Wise choice in documentation, this is!

Clear explanation about pion hypothesis being arbitrary, you provide. Good practice in code documentation, this represents.


401-401: Elegant reuse of existing method, this is!

Wise decision to delegate to existing implementation, you made. Clean and maintainable, the code remains.

Core/include/Acts/Propagator/Propagator.hpp (2)

52-61: Wise addition to the interface, this is!

Clear documentation about limitations, you have provided. No covariance transport and meaningless particle hypothesis, well documented they are. Interface consistency with bound parameters version, maintained it is.


76-78: Verify the implementation in .ipp file, we must

Correctly declared the override is, but implementation in Propagator.ipp file, verify we must.

✅ Verification successful

Found the implementation, I have. Correct and complete, it is.

In the Propagator.ipp file, the implementation exists at line 482:

template <typename derived_t>
Acts::Result<Acts::BoundTrackParameters>
Acts::detail::BasePropagatorHelper<derived_t>::propagateToSurface(
    const FreeVector& start, const Surface& target,
    const Options& options) const {
  // Convert free parameters to curvilinear parameters...
  CurvilinearTrackParameters startBound(
      start.segment<4>(Acts::eFreePos0), start.segment<3>(Acts::eFreeDir0),
      start[Acts::eFreeQOverP], std::nullopt, ParticleHypothesis::pion());

  return propagateToSurface(startBound, target, options);
}

Properly implemented the method is, converting free parameters to curvilinear parameters it does, before propagating to the surface. Hmmmm, yes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the implementation exists in the .ipp file

# Search for the implementation
rg -A 5 "propagateToSurface.*FreeVector.*const Surface" Core/include/Acts/Propagator/Propagator.ipp

Length of output: 101


Script:

#!/bin/bash
# Search for any implementation of propagateToSurface in .ipp files
rg -l "propagateToSurface" --type cpp Core/include/Acts/Propagator/

# Check if the .ipp file exists
fd "Propagator.ipp" Core/include/Acts/Propagator/

# Try broader search for implementation
rg -A 5 "Result.*propagateToSurface.*FreeVector" Core/include/Acts/Propagator/

Length of output: 337


Script:

#!/bin/bash
# Let's examine the content of Propagator.ipp directly
cat Core/include/Acts/Propagator/Propagator.ipp

# Also check the header file for any inline implementations
cat Core/include/Acts/Propagator/Propagator.hpp

Length of output: 33899

Core/include/Acts/Propagator/Propagator.ipp Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Core Affects the Core module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants