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!: (fix + chore) streamline nSegments usage #3419

Merged

Conversation

asalzburger
Copy link
Contributor

@asalzburger asalzburger commented Jul 19, 2024

The generation of display vertices for segments was buggy and very unstable, I have put this onto more solid grounds, which helps displaying (not only) AnnulusBounds correctly.

ITk Petal Before:

Screenshot 2024-07-18 at 17 01 59

ITk Petal After:

Screenshot 2024-07-19 at 12 07 32

When checking the code, I see that there was a pretty big inconsistency in how the nSegments have been handled, so I re-worked that:

  • nSegments (full 2 * PI segments) -> changed and renamed to quaterSegments

This guarantees that the number of segments for a full circle is a multiplier of 4 and hence the phi extrema points at (-pi,-0.5*pi,0,0.5*pi,pi) are consistently added. This will lead to a correct x and y estimation for the Extent of the Polyhedron.

This also guarantees that e.g. overlapping/attaching surfaces with the same number of segments will have vertices at the same positions, which will be better for the displaying.

  • inconsitent use of unsigned int (SurfaceBounds) and std::size_t -> changed to `unsigned int everywhere

  • Introduces tests for the vertex generation (which were missing)

@github-actions github-actions bot added Component - Core Affects the Core module Component - Plugins Affects one or more Plugins labels Jul 19, 2024
@asalzburger asalzburger force-pushed the fix-display-vertices-annulus-bounds branch from d15136a to 863cc15 Compare July 19, 2024 15:11
@asalzburger asalzburger added this to the next milestone Jul 19, 2024
@asalzburger asalzburger requested a review from noemina July 19, 2024 15:12
@github-actions github-actions bot added the Component - Examples Affects the Examples module label Jul 22, 2024
Copy link

github-actions bot commented Jul 22, 2024

📊: Physics performance monitoring for d3ba2c1

Full contents

physmon summary

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.

Can you avoid the physmon output changes? This should not affect the reconstruction at all should it?

@paulgessinger
Copy link
Member

I was wondering generally: wouldn't we be able to get rid of manual passing of segments if we just define a maximum arc length $r\times\phi$ in $mm$ that a single segment is allowed to be? That way, the target bounds could decide on their own how many segments to produce, because they can just calculate the arc length?

@asalzburger asalzburger changed the title fix: display vertices annulus bounds feat!: (fix + chore) streamline nSegments usage Jul 23, 2024
@asalzburger
Copy link
Contributor Author

Can you avoid the physmon output changes? This should not affect the reconstruction at all should it?

I suppose that we get a slightly different bin association for one or another surface now ... hence the fluctuation in the output.

@paulgessinger
Copy link
Member

@asalzburger Is this because we use it for the auto-binning in the Gen1 layer building?

@asalzburger
Copy link
Contributor Author

I was wondering generally: wouldn't we be able to get rid of manual passing of segments if we just define a maximum arc length r×ϕ in mm that a single segment is allowed to be? That way, the target bounds could decide on their own how many segments to produce, because they can just calculate the arc length?

That's a possibility, however:
The polyhedron is used mainly in two different context situations:

  • (a) displaying
  • (b) space/extent estimation

For latter (in many cases) a choice of quarterSegments =1 is sufficient, as it will generate now the phi values that are need to estimate the maximum extent in x/y. That's the reason why I have changed to quarterSegments rather than full 2*pi.

For displaying, however, this newly implemented schema - where the number of segments is given per quarter (and drives the vertex generation) will guarantee that attaching surfaces (even with different phi sector openings) will have vertices at the same points in space and hence will "look attaching".

That's why I changed to this schema.

@asalzburger
Copy link
Contributor Author

@asalzburger Is this because we use it for the auto-binning in the Gen1 layer building?

That is my assumption, I will try to dig down a bit on this - I was surprised as well ....

@paulgessinger
Copy link
Member

@asalzburger Do we need the extent building from cartesian vertices if we switch to local sizing in Gen3 and potentially reconsider the global root volume finders? Maybe something we can discuss going forward, since relying on the approximation seems a bit fragile to me.

@github-actions github-actions bot added the Component - Fatras Affects the Fatras module label Jul 23, 2024
@github-actions github-actions bot added the Stale label Aug 28, 2024
andiwand
andiwand previously approved these changes Oct 3, 2024
@andiwand
Copy link
Contributor

andiwand commented Oct 3, 2024

there is a small build issue @paulgessinger

[232/1487] Building CXX object Core/CMakeFiles/ActsCore.dir/src/Surfaces/PlaneSurface.cpp.o
FAILED: Core/CMakeFiles/ActsCore.dir/src/Surfaces/PlaneSurface.cpp.o 
ccache /usr/bin/c++ -DACTS_ENABLE_LOG_FAILURE_THRESHOLD -DActsCore_EXPORTS -I/__w/acts/acts/Core/include -I/__w/acts/acts/build/Core -isystem /__w/acts/acts/cmake/assert_include -isystem /usr/include/eigen3 -Wall -Wextra -Wpedantic -Wshadow -Wzero-as-null-pointer-constant -Wold-style-cast -Werror -O3 -DNDEBUG -std=c++20 -fPIC -MD -MT Core/CMakeFiles/ActsCore.dir/src/Surfaces/PlaneSurface.cpp.o -MF Core/CMakeFiles/ActsCore.dir/src/Surfaces/PlaneSurface.cpp.o.d -o Core/CMakeFiles/ActsCore.dir/src/Surfaces/PlaneSurface.cpp.o -c /__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp: In member function 'virtual Acts::Polyhedron Acts::PlaneSurface::polyhedronRepresentation(const Acts::GeometryContext&, unsigned int) const':
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:119:13: error: declaration of 'faces' shadows a previous local [-Werror=shadow]
  119 |       auto [faces, triangularMesh] =
      |             ^~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:94:37: note: shadowed declaration is here
   94 |   std::vector<Polyhedron::FaceType> faces;
      |                                     ^~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:119:20: error: declaration of 'triangularMesh' shadows a previous local [-Werror=shadow]
  119 |       auto [faces, triangularMesh] =
      |                    ^~~~~~~~~~~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:95:37: note: shadowed declaration is here
   95 |   std::vector<Polyhedron::FaceType> triangularMesh;
      |                                     ^~~~~~~~~~~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:126:13: error: declaration of 'faces' shadows a previous local [-Werror=shadow]
  126 |       auto [faces, triangularMesh] =
      |             ^~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:94:37: note: shadowed declaration is here
   94 |   std::vector<Polyhedron::FaceType> faces;
      |                                     ^~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:126:20: error: declaration of 'triangularMesh' shadows a previous local [-Werror=shadow]
  126 |       auto [faces, triangularMesh] =
      |                    ^~~~~~~~~~~~~~
/__w/acts/acts/Core/src/Surfaces/PlaneSurface.cpp:95:37: note: shadowed declaration is here
   95 |   std::vector<Polyhedron::FaceType> triangularMesh;
      |                                     ^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

@paulgessinger
Copy link
Member

@andiwand meh, I thought that was because of the merge conflict. I'll fix it.

@paulgessinger
Copy link
Member

@andiwand Compile fixes should be in now.

@andiwand andiwand requested a review from paulgessinger October 3, 2024 08:22
@andiwand
Copy link
Contributor

andiwand commented Oct 3, 2024

@paulgessinger can you also approve?
image

Copy link
Contributor Author

@asalzburger asalzburger left a comment

Choose a reason for hiding this comment

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

Good to go from my side.

Copy link

sonarqubecloud bot commented Oct 3, 2024

@kodiakhq kodiakhq bot merged commit f5a34f3 into acts-project:main Oct 3, 2024
42 checks passed
@github-actions github-actions bot removed the automerge label Oct 3, 2024
@acts-project-service acts-project-service added the Breaks Athena build This PR breaks the Athena build label Oct 3, 2024
@paulgessinger paulgessinger deleted the fix-display-vertices-annulus-bounds branch October 4, 2024 06:15
@acts-project-service acts-project-service added the Fails Athena tests This PR causes a failure in the Athena tests label Oct 4, 2024
@paulgessinger paulgessinger modified the milestones: next, v37.0.0 Oct 4, 2024
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 Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Fatras Affects the Fatras module Component - Plugins Affects one or more Plugins Fails Athena tests This PR causes a failure in the Athena tests Track Fitting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants