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: GSF python example #1232

Merged
merged 23 commits into from
May 24, 2022

Conversation

benjaminhuth
Copy link
Member

This PR proposes a first version of an GSF example. The implementation of this required some bigger changes in the TrackFittingAlgorithm, since I wanted the TrackFittingAlgorithm to support different fitters with different options.

  • I split the "algorithm-specific" options from the "fitter-specific" options. This now looks (in python) like this (for the Kalman Fitter):
  kalmanOptions = {
      "multipleScattering": True,
      "energyLoss": True,
      "reverseFilteringMomThreshold": reverseFilteringMomThreshold,
  }

  fitAlg = acts.examples.TrackFittingAlgorithm(
      level=acts.logging.INFO,
      inputMeasurements=digiAlg.config.outputMeasurements,
      inputSourceLinks=digiAlg.config.outputSourceLinks,
      inputProtoTracks=inputProtoTracks,
      inputInitialTrackParameters=smearAlg.config.outputTrackParameters,
      outputTrajectories="trajectories",
      directNavigation=directNavigation,
      pickTrack=-1,
      trackingGeometry=trackingGeometry,
      dFit=acts.examples.TrackFittingAlgorithm.makeKalmanFitterFunction(
          field, **kalmanOptions
      ),
      fit=acts.examples.TrackFittingAlgorithm.makeKalmanFitterFunction(
          trackingGeometry, field, **kalmanOptions
      ),
  )
  s.addAlgorithm(fitAlg)
  • The extensions (with exception of the MeasurementCalibrator) live now inside the TrackFitterFunction, since there may be different extensions required by different fitters. The MeasurementCalibrator still must live in the TrackFittingAlgorithm, since it must be constructed with the measurements, which are obviously not known when constructing the TrackFitterFunction.

Besides this there are some minor changes in the GSF (moved some config structs from Acts::detail to Acts, ...), but should be uncontroversial

@benjaminhuth benjaminhuth added Component - Examples Affects the Examples module Feature Development to integrate a new feature 🚧 WIP Work-in-progress labels Apr 20, 2022
@benjaminhuth benjaminhuth added this to the WIP milestone Apr 20, 2022
Copy link
Member

@paulgessinger paulgessinger left a comment

Choose a reason for hiding this comment

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

Looks reasonable overall, I've added a few comments here and there.

At the python level, there could be some cleanup. I'm also wondering if at this point we should rename truth_tracking.py to make it obvious it runs the KF.

Aside from that: do you think you could look into running the GSF example from a pytest test, so we run it in the CI and do basic checks on the output? Do you have any kind of code / tooling to produce validation plots for the GSF? If so, that could potentially also be added and monitored by the CI.

Examples/Python/src/TrackFitting.cpp Show resolved Hide resolved
Examples/Scripts/Python/gaussian_sum_filter.py Outdated Show resolved Hide resolved
Examples/Scripts/Python/gaussian_sum_filter.py Outdated Show resolved Hide resolved
Examples/Scripts/Python/gaussian_sum_filter.py Outdated Show resolved Hide resolved
Examples/Scripts/Python/gaussian_sum_filter.py Outdated Show resolved Hide resolved
Examples/Scripts/Python/gaussian_sum_filter.py Outdated Show resolved Hide resolved
@benjaminhuth
Copy link
Member Author

Regarding the physics performance monitoring: In principle the fitter returns a Acts::KalmanFitterResult object, so maybe one could reuse some infrastructure there? I also have some custom plotting scripts, because I'm not so familiar with the ROOT things, but they should do similar things than the Root-Writer...
I will look into this in a follow-up PR if this is okay!

@benjaminhuth
Copy link
Member Author

I did some renaming at this point as @paulgessinger mentioned above (truth_tracking.py -> kalman_tracks.py, gaussian_sum_filter.py-> gsf_tracks.py), and added the functions addKalmanTracks(...) as well as addGsfTracks(...).

I think this is now more in line with the other examples

@paulgessinger
Copy link
Member

Changes look good to me in principle. There's some build failures right now though.

@benjaminhuth benjaminhuth removed the 🚧 WIP Work-in-progress label May 3, 2022
@benjaminhuth benjaminhuth modified the milestones: WIP, next May 3, 2022
@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #1232 (f722fcd) into main (6e64a4c) will decrease coverage by 0.00%.
The diff coverage is 25.00%.

@@            Coverage Diff             @@
##             main    #1232      +/-   ##
==========================================
- Coverage   47.71%   47.71%   -0.01%     
==========================================
  Files         375      376       +1     
  Lines       19718    19722       +4     
  Branches     9264     9267       +3     
==========================================
+ Hits         9409     9410       +1     
- Misses       3920     3922       +2     
- Partials     6389     6390       +1     
Impacted Files Coverage Δ
...re/include/Acts/TrackFitting/GaussianSumFitter.hpp 71.03% <ø> (ø)
Core/include/Acts/TrackFitting/detail/GsfActor.hpp 41.24% <ø> (ø)
Core/include/Acts/TrackFitting/GsfOptions.hpp 25.00% <25.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@paulgessinger
Copy link
Member

Note that there are some CI issues that should be fixed by #1243.

@benjaminhuth benjaminhuth added the 🚧 WIP Work-in-progress label May 10, 2022
@benjaminhuth benjaminhuth modified the milestones: next, WIP May 10, 2022
@benjaminhuth benjaminhuth removed the 🚧 WIP Work-in-progress label May 18, 2022
@benjaminhuth benjaminhuth modified the milestones: WIP, next May 18, 2022
@benjaminhuth benjaminhuth modified the milestone: next May 18, 2022
@kodiakhq kodiakhq bot merged commit f1eee2f into acts-project:main May 24, 2022
@benjaminhuth benjaminhuth deleted the feature/gsf-python-example branch May 25, 2022 08:49
@paulgessinger paulgessinger modified the milestones: next, v19.1.0 May 25, 2022
kodiakhq bot pushed a commit that referenced this pull request Jun 14, 2022
This fixes an issue in compiling using clang + libstdc++ after #1232 was merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Component - Examples Affects the Examples module Feature Development to integrate a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants