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: Refactor the measurement calibrator in the examples #2058

Merged
merged 12 commits into from
Apr 27, 2023

Conversation

gagnonlg
Copy link
Contributor

I'm currently working on implementing a few different measurement/cluster calibration methods for a bona fide calibration study. The easiest way to run such a study would be to have the option to swap the calibrators on the python side so one does not need to either recompile everytime or duplicate the TrackFitting example for each different methods.

Towards that end, I propose the following changes:

  • Rename MeasurementCalibrator to PassThroughCalibrator;
  • Create an abstract base class MeasurementCalibrator with a calibrate method which takes a measurement container as input;
  • Created a PairedMeasurementCalibrator class that binds a calibrator to a MeasurementContainer, to pass to the actual fitter;
  • Add machinery to instantiate the calibrators outside of the execute() loop.

#1940 introduced a alternate path using a RefittingCalibrator instead of a MeasurementCalibrator. I did not touch this code since I'm not sure if it makes sense to unify it with what I have planned -- any thoughts @benjaminhuth ? I propose to leave this as-is for the time being and re-assess once I push actual calibrators (shortly, hopefully).

@gagnonlg gagnonlg added Improvement Changes to an existing feature Component - Examples Affects the Examples module labels Apr 25, 2023
@gagnonlg gagnonlg added this to the next milestone Apr 25, 2023
@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #2058 (3498fe7) into main (83ed775) will increase coverage by 0.36%.
The diff coverage is n/a.

❗ Current head 3498fe7 differs from pull request most recent head 052ab73. Consider uploading reports for the commit 052ab73 to get more accurate results

@@            Coverage Diff             @@
##             main    #2058      +/-   ##
==========================================
+ Coverage   49.37%   49.73%   +0.36%     
==========================================
  Files         427      426       -1     
  Lines       24779    24221     -558     
  Branches    11430    11006     -424     
==========================================
- Hits        12234    12047     -187     
+ Misses       4484     4434      -50     
+ Partials     8061     7740     -321     

see 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@benjaminhuth benjaminhuth self-assigned this Apr 25, 2023
@github-actions
Copy link

github-actions bot commented Apr 25, 2023

📊 Physics performance monitoring for 052ab73

Full report
Seeding: seeded, truth estimated, orthogonal
CKF: seeded, truth smeared, truth estimated, orthogonal
IVF: seeded, truth smeared, truth estimated, orthogonal
Ambiguity resolution: seeded, orthogonal
Truth tracking
Truth tracking (GSF)

Vertexing

Vertexing vs. mu
IVF seeded

IVF truth_smeared

IVF truth_estimated

IVF orthogonal

Seeding

Seeding seeded

Seeding truth_estimated

Seeding orthogonal

CKF

CKF seeded

CKF truth_smeared

CKF truth_estimated

CKF orthogonal

Ambiguity resolution

seeded

Truth tracking (Kalman Filter)

Truth tracking

Truth tracking (GSF)

Truth tracking

@gagnonlg
Copy link
Contributor Author

I'm aware of the segfault in some of the tests, I'm investigating...

Copy link
Member

@benjaminhuth benjaminhuth left a comment

Choose a reason for hiding this comment

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

Looks good to me, just a few comments

  • The code is under Examples/Algorithms/Calibration, but there is no CalibrationAlgorithm. Would it be an option to put this code under Examples/Framework/EventData or something like that?

  • I currently find the naming of the classes not optimal, it took me quite a while to understand. Maybe PairedMeasurementCalibrator -> MeasurementCallibratorInterface to indicate that this provides the interface to the ACTS core library...

  • So far this is not generic enough to work with my refitting-calibrator, as this is not measurement based (It defines an own source-link type, which internally already has all information, so it does not need any container or something like that). But from my perspective this is not a problem.

@gagnonlg
Copy link
Contributor Author

@benjaminhuth Thanks for the feedback! I will change the location & naming of the sources as you suggest.

For the refitting calibrator: okay then it makes sense to keep this separate!

Thanks again,
L-G

To prepare for implementation of actual calibration methods, made the
following changes:

+ Renamed MeasurementCalibrator to PassThroughCalibrator

+ Created an abstract base calss MeasurementCalibrator with a
calibrate method which takes a measurement container as input

+ Created a PairedMeasurementCalibrator class that binds a calibrator
to a MeasurementContainer, to pass to the fitter
@gagnonlg
Copy link
Contributor Author

@benjaminhuth I implemented your suggestion. For the renaming, it occured to me that the PairedMeasurementCalibrator is an instance of the adapter pattern, and thus I renamed it to MeasurementCalibratorAdapter.

let me know if you have more feedback :-)

Copy link
Member

@benjaminhuth benjaminhuth left a comment

Choose a reason for hiding this comment

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

I think we can get it in now!

@kodiakhq kodiakhq bot merged commit 69e6115 into acts-project:main Apr 27, 2023
38 checks passed
py::class_<MeasurementCalibrator, std::shared_ptr<MeasurementCalibrator>>(
mex, "MeasurementCalibrator");

mex.def("makePassThroughCalibrator",
Copy link
Member

Choose a reason for hiding this comment

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

I know this is merged already, but I there a reason not to just expose the inheritance relationship and then have Python just construct the object directly instead of the factory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No real reason I guess, I just don't know what I'm doing on the python side ;-) putting this on my list

@paulgessinger paulgessinger modified the milestones: next, v26.0.0 May 22, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 16, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 17, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 25, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 25, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 25, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 26, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Oct 30, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Nov 5, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Nov 6, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Nov 15, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Nov 15, 2023
wdconinc added a commit to eic/EICrecon that referenced this pull request Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module Improvement Changes to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants