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

fix: minor bugs in grid vertex seeder #2376

Merged
merged 22 commits into from
Aug 30, 2023

Conversation

felix-russo
Copy link
Contributor

@felix-russo felix-russo commented Aug 16, 2023

Some small improvements in AdaptiveGridTrackDensity and GaussianGridTrackDensity:

  • 1/(2 * M_PI) is removed from the track density since constant factors have no influence on the position of the maximum z value.
  • The central bin was twice as large as the others in AdaptiveGridTrackDensity. I repositioned the grid such that the central bin corresponds to the interval [-binSize/2, binSize/2). As a consequence, I had to modify the unit tests.
  • There was a sign mistake in the computation of the exponent. I removed it and check if the new sign is correct in the unit test compare_to_analytical_solution_for_single_track.
  • There was a sign mistake and a typo in the computation of the seed width. I removed them and check that the new computation is correct in the unit tests check_seed_width_estimation and compare_to_analytical_solution_for_single_track.

@github-actions github-actions bot added Component - Core Affects the Core module Vertexing labels Aug 16, 2023
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #2376 (f8a6c10) into main (ed0bb27) will decrease coverage by 0.02%.
The diff coverage is 63.15%.

@@            Coverage Diff             @@
##             main    #2376      +/-   ##
==========================================
- Coverage   49.69%   49.68%   -0.02%     
==========================================
  Files         454      454              
  Lines       25796    25799       +3     
  Branches    11850    11849       -1     
==========================================
- Hits        12820    12818       -2     
- Misses       4575     4580       +5     
  Partials     8401     8401              
Files Changed Coverage Δ
...nclude/Acts/Vertexing/AdaptiveGridTrackDensity.hpp 100.00% <ø> (ø)
...nclude/Acts/Vertexing/GaussianGridTrackDensity.hpp 100.00% <ø> (ø)
...nclude/Acts/Vertexing/AdaptiveGridTrackDensity.ipp 61.15% <56.81%> (-1.26%) ⬇️
...nclude/Acts/Vertexing/GaussianGridTrackDensity.ipp 66.40% <84.61%> (-1.54%) ⬇️

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

@felix-russo felix-russo marked this pull request as ready for review August 21, 2023 14:17
@baschlag
Copy link
Contributor

Hi. Thanks for the PR!
First comment: You wrote '... such that the central bin corresponds to the interval [-binSize, binSize)'. If that's really the case, the central bin would be of size 2*binSize again (i.e. everything in this interval gets mapped to 0), wouldn't it? Can't we just make sure that everything in [0,binSize) gets mapped to bin number 0, whereas the interval [-binSize, 0) gets mapped to -1?
I'll have a closer look at the code soon and get back to you.

@baschlag
Copy link
Contributor

Hi. Thanks for the PR!
First comment: You wrote '... such that the central bin corresponds to the interval [-binSize, binSize)'. If that's really the case, the central bin would be of size 2*binSize again (i.e. everything in this interval gets mapped to 0), wouldn't it? Can't we just make sure that everything in [0,binSize) gets mapped to bin number 0, whereas the interval [-binSize, 0) gets mapped to -1?
I'll have a closer look at the code soon and get back to you.

Just to add: in my understanding, the previous implementation also mapped [-binSize, 0) to 0(which is clearly wrong, so thanks for catching this!), and bin number -1 was just skipped. So we effectively had a binning like ..., -3, -2, 0, 1, 2, 3, ..., skipping -1 and having bin 0 twice as large, right?

@felix-russo
Copy link
Contributor Author

felix-russo commented Aug 22, 2023

Hi. Thanks for the PR!

Thanks for having a look at it!

First comment: You wrote '... such that the central bin corresponds to the interval [-binSize, binSize)'. If that's really the case, the central bin would be of size 2*binSize again (i.e. everything in this interval gets mapped to 0), wouldn't it?

Sorry, that was a very misleading typo, I meant to write [-binSize/2, binSize/2). In the code this is however implemented correctly I think: in the function getBin; we have:
return static_cast<int>(std::floor(value / m_cfg.binSize - 0.5) + 1);.
Substituting

  • value = binSize/2 yields 1,
  • value = binSize/2 - epsilon, where epsilon is a small positive number, yields 0
  • value = -binSize/2 yields 0.

Here is some code you can have a look at https://onlinegdb.com/UGjDeZYK2.

Can't we just make sure that everything in [0,binSize) gets mapped to bin number 0, whereas the interval [-binSize, 0) gets mapped to -1?

We could, but since we impose an uneven number of bins this would introduce some asymmetry (e.g., for a track centered at z=0, there would be more positive than negative bins (or vice versa)).

Just to add: in my understanding, the previous implementation also mapped [-binSize, 0) to 0(which is clearly wrong, so thanks for catching this!), and bin number -1 was just skipped. So we effectively had a binning like ..., -3, -2, 0, 1, 2, 3, ..., skipping -1 and having bin 0 twice as large, right?

I think bin -1 was not skipped, rather

  • values from bin -2 were mapped to bin -1,
  • values from bin -3 were mapped -2,
  • etc.

You can have a look at https://onlinegdb.com/mjoUXyTTT to confirm this.

I'll have a closer look at the code soon and get back to you.

Great, thanks a lot for your time!

baschlag
baschlag previously approved these changes Aug 30, 2023
Copy link
Contributor

@baschlag baschlag left a comment

Choose a reason for hiding this comment

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

Ok, looks good to me! Thanks for the PR!

@acts-policybot acts-policybot bot dismissed baschlag’s stale review August 30, 2023 10:44

Invalidated by push of 9044fb2

@github-actions github-actions bot added Infrastructure Changes to build tools, continous integration, ... Changes Performance labels Aug 30, 2023
@paulgessinger paulgessinger added this to the next milestone Aug 30, 2023
@kodiakhq kodiakhq bot merged commit 241c1e1 into acts-project:main Aug 30, 2023
56 checks passed
@felix-russo felix-russo deleted the refactor-grid-seeder branch August 30, 2023 14:30
@paulgessinger paulgessinger modified the milestones: next, v29.1.0 Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes Performance Component - Core Affects the Core module Infrastructure Changes to build tools, continous integration, ... Vertexing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants