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: Managing Seed Candidates with ad-hoc container #1764

Merged
merged 28 commits into from
Jan 17, 2023

Conversation

CarloVarni
Copy link
Collaborator

@CarloVarni CarloVarni commented Dec 20, 2022

Rewriting some part of the seeding codes, in particular how we collect the triplets candidates given a specific middle space point.

As of now these candidates are stored (and passed throughout the code) as std::pair<float, std::unique_ptr<InternalSeed<external_spacepoint_t>>>. Replacing the lower quality candidate with a new higher-quality candidate is not trivial if this has to happen multiple times during execution.

This is now handled by a specific class (CandidatesForSpM<InternalSpacePoint<external_spacepoint_t>>), which stores triplets candidates in a vector sorted as min heap tree. The first elements of this vector is always guaranteed to be the one with the lowest weight (i.e. quality) even after removals and/or additions of other candidates.

Inserting and removing elements from the stored collection is a log(N) operation.

Also taken a look around and made a few optimization changes:

  • Do not create Internal Seeds anymore (do we actually need them at all in Acts??? And why they have their own class if they are nothing more then a Seed<InternalSpacePoint<external_spacepoint_t>>?)
  • Avoid redundant or unnecessary sorting of vectors
  • Modularization of SeedFinder methods to make code cleaner and more readable by humans

Both default and orthogonal seedings have been adapted.
No physics performance changes are expected from this.

Still have to investigate on timings w.r.t. default code

/cc @noemina @LuisFelipeCoelho @paulgessinger @tboldagh @gagnonlg

@CarloVarni CarloVarni added the 🚧 WIP Work-in-progress label Dec 20, 2022
@github-actions
Copy link

github-actions bot commented Dec 20, 2022

📊 Physics performance monitoring for 90764f0

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

@CarloVarni CarloVarni added Component - Core Affects the Core module Improvement Changes to an existing feature labels Dec 20, 2022
@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Merging #1764 (90764f0) into main (75d5271) will decrease coverage by 0.17%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1764      +/-   ##
==========================================
- Coverage   49.77%   49.61%   -0.17%     
==========================================
  Files         406      407       +1     
  Lines       22521    22596      +75     
  Branches    10286    10301      +15     
==========================================
  Hits        11210    11210              
- Misses       4132     4207      +75     
  Partials     7179     7179              
Impacted Files Coverage Δ
...ore/include/Acts/Seeding/CandidatesForMiddleSp.hpp 0.00% <0.00%> (ø)
...ore/include/Acts/Seeding/CandidatesForMiddleSp.ipp 0.00% <0.00%> (ø)
Core/include/Acts/Seeding/IExperimentCuts.hpp 0.00% <ø> (ø)
Core/include/Acts/Seeding/SeedFilter.hpp 0.00% <ø> (ø)
Core/include/Acts/Seeding/SeedFilter.ipp 0.00% <0.00%> (ø)
Core/include/Acts/Seeding/SeedFinder.hpp 0.00% <ø> (ø)
Core/include/Acts/Seeding/SeedFinder.ipp 0.00% <0.00%> (ø)
Core/include/Acts/Seeding/SeedFinderUtils.ipp 0.00% <0.00%> (ø)
... and 2 more

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

@CarloVarni CarloVarni added the Component - Plugins Affects one or more Plugins label Dec 20, 2022
@CarloVarni CarloVarni added this to the next milestone Dec 21, 2022
@CarloVarni CarloVarni added the Component - Documentation Affects the documentation label Dec 21, 2022
Copy link
Contributor

@tboldagh tboldagh left a comment

Choose a reason for hiding this comment

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

Just a few comments concerning the readability of the code (naming). I tis clearly inherited but maybe it could be improved.
One technical suggestion about use of quality ordered set. It may be that I have misunderstood things though.

Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForSpM.hpp Outdated Show resolved Hide resolved
@CarloVarni CarloVarni marked this pull request as ready for review January 2, 2023 11:27
@CarloVarni CarloVarni removed the 🚧 WIP Work-in-progress label Jan 2, 2023
Copy link
Contributor

@tboldagh tboldagh left a comment

Choose a reason for hiding this comment

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

Had a quick look. I realy have (again) some better naming suggestions and questions. Besides that it all looks good.

Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/SeedFilter.hpp Show resolved Hide resolved
Core/include/Acts/Seeding/SeedFilter.ipp Show resolved Hide resolved
Core/include/Acts/Seeding/SeedFinderUtils.hpp Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
@CarloVarni
Copy link
Collaborator Author

On a positive side, the effect of these changes is a slightly faster code. The plot is for the default seeding, but the same consideration applies to the orthogonal seeding.

Sample: tt-bar PU200 (50 events)
Script: full_chain_itk.py

plot_default

@paulgessinger
Copy link
Member

@tboldagh, @noemina can one of you review this and hit "approve" if we can merge?

Copy link
Contributor

@noemina noemina left a comment

Choose a reason for hiding this comment

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

Great code! I really like it. I have left a few comments to correct typos and add lines to the documentation.
The major is to better explain the logic in the bubbledw method.

Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.ipp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.ipp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/SeedFilter.ipp Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp Outdated Show resolved Hide resolved
@CarloVarni
Copy link
Collaborator Author

Hi @noemina I should have addressed you comments. In particular I've extended the documentation on the bubbledw method. Hopefully it is now clearer what it does

Carlo Varni added 2 commits January 16, 2023 14:45
@CarloVarni
Copy link
Collaborator Author

thanks @noemina for the feedback. All threads are resolved. However the CI fails due to the codecov test, so I'm afraid that the automerge will not work

@noemina
Copy link
Contributor

noemina commented Jan 17, 2023

Great! All good from my side.

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.

Assuming @noemina meant to approve this PR.

I suspect the codecov might resolve when this branch is updated to current main.

Copy link
Contributor

@noemina noemina left a comment

Choose a reason for hiding this comment

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

Of course!

@CarloVarni
Copy link
Collaborator Author

@paulgessinger I'm afraid codecov is stubborn and doesn't want to succeed.

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 Component - Documentation Affects the documentation Component - Plugins Affects one or more Plugins Improvement Changes to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants