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!: Decouple navigation and stepping #3449

Merged
merged 78 commits into from
Jan 15, 2025

Conversation

andiwand
Copy link
Contributor

@andiwand andiwand commented Jul 27, 2024

This is a proposal to decouple navigation from stepping by

  • changing the navigator interface to only consume its state and not the propagation state
  • providing position and direction as an input to the navigation
  • putting the Propagator in charge of communicating the target and estimated distance to the stepper

Originally I wanted the navigator to return the next step size but that clashes with the multi stepper. The current solution allows the stepper to judge on the step size given a surface. This allows the stepper to tweak the step size or to just take what the navigator proposed. In case of the multi stepper we will still just run intersections with the individual components.

The navigator is reduced to providing surface candidates and the surface status will be purely determined by the stepper. The propagator passes the information so the navigator knows when to switch surface / layer / volume.

Ultimately this removes all the templating from the navigator and the interface captures well what the navigator is supposed to do by having dedicated and visible I/O paths.

In case this is where we want to go I would like to do something similar to the steppers.

blocked by

Summary by CodeRabbit

Release Notes

  • Navigation Improvements

    • Introduced a new NavigationTarget structure to enhance navigation precision.
    • Streamlined navigator initialization and target resolution processes.
    • Added more robust surface and target validation mechanisms.
    • Removed unnecessary member variables from navigators to simplify state management.
  • Propagator Enhancements

    • Updated propagation logic to improve step size management.
    • Introduced configurable maximum target skipping limit.
    • Enhanced error handling for navigation scenarios.
    • Updated error enumerations to reflect new conditions.
  • Stepper Refinements

    • Simplified stepper state initialization.
    • Improved step size update and release mechanisms.
    • Added more flexible context and options handling.
    • Removed redundant tolerance parameters from stepper states.
  • Testing and Validation

    • Updated test cases to reflect new navigation and propagation interfaces.
    • Enhanced logging and error reporting.
    • Improved test coverage for various navigation scenarios.
    • Streamlined test setup and initialization processes.
  • Performance Optimizations

    • Removed redundant state management variables.
    • Simplified navigation and stepping logic.
    • Improved memory management in propagation states.

@andiwand andiwand added Needs Decision Needs decision or further information 🚧 WIP Work-in-progress labels Jul 27, 2024
@github-actions github-actions bot added Component - Core Affects the Core module Infrastructure Changes to build tools, continous integration, ... Component - Examples Affects the Examples module Track Finding Track Fitting labels Jul 27, 2024
@andiwand andiwand added this to the v37.0.0 milestone Jul 27, 2024
Copy link

github-actions bot commented Jul 28, 2024

📊: Physics performance monitoring for 1288d9f

Full contents

physmon summary

@andiwand andiwand force-pushed the decouple-navigation-stepping branch from 901d3e4 to cf443f5 Compare August 19, 2024 14:45
@github-actions github-actions bot removed the Infrastructure Changes to build tools, continous integration, ... label Aug 19, 2024
@andiwand andiwand force-pushed the decouple-navigation-stepping branch from cf443f5 to b2ef11b Compare August 19, 2024 15:02
@github-actions github-actions bot added the Infrastructure Changes to build tools, continous integration, ... label Aug 19, 2024
@andiwand andiwand force-pushed the decouple-navigation-stepping branch from 474eeca to b680a36 Compare August 20, 2024 06:07
@github-actions github-actions bot removed Infrastructure Changes to build tools, continous integration, ... Component - Examples Affects the Examples module Track Finding Track Fitting labels Aug 20, 2024
@andiwand andiwand force-pushed the decouple-navigation-stepping branch from f1eb04c to 3c2406b Compare August 21, 2024 11:53
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: 0

🧹 Nitpick comments (1)
Examples/Scripts/Python/hashing_seeding.py (1)

Line range hint 212-224: Architectural wisdom in particle selection strategy, I sense.

Part of the larger navigation and stepping decoupling effort, these changes are. Clear separation between:

  • Spatial selection (navigation domain)
  • Physics selection (propagation domain)

To future stepper decoupling mentioned in PR objectives, this pattern points.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dab01f9 and 1ce7bce.

📒 Files selected for processing (1)
  • Examples/Scripts/Python/hashing_seeding.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: merge-sentinel
  • GitHub Check: unused_files
  • GitHub Check: macos
  • GitHub Check: missing_includes
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20)
  • GitHub Check: linux_ubuntu
  • GitHub Check: build_debug
  • GitHub Check: docs
🔇 Additional comments (2)
Examples/Scripts/Python/hashing_seeding.py (2)

Line range hint 212-224: Complementary selection criteria between pre and post selection, observe.

A balanced approach to particle filtering, I sense:

  • Pre-selection: Spatial constraints (rho, absZ) for initial volume
  • Post-selection: Physics constraints (pt, eta) and quality cuts (hits)

Wise separation of concerns, this is. Improved performance in Fatras algorithm, as mentioned in PR comments, it explains.


212-213: Changed particle selection criteria, hmm.

Replaced the previous eta and pt-based selection with spatial constraints for particle pre-selection, I see. A significant change in the way particles are filtered before simulation, this is.

Run this command to verify the impact, we must:

Wise to verify these values against detector geometry constraints, it would be:

  • rho max of 24mm: aligns with typical beam pipe radius, it does
  • absZ of 1m: reasonable for initial particle selection, it is
✅ Verification successful

Consistent with the Force, these changes are.

The spatial constraints chosen (rho=(0.0, 24 * u.mm), absZ=(0.0, 1.0 * u.m)) align with established patterns across many files in the codebase, they do. A common approach for particle selection in the ACTS project, this has become.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other instances of ParticleSelectorConfig to ensure consistency
rg -A 5 "ParticleSelectorConfig" | grep -v "postSelectParticles"

Length of output: 26169

kodiakhq bot pushed a commit that referenced this pull request Jan 14, 2025
Currently we respect the overstepping tolerance in the `MultiStepperSurfaceReached` aborter. This can lead to problems with overstepping in situations with high curvature or surfaces that bent like cylinders and perigees. To fix this we can use directly `ForcedSurfaceReached` as a base which will always target the requested surface without checking the overstep tolerance.

This can cause problems with cylinders but we usually do not target them with the GSF or one of the solutions should be strictly closer which suppresses the problem.

Discovered and pulled out of #3449

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
	- Updated inheritance for `MultiStepperSurfaceReached` struct
	- Simplified constructor initialization for the struct

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@AJPfleger AJPfleger removed the Needs Decision Needs decision or further information label Jan 14, 2025
kodiakhq bot pushed a commit that referenced this pull request Jan 15, 2025
…perSurfaceReached` (#4027)

After facing another problem with the GSF in #3449 this might resolve it. The problem seems to be that the navigator and the surface reached aborter are fighting over the surface reached status which can lead to removing all components if the target surface is not reached and the maximum step trials for the multi stepper are reached.

This might introduce other problems so waiting for physmon report.

blocked by
- #4025

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
	- Updated inheritance for `MultiStepperSurfaceReached` struct to use `ForcedSurfaceReached` as base class
	- Removed explicit constructor for `MultiStepperSurfaceReached`
	- Modified `checkAbort` method to use new base class implementation

- **Chores**
	- Improved component handling and logging in `MultiEigenStepperLoop` class
	- Enhanced state management for components during stepping process

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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: 0

🧹 Nitpick comments (1)
Core/include/Acts/TrackFitting/detail/GsfUtils.hpp (1)

207-207: Consider documenting weight modification behavior, we should.

Clear the behavior when weights are skipped or modified, make it. Add documentation about edge cases, helpful it would be.

+    // Modify the weight only if both determinant and factor are valid
     weights.at(tip) *= factor;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa21ba7 and cf2b28a.

📒 Files selected for processing (1)
  • Core/include/Acts/TrackFitting/detail/GsfUtils.hpp (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: merge-sentinel
  • GitHub Check: CI Bridge / build_exatrkx
  • GitHub Check: build_debug
  • GitHub Check: CI Bridge / lcg_106a: [alma9, clang16]
  • GitHub Check: CI Bridge / lcg_106a: [alma9, gcc14]
  • GitHub Check: CI Bridge / lcg_106a: [alma9, gcc13]
  • GitHub Check: CI Bridge / lcg_105: [alma9, clang16]
  • GitHub Check: unused_files
  • GitHub Check: CI Bridge / lcg_105: [alma9, gcc13]
  • GitHub Check: CI Bridge / linux_ubuntu_2204_clang
  • GitHub Check: CI Bridge / linux_ubuntu_2204
  • GitHub Check: CI Bridge / build_linux_ubuntu
  • GitHub Check: linux_ubuntu_extra (ubuntu2204_clang, 20)
  • GitHub Check: CI Bridge / clang_tidy
  • GitHub Check: CI Bridge / build_exatrkx_cpu
  • GitHub Check: linux_ubuntu
  • GitHub Check: missing_includes
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20)
  • GitHub Check: docs
  • GitHub Check: macos
🔇 Additional comments (3)
Core/include/Acts/TrackFitting/detail/GsfUtils.hpp (3)

195-198: Wise handling of determinant, this is!

Protect against invalid mathematical operations when determinant is not positive, we do. Skip weight modification in such cases, we shall.


202-204: Graceful handling of non-finite factors, implemented well it is!

Skip weight modification when factor calculation yields non-finite results, we do. Robust error handling, this demonstrates.


195-207: Verify impact on numerical stability across test cases, we must.

Changes in weight computation logic, significant they are. Ensure stability across various input ranges and edge cases, we should.

Run these commands to analyze the test coverage and numerical stability:

@andiwand
Copy link
Contributor Author

andiwand commented Jan 15, 2025

With cf2b28a I am trying to work around an FPE that popped up in the GSF.

We already checked for std::isfinite which might come from a previous treatment of the FPE without monitoring. So I thought I can just prevent it by checking directly on detR.

What do you think about that handling @benjaminhuth @paulgessinger?

@paulgessinger
Copy link
Member

Let's go 🚀

@kodiakhq kodiakhq bot merged commit f060123 into acts-project:main Jan 15, 2025
44 checks passed
@andiwand andiwand deleted the decouple-navigation-stepping branch January 15, 2025 14:04
@acts-project-service acts-project-service added the Breaks Athena build This PR breaks the Athena build label Jan 15, 2025
@paulgessinger paulgessinger modified the milestones: next, v39.0.0 Feb 5, 2025
kodiakhq bot pushed a commit that referenced this pull request Feb 11, 2025
Very similar to #3449 this decouples the stepping from the navigation. Instead of passing the whole propagation state into stepping function we can just pass in the stepping state. This cuts all dependencies from the navigation and allows to use and test steppers independent from a propagation state and navigation. 

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

## Release Notes

- **New Features**
	- Introduced a new `IVolumeMaterial` interface across multiple propagation components.
	- Enhanced stepper interfaces with more explicit state and direction management.

- **Improvements**
	- Simplified method signatures in propagator components.
	- Removed unnecessary template parameters in stepper implementations.
	- Streamlined state management across propagation classes.
	- Improved type safety and code clarity in propagation logic.

- **Breaking Changes**
	- Modified method signatures in steppers, potentially requiring updates to existing code.
	- Removed mock state structures in test files.
	- Changed how state and navigation are handled in propagation components.

- **Technical Refinements**
	- Updated type aliases and inheritance structures.
	- Removed redundant compatibility checks.
	- Enhanced error handling in propagation methods.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaks Athena build This PR breaks the Athena build Changes Performance Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Fatras Affects the Fatras module Fails Athena tests This PR causes a failure in the Athena tests Infrastructure Changes to build tools, continous integration, ... Track Finding Track Fitting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants