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: DetectorVolume containment check #2895

Merged
merged 32 commits into from
Mar 13, 2024

Conversation

ssdetlab
Copy link
Contributor

The PR makes changes to the DetectorVolume code that address the issue of the surfaces/subvolumes containment checks, i.e. making sure that they are fully inside the volume. Additionally, minor fixes are made in the Json-related parts of the code (see below).

DetectorVolume checkContainment call is moved from the constructor to the end of the "construct" method, where the volume's portals are initialized. Because the containment checks rely on the volume having the initialized Extent and the Extent is derived from the volume's portals, keeping the call in the constructor prevents the proper check from happening, as there are yet no portals to derive the Extent from. Additionally, assert is replaced with invalid_argument thrown in case the internals are not contained.

To check the compatibility of the external and internal extents a new "canonicalBinning" method is introduced to the VolumeBounds. It returns the binning values that should be enough to describe the relevant parts of the Extent for a given volume shape, e.g. X,Y,Z bins are returned for cubic volumes, as, for example, there is no reason to check the binMag. Some of the VolumeBounds return the bounding box binning for now as a placeholder.

A UnitTest is added to the DetectorVolumeTests that checks incompatibility with internals that are not contained.

A minor fixes had to be introduced to DetectorJsonConverter with respect to the geometry parameters.

In Transform3 Json writer the default option "transpose" is changed to be false to be consistent with the default reading options.

@github-actions github-actions bot added Component - Core Affects the Core module Component - Plugins Affects one or more Plugins labels Jan 24, 2024
@ssdetlab
Copy link
Contributor Author

Forgot to add. The number of segments for polyhedronRepresentation is hardcoded to be 1k. The default option of 1 didn't work with cylindrical shapes on more complex side -- the Extent that was returned for what I think was a barrel/endcap had big enough errors in phi/radius for the check to fail

@ssdetlab
Copy link
Contributor Author

Moved the check inside the DetectorVolumeFactory::construct(). The one that takes the surfaces and subvolumes. Also, made the number of polyhedron segments a parameter with a default value

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: Patch coverage is 21.73913% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 48.84%. Comparing base (ccc1975) to head (e147aa2).

Files Patch % Lines
Core/src/Detector/DetectorVolume.cpp 30.00% 0 Missing and 7 partials ⚠️
Core/include/Acts/Detector/DetectorVolume.hpp 33.33% 0 Missing and 2 partials ⚠️
...clude/Acts/Geometry/CutoutCylinderVolumeBounds.hpp 0.00% 2 Missing ⚠️
...ore/include/Acts/Geometry/CylinderVolumeBounds.hpp 0.00% 2 Missing ⚠️
...nclude/Acts/Geometry/GenericCuboidVolumeBounds.hpp 0.00% 2 Missing ⚠️
Core/include/Acts/Geometry/VolumeBounds.hpp 0.00% 2 Missing ⚠️
Core/include/Acts/Geometry/CuboidVolumeBounds.hpp 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2895      +/-   ##
==========================================
- Coverage   48.84%   48.84%   -0.01%     
==========================================
  Files         492      492              
  Lines       28846    28861      +15     
  Branches    13677    13685       +8     
==========================================
+ Hits        14091    14096       +5     
- Misses       4949     4955       +6     
- Partials     9806     9810       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@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.

A few comments.

Core/include/Acts/Detector/DetectorVolume.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp Outdated Show resolved Hide resolved
Core/include/Acts/Geometry/VolumeBounds.hpp Outdated Show resolved Hide resolved
@ssdetlab
Copy link
Contributor Author

Made minor adjustments to the geometry inside the DD4hep Cylindrical Detector test

asalzburger
asalzburger previously approved these changes Jan 25, 2024
@asalzburger asalzburger added this to the next milestone Jan 25, 2024
@ssdetlab
Copy link
Contributor Author

@asalzburger, looks like it is still waiting for your approval

@ssdetlab
Copy link
Contributor Author

ssdetlab commented Mar 3, 2024

@asalzburger, Just a reminder that the policy-bot is still waiting for the approval

@andiwand
Copy link
Contributor

we need a codecov overwrite here @asalzburger @paulgessinger

@asalzburger asalzburger added automerge and removed Component - Core Affects the Core module labels Mar 13, 2024
@github-actions github-actions bot added the Component - Core Affects the Core module label Mar 13, 2024
@kodiakhq kodiakhq bot merged commit d244dee into acts-project:main Mar 13, 2024
57 checks passed
dimitra97 pushed a commit to dimitra97/acts that referenced this pull request Mar 19, 2024
The PR makes changes to the DetectorVolume code that address the issue of the surfaces/subvolumes containment checks, i.e. making sure that they are fully inside the volume. Additionally, minor fixes are made in the Json-related parts of the code (see below).

DetectorVolume checkContainment call is moved from the constructor to the end of the "construct" method, where the volume's portals are initialized. Because the containment checks rely on the volume having the initialized Extent and the Extent is derived from the volume's portals, keeping the call in the constructor prevents the proper check from happening, as there are yet no portals to derive the Extent from. Additionally, assert is replaced with invalid_argument thrown in case the internals are not contained. 

To check the compatibility of the external and internal extents a new "canonicalBinning" method is introduced to the VolumeBounds. It returns the binning values that should be enough to describe the relevant parts of the Extent for a given volume shape, e.g.  X,Y,Z bins are returned for cubic volumes, as, for example, there is no reason to check the binMag. Some of the VolumeBounds return the bounding box binning for now as a placeholder. 

A UnitTest is added to the DetectorVolumeTests that checks incompatibility with internals that are not contained. 

A minor fixes had to be introduced to DetectorJsonConverter with respect to the geometry parameters. 

In Transform3 Json writer the default option "transpose" is changed to be false to be consistent with the default reading options.
@paulgessinger paulgessinger modified the milestones: next, v33.1.0 Mar 26, 2024
EleniXoch pushed a commit to EleniXoch/acts that referenced this pull request May 6, 2024
The PR makes changes to the DetectorVolume code that address the issue of the surfaces/subvolumes containment checks, i.e. making sure that they are fully inside the volume. Additionally, minor fixes are made in the Json-related parts of the code (see below).

DetectorVolume checkContainment call is moved from the constructor to the end of the "construct" method, where the volume's portals are initialized. Because the containment checks rely on the volume having the initialized Extent and the Extent is derived from the volume's portals, keeping the call in the constructor prevents the proper check from happening, as there are yet no portals to derive the Extent from. Additionally, assert is replaced with invalid_argument thrown in case the internals are not contained. 

To check the compatibility of the external and internal extents a new "canonicalBinning" method is introduced to the VolumeBounds. It returns the binning values that should be enough to describe the relevant parts of the Extent for a given volume shape, e.g.  X,Y,Z bins are returned for cubic volumes, as, for example, there is no reason to check the binMag. Some of the VolumeBounds return the bounding box binning for now as a placeholder. 

A UnitTest is added to the DetectorVolumeTests that checks incompatibility with internals that are not contained. 

A minor fixes had to be introduced to DetectorJsonConverter with respect to the geometry parameters. 

In Transform3 Json writer the default option "transpose" is changed to be false to be consistent with the default reading options.
asalzburger pushed a commit to asalzburger/acts that referenced this pull request May 21, 2024
The PR makes changes to the DetectorVolume code that address the issue of the surfaces/subvolumes containment checks, i.e. making sure that they are fully inside the volume. Additionally, minor fixes are made in the Json-related parts of the code (see below).

DetectorVolume checkContainment call is moved from the constructor to the end of the "construct" method, where the volume's portals are initialized. Because the containment checks rely on the volume having the initialized Extent and the Extent is derived from the volume's portals, keeping the call in the constructor prevents the proper check from happening, as there are yet no portals to derive the Extent from. Additionally, assert is replaced with invalid_argument thrown in case the internals are not contained. 

To check the compatibility of the external and internal extents a new "canonicalBinning" method is introduced to the VolumeBounds. It returns the binning values that should be enough to describe the relevant parts of the Extent for a given volume shape, e.g.  X,Y,Z bins are returned for cubic volumes, as, for example, there is no reason to check the binMag. Some of the VolumeBounds return the bounding box binning for now as a placeholder. 

A UnitTest is added to the DetectorVolumeTests that checks incompatibility with internals that are not contained. 

A minor fixes had to be introduced to DetectorJsonConverter with respect to the geometry parameters. 

In Transform3 Json writer the default option "transpose" is changed to be false to be consistent with the default reading options.
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 - Plugins Affects one or more Plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants