diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root index f7fb66f24ab..b02aa3773ac 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root index 8fbd66c0abb..35c6a2c8519 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root index cb71ba79000..4cd67bc9bec 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root index 0980823e57c..3ee1d6b2e89 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root differ diff --git a/Core/include/Acts/Detector/LayerStructureBuilder.hpp b/Core/include/Acts/Detector/LayerStructureBuilder.hpp index 9dd0e0a8e8e..02fd726824e 100644 --- a/Core/include/Acts/Detector/LayerStructureBuilder.hpp +++ b/Core/include/Acts/Detector/LayerStructureBuilder.hpp @@ -91,8 +91,9 @@ class LayerStructureBuilder : public IInternalStructureBuilder { /// Minimum number of surfaces to build an internal structure /// - otherwise the tryAll options is used unsigned int nMinimalSurfaces = 4u; - /// Polyhedron approximations - unsigned int nSegments = 1u; + /// Polyhedron approximations: number of segments to be used + /// to approximate a quarter of a circle + unsigned int quarterSegments = 1u; /// Extra information, mainly for screen output std::string auxiliary = ""; }; diff --git a/Core/include/Acts/Geometry/Polyhedron.hpp b/Core/include/Acts/Geometry/Polyhedron.hpp index 2a6eb47d765..00ccaaab4c5 100644 --- a/Core/include/Acts/Geometry/Polyhedron.hpp +++ b/Core/include/Acts/Geometry/Polyhedron.hpp @@ -39,6 +39,7 @@ struct Polyhedron { /// @param facesIn List of lists of indices for faces. /// @param triangularMeshIn List of lists of indices for a triangular mesh /// @param isExact A dedicated flag if this is exact or not + /// /// @note This creates copies of the input vectors Polyhedron(const std::vector<Vector3>& verticesIn, const std::vector<FaceType>& facesIn, diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 17e64f2a505..f1283ec63b8 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -133,19 +133,20 @@ class AnnulusBounds : public DiscBounds { std::vector<Vector2> corners() const; /// This method returns the xy coordinates of the four corners of the - /// bounds in module coordinates (in x/y) + /// bounds in module coordinates (in x/y), and if quarterSegments is bigger or + /// equal to 0, the curved part of the segment is included and approximated + /// by the corresponding number of segments. + /// /// Starting from the upper right (max R, pos locX) and proceeding clock-wise /// i.e. (max R; pos locX), (min R; pos locX), (min R; neg loc X), (max R: neg /// locX) /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line - /// - /// @note that that if @c lseg > 0, the extrema points are given, - /// which may slightly alter the number of segments returned + /// @param quarterSegments the number of segments used to approximate + /// a quarter of a circle /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg) const override; + std::vector<Vector2> vertices( + unsigned int quarterSegments = 2u) const override; /// This method returns inner radius double rMin() const final; diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index c15d84d1c23..a2b2572bba8 100644 --- a/Core/include/Acts/Surfaces/ConeSurface.hpp +++ b/Core/include/Acts/Surfaces/ConeSurface.hpp @@ -200,15 +200,16 @@ class ConeSurface : public RegularSurface { /// Return a Polyhedron for the surfaces /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg Number of segments along curved lines, it represents - /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema - /// are given - /// @note that a surface transform can invalidate the extrema - /// in the transformed space + /// @param quarterSegments Number of segments used to approximate a quarter + /// + /// @note The phi extrema points at (-pi, -1/2 pi, 0, 1/2 pi) that fall within + /// the surface will be inserted to guarantee an appropriate extent + /// measurement in x and y /// /// @return A list of vertices and a face/facett description of it - Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const override; + Polyhedron polyhedronRepresentation( + const GeometryContext& gctx, + unsigned int quarterSegments = 2u) const override; /// Return properly formatted class name for screen output std::string name() const override; diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index 2f116ddcee5..e802056e7fd 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -114,13 +114,13 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// Return the vertices /// - /// @param lseg the number of segments used to approximate + /// @param ignoredSegments the number of segments used to approximate /// and eventually curved line /// /// @note the number of segments is ignored in this representation /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg = 1) const final; + std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final; /// Return a rectangle bounds object that encloses this polygon. /// @return The rectangular bounds diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 505d9f95d82..9f1a61955ae 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -111,7 +111,7 @@ bool Acts::ConvexPolygonBounds<N>::inside( template <int N> std::vector<Acts::Vector2> Acts::ConvexPolygonBounds<N>::vertices( - unsigned int /*lseg*/) const { + unsigned int /*ignoredSegments*/) const { return {m_vertices.begin(), m_vertices.end()}; } diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index 7453029c213..51508055e06 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -112,12 +112,18 @@ class CylinderBounds : public SurfaceBounds { /// Returns true for full phi coverage bool coversFullAzimuth() const; - /// Create the bows/circles on either side of the cylinder + /// Create the bow/circle vertices on either side of the cylinder /// - /// @param trans is the global transform - /// @param lseg are the numbero if phi segments - std::vector<Vector3> createCircles(const Transform3 trans, - std::size_t lseg) const; + /// @param transform is the global transform + /// @param quarterSegments is the number of segments to approximate a quarter + /// of a circle. In order to symmetrize fully closed and sectoral cylinders, + /// also in the first case the two end points are given (albeit they overlap) + /// in -pi / pi + /// + /// @return a singlevector containing the vertices from one side and then + /// from the other side consecutively + std::vector<Vector3> circleVertices(const Transform3 transform, + unsigned int quarterSegments) const; /// Output Method for std::ostream std::ostream& toStream(std::ostream& sl) const final; diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 82bc1c68bc2..09b953afce1 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -214,14 +214,20 @@ class CylinderSurface : public RegularSurface { /// Return a Polyhedron for a cylinder /// + /// This method represents the cylinder as a polyhedron with a given number + /// of segments to represent a quarter of a full circle. The polyedron will + /// consist of the vertices of the cylinder on both sides, and faces between + /// them, both as rectangular faces and as triangular faces. + /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg Number of segments along curved lines, it represents - /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema - /// are given + /// @param quarterSegments The number of segments to approximate a quarter of the + /// full circle; it's chosen to be 1, only the extrema points (-pi, -0.5pi, + /// 0., 0.5pi) are inserted to capture the correct extent in the x-y plane /// /// @return A list of vertices and a face/facett description of it - Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const override; + Polyhedron polyhedronRepresentation( + const GeometryContext& gctx, + unsigned int quarterSegments = 2u) const override; /// Calculate the derivative of path length at the geometry constraint or /// point-of-closest-approach w.r.t. alignment parameters of the surface (i.e. diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index ddaf727a3e9..7497bd22309 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -90,15 +90,13 @@ class DiamondBounds : public PlanarBounds { bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const final; - /// Return the vertices + /// Return the vertices that describe this shape /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line - /// - /// @note the number of segments is ignored for this representation + /// @param ignoredSegments is an ignored parameter only used for + /// curved bound segments /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg = 1) const final; + std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final; // Bounding box representation const RectangleBounds& boundingBox() const final; @@ -128,8 +126,7 @@ inline std::vector<double> DiamondBounds::values() const { } inline void DiamondBounds::checkConsistency() noexcept(false) { - if (std::any_of(m_values.begin(), m_values.end(), - [](auto v) { return v <= 0.; })) { + if (std::ranges::any_of(m_values, [](auto v) { return v <= 0.; })) { throw std::invalid_argument("DiamondBounds: negative half length."); } if (get(eHalfLengthXnegY) > get(eHalfLengthXzeroY) || diff --git a/Core/include/Acts/Surfaces/DiscBounds.hpp b/Core/include/Acts/Surfaces/DiscBounds.hpp index 22bcce3f960..626f8e2405c 100644 --- a/Core/include/Acts/Surfaces/DiscBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscBounds.hpp @@ -29,14 +29,13 @@ class DiscBounds : public SurfaceBounds { /// Return the vertices /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line, the number refers to full 2*PI - /// - /// @note that the extremas are given, which may slightly alter the - /// number of segments returned + /// @param quarterSegments The number of segments used to describe a quarter + /// of a circle, if it is 1, then only the extrema points in phi are inserted + /// next to the segment corners /// /// @return vector for vertices in 2D - virtual std::vector<Vector2> vertices(unsigned int lseg) const = 0; + virtual std::vector<Vector2> vertices( + unsigned int quarterSegments = 2u) const = 0; /// Returns a reference radius for binning virtual double binningValueR() const = 0; diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index 112ec0b30d2..e2c10df4023 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -312,13 +312,12 @@ class DiscSurface : public RegularSurface { /// Return a Polyhedron for the surfaces /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg Number of segments along curved lines, it represents - /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema - /// are given + /// @param quarterSegments Number of segments used to describe the + /// quarter of a full circle /// /// @return A list of vertices and a face/facett description of it - Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const override; + Polyhedron polyhedronRepresentation( + const GeometryContext& gctx, unsigned int quarterSegments) const override; /// Calculate the derivative of bound track parameters local position w.r.t. /// position in local 3D Cartesian coordinates diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index 1e4d9d7706a..a3e4e5ea28f 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -123,13 +123,11 @@ class DiscTrapezoidBounds : public DiscBounds { /// This method returns the xy coordinates of the four corners of the /// bounds in module coorindates (in xy) /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line - /// - /// @note that the number of segments are ignored for this surface + /// @param ignoredSegments is an ignored parameter only used for + /// curved bound segments /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg) const final; + std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final; private: std::array<double, eSize> m_values; diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index dc6983b86bb..aec08d10381 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -92,14 +92,13 @@ class EllipseBounds : public PlanarBounds { /// Return the vertices /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line, here it refers to the full 2PI Ellipse - /// - /// @note the number of segments to may be altered by also providing - /// the extremas in all direction + /// @param quarterSegments is the number of segments to approximate a quarter + /// of a circle. In order to symmetrize fully closed and sectoral cylinders, + /// also in the first case the two end points are given (albeit they overlap) + /// in -pi / pi /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg) const final; + std::vector<Vector2> vertices(unsigned int quarterSegments) const final; // Bounding box representation const RectangleBounds& boundingBox() const final; diff --git a/Core/include/Acts/Surfaces/PerigeeSurface.hpp b/Core/include/Acts/Surfaces/PerigeeSurface.hpp index 37b1044f0ce..1d913ecc43e 100644 --- a/Core/include/Acts/Surfaces/PerigeeSurface.hpp +++ b/Core/include/Acts/Surfaces/PerigeeSurface.hpp @@ -76,11 +76,11 @@ class PerigeeSurface : public LineSurface { /// Return a Polyhedron for the surfaces /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg is ignored for a perigee @note ignored + /// @param ingoreSegments is an ignored parameter /// /// @return A list of vertices and a face/facett description of it Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const final; + unsigned int ingoreSegments) const final; protected: /// Output Method for std::ostream diff --git a/Core/include/Acts/Surfaces/PlanarBounds.hpp b/Core/include/Acts/Surfaces/PlanarBounds.hpp index 8c4363dbbc3..28bc0e42b60 100644 --- a/Core/include/Acts/Surfaces/PlanarBounds.hpp +++ b/Core/include/Acts/Surfaces/PlanarBounds.hpp @@ -26,14 +26,15 @@ class PlanarBounds : public SurfaceBounds { public: /// Return the vertices /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line + /// @param quarterSegments is the number of segments used to describe curved + /// segments in a quarter of the phi range. If it is 1, then only the extrema + /// points in phi are inserted next to the segment corners. /// - /// @note that the extremas are given, which may slightly alter the - /// number of segments returned + /// @note for planar bounds without curved segments @c quarterSegments is ignored /// /// @return vector for vertices in 2D - virtual std::vector<Vector2> vertices(unsigned int lseg = 1) const = 0; + virtual std::vector<Vector2> vertices( + unsigned int quarterSegments = 2u) const = 0; /// Bounding box parameters /// diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index 866cb4d4585..2bc65398f8d 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -198,13 +198,15 @@ class PlaneSurface : public RegularSurface { /// Return a Polyhedron for the surfaces /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg Number of segments along curved lines, it represents - /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema - /// are given + /// @param quarterSegments is the number of segments used to describe curved + /// segments in a quarter of the phi range. If it is 1, then only the extrema + /// points in phi are inserted next to the segment corners. + /// + /// @note for planar surfaces without curved segments @c quarterSegments is ignored /// /// @return A list of vertices and a face/facett description of it - Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const override; + Polyhedron polyhedronRepresentation( + const GeometryContext& gctx, unsigned int quarterSegments) const override; /// Return properly formatted class name for screen output std::string name() const override; diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 7ad67f3aafb..aba1743fa74 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -86,13 +86,12 @@ class RectangleBounds : public PlanarBounds { /// Return the vertices /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line - /// + /// @param quarterSegments is the number of segments used to describe curved + /// segments in a quarter of the phi range. /// @note the number of segments is ignored in this representation /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg = 1) const final; + std::vector<Vector2> vertices(unsigned int quarterSegments = 0u) const final; // Bounding box representation const RectangleBounds& boundingBox() const final; diff --git a/Core/include/Acts/Surfaces/StrawSurface.hpp b/Core/include/Acts/Surfaces/StrawSurface.hpp index 88fd8423525..706bb7d9823 100644 --- a/Core/include/Acts/Surfaces/StrawSurface.hpp +++ b/Core/include/Acts/Surfaces/StrawSurface.hpp @@ -92,13 +92,13 @@ class StrawSurface : public LineSurface { /// Return a Polyhedron for the surfaces /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg Number of segments along curved lines, it represents - /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema - /// are given @note if lseg is set to 1 then only the straw is created + /// @param quarterSegments is the number of segments used to describe curved + /// segments in a quarter of the phi range. If it is 1, then only the extrema + /// points in phi are inserted next to the segment corners. /// /// @return A list of vertices and a face/facett description of it Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const final; + unsigned int quarterSegments) const final; }; inline Surface::SurfaceType StrawSurface::type() const { diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index c93e7d3c9aa..3a823671823 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -418,20 +418,21 @@ class Surface : public virtual GeometryObject, /// Return properly formatted class name virtual std::string name() const = 0; - /// Return a Polyhedron for this object + /// Return a Polyhedron for surface objects /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg Number of segments along curved lines, if the lseg - /// is set to one, only the corners and the extrema are given, - /// otherwise it represents the number of segments for a full 2*M_PI - /// circle and is scaled to the relevant sector + /// @param quarterSegments The number of segemtns to approximate a 0.5*pi sector, + /// which represents a quarter of the full circle + /// + /// @note In order to symmetrize the code between sectoral and closed cylinders + /// in case of closed cylinders, both (-pi, pi) are given as separate vertices /// /// @note An internal surface transform can invalidate the extrema /// in the transformed space /// /// @return A list of vertices and a face/facett description of it - virtual Polyhedron polyhedronRepresentation(const GeometryContext& gctx, - std::size_t lseg) const = 0; + virtual Polyhedron polyhedronRepresentation( + const GeometryContext& gctx, unsigned int quarterSegments = 2u) const = 0; /// The derivative of bound track parameters w.r.t. alignment /// parameters of its reference surface (i.e. local frame origin in diff --git a/Core/include/Acts/Surfaces/SurfaceConcept.hpp b/Core/include/Acts/Surfaces/SurfaceConcept.hpp index e09b420ee9f..2abcda1d5d7 100644 --- a/Core/include/Acts/Surfaces/SurfaceConcept.hpp +++ b/Core/include/Acts/Surfaces/SurfaceConcept.hpp @@ -87,7 +87,7 @@ concept SurfaceConcept = requires(S s, const S cs, S s2, const S cs2, { cs.name() } -> std::same_as<std::string>; { - cs.polyhedronRepresentation(gctx, std::declval<std::size_t>()) + cs.polyhedronRepresentation(gctx, std::declval<unsigned int>()) } -> std::same_as<Polyhedron>; { diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index 3f116dc4110..8ccd3a5c928 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -108,13 +108,13 @@ class TrapezoidBounds : public PlanarBounds { /// Return the vertices /// - /// @param lseg the number of segments used to approximate - /// and eventually curved line + /// @param ignoredSegments is and ignored parameter used to describe + /// the number of segments to approximate curved sectors. /// /// @note the number of segments is ignored in this representation /// /// @return vector for vertices in 2D - std::vector<Vector2> vertices(unsigned int lseg = 1) const final; + std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final; // Bounding box representation const RectangleBounds& boundingBox() const final; diff --git a/Core/include/Acts/Surfaces/detail/FacesHelper.hpp b/Core/include/Acts/Surfaces/detail/FacesHelper.hpp index 260f7ce3b01..ca2922c325e 100644 --- a/Core/include/Acts/Surfaces/detail/FacesHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/FacesHelper.hpp @@ -21,7 +21,7 @@ namespace Acts::detail { struct FacesHelper { using FaceVector = std::vector<Polyhedron::FaceType>; - /// @brief This method words for all convex type surface setups + /// @brief This method works for all convex type surface setups /// It includes: /// /// Rectangle / Triangle / Polygon @@ -60,14 +60,12 @@ struct FacesHelper { /// vector is splittable in half into the two bows. /// /// @param vertices The vector of vertices - /// @param fullTwoPi The indicator if the concentric face is closed static std::pair<FaceVector, FaceVector> cylindricalFaceMesh( - const std::vector<Vector3>& vertices, bool fullTwoPi = true) { + const std::vector<Vector3>& vertices) { FaceVector faces; FaceVector triangularMesh; std::size_t nqfaces = static_cast<std::size_t>(0.5 * vertices.size()); - std::size_t reduce = (!fullTwoPi) ? 1 : 0; - for (std::size_t iface = 0; iface < nqfaces - reduce; ++iface) { + for (std::size_t iface = 0; iface < nqfaces - 1; ++iface) { std::size_t p2 = (iface + 1 == nqfaces) ? 0 : iface + 1; std::vector<std::size_t> face = {iface, p2, p2 + nqfaces, nqfaces + iface}; diff --git a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp index 71938626eaf..3e63c7189e6 100644 --- a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp @@ -22,51 +22,53 @@ namespace Acts::detail::VerticesHelper { /// A method that inserts the cartesian extrema points and segments /// a curved segment into sub segments /// -/// @param phiMin the minimum Phi of the bounds object -/// @param phiMax the maximum Phi of the bounds object +/// @param phiMin the minimum phi value +/// @param phiMax The second phi value /// @param phiRef is a vector of reference phi values to be included as well -/// @param phiTolerance is the tolerance for reference phi insertion -/// @return a vector +/// @param quarterSegments number of segments used to approximate a segment quarter +/// +/// @return a vector of generated phi values std::vector<ActsScalar> phiSegments(ActsScalar phiMin = -M_PI, ActsScalar phiMax = M_PI, const std::vector<ActsScalar>& phiRefs = {}, - ActsScalar phiTolerance = 1e-6); + unsigned int quarterSegments = 2u); /// Helper method to create a regular 2 or 3 D segment -/// between two phi values +/// between two phi values with a given number of segments +/// +/// It will insert the phi at extrema points and reference points, it uses +/// a minimum approximation of a circle with 8 segments /// /// @tparam vertex_t Type of vertex to be applied /// @tparam transform_t Optional transform /// -/// @param vertices [in,out] The 3D vertices to be filled -/// @param rxy The radius description if first +/= second: ellipse -/// @param phi1 The first phi value -/// @param phi2 The second phi value -/// @param lseg The number of segments for full 2*PI -/// @param addon The additional segments to be built +/// @param rXY The radius description if first +/= second: ellipse +/// @param phiMin the minimum phi value +/// @param phiMax the second phi value +/// @param phiRef is a vector of reference phi values to be included as well +/// @param quarterSegments number of segments used to approximate a segment quarter /// @param offset The out of plane offset position of the bow /// @param transform The transform applied (optional) +/// +/// @return a vector of vertices template <typename vertex_t, typename transform_t> -void createSegment(std::vector<vertex_t>& vertices, - std::pair<ActsScalar, ActsScalar> rxy, ActsScalar phi1, - ActsScalar phi2, unsigned int lseg, int addon = 0, - const vertex_t& offset = vertex_t::Zero(), - const transform_t& transform = transform_t::Identity()) { - // Calculate the number of segments - 1 is the minimum - unsigned int segs = - static_cast<unsigned int>(std::abs(phi2 - phi1) / (2 * M_PI) * lseg); - segs = segs > 0 ? segs : 1; - ActsScalar phistep = (phi2 - phi1) / segs; - // Create the segments - for (unsigned int iphi = 0; iphi < segs + addon; ++iphi) { - ActsScalar phi = phi1 + iphi * phistep; +std::vector<vertex_t> segmentVertices( + std::pair<ActsScalar, ActsScalar> rXY, ActsScalar phiMin, ActsScalar phiMax, + const std::vector<ActsScalar>& phiRefs = {}, + unsigned int quarterSegments = 2u, + const vertex_t& offset = vertex_t::Zero(), + const transform_t& transform = transform_t::Identity()) { + std::vector<vertex_t> vertices; + std::vector<ActsScalar> phis = + phiSegments(phiMin, phiMax, phiRefs, quarterSegments); + for (ActsScalar phi : phis) { vertex_t vertex = vertex_t::Zero(); - vertex(0) = rxy.first * std::cos(phi); - vertex(1) = rxy.second * std::sin(phi); - + vertex(0) = rXY.first * std::cos(phi); + vertex(1) = rXY.second * std::sin(phi); vertex = vertex + offset; vertices.push_back(transform * vertex); } + return vertices; } /// Construct vertices on an ellipse-like bound object. @@ -76,14 +78,15 @@ void createSegment(std::vector<vertex_t>& vertices, /// @param outerRx The radius of the outer ellipse (in x) /// @param outerRy The radius of the outer ellipse (in y) /// @param avgPhi The phi direction of the center if sector -/// @param halfPhi The half phi sector if sector -/// @param lseg The number of segments for for a full 2*pi segment +/// @param halfPhi The half phi sector of the ellipse +/// @param quarterSegments number of segments used to approximate a segment quarter +/// /// @return a vector of 2d-vectors std::vector<Vector2> ellipsoidVertices(ActsScalar innerRx, ActsScalar innerRy, ActsScalar outerRx, ActsScalar outerRy, ActsScalar avgPhi = 0., ActsScalar halfPhi = M_PI, - unsigned int lseg = 1); + unsigned int quarterSegments = 2u); /// Construct vertices on an disc/wheel-like bound object. /// @@ -91,12 +94,14 @@ std::vector<Vector2> ellipsoidVertices(ActsScalar innerRx, ActsScalar innerRy, /// @param outerR The radius of the outer circle (sector) /// @param avgPhi The phi direction of the center if sector /// @param halfPhi The half phi sector if sector -/// @param lseg The number of segments for for a full 2*pi segment +/// @param quarterSegments number of segments used to approximate a segment quarter +/// /// @return a vector of 2d-vectors std::vector<Vector2> circularVertices(ActsScalar innerR, ActsScalar outerR, ActsScalar avgPhi = 0., ActsScalar halfPhi = M_PI, - unsigned int lseg = 1); + unsigned int quarterSegments = 2u); + /// Check if the point is inside the polygon w/o any tolerances. /// /// @tparam vertex_container_t is an iterable container diff --git a/Core/include/Acts/Utilities/Iterator.hpp b/Core/include/Acts/Utilities/Iterator.hpp index ccdff61c061..a69e6c77faa 100644 --- a/Core/include/Acts/Utilities/Iterator.hpp +++ b/Core/include/Acts/Utilities/Iterator.hpp @@ -22,6 +22,8 @@ class ContainerIndexIterator { using container_type = std::conditional_t<Const, const _Container, _Container>; using difference_type = std::ptrdiff_t; + using pointer = void; + using reference = void; ContainerIndexIterator() : m_container(nullptr), m_index(0) {} diff --git a/Core/include/Acts/Visualization/ViewConfig.hpp b/Core/include/Acts/Visualization/ViewConfig.hpp index 6fcf1b47984..0414fa58aba 100644 --- a/Core/include/Acts/Visualization/ViewConfig.hpp +++ b/Core/include/Acts/Visualization/ViewConfig.hpp @@ -112,8 +112,8 @@ struct ViewConfig { double lineThickness = 0.15; /// The visual surface thickness for this object double surfaceThickness = 0.15; - /// The number of segments to approximate full 2pi - unsigned int nSegments = 72; + /// The number of segments to approximate a quarter of the circle + unsigned int quarterSegments = 72; /// Whether to triangulate or not bool triangulate = false; /// Write name - non-empty string indicates writing diff --git a/Core/include/Acts/Visualization/detail/ObjVisualization3D.ipp b/Core/include/Acts/Visualization/detail/ObjVisualization3D.ipp index 2419ef8c546..354ef518bef 100644 --- a/Core/include/Acts/Visualization/detail/ObjVisualization3D.ipp +++ b/Core/include/Acts/Visualization/detail/ObjVisualization3D.ipp @@ -160,8 +160,8 @@ void ObjVisualization3D<T>::write(std::ostream& os, std::ostream& mos) const { } } os << "f"; - for (std::size_t i = 0; i < fc.size(); i++) { - os << " " << fc[i] + 1; + for (auto fi : fc) { + os << " " << fi + 1; } os << "\n"; ++is; diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index d936b27398a..94766a80d0d 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -256,7 +256,8 @@ Acts::Experimental::LayerStructureBuilder::construct( if (!support.internalConstraints.empty()) { // Estimate the extent from the surfaces for (const auto& s : internalSurfaces) { - auto sPolyhedron = s->polyhedronRepresentation(gctx, m_cfg.nSegments); + auto sPolyhedron = + s->polyhedronRepresentation(gctx, m_cfg.quarterSegments); supportExtent.extend(sPolyhedron.extent(), support.internalConstraints); } diff --git a/Core/src/Geometry/Extent.cpp b/Core/src/Geometry/Extent.cpp index 9e520d171a3..2f07f6358bc 100644 --- a/Core/src/Geometry/Extent.cpp +++ b/Core/src/Geometry/Extent.cpp @@ -144,8 +144,7 @@ bool Acts::Extent::contains(const Extent& rhs, // Check all if (!bValue.has_value()) { - return std::all_of(allBinningValues().begin(), allBinningValues().end(), - checkContainment); + return std::ranges::all_of(allBinningValues(), checkContainment); } // Check specific return checkContainment(bValue.value()); @@ -163,8 +162,7 @@ bool Acts::Extent::intersects(const Extent& rhs, // Check all if (!bValue.has_value()) { - return std::any_of(allBinningValues().begin(), allBinningValues().end(), - checkIntersect); + return std::ranges::any_of(allBinningValues(), checkIntersect); } // Check specific return checkIntersect(bValue.value()); diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index d96b3bc7e80..34c7b5c468b 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -103,33 +103,30 @@ std::vector<Acts::Vector2> Acts::AnnulusBounds::corners() const { } std::vector<Acts::Vector2> Acts::AnnulusBounds::vertices( - unsigned int lseg) const { - if (lseg > 0) { - // List of vertices counter-clockwise starting with left inner - std::vector<Acts::Vector2> rvertices; - + unsigned int quarterSegments) const { + if (quarterSegments > 0u) { using VectorHelpers::phi; - auto phisInner = detail::VerticesHelper::phiSegments( - phi(m_inRightStripXY - m_moduleOrigin), - phi(m_inLeftStripXY - m_moduleOrigin)); - auto phisOuter = detail::VerticesHelper::phiSegments( - phi(m_outLeftStripXY - m_moduleOrigin), - phi(m_outRightStripXY - m_moduleOrigin)); - - // Inner bow from phi_min -> phi_max - for (unsigned int iseg = 0; iseg < phisInner.size() - 1; ++iseg) { - int addon = (iseg == phisInner.size() - 2) ? 1 : 0; - detail::VerticesHelper::createSegment<Vector2, Transform2>( - rvertices, {get(eMinR), get(eMinR)}, phisInner[iseg], - phisInner[iseg + 1], lseg, addon); - } - // Upper bow from phi_max -> phi_min - for (unsigned int iseg = 0; iseg < phisOuter.size() - 1; ++iseg) { - int addon = (iseg == phisOuter.size() - 2) ? 1 : 0; - detail::VerticesHelper::createSegment<Vector2, Transform2>( - rvertices, {get(eMaxR), get(eMaxR)}, phisOuter[iseg], - phisOuter[iseg + 1], lseg, addon); - } + + ActsScalar phiMinInner = phi(m_inRightStripXY - m_moduleOrigin); + ActsScalar phiMaxInner = phi(m_inLeftStripXY - m_moduleOrigin); + + ActsScalar phiMinOuter = phi(m_outRightStripXY - m_moduleOrigin); + ActsScalar phiMaxOuter = phi(m_outLeftStripXY - m_moduleOrigin); + + // Inner bow from phi_min -> phi_max (needs to be reversed) + std::vector<Acts::Vector2> rvertices = + detail::VerticesHelper::segmentVertices<Vector2, Transform2>( + {get(eMinR), get(eMinR)}, phiMinInner, phiMaxInner, {}, + quarterSegments); + std::reverse(rvertices.begin(), rvertices.end()); + + // Outer bow from phi_min -> phi_max + auto overtices = + detail::VerticesHelper::segmentVertices<Vector2, Transform2>( + {get(eMaxR), get(eMaxR)}, phiMinOuter, phiMaxOuter, {}, + quarterSegments); + rvertices.insert(rvertices.end(), overtices.begin(), overtices.end()); + std::for_each(rvertices.begin(), rvertices.end(), [&](Acts::Vector2& rv) { rv += m_moduleOrigin; }); return rvertices; diff --git a/Core/src/Surfaces/CMakeLists.txt b/Core/src/Surfaces/CMakeLists.txt index 2f704f595c6..07cc26cbfcf 100644 --- a/Core/src/Surfaces/CMakeLists.txt +++ b/Core/src/Surfaces/CMakeLists.txt @@ -24,7 +24,7 @@ target_sources( SurfaceArray.cpp SurfaceError.cpp TrapezoidBounds.cpp - VerticesHelper.cpp + detail/VerticesHelper.cpp RegularSurface.cpp CurvilinearSurface.cpp detail/AlignmentHelper.cpp diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 98f1484609d..ce10c59815f 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -183,19 +183,18 @@ const Acts::ConeBounds& Acts::ConeSurface::bounds() const { } Acts::Polyhedron Acts::ConeSurface::polyhedronRepresentation( - const GeometryContext& gctx, std::size_t lseg) const { + const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector<Vector3> vertices; std::vector<Polyhedron::FaceType> faces; std::vector<Polyhedron::FaceType> triangularMesh; - - double minZ = bounds().get(ConeBounds::eMinZ); - double maxZ = bounds().get(ConeBounds::eMaxZ); + ActsScalar minZ = bounds().get(ConeBounds::eMinZ); + ActsScalar maxZ = bounds().get(ConeBounds::eMaxZ); if (minZ == -std::numeric_limits<double>::infinity() || maxZ == std::numeric_limits<double>::infinity()) { throw std::domain_error( - "Polyhedron repr of boundless surface not possible"); + "Polyhedron representation of boundless surface is not possible"); } auto ctransform = transform(gctx); @@ -208,64 +207,53 @@ Acts::Polyhedron Acts::ConeSurface::polyhedronRepresentation( } // Cone parameters - double hPhiSec = bounds().get(ConeBounds::eHalfPhiSector); - double avgPhi = bounds().get(ConeBounds::eAveragePhi); - bool fullCone = (hPhiSec == M_PI); - - // Get the phi segments from the helper - auto phiSegs = fullCone ? detail::VerticesHelper::phiSegments() - : detail::VerticesHelper::phiSegments( - avgPhi - hPhiSec, avgPhi + hPhiSec, - {static_cast<ActsScalar>(avgPhi)}); - - // Negative cone if exists - std::vector<double> coneSides; + ActsScalar hPhiSec = bounds().get(ConeBounds::eHalfPhiSector); + ActsScalar avgPhi = bounds().get(ConeBounds::eAveragePhi); + std::vector<ActsScalar> refPhi = {}; + if (bool fullCone = (hPhiSec == M_PI); !fullCone) { + refPhi = {avgPhi}; + } + + // Add the cone sizes + std::vector<ActsScalar> coneSides; if (std::abs(minZ) > s_onSurfaceTolerance) { coneSides.push_back(minZ); } if (std::abs(maxZ) > s_onSurfaceTolerance) { coneSides.push_back(maxZ); } + for (auto& z : coneSides) { - // Remember the first vertex std::size_t firstIv = vertices.size(); // Radius and z offset double r = std::abs(z) * bounds().tanAlpha(); Vector3 zoffset(0., 0., z); - for (unsigned int iseg = 0; iseg < phiSegs.size() - 1; ++iseg) { - int addon = (iseg == phiSegs.size() - 2 && !fullCone) ? 1 : 0; - detail::VerticesHelper::createSegment(vertices, {r, r}, phiSegs[iseg], - phiSegs[iseg + 1], lseg, addon, - zoffset, ctransform); - } - // Create the faces + auto svertices = detail::VerticesHelper::segmentVertices( + {r, r}, avgPhi - hPhiSec, avgPhi + hPhiSec, refPhi, quarterSegments, + zoffset, ctransform); + vertices.insert(vertices.end(), svertices.begin(), svertices.end()); + // If the tip exists, the faces need to be triangular if (tipExists) { - for (std::size_t iv = firstIv + 2; iv < vertices.size() + 1; ++iv) { - std::size_t one = 0, two = iv - 1, three = iv - 2; + for (std::size_t iv = firstIv + 1; iv < svertices.size() + firstIv; + ++iv) { + std::size_t one = 0, two = iv, three = iv - 1; if (z < 0.) { std::swap(two, three); } faces.push_back({one, two, three}); } - // Complete cone if necessary - if (fullCone) { - if (z > 0.) { - faces.push_back({0, firstIv, vertices.size() - 1}); - } else { - faces.push_back({0, vertices.size() - 1, firstIv}); - } - } } } + // if no tip exists, connect the two bows if (tipExists) { triangularMesh = faces; } else { - auto facesMesh = - detail::FacesHelper::cylindricalFaceMesh(vertices, fullCone); + auto facesMesh = detail::FacesHelper::cylindricalFaceMesh(vertices); faces = facesMesh.first; triangularMesh = facesMesh.second; } + return Polyhedron(vertices, faces, triangularMesh, false); } diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index 76e3e902ea7..e7d5032c993 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -104,45 +104,40 @@ std::ostream& Acts::CylinderBounds::toStream(std::ostream& sl) const { return sl; } -std::vector<Acts::Vector3> Acts::CylinderBounds::createCircles( - const Transform3 ctrans, std::size_t lseg) const { +std::vector<Acts::Vector3> Acts::CylinderBounds::circleVertices( + const Transform3 transform, unsigned int quarterSegments) const { std::vector<Vector3> vertices; double avgPhi = get(eAveragePhi); double halfPhi = get(eHalfPhiSector); - bool fullCylinder = coversFullAzimuth(); - - // Get the phi segments from the helper - ensures extra points - auto phiSegs = fullCylinder ? detail::VerticesHelper::phiSegments() - : detail::VerticesHelper::phiSegments( - avgPhi - halfPhi, avgPhi + halfPhi, - {static_cast<ActsScalar>(avgPhi)}); + std::vector<ActsScalar> phiRef = {}; + if (bool fullCylinder = coversFullAzimuth(); fullCylinder) { + phiRef = {static_cast<ActsScalar>(avgPhi)}; + } // Write the two bows/circles on either side std::vector<int> sides = {-1, 1}; for (auto& side : sides) { - for (std::size_t iseg = 0; iseg < phiSegs.size() - 1; ++iseg) { - int addon = (iseg == phiSegs.size() - 2 && !fullCylinder) ? 1 : 0; - /// Helper method to create the segment - detail::VerticesHelper::createSegment( - vertices, {get(eR), get(eR)}, phiSegs[iseg], phiSegs[iseg + 1], lseg, - addon, Vector3(0., 0., side * get(eHalfLengthZ)), ctrans); - } + /// Helper method to create the segment + auto svertices = detail::VerticesHelper::segmentVertices( + {get(eR), get(eR)}, avgPhi - halfPhi, avgPhi + halfPhi, phiRef, + quarterSegments, Vector3(0., 0., side * get(eHalfLengthZ)), transform); + vertices.insert(vertices.end(), svertices.begin(), svertices.end()); } - double bevelMinZ = get(eBevelMinZ); - double bevelMaxZ = get(eBevelMaxZ); + ActsScalar bevelMinZ = get(eBevelMinZ); + ActsScalar bevelMaxZ = get(eBevelMaxZ); // Modify the vertices position if bevel is defined if ((bevelMinZ != 0. || bevelMaxZ != 0.) && vertices.size() % 2 == 0) { auto halfWay = vertices.end() - vertices.size() / 2; - double mult{1}; - auto invCtrans = ctrans.inverse(); - auto func = [&mult, &ctrans, &invCtrans](Vector3& v) { - v = invCtrans * v; + ActsScalar mult{1}; + auto invTransform = transform.inverse(); + auto func = [&mult, &transform, &invTransform](Vector3& v) { + v = invTransform * v; v(2) += v(1) * mult; - v = ctrans * v; + v = transform * v; }; if (bevelMinZ != 0.) { mult = std::tan(-bevelMinZ); diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 29ca1edf150..a39dce4a4fa 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -188,19 +188,15 @@ const Acts::CylinderBounds& Acts::CylinderSurface::bounds() const { } Acts::Polyhedron Acts::CylinderSurface::polyhedronRepresentation( - const GeometryContext& gctx, std::size_t lseg) const { + const GeometryContext& gctx, unsigned int quarterSegments) const { auto ctrans = transform(gctx); // Prepare vertices and faces - std::vector<Vector3> vertices = bounds().createCircles(ctrans, lseg); - std::vector<Polyhedron::FaceType> faces; - std::vector<Polyhedron::FaceType> triangularMesh; - - bool fullCylinder = bounds().coversFullAzimuth(); - - auto facesMesh = - detail::FacesHelper::cylindricalFaceMesh(vertices, fullCylinder); - return Polyhedron(vertices, facesMesh.first, facesMesh.second, false); + std::vector<Vector3> vertices = + bounds().circleVertices(ctrans, quarterSegments); + auto [faces, triangularMesh] = + detail::FacesHelper::cylindricalFaceMesh(vertices); + return Polyhedron(vertices, faces, triangularMesh, false); } Acts::Vector3 Acts::CylinderSurface::rotSymmetryAxis( diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index b0239eca3f3..7febf8e7f2d 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -27,7 +27,7 @@ bool Acts::DiamondBounds::inside( } std::vector<Acts::Vector2> Acts::DiamondBounds::vertices( - unsigned int /*lseg*/) const { + unsigned int /*ignoredSegments*/) const { // Vertices starting at lower left (min rel. phi) // counter-clockwise double x1 = get(DiamondBounds::eHalfLengthXnegY); diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index c46390ff1c9..aa2f3f7036f 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -154,12 +154,9 @@ const Acts::SurfaceBounds& Acts::DiscSurface::bounds() const { } Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( - const GeometryContext& gctx, std::size_t lseg) const { + const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector<Vector3> vertices; - std::vector<Polyhedron::FaceType> faces; - std::vector<Polyhedron::FaceType> triangularMesh; - // Understand the disc bool fullDisc = m_bounds->coversFullAzimuth(); bool toCenter = m_bounds->rMin() < s_onSurfaceTolerance; @@ -167,7 +164,7 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( bool exactPolyhedron = (m_bounds->type() == SurfaceBounds::eDiscTrapezoid); bool addCentreFromConvexFace = (m_bounds->type() != SurfaceBounds::eAnnulus); if (m_bounds) { - auto vertices2D = m_bounds->vertices(lseg); + auto vertices2D = m_bounds->vertices(quarterSegments); vertices.reserve(vertices2D.size() + 1); Vector3 wCenter(0., 0., 0); for (const auto& v2D : vertices2D) { @@ -182,22 +179,19 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( if (addCentreFromConvexFace) { vertices.push_back(wCenter); } - auto facesMesh = detail::FacesHelper::convexFaceMesh(vertices, true); - faces = facesMesh.first; - triangularMesh = facesMesh.second; + auto [faces, triangularMesh] = + detail::FacesHelper::convexFaceMesh(vertices, true); + return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron); } else { // Two concentric rings, we use the pure concentric method momentarily, // but that creates too many unneccesarry faces, when only two // are needed to describe the mesh, @todo investigate merging flag - auto facesMesh = detail::FacesHelper::cylindricalFaceMesh(vertices, true); - faces = facesMesh.first; - triangularMesh = facesMesh.second; + auto [faces, triangularMesh] = + detail::FacesHelper::cylindricalFaceMesh(vertices); + return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron); } - } else { - throw std::domain_error( - "Polyhedron repr of boundless surface not possible."); } - return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron); + throw std::domain_error("Polyhedron repr of boundless surface not possible."); } Acts::Vector2 Acts::DiscSurface::localPolarToCartesian( diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index 6cebe5433d5..ed02bac17de 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -64,7 +64,7 @@ bool Acts::DiscTrapezoidBounds::inside( } std::vector<Acts::Vector2> Acts::DiscTrapezoidBounds::vertices( - unsigned int /*lseg*/) const { + unsigned int /*ignoredSegments*/) const { Vector2 cAxis(std::cos(get(eAveragePhi)), std::sin(get(eAveragePhi))); Vector2 nAxis(cAxis.y(), -cAxis.x()); auto ymin = std::sqrt(get(eMinR) * get(eMinR) - diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index d6357eabcc3..485f36736d8 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -61,10 +61,10 @@ bool Acts::EllipseBounds::inside( } std::vector<Acts::Vector2> Acts::EllipseBounds::vertices( - unsigned int lseg) const { + unsigned int quarterSegments) const { return detail::VerticesHelper::ellipsoidVertices( get(eInnerRx), get(eInnerRy), get(eOuterRx), get(eOuterRy), - get(eAveragePhi), get(eHalfPhiSector), lseg); + get(eAveragePhi), get(eHalfPhiSector), quarterSegments); } const Acts::RectangleBounds& Acts::EllipseBounds::boundingBox() const { diff --git a/Core/src/Surfaces/PerigeeSurface.cpp b/Core/src/Surfaces/PerigeeSurface.cpp index 328db94478e..777d061b2b1 100644 --- a/Core/src/Surfaces/PerigeeSurface.cpp +++ b/Core/src/Surfaces/PerigeeSurface.cpp @@ -58,7 +58,7 @@ std::ostream& Acts::PerigeeSurface::toStreamImpl(const GeometryContext& gctx, } Acts::Polyhedron Acts::PerigeeSurface::polyhedronRepresentation( - const GeometryContext& gctx, std::size_t /*lseg*/) const { + const GeometryContext& gctx, unsigned int /*quarterSegments*/) const { // Prepare vertices and faces std::vector<Vector3> vertices; std::vector<Polyhedron::FaceType> faces; diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index 414f2611eef..b33ef82eb46 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -88,16 +88,14 @@ const Acts::SurfaceBounds& Acts::PlaneSurface::bounds() const { } Acts::Polyhedron Acts::PlaneSurface::polyhedronRepresentation( - const GeometryContext& gctx, std::size_t lseg) const { + const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector<Vector3> vertices; - std::vector<Polyhedron::FaceType> faces; - std::vector<Polyhedron::FaceType> triangularMesh; bool exactPolyhedron = true; // If you have bounds you can create a polyhedron representation if (m_bounds) { - auto vertices2D = m_bounds->vertices(lseg); + auto vertices2D = m_bounds->vertices(quarterSegments); vertices.reserve(vertices2D.size() + 1); for (const auto& v2D : vertices2D) { vertices.push_back(transform(gctx) * Vector3(v2D.x(), v2D.y(), 0.)); @@ -116,22 +114,20 @@ Acts::Polyhedron Acts::PlaneSurface::polyhedronRepresentation( // @todo same as for Discs: coversFull is not the right criterium // for triangulation if (!isEllipse || !innerExists || !coversFull) { - auto facesMesh = detail::FacesHelper::convexFaceMesh(vertices); - faces = facesMesh.first; - triangularMesh = facesMesh.second; + auto [faces, triangularMesh] = + detail::FacesHelper::convexFaceMesh(vertices); + return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron); } else { // Two concentric rings, we use the pure concentric method momentarily, // but that creates too many unneccesarry faces, when only two // are needed to describe the mesh, @todo investigate merging flag - auto facesMesh = detail::FacesHelper::cylindricalFaceMesh(vertices, true); - faces = facesMesh.first; - triangularMesh = facesMesh.second; + auto [faces, triangularMesh] = + detail::FacesHelper::cylindricalFaceMesh(vertices); + return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron); } - } else { - throw std::domain_error( - "Polyhedron repr of boundless surface not possible."); } - return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron); + throw std::domain_error( + "Polyhedron representation of boundless surface not possible."); } Acts::Vector3 Acts::PlaneSurface::normal(const GeometryContext& gctx, diff --git a/Core/src/Surfaces/StrawSurface.cpp b/Core/src/Surfaces/StrawSurface.cpp index 1ac8f8eb264..2ce1ef74b42 100644 --- a/Core/src/Surfaces/StrawSurface.cpp +++ b/Core/src/Surfaces/StrawSurface.cpp @@ -48,7 +48,7 @@ Acts::StrawSurface& Acts::StrawSurface::operator=(const StrawSurface& other) { } Acts::Polyhedron Acts::StrawSurface::polyhedronRepresentation( - const GeometryContext& gctx, std::size_t lseg) const { + const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector<Vector3> vertices; std::vector<Polyhedron::FaceType> faces; @@ -56,20 +56,17 @@ Acts::Polyhedron Acts::StrawSurface::polyhedronRepresentation( const Transform3& ctransform = transform(gctx); // Draw the bounds if more than one segment are chosen - if (lseg > 1) { + if (quarterSegments > 0u) { double r = m_bounds->get(LineBounds::eR); - auto phiSegs = detail::VerticesHelper::phiSegments(); // Write the two bows/circles on either side std::vector<int> sides = {-1, 1}; for (auto& side : sides) { - for (std::size_t iseg = 0; iseg < phiSegs.size() - 1; ++iseg) { - int addon = (iseg == phiSegs.size() - 2) ? 1 : 0; - /// Helper method to create the segment - detail::VerticesHelper::createSegment( - vertices, {r, r}, phiSegs[iseg], phiSegs[iseg + 1], lseg, addon, - Vector3(0., 0., side * m_bounds->get(LineBounds::eHalfLengthZ)), - ctransform); - } + /// Helper method to create the segment + auto svertices = detail::VerticesHelper::segmentVertices( + {r, r}, -M_PI, M_PI, {}, quarterSegments, + Vector3(0., 0., side * m_bounds->get(LineBounds::eHalfLengthZ)), + ctransform); + vertices.insert(vertices.end(), svertices.begin(), svertices.end()); } auto facesMesh = detail::FacesHelper::cylindricalFaceMesh(vertices); faces = facesMesh.first; diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 3ebf11d8e92..cadef176cda 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -359,6 +359,7 @@ void Acts::Surface::associateLayer(const Acts::Layer& lay) { void Acts::Surface::visualize(IVisualization3D& helper, const GeometryContext& gctx, const ViewConfig& viewConfig) const { - Polyhedron polyhedron = polyhedronRepresentation(gctx, viewConfig.nSegments); + Polyhedron polyhedron = + polyhedronRepresentation(gctx, viewConfig.quarterSegments); polyhedron.visualize(helper, viewConfig); } diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 06da2fa0fef..e74285e445e 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -96,7 +96,7 @@ bool Acts::TrapezoidBounds::inside( } std::vector<Acts::Vector2> Acts::TrapezoidBounds::vertices( - unsigned int /*lseg*/) const { + unsigned int /*ignoredSegments*/) const { const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); const double hlY = get(TrapezoidBounds::eHalfLengthY); diff --git a/Core/src/Surfaces/VerticesHelper.cpp b/Core/src/Surfaces/detail/VerticesHelper.cpp similarity index 55% rename from Core/src/Surfaces/VerticesHelper.cpp rename to Core/src/Surfaces/detail/VerticesHelper.cpp index 448ee97e8da..b8bed1fb50f 100644 --- a/Core/src/Surfaces/VerticesHelper.cpp +++ b/Core/src/Surfaces/detail/VerticesHelper.cpp @@ -14,42 +14,61 @@ std::vector<Acts::ActsScalar> Acts::detail::VerticesHelper::phiSegments( ActsScalar phiMin, ActsScalar phiMax, - const std::vector<ActsScalar>& phiRefs, ActsScalar phiTolerance) { - // This is to ensure that the extrema are built regardless of number - // of segments - std::vector<ActsScalar> phiSegments; - std::vector<ActsScalar> quarters = {-M_PI, -0.5 * M_PI, 0., 0.5 * M_PI, M_PI}; - // It does not cover the full azimuth - if (phiMin != -M_PI || phiMax != M_PI) { - phiSegments.push_back(phiMin); - for (unsigned int iq = 1; iq < 4; ++iq) { - if (phiMin < quarters[iq] && phiMax > quarters[iq]) { - phiSegments.push_back(quarters[iq]); - } + const std::vector<ActsScalar>& phiRefs, unsigned int quarterSegments) { + // Check that the phi range is valid + if (phiMin > phiMax) { + throw std::invalid_argument( + "VerticesHelper::phiSegments ... Minimum phi must be smaller than " + "maximum phi"); + } + + // First check that no reference phi is outside the range + for (ActsScalar phiRef : phiRefs) { + if (phiRef < phiMin || phiRef > phiMax) { + throw std::invalid_argument( + "VerticesHelper::phiSegments ... Reference phi is outside the range " + "of the segment"); } - phiSegments.push_back(phiMax); - } else { - phiSegments = quarters; } - // Insert the reference phis if - if (!phiRefs.empty()) { - for (const auto& phiRef : phiRefs) { - // Trying to find the right patch - if (std::ranges::none_of(phiSegments, [&](ActsScalar phiSeg) { - return std::abs(phiSeg - phiRef) < phiTolerance; + if (quarterSegments == 0u) { + throw std::invalid_argument( + "VerticesHelper::phiSegments ... Number of segments must be larger " + "than 0."); + } + std::vector<ActsScalar> phiSegments = {phiMin, phiMax}; + // Minimum approximation for a circle need + // - if the circle is closed the last point is given twice + for (unsigned int i = 0; i < 4 * quarterSegments + 1; ++i) { + ActsScalar phiExt = -M_PI + i * 2 * M_PI / (4 * quarterSegments); + if (phiExt > phiMin && phiExt < phiMax && + std::ranges::none_of(phiSegments, [&phiExt](ActsScalar phi) { + return std::abs(phi - phiExt) < + std::numeric_limits<ActsScalar>::epsilon(); + })) { + phiSegments.push_back(phiExt); + } + } + // Add the reference phis + for (const auto& phiRef : phiRefs) { + if (phiRef > phiMin && phiRef < phiMax) { + if (std::ranges::none_of(phiSegments, [&phiRef](ActsScalar phi) { + return std::abs(phi - phiRef) < + std::numeric_limits<ActsScalar>::epsilon(); })) { phiSegments.push_back(phiRef); } } - std::ranges::sort(phiSegments); } + + // Sort the phis + std::ranges::sort(phiSegments); return phiSegments; } std::vector<Acts::Vector2> Acts::detail::VerticesHelper::ellipsoidVertices( ActsScalar innerRx, ActsScalar innerRy, ActsScalar outerRx, ActsScalar outerRy, ActsScalar avgPhi, ActsScalar halfPhi, - unsigned int lseg) { + unsigned int quarterSegments) { // List of vertices counter-clockwise starting at smallest phi w.r.t center, // for both inner/outer ring/segment std::vector<Vector2> rvertices; // return vertices @@ -59,22 +78,20 @@ std::vector<Acts::Vector2> Acts::detail::VerticesHelper::ellipsoidVertices( bool innerExists = (innerRx > 0. && innerRy > 0.); bool closed = std::abs(halfPhi - M_PI) < s_onSurfaceTolerance; - // Get the phi segments from the helper method - auto phiSegs = detail::VerticesHelper::phiSegments( - avgPhi - halfPhi, avgPhi + halfPhi, {avgPhi}); + std::vector<ActsScalar> refPhi = {}; + if (avgPhi != 0.) { + refPhi.push_back(avgPhi); + } // The inner (if exists) and outer bow - for (unsigned int iseg = 0; iseg < phiSegs.size() - 1; ++iseg) { - int addon = (iseg == phiSegs.size() - 2 && !closed) ? 1 : 0; - if (innerExists) { - createSegment<Vector2, Transform2>(ivertices, {innerRx, innerRy}, - phiSegs[iseg], phiSegs[iseg + 1], lseg, - addon); - } - createSegment<Vector2, Transform2>(overtices, {outerRx, outerRy}, - phiSegs[iseg], phiSegs[iseg + 1], lseg, - addon); + if (innerExists) { + ivertices = segmentVertices<Vector2, Transform2>( + {innerRx, innerRy}, avgPhi - halfPhi, avgPhi + halfPhi, refPhi, + quarterSegments); } + overtices = segmentVertices<Vector2, Transform2>( + {outerRx, outerRy}, avgPhi - halfPhi, avgPhi + halfPhi, refPhi, + quarterSegments); // We want to keep the same counter-clockwise orientation for displaying if (!innerExists) { @@ -95,9 +112,9 @@ std::vector<Acts::Vector2> Acts::detail::VerticesHelper::ellipsoidVertices( std::vector<Acts::Vector2> Acts::detail::VerticesHelper::circularVertices( ActsScalar innerR, ActsScalar outerR, ActsScalar avgPhi, ActsScalar halfPhi, - unsigned int lseg) { + unsigned int quarterSegments) { return ellipsoidVertices(innerR, innerR, outerR, outerR, avgPhi, halfPhi, - lseg); + quarterSegments); } bool Acts::detail::VerticesHelper::onHyperPlane( diff --git a/Core/src/Visualization/EventDataView3D.cpp b/Core/src/Visualization/EventDataView3D.cpp index 63644d0204f..ac3a62a1e79 100644 --- a/Core/src/Visualization/EventDataView3D.cpp +++ b/Core/src/Visualization/EventDataView3D.cpp @@ -27,12 +27,13 @@ void Acts::EventDataView3D::drawCovarianceCartesian( std::vector<Vector3> ellipse = createEllipse( lambda0 * locErrorScale, lambda1 * locErrorScale, theta, - viewConfig.nSegments, viewConfig.offset, lposition, transform); + viewConfig.quarterSegments, viewConfig.offset, lposition, transform); ellipse.push_back(transform * Vector3(lposition.x(), lposition.y(), viewConfig.offset)); - auto faces = detail::FacesHelper::convexFaceMesh(ellipse, true); - Polyhedron ellipseHedron(ellipse, faces.first, faces.second); + auto [faces, triangularMesh] = + detail::FacesHelper::convexFaceMesh(ellipse, true); + Polyhedron ellipseHedron(ellipse, faces, triangularMesh); Acts::GeometryView3D::drawPolyhedron(helper, ellipseHedron, viewConfig); } @@ -56,12 +57,13 @@ void Acts::EventDataView3D::drawCovarianceAngular( std::vector<Vector3> ellipse = createEllipse(angularErrorScale * directionScale * lambda0 * sin(dtheta), angularErrorScale * directionScale * lambda1, theta, - viewConfig.nSegments, 0., {0., 0.}, eplane); + viewConfig.quarterSegments, 0., {0., 0.}, eplane); std::vector<Vector3> coneTop = ellipse; coneTop.push_back(anker); - auto coneTopFaces = detail::FacesHelper::convexFaceMesh(coneTop, true); - Polyhedron coneTopHedron(coneTop, coneTopFaces.first, coneTopFaces.second); + auto [faces, triangularMesh] = + detail::FacesHelper::convexFaceMesh(coneTop, true); + Polyhedron coneTopHedron(coneTop, faces, triangularMesh); GeometryView3D::drawPolyhedron(helper, coneTopHedron, viewConfig); std::vector<Vector3> cone = ellipse; @@ -69,7 +71,8 @@ void Acts::EventDataView3D::drawCovarianceAngular( // Force triangular ViewConfig coneViewConfig = viewConfig; coneViewConfig.triangulate = true; - auto coneFaces = detail::FacesHelper::convexFaceMesh(cone, true); - Polyhedron coneHedron(cone, coneFaces.first, coneFaces.second); + auto [facesCone, triangularMeshCone] = + detail::FacesHelper::convexFaceMesh(cone, true); + Polyhedron coneHedron(cone, facesCone, triangularMeshCone); GeometryView3D::drawPolyhedron(helper, coneHedron, coneViewConfig); } diff --git a/Core/src/Visualization/GeometryView3D.cpp b/Core/src/Visualization/GeometryView3D.cpp index e0a7c52a5a7..17b7b5c7df9 100644 --- a/Core/src/Visualization/GeometryView3D.cpp +++ b/Core/src/Visualization/GeometryView3D.cpp @@ -95,7 +95,6 @@ void Acts::GeometryView3D::drawSurfaceArray( auto phiValues = axes[0]->getBinEdges(); auto zValues = axes[1]->getBinEdges(); ViewConfig gridRadConfig = gridConfig; - gridRadConfig.nSegments = phiValues.size(); // Longitudinal lines for (auto phi : phiValues) { double cphi = std::cos(phi); @@ -120,7 +119,7 @@ void Acts::GeometryView3D::drawSurfaceArray( auto rValues = axes[0]->getBinEdges(); auto phiValues = axes[1]->getBinEdges(); ViewConfig gridRadConfig = gridConfig; - gridRadConfig.nSegments = phiValues.size(); + gridRadConfig.quarterSegments = phiValues.size(); for (auto r : rValues) { CylinderVolumeBounds cvb(r - 0.5 * thickness, r + 0.5 * thickness, 0.5 * thickness); @@ -244,7 +243,7 @@ void Acts::GeometryView3D::drawTrackingVolume( ViewConfig lConfig = layerView; ViewConfig sConfig = sensitiveView; ViewConfig gConfig = gridView; - gConfig.nSegments = 8; + gConfig.quarterSegments = 8; ViewConfig vcConfig = cConfig; std::string vname = tVolume.volumeName(); diff --git a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp index cb763ecc582..17df42bdb21 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp @@ -18,6 +18,7 @@ #include "ActsExamples/Geant4/SensitiveSurfaceMapper.hpp" #include "ActsFatras/EventData/Barcode.hpp" +#include <algorithm> #include <cstddef> #include <string> #include <unordered_map> @@ -254,11 +255,10 @@ void ActsExamples::SensitiveSteppingAction::UserSteppingAction( buffer.back().momentum4After(), eventStore().particleHitCount.at(particleId) - 1); - assert(std::all_of(buffer.begin(), buffer.end(), - [&](const auto& h) { return h.geometryId() == geoId; })); - assert(std::all_of(buffer.begin(), buffer.end(), [&](const auto& h) { - return h.particleId() == particleId; - })); + assert(std::ranges::all_of( + buffer, [&](const auto& h) { return h.geometryId() == geoId; })); + assert(std::ranges::all_of( + buffer, [&](const auto& h) { return h.particleId() == particleId; })); eventStore().numberGeantSteps += buffer.size(); eventStore().maxStepsForHit = diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index ced44d89e94..2fd1a924d94 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -331,7 +331,7 @@ bool ActsExamples::SensitiveSurfaceMapper::checkMapping( if (writeMissingSurfacesAsObj) { Acts::ObjVisualization3D visualizer; Acts::ViewConfig vcfg; - vcfg.nSegments = 720; + vcfg.quarterSegments = 720; for (auto srf : missing) { Acts::GeometryView3D::drawSurface(visualizer, *srf, gctx, Acts::Transform3::Identity(), vcfg); diff --git a/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp index c5dbc8bb625..880e1571517 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp @@ -56,7 +56,7 @@ Acts::BoundSquareMatrix makeInitialCovariance( // theta contribution variance += - varianceTheta * std::pow(params[Acts::eBoundQOverP] * + varianceTheta * std::pow(params[Acts::eBoundQOverP] / std::tan(params[Acts::eBoundTheta]), 2); } @@ -77,11 +77,9 @@ Acts::BoundSquareMatrix makeInitialCovariance( } // namespace -ActsExamples::TrackParamsEstimationAlgorithm::TrackParamsEstimationAlgorithm( - ActsExamples::TrackParamsEstimationAlgorithm::Config cfg, - Acts::Logging::Level lvl) - : ActsExamples::IAlgorithm("TrackParamsEstimationAlgorithm", lvl), - m_cfg(std::move(cfg)) { +TrackParamsEstimationAlgorithm::TrackParamsEstimationAlgorithm( + TrackParamsEstimationAlgorithm::Config cfg, Acts::Logging::Level lvl) + : IAlgorithm("TrackParamsEstimationAlgorithm", lvl), m_cfg(std::move(cfg)) { if (m_cfg.inputSeeds.empty()) { throw std::invalid_argument("Missing seeds input collection"); } @@ -103,8 +101,8 @@ ActsExamples::TrackParamsEstimationAlgorithm::TrackParamsEstimationAlgorithm( m_outputTracks.maybeInitialize(m_cfg.outputProtoTracks); } -ActsExamples::ProcessCode ActsExamples::TrackParamsEstimationAlgorithm::execute( - const ActsExamples::AlgorithmContext& ctx) const { +ProcessCode TrackParamsEstimationAlgorithm::execute( + const AlgorithmContext& ctx) const { auto const& seeds = m_inputSeeds(ctx); ACTS_VERBOSE("Read " << seeds.size() << " seeds"); @@ -197,4 +195,5 @@ ActsExamples::ProcessCode ActsExamples::TrackParamsEstimationAlgorithm::execute( return ProcessCode::SUCCESS; } + } // namespace ActsExamples diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp index 06fcb1c9438..05fe35a6ea0 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp @@ -19,6 +19,7 @@ #include "ActsExamples/EventData/SimSpacePoint.hpp" #include "ActsExamples/Framework/WhiteBoard.hpp" +#include <algorithm> #include <numeric> using namespace ActsExamples; @@ -97,8 +98,8 @@ ActsExamples::TrackFindingAlgorithmExaTrkX::TrackFindingAlgorithmExaTrkX( NodeFeature::eClusterX, NodeFeature::eClusterY, NodeFeature::eCellCount, NodeFeature::eCellSum, NodeFeature::eCluster1R, NodeFeature::eCluster2R}; - auto wantClFeatures = std::any_of( - m_cfg.nodeFeatures.begin(), m_cfg.nodeFeatures.end(), + auto wantClFeatures = std::ranges::any_of( + m_cfg.nodeFeatures, [&](const auto& f) { return Acts::rangeContainsValue(clFeatures, f); }); if (wantClFeatures && !m_inputClusters.isInitialized()) { diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp index f0d20f1a370..937a5bc1863 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp @@ -143,7 +143,7 @@ ActsExamples::ProcessCode ActsExamples::ParticleSmearing::execute( // theta contribution variance += varianceTheta * - std::pow(params[Acts::eBoundQOverP] * + std::pow(params[Acts::eBoundQOverP] / std::tan(params[Acts::eBoundTheta]), 2); } diff --git a/Examples/Framework/src/Utilities/EventDataTransforms.cpp b/Examples/Framework/src/Utilities/EventDataTransforms.cpp index a82df0cf5a3..79d3d543a05 100644 --- a/Examples/Framework/src/Utilities/EventDataTransforms.cpp +++ b/Examples/Framework/src/Utilities/EventDataTransforms.cpp @@ -32,7 +32,7 @@ const ActsExamples::SimSpacePoint* ActsExamples::findSpacePointForIndex( ActsExamples::Index index, const SimSpacePointContainer& spacepoints) { auto match = [&](const SimSpacePoint& sp) { const auto& sls = sp.sourceLinks(); - return std::any_of(sls.begin(), sls.end(), [&](const auto& sl) { + return std::ranges::any_of(sls, [&](const auto& sl) { return sl.template get<IndexSourceLink>().index() == index; }); }; diff --git a/Examples/Io/Root/src/RootMaterialDecorator.cpp b/Examples/Io/Root/src/RootMaterialDecorator.cpp index b8f49c53ea1..37f396bb86c 100644 --- a/Examples/Io/Root/src/RootMaterialDecorator.cpp +++ b/Examples/Io/Root/src/RootMaterialDecorator.cpp @@ -148,8 +148,8 @@ ActsExamples::RootMaterialDecorator::RootMaterialDecorator( std::vector<const TH1*> hists{n, v, o, min, max, t, x0, l0, A, Z, rho}; // Only go on when you have all histograms - if (std::all_of(hists.begin(), hists.end(), - [](const auto* hist) { return hist != nullptr; })) { + if (std::ranges::all_of( + hists, [](const auto* hist) { return hist != nullptr; })) { // Get the number of bins int nbins0 = t->GetNbinsX(); int nbins1 = t->GetNbinsY(); diff --git a/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgDefaults.hpp b/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgDefaults.hpp index 14d0474776e..b4e6c4f8178 100644 --- a/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgDefaults.hpp +++ b/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgDefaults.hpp @@ -22,7 +22,7 @@ static inline Acts::Svg::Style layerStyle() { lStyle.highlights = {"mouseover", "mouseout"}; lStyle.strokeColor = {25, 25, 25}; lStyle.strokeWidth = 0.5; - lStyle.nSegments = 72u; + lStyle.quarterSegments = 72u; return lStyle; } @@ -43,7 +43,7 @@ static inline Acts::Svg::Style backgroundStyle() { bgStyle.highlights = {}; bgStyle.strokeColor = {25, 25, 25}; bgStyle.strokeWidth = 0.5; - bgStyle.nSegments = 72u; + bgStyle.quarterSegments = 72u; return bgStyle; } @@ -55,7 +55,7 @@ static inline Acts::Svg::Style pointStyle() { pStyle.highlights = {"mouseover", "mouseout"}; pStyle.strokeColor = {0, 0, 0}; pStyle.strokeWidth = 0.5; - pStyle.nSegments = 72u; + pStyle.quarterSegments = 72u; return pStyle; } diff --git a/Examples/Python/src/Geometry.cpp b/Examples/Python/src/Geometry.cpp index 4fb0f07d07a..51188ee93e4 100644 --- a/Examples/Python/src/Geometry.cpp +++ b/Examples/Python/src/Geometry.cpp @@ -333,7 +333,7 @@ void addExperimentalGeometry(Context& ctx) { ACTS_PYTHON_MEMBER(surfacesProvider); ACTS_PYTHON_MEMBER(supports); ACTS_PYTHON_MEMBER(binnings); - ACTS_PYTHON_MEMBER(nSegments); + ACTS_PYTHON_MEMBER(quarterSegments); ACTS_PYTHON_MEMBER(auxiliary); ACTS_PYTHON_STRUCT_END(); diff --git a/Examples/Python/src/Obj.cpp b/Examples/Python/src/Obj.cpp index ce03e60a3fe..5ca2df40033 100644 --- a/Examples/Python/src/Obj.cpp +++ b/Examples/Python/src/Obj.cpp @@ -35,7 +35,7 @@ void addObj(Context& ctx) { /// @param surfaces is the collection of surfaces /// @param viewContext is the geometry context /// @param viewRgb is the color of the surfaces - /// @param viewSegements is the number of segments to approximate a full circle + /// @param viewSegments is the number of segments to approximate a quarter of a circle /// @param fileName is the path to the output file /// mex.def("writeSurfacesObj", diff --git a/Examples/Python/src/Output.cpp b/Examples/Python/src/Output.cpp index 328ae9ecd92..b53ba905700 100644 --- a/Examples/Python/src/Output.cpp +++ b/Examples/Python/src/Output.cpp @@ -119,7 +119,7 @@ void addOutput(Context& ctx) { ACTS_PYTHON_MEMBER(offset); ACTS_PYTHON_MEMBER(lineThickness); ACTS_PYTHON_MEMBER(surfaceThickness); - ACTS_PYTHON_MEMBER(nSegments); + ACTS_PYTHON_MEMBER(quarterSegments); ACTS_PYTHON_MEMBER(triangulate); ACTS_PYTHON_MEMBER(outputName); ACTS_PYTHON_STRUCT_END(); diff --git a/Examples/Python/src/Svg.cpp b/Examples/Python/src/Svg.cpp index 2c0219d0466..ee011920947 100644 --- a/Examples/Python/src/Svg.cpp +++ b/Examples/Python/src/Svg.cpp @@ -225,7 +225,7 @@ void addSvg(Context& ctx) { ACTS_PYTHON_MEMBER(highlights); ACTS_PYTHON_MEMBER(strokeWidth); ACTS_PYTHON_MEMBER(strokeColor); - ACTS_PYTHON_MEMBER(nSegments); + ACTS_PYTHON_MEMBER(quarterSegments); ACTS_PYTHON_STRUCT_END(); } @@ -328,6 +328,21 @@ void addSvg(Context& ctx) { }); } + { + auto gco = py::class_<Svg::GridConverter::Options>(svg, "GridOptions") + .def(py::init<>()); + ACTS_PYTHON_STRUCT_BEGIN(gco, Svg::GridConverter::Options); + ACTS_PYTHON_MEMBER(style); + ACTS_PYTHON_STRUCT_END(); + + auto isco = py::class_<Svg::IndexedSurfacesConverter::Options>( + svg, "IndexedSurfacesOptions") + .def(py::init<>()); + ACTS_PYTHON_STRUCT_BEGIN(isco, Svg::IndexedSurfacesConverter::Options); + ACTS_PYTHON_MEMBER(gridOptions); + ACTS_PYTHON_STRUCT_END(); + } + // How detector volumes are drawn: Svg DetectorVolume options & drawning { auto c = py::class_<Svg::DetectorVolumeConverter::Options>( @@ -338,12 +353,16 @@ void addSvg(Context& ctx) { ACTS_PYTHON_MEMBER(portalIndices); ACTS_PYTHON_MEMBER(portalOptions); ACTS_PYTHON_MEMBER(surfaceOptions); + ACTS_PYTHON_MEMBER(indexedSurfacesOptions); ACTS_PYTHON_STRUCT_END(); // Define the proto volume & indexed surface grid py::class_<Svg::ProtoVolume>(svg, "ProtoVolume"); py::class_<Svg::ProtoIndexedSurfaceGrid>(svg, "ProtoIndexedSurfaceGrid"); + // Define the proto grid + py::class_<Svg::ProtoGrid>(svg, "ProtoGrid"); + // Convert an Acts::Experimental::DetectorVolume object into an // acts::svg::proto::volume svg.def("convertDetectorVolume", &Svg::DetectorVolumeConverter::convert); @@ -352,6 +371,15 @@ void addSvg(Context& ctx) { svg.def("drawDetectorVolume", &drawDetectorVolume); } + // Draw the ProtoIndexedSurfaceGrid + { + svg.def("drawIndexedSurfaces", + [](const Svg::ProtoIndexedSurfaceGrid& pIndexedSurfaceGrid, + const std::string& identification) { + return Svg::View::xy(pIndexedSurfaceGrid, identification); + }); + } + // How a detector is drawn: Svg Detector options & drawning { svg.def("drawDetector", &drawDetector); } diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 368a7c45ef3..84f90c6d811 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -3,16 +3,16 @@ test_fatras__particles_simulation.root: bc970873fef0c2efd86ed5413623802353d2cd04 test_fatras__hits.root: 6e4beb045fa1712c4d14c280ba33c3fa13e4aff9de88d55c3e32f62ad226f724 test_geant4__particles_simulation.root: 3c9c6265183b04c9d62ed5f2d0709c6dd74e33fbb53ac0aeb3274f6600257fc1 test_geant4__hits.root: adf5dcdf000a580412dc5089e17460897d6535c978eafa021584ba4281d0a1ac -test_seeding__estimatedparams.root: ff9b876f07de7e352c71f11dccdbaed93b6ef0328bba40c4f6c9fdb2090f386e +test_seeding__estimatedparams.root: 69c0e268f9025a0991a212ea2a7f26f53112fecf614b475605bd1cb08415ba56 test_seeding__performance_seeding.root: 992f9c611d30dde0d3f3ab676bab19ada61ab6a4442828e27b65ec5e5b7a2880 test_seeding__particles.root: 7855b021f39ad238bca098e4282667be0666f2d1630e5bcb9d51d3b5ee39fa14 test_seeding__particles_simulation.root: 87d9c6c82422ca381a17735096b36c547eacb5dda2f26d7377614bd97a70ab1a -test_hashing_seeding__estimatedparams.root: 77658e952bbceb5a61b0235c76f4dbb7bb5994a8ef32b769197ddcfe46ade241 -test_seeding_orthogonal__estimatedparams.root: 47718b57d59d9b9686bd7a7bb5958d668c0a953ad6b094601ca7b27f530db786 +test_hashing_seeding__estimatedparams.root: 1f43b760e80089b5674e106d00d962d74be564cbf33ae38222052ebb6f9cbf3a +test_seeding_orthogonal__estimatedparams.root: ca5896ec325daf5c8012291bc454269c61c32fe3d7e33bd1fa3b812826930299 test_seeding_orthogonal__performance_seeding.root: 60fbedcf5cb2b37cd8e526251940564432890d3a159d231ed819e915a904682c test_seeding_orthogonal__particles.root: 7855b021f39ad238bca098e4282667be0666f2d1630e5bcb9d51d3b5ee39fa14 test_seeding_orthogonal__particles_simulation.root: 87d9c6c82422ca381a17735096b36c547eacb5dda2f26d7377614bd97a70ab1a -test_itk_seeding__estimatedparams.root: 1266e99f1885a3c74a58471a4d6e750ad8fd87c7372a9ab929e8b99603b42ac8 +test_itk_seeding__estimatedparams.root: 1cc05f9f2aefb5f71a85b31e97bc4e5845fedfcef6c53199495a6340c6b6210b test_itk_seeding__performance_seeding.root: 78ebda54cd0f026ba4b7f316724ffd946de56a932735914baf1b7bba9505c29d test_itk_seeding__particles.root: 0b6f4ad438010ac48803d48ed98e80b5e87d310bae6c2c02b16cd94d7a4d7d07 test_itk_seeding__particles_simulation.root: ef0246069aa697019f28a8b270a68de95312cae5f2f2c74848566c3ce4f70363 @@ -33,22 +33,22 @@ test_digitization_example_input[smeared]__particles.root: 5fe7dda2933ee6b9615b06 test_digitization_example_input[smeared]__measurements.root: 243c2f69b7b0db9dbeaa7494d4ea0f3dd1691dc90f16e10df6c0491ff4dc7d62 test_digitization_example_input[geometric]__particles.root: 5fe7dda2933ee6b9615b064d192322fe07831133cd998e5ed99a3b992b713a10 test_digitization_example_input[geometric]__measurements.root: 63ec81635979058fb8976f94455bf490cf92b7b142c4a05cc39de6225f5de2fb -test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: e041089f5ddf060580f068a951621882082b4659d935965c118b76f6c3944fd2 -test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: 4d2e26c352285aed77e46e09ee1977eb34cd82a29b0cb08f162a61ea76f71f17 +test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: f15437e7873a92615e7f967cbcb8c48119e7fa31136817dc275d186552ce8b26 +test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: d5e8542d2b735cd8ab60774bb5dbe01b1e0b0924dffff1ff719723802a4933e6 test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e -test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 71a48e6d22be7f01611394ed7bd5a4a498aade6e20deb7efb0d9bd67dd950970 -test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 5a973ec1c159681361ac069809e364cef4ec3e0efcafb05689f1175764f438b4 +test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 2f4d7d5fed66bc2c7d7df6eff2637ab1c34877eb84123bf8e543731fe5d96b91 +test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 1d0931cd08865cf8d69e1d9b4e7b87aaa1dc4337bdd14cb925c45553851b6040 test_ckf_tracks_example[generic-truth_estimated]__performance_seeding.root: 1facb05c066221f6361b61f015cdf0918e94d9f3fce2269ec7b6a4dffeb2bc7e -test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: b10f61d3b68ecc3d1910a17aeadd01a1e23b31b6418935809d1f12e95eac607a -test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 69733ede1fc08370b5c0d0535f274b59bb51217239bd6645ff62ec9dadaa1f41 -test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: 33a68b20005a92b88bf7d01179a4b4fe3c1476a2019176904356924c0ad68f4b -test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 749a53533fed3d550c2e37f504bac5a8ab5c5cdf60d5055dcd545aa44613601a +test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 9d5c3d943d3baccacb9969430386b71a6c5570c0d4ee50c09b8ef5471b9a42cd +test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 1f38a7fe0f5ff1d8f054b8120caf55243104f49da6c39a8dd17defaf4547aa07 +test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: f373840f282f113667248d4f63a8cebec4d94d438fcf9508b30c6c4b2f220f23 +test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 9e4cf24b0be8e2285c453272a7a0424f75ff4d7d863db2ced4f178da390d9073 test_ckf_tracks_example[odd-full_seeding]__performance_seeding_trees.root: 43c58577aafe07645e5660c4f43904efadf91d8cda45c5c04c248bbe0f59814f -test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 7750f58b970c79dc3c937482e2a6e4576bc5d495fd6e4576d63ac2882d8283d4 -test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: f5d5d5521e367dd2e26365b896b079279a5a8b97b7e11d38eb0eb317740ad4dd +test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 3246e7530ae263d8856e487b8cc5de392dcce54ba807e0299c6a409e139e0910 +test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 1ab5d0271be05e47b5f367ae9f818c8de058ee841ac0b6c62c08521a81e11a9a test_ckf_tracks_example[odd-truth_estimated]__performance_seeding.root: 1a36b7017e59f1c08602ef3c2cb0483c51df248f112e3780c66594110719c575 -test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 33398059bf968f7279d4cc706f3b914fcf6f010ae82c43df8875785bda6f7cbe -test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 3d01335a51fb03c78a174c8b11d473b38ba9c4ed3d6cba201b3925f463411708 +test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 39f3d17a4f3fb9ba792ccf41b3851b5c690e8a7777e1777f072a3d9aa4aca66b +test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: d6a05c8e8522e676d65c5a1cc634938340689b53f057a4d4c75c3b2c8efb1169 test_vertex_fitting_reading[Truth-False-100]__performance_vertexing.root: 76ef6084d758dfdfc0151ddec2170e12d73394424e3dac4ffe46f0f339ec8293 test_vertex_fitting_reading[Iterative-False-100]__performance_vertexing.root: 60372210c830a04f95ceb78c6c68a9b0de217746ff59e8e73053750c837b57eb test_vertex_fitting_reading[Iterative-True-100]__performance_vertexing.root: e34f217d524a5051dbb04a811d3407df3ebe2cc4bb7f54f6bda0847dbd7b52c3 diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/DetectorVolumeSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/DetectorVolumeSvgConverter.hpp index 6ac84da77ee..f27db472439 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/DetectorVolumeSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/DetectorVolumeSvgConverter.hpp @@ -41,6 +41,8 @@ struct Options { PortalConverter::Options portalOptions; /// The Surface converter options SurfaceConverter::Options surfaceOptions; + /// The Grid converter options + IndexedSurfacesConverter::Options indexedSurfacesOptions; }; /// Write/create the detector volume diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp index a6faa5ed42c..0b36d7f82c9 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp @@ -19,6 +19,7 @@ namespace Acts::Svg { +/// @brief Style struct struct Style { // Fill parameters std::array<int, 3> fillColor = {255, 255, 255}; @@ -38,7 +39,8 @@ struct Style { unsigned int fontSize = 14u; - unsigned int nSegments = 72u; + /// Number of segments to approximate a quarter of a circle + unsigned int quarterSegments = 72u; /// Conversion to fill and stroke object from the base library /// @return a tuple of actsvg digestable objects diff --git a/Plugins/ActSVG/src/DetectorVolumeSvgConverter.cpp b/Plugins/ActSVG/src/DetectorVolumeSvgConverter.cpp index c187e69569b..93527488538 100644 --- a/Plugins/ActSVG/src/DetectorVolumeSvgConverter.cpp +++ b/Plugins/ActSVG/src/DetectorVolumeSvgConverter.cpp @@ -68,7 +68,8 @@ Acts::Svg::DetectorVolumeConverter::convert( // Make dedicated surface grid sheets const auto& internalNavigationDelegate = dVolume.internalNavigation(); - IndexedSurfacesConverter::Options isOptions; + IndexedSurfacesConverter::Options isOptions = + volumeOptions.indexedSurfacesOptions; // Use or transfer the surface style if (isOptions.surfaceStyles.empty()) { std::pair<Acts::GeometryIdentifier, Acts::Svg::Style> style{ diff --git a/Plugins/ActSVG/src/SurfaceSvgConverter.cpp b/Plugins/ActSVG/src/SurfaceSvgConverter.cpp index c5bf2bba429..d9fb864a1f4 100644 --- a/Plugins/ActSVG/src/SurfaceSvgConverter.cpp +++ b/Plugins/ActSVG/src/SurfaceSvgConverter.cpp @@ -21,7 +21,7 @@ Acts::Svg::ProtoSurface Acts::Svg::SurfaceConverter::convert( if (!cOptions.templateSurface) { // Polyhedron surface for vertices needed anyway Polyhedron surfaceHedron = - surface.polyhedronRepresentation(gctx, cOptions.style.nSegments); + surface.polyhedronRepresentation(gctx, cOptions.style.quarterSegments); auto vertices3D = surfaceHedron.vertices; pSurface._vertices = vertices3D; } else { @@ -30,7 +30,7 @@ Acts::Svg::ProtoSurface Acts::Svg::SurfaceConverter::convert( auto planarBounds = dynamic_cast<const Acts::PlanarBounds*>(&(surface.bounds())); if (planarBounds != nullptr) { - auto vertices2D = planarBounds->vertices(cOptions.style.nSegments); + auto vertices2D = planarBounds->vertices(cOptions.style.quarterSegments); pSurface._vertices.reserve(vertices2D.size()); for (const auto& v2 : vertices2D) { pSurface._vertices.push_back({v2[0], v2[1], 0.}); @@ -40,7 +40,8 @@ Acts::Svg::ProtoSurface Acts::Svg::SurfaceConverter::convert( auto annulusBounds = dynamic_cast<const Acts::AnnulusBounds*>(&(surface.bounds())); if (annulusBounds != nullptr) { - auto vertices2D = annulusBounds->vertices(cOptions.style.nSegments); + auto vertices2D = + annulusBounds->vertices(cOptions.style.quarterSegments); pSurface._vertices.reserve(vertices2D.size()); for (const auto& v2 : vertices2D) { pSurface._vertices.push_back({v2[0], v2[1], 0.}); diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp index 0a283433ab4..d6855443af2 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp @@ -71,8 +71,8 @@ class DD4hepDetectorSurfaceFactory { std::optional<Extent> pExtent = std::nullopt; /// Optionally provide an Extent constraints to measure the layers std::vector<BinningValue> extentConstraints = {}; - /// The approximination for extent measuring - std::size_t nExtentSegments = 1u; + /// The approximination of a circle quarter for extent measuring + std::size_t nExtentQSegments = 1u; }; /// Nested options struct to steer the conversion diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp index bdf4780fb2f..a44e4341feb 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerStructure.hpp @@ -65,8 +65,8 @@ class DD4hepLayerStructure { std::optional<Extent> extent = std::nullopt; /// The extent constraints - optionally std::vector<BinningValue> extentConstraints = {}; - /// Approximation for the polyhedron binning nSegments - unsigned int nSegments = 1u; + /// Approximation for the polyhedron binning + unsigned int quarterSegments = 1u; /// Patch the binning with the extent if possible bool patchBinningWithExtent = true; /// Conversion options diff --git a/Plugins/DD4hep/src/DD4hepDetectorSurfaceFactory.cpp b/Plugins/DD4hep/src/DD4hepDetectorSurfaceFactory.cpp index f3059fbeed5..d628ff76379 100644 --- a/Plugins/DD4hep/src/DD4hepDetectorSurfaceFactory.cpp +++ b/Plugins/DD4hep/src/DD4hepDetectorSurfaceFactory.cpp @@ -108,7 +108,7 @@ Acts::DD4hepDetectorSurfaceFactory::constructSensitiveComponents( // Measure if configured to do so if (cache.sExtent.has_value()) { auto sExtent = - sSurface->polyhedronRepresentation(gctx, cache.nExtentSegments) + sSurface->polyhedronRepresentation(gctx, cache.nExtentQSegments) .extent(); cache.sExtent.value().extend(sExtent, cache.extentConstraints); } @@ -137,7 +137,7 @@ Acts::DD4hepDetectorSurfaceFactory::constructPassiveComponents( // Measure if configured to do so if (cache.pExtent.has_value()) { auto sExtent = - pSurface->polyhedronRepresentation(gctx, cache.nExtentSegments) + pSurface->polyhedronRepresentation(gctx, cache.nExtentQSegments) .extent(); cache.pExtent.value().extend(sExtent, cache.extentConstraints); } diff --git a/Plugins/DD4hep/src/DD4hepLayerStructure.cpp b/Plugins/DD4hep/src/DD4hepLayerStructure.cpp index 64b6e8cf32e..10a4e6eb9f0 100644 --- a/Plugins/DD4hep/src/DD4hepLayerStructure.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerStructure.cpp @@ -38,7 +38,7 @@ Acts::Experimental::DD4hepLayerStructure::builder( fCache.sExtent = options.extent; fCache.pExtent = options.extent; fCache.extentConstraints = options.extentConstraints; - fCache.nExtentSegments = options.nSegments; + fCache.nExtentQSegments = options.quarterSegments; m_surfaceFactory->construct(fCache, gctx, dd4hepElement, options.conversionOptions); diff --git a/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp b/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp index a3d6dfe1148..d53de1d3071 100644 --- a/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp +++ b/Plugins/ExaTrkX/src/ExaTrkXPipeline.cpp @@ -8,6 +8,8 @@ #include "Acts/Plugins/ExaTrkX/ExaTrkXPipeline.hpp" +#include "Acts/Utilities/Helpers.hpp" + #include <algorithm> namespace Acts { @@ -27,9 +29,8 @@ ExaTrkXPipeline::ExaTrkXPipeline( if (!m_trackBuilder) { throw std::invalid_argument("Missing track building module"); } - if (m_edgeClassifiers.empty() or - not std::all_of(m_edgeClassifiers.begin(), m_edgeClassifiers.end(), - [](const auto &a) { return static_cast<bool>(a); })) { + if (m_edgeClassifiers.empty() || + rangeContainsValue(m_edgeClassifiers, nullptr)) { throw std::invalid_argument("Missing graph construction module"); } } diff --git a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp index f382a49543a..df895eb0741 100644 --- a/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp +++ b/Plugins/GeoModel/include/Acts/Plugins/GeoModel/GeoModelBlueprintCreater.hpp @@ -40,8 +40,8 @@ class GeoModelBlueprintCreater { std::vector<std::shared_ptr<Surface>> detectorSurfaces = {}; /// The binning values for the KDTree sorting std::vector<BinningValue> kdtBinning = {}; - /// Polyhedron approximations - unsigned int nSegments = 1u; + /// Polyhedron approximation: number of segments per circlequarter + unsigned int quarterSegments = 1u; }; /// The cache struct diff --git a/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp b/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp index 9d31eeaaffc..93712d5d911 100644 --- a/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp +++ b/Plugins/GeoModel/src/GeoModelBlueprintCreater.cpp @@ -354,7 +354,7 @@ Acts::GeoModelBlueprintCreater::createInternalStructureBuilder( // Loop over surfaces and create an internal extent for (auto& sf : surfaces) { auto sfExtent = - sf->polyhedronRepresentation(gctx, m_cfg.nSegments).extent(); + sf->polyhedronRepresentation(gctx, m_cfg.quarterSegments).extent(); internalExtent.extend(sfExtent, internalConstraints); } ACTS_VERBOSE("Found " << surfaces.size() << " surfaces in range " diff --git a/Plugins/GeoModel/src/GeoModelDetectorObjectFactory.cpp b/Plugins/GeoModel/src/GeoModelDetectorObjectFactory.cpp index 91580a7bfda..a8844d9fa5d 100644 --- a/Plugins/GeoModel/src/GeoModelDetectorObjectFactory.cpp +++ b/Plugins/GeoModel/src/GeoModelDetectorObjectFactory.cpp @@ -19,6 +19,7 @@ #include "Acts/Plugins/GeoModel/GeoModelConverters.hpp" #include "Acts/Plugins/GeoModel/IGeoShapeConverter.hpp" +#include <algorithm> #include <iostream> #include <typeinfo> @@ -141,9 +142,9 @@ Acts::GeoModelDetectorObjectFactory::findAllSubVolumes(const PVConstLink &vol) { } bool Acts::GeoModelDetectorObjectFactory::convertBox(std::string name) { - auto convB = std::any_of( - m_cfg.convertBox.begin(), m_cfg.convertBox.end(), - [&](const auto &n) { return name.find(n) != std::string::npos; }); + auto convB = std::ranges::any_of(m_cfg.convertBox, [&](const auto &n) { + return name.find(n) != std::string::npos; + }); return convB; } @@ -192,14 +193,14 @@ bool Acts::GeoModelDetectorObjectFactory::matches(const std::string &name, return true; } - auto matchName = std::any_of( - m_cfg.nameList.begin(), m_cfg.nameList.end(), - [&](const auto &n) { return name.find(n) != std::string::npos; }); + auto matchName = std::ranges::any_of(m_cfg.nameList, [&](const auto &n) { + return name.find(n) != std::string::npos; + }); std::string matStr = physvol->getLogVol()->getMaterial()->getName(); - auto matchMaterial = std::any_of( - m_cfg.materialList.begin(), m_cfg.materialList.end(), + auto matchMaterial = std::ranges::any_of( + m_cfg.materialList, [&](const auto &m) { return matStr.find(m) != std::string::npos; }); bool match = matchMaterial && matchName; diff --git a/Tests/Benchmarks/RayFrustumBenchmark.cpp b/Tests/Benchmarks/RayFrustumBenchmark.cpp index 2d0069da1b1..e4f11e60991 100644 --- a/Tests/Benchmarks/RayFrustumBenchmark.cpp +++ b/Tests/Benchmarks/RayFrustumBenchmark.cpp @@ -187,10 +187,10 @@ int main(int /*argc*/, char** /*argv[]*/) { return {name, func(testBox, ray)}; }); - bool all = std::all_of(results.begin(), results.end(), - [](const auto& r) { return r.second; }); - bool none = std::none_of(results.begin(), results.end(), - [](const auto& r) { return r.second; }); + bool all = + std::ranges::all_of(results, [](const auto& r) { return r.second; }); + bool none = + std::ranges::none_of(results, [](const auto& r) { return r.second; }); if (!all && !none) { std::cerr << "Discrepancy: " << std::endl; @@ -369,10 +369,10 @@ int main(int /*argc*/, char** /*argv[]*/) { return {name, func(testBox, fr)}; }); - bool all = std::all_of(results.begin(), results.end(), - [](const auto& r) { return r.second; }); - bool none = std::none_of(results.begin(), results.end(), - [](const auto& r) { return r.second; }); + bool all = + std::ranges::all_of(results, [](const auto& r) { return r.second; }); + bool none = + std::ranges::none_of(results, [](const auto& r) { return r.second; }); if (!all && !none) { std::cerr << "Discrepancy: " << std::endl; diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp index 6bc19dc0431..3fee5af18ae 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/Assertions.hpp @@ -10,15 +10,15 @@ #include <boost/test/unit_test.hpp> +#include <algorithm> #include <vector> -#define CHECK_NE_COLLECTIONS(col1, col2) \ - do { \ - BOOST_CHECK_EQUAL(col1.size(), col2.size()); \ - std::vector<bool> result; \ - for (std::size_t i = 0; i < col1.size(); i++) { \ - result.push_back(col1[i] == col2[i]); \ - } \ - BOOST_CHECK( \ - !std::all_of(result.begin(), result.end(), [](bool r) { return r; })); \ +#define CHECK_NE_COLLECTIONS(col1, col2) \ + do { \ + BOOST_CHECK_EQUAL(col1.size(), col2.size()); \ + std::vector<bool> result; \ + for (std::size_t i = 0; i < col1.size(); i++) { \ + result.push_back(col1[i] == col2[i]); \ + } \ + BOOST_CHECK(!std::ranges::all_of(result, [](bool r) { return r; })); \ } while (0) diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp index 848e02cab01..662969bc450 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp @@ -52,11 +52,11 @@ class LineSurfaceStub : public LineSurface { /// Return a Polyhedron for the surfaces /// /// @param gctx The current geometry context object, e.g. alignment - /// @param lseg is ignored for a perigee @note ignored + /// @param ingoredSegmeent is ignored for the srub /// /// @return A list of vertices and a face/facett description of it Polyhedron polyhedronRepresentation(const GeometryContext& /*gctx*/, - std::size_t /*lseg*/) const final { + unsigned int /*lseg*/) const final { return Polyhedron({}, {}, {}); } }; diff --git a/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp index c284d6d4796..9f09fb2c213 100644 --- a/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp @@ -23,10 +23,10 @@ namespace Acts::Test { BOOST_AUTO_TEST_SUITE(Surfaces) -double minRadius = 7.2; -double maxRadius = 12.0; -double minPhi = 0.74195; -double maxPhi = 1.33970; +ActsScalar minRadius = 7.2; +ActsScalar maxRadius = 12.0; +ActsScalar minPhi = 0.74195; +ActsScalar maxPhi = 1.33970; Vector2 offset(-2., 2.); @@ -123,6 +123,25 @@ BOOST_AUTO_TEST_CASE(AnnulusBoundsProperties) { BOOST_CHECK_EQUAL(aBounds.get(AnnulusBounds::eMaxPhiRel), maxPhi); } +/// Unit tests for AnnulusBounds vertices +BOOST_AUTO_TEST_CASE(AnnulusBoundsVertices) { + /// Test construction with radii and default sector + AnnulusBounds aBounds(minRadius, maxRadius, minPhi, maxPhi, offset); + + // Retrieve the corners + auto corners = aBounds.corners(); + BOOST_CHECK_EQUAL(corners.size(), 4); + + // Retrieve the vertices + auto vertices = aBounds.vertices(0u); + BOOST_CHECK_EQUAL(vertices.size(), 4); + + // Now generate with more segments + unsigned int nQuarterSegments = 12; + vertices = aBounds.vertices(nQuarterSegments); + BOOST_CHECK_EQUAL(vertices.size(), 14u); +} + BOOST_AUTO_TEST_SUITE_END() } // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp index bdb4c2948be..6b6712c230b 100644 --- a/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp @@ -101,6 +101,10 @@ BOOST_AUTO_TEST_CASE(ConvexPolygonBoundsRecreation) { std::copy_n(valvector.begin(), poly<4>::eSize, values.begin()); poly<4> recreated(values); BOOST_CHECK_EQUAL(original, recreated); + + // Get the vertices back + auto rvertices = original.vertices(); + BOOST_CHECK_EQUAL(rvertices.size(), 4u); } BOOST_AUTO_TEST_CASE(ConvexPolygonBoundsDynamicTest) { diff --git a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp index c858f10f6db..184d69e341f 100644 --- a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp @@ -42,7 +42,7 @@ namespace Acts::Test { const GeometryContext tgContext = GeometryContext(); const std::vector<std::tuple<std::string, unsigned int>> testModes = { - {"Triangulate", 72}, {"Extrema", 1}}; + {"Triangulate", 18}, {"Extrema", 1}}; const Transform3 transform = Transform3::Identity(); const double epsAbs = 1e-12; @@ -61,9 +61,8 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { const double rMax = hzPos * std::tan(alpha); - for (const auto& mode : testModes) { - ACTS_INFO("\tMode: " << std::get<std::string>(mode)); - const unsigned int segments = std::get<unsigned int>(mode); + for (const auto& [mode, segments] : testModes) { + ACTS_INFO("\tMode: " << mode); /// The full cone on one side { @@ -81,9 +80,10 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), 0_mm, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); - const unsigned int expectedFaces = segments < 4 ? 4 : segments; + const unsigned int expectedFaces = 4 * segments; BOOST_CHECK_EQUAL(oneConePh.faces.size(), expectedFaces); - BOOST_CHECK_EQUAL(oneConePh.vertices.size(), expectedFaces + 1); + // full segments + overlap at (pi/pi) + tip + BOOST_CHECK_EQUAL(oneConePh.vertices.size(), expectedFaces + 2); } /// The full cone on one side @@ -106,6 +106,11 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), rMax, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), hzpMin, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); + + const unsigned int expectedFaces = 4 * segments; + BOOST_CHECK_EQUAL(oneConePiecePh.faces.size(), expectedFaces); + BOOST_CHECK_EQUAL(oneConePiecePh.vertices.size(), + (expectedFaces + 1) * 2); } /// The full cone on both sides @@ -124,9 +129,11 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), hzNeg, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); - const unsigned int expectedFaces = segments < 4 ? 8 : 2 * segments; + const unsigned int expectedFaces = 2 * segments * 4; + const unsigned int expectedVertices = 2 * (4 * segments + 1) + 1; + BOOST_CHECK_EQUAL(twoConesPh.faces.size(), expectedFaces); - BOOST_CHECK_EQUAL(twoConesPh.vertices.size(), expectedFaces + 1); + BOOST_CHECK_EQUAL(twoConesPh.vertices.size(), expectedVertices); } /// A centered sectoral cone on both sides @@ -143,13 +150,16 @@ BOOST_AUTO_TEST_CASE(ConeSurfacePolyhedrons) { const auto extent = sectoralConesPh.extent(); CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), 0, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), rMax, epsAbs); - // CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), ???, - // epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), - // ???, epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), + -rMax * std::sin(phiSector), epsAbs); + CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), + rMax * std::sin(phiSector), epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), 0_mm, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), rMax, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), hzNeg, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hzPos, epsAbs); + + // Segment numbers are further checked with the VertexHelper checks } } } @@ -185,8 +195,8 @@ BOOST_AUTO_TEST_CASE(CylinderSurfacePolyhedrons) { CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).min(), -hZ, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), hZ, epsAbs); - const unsigned int expectedFaces = segments < 4 ? 4 : segments; - const unsigned int expectedVertices = segments < 4 ? 8 : 2 * segments; + const unsigned int expectedFaces = 4 * segments; + const unsigned int expectedVertices = (4 * segments + 1) * 2; BOOST_CHECK_EQUAL(fullCylinderPh.faces.size(), expectedFaces); BOOST_CHECK_EQUAL(fullCylinderPh.vertices.size(), expectedVertices); } @@ -248,7 +258,8 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { CHECK_CLOSE_ABS(extent.range(BinningValue::binZ).max(), 0., epsAbs); const unsigned int expectedFaces = 1; - const unsigned int expectedVertices = segments > 4 ? segments + 1 : 4 + 1; + // Segments + overlap + center + const unsigned int expectedVertices = 4 * segments + 1 + 1; BOOST_CHECK_EQUAL(fullDiscPh.faces.size(), expectedFaces); BOOST_CHECK_EQUAL(fullDiscPh.vertices.size(), expectedVertices); } @@ -353,14 +364,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfacePolyhedrons) { auto annulusDisc = Surface::makeShared<DiscSurface>(transform, annulus); auto annulusDiscPh = annulusDisc->polyhedronRepresentation(tgContext, segments); - const auto extent = annulusDiscPh.extent(); - // CHECK_CLOSE_ABS(extent.range(BinningValue::binX).min(), ???, - // epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binX).max(), - // ???, epsAbs); - // CHECK_CLOSE_ABS(extent.range(BinningValue::binY).min(), ???, - // epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binY).max(), - // ???, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binR).min(), minRadius, epsAbs); CHECK_CLOSE_ABS(extent.range(BinningValue::binR).max(), maxRadius, diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp index 573c9f55ce9..ce745bec85c 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp @@ -102,7 +102,7 @@ class SurfaceStub : public RegularSurface { /// Return a Polyhedron for the surfaces Polyhedron polyhedronRepresentation(const GeometryContext& /*gctx*/, - std::size_t /*lseg */) const final { + unsigned int /* ignored */) const final { std::vector<Vector3> vertices; std::vector<std::vector<std::size_t>> faces; std::vector<std::vector<std::size_t>> triangularMesh; diff --git a/Tests/UnitTests/Core/Surfaces/VerticesHelperTests.cpp b/Tests/UnitTests/Core/Surfaces/VerticesHelperTests.cpp index d2838760081..2b52064cb8d 100644 --- a/Tests/UnitTests/Core/Surfaces/VerticesHelperTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/VerticesHelperTests.cpp @@ -92,6 +92,127 @@ BOOST_AUTO_TEST_CASE(VerticesHelperOnHyperPlane) { } } +BOOST_AUTO_TEST_CASE(GeneratePhiSegments) { + // Case (1): a small segment is given, no cartesian maximum vertex + ActsScalar minPhi = 0.1; + ActsScalar maxPhi = 0.3; + + auto phis = VerticesHelper::phiSegments(minPhi, maxPhi); + BOOST_CHECK_EQUAL(phis.size(), 2u); + BOOST_CHECK(phis[0] == minPhi); + BOOST_CHECK(phis[1] == maxPhi); + + // Case (2) a small segment is given, with one maximum vertex at phi = 0 + minPhi = -0.1; + phis = VerticesHelper::phiSegments(minPhi, maxPhi); + BOOST_CHECK_EQUAL(phis.size(), 3u); + BOOST_CHECK(phis[0] == minPhi); + BOOST_CHECK(phis[1] == 0.); + BOOST_CHECK(phis[2] == maxPhi); + + // Case (3) a small segment is given, with one maximum vertex at phi = 2pi, + // and one extra value + phis = VerticesHelper::phiSegments(minPhi, maxPhi, {0.25}); + BOOST_CHECK_EQUAL(phis.size(), 4u); + BOOST_CHECK(phis[0] == minPhi); + BOOST_CHECK(phis[1] == 0.); + BOOST_CHECK(phis[2] == 0.25); + BOOST_CHECK(phis[3] == maxPhi); + + // Case (4) a small segment is given, with one maximum vertex at phi = 2pi, + // and two extra values, one outside & hence throw an exception + BOOST_CHECK_THROW(VerticesHelper::phiSegments(minPhi, maxPhi, {0.25, 0.5}), + std::invalid_argument); + + // Case (5) an invalid phi range is given + BOOST_CHECK_THROW(VerticesHelper::phiSegments(0.8, 0.2, {0.25, 0.5}), + std::invalid_argument); + + // Case (6) a wrong number of minimum segments is given + BOOST_CHECK_THROW(VerticesHelper::phiSegments(0.1, 0.3, {0.25, 0.5}, 3), + std::invalid_argument); +} + +BOOST_AUTO_TEST_CASE(GenerateSegmentVertices) { + // Case (1): a small segment is given, no cartesian maximum vertex & 1 step + // segment + ActsScalar rx = 10.; + ActsScalar ry = 10.; + ActsScalar minPhi = 0.1; + ActsScalar maxPhi = 0.3; + + auto vertices = VerticesHelper::segmentVertices<Vector3, Transform3>( + {rx, ry}, minPhi, maxPhi, {}, 1); + std::size_t expectedVertices = 2u; + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Now with a reference phi value + vertices = VerticesHelper::segmentVertices<Vector3, Transform3>( + {rx, ry}, minPhi, maxPhi, {0.2}, 1); + expectedVertices = 3u; // the reference is inserted + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Now with more vertices - the the two corners and the ones from the + // reference + unsigned int quarterVertices = 36; + vertices = VerticesHelper::segmentVertices<Vector3, Transform3>( + {rx, ry}, minPhi, maxPhi, {}, quarterVertices); + expectedVertices = + static_cast<unsigned int>((maxPhi - minPhi) / M_PI_2 * quarterVertices) + + 2u; + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Case (2) a small segment is given, with one maximum vertex at phi = 0 + minPhi = -0.1; + vertices = VerticesHelper::segmentVertices<Vector3, Transform3>( + {rx, ry}, minPhi, maxPhi, {}, 1); + expectedVertices = 3u; + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Same with more segments + quarterVertices = 12; + vertices = VerticesHelper::segmentVertices<Vector3, Transform3>( + {rx, ry}, minPhi, maxPhi, {}, quarterVertices); + // Extrema will be covered by the segments + expectedVertices = + static_cast<unsigned int>((maxPhi - minPhi) / M_PI_2 * quarterVertices) + + 2u; + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); +} + +BOOST_AUTO_TEST_CASE(GenerateCircleEllipseVertices) { + // Case (1): A full disc + ActsScalar ri = 0.; + ActsScalar ro = 10.; + + // Extreme points in phi - only outer radius + auto vertices = VerticesHelper::circularVertices(ri, ro, 0., M_PI, 1u); + unsigned int expectedVertices = 5u; + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Case (2): A ring + ri = 3.; + + // Extreme points in phi - only outer radius + vertices = VerticesHelper::circularVertices(ri, ro, 0., M_PI, 1u); + expectedVertices = 10u; + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Now with 10 bins per sector + ri = 0.; + + vertices = VerticesHelper::circularVertices(ri, ro, 0., M_PI, 10u); + expectedVertices = 41u; // 4 sectors + 1 overlap at (-pi/pi) + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); + + // Now ellipsiod + ActsScalar riy = 4.; + ActsScalar roy = 14.; + vertices = VerticesHelper::ellipsoidVertices(ri, riy, ro, roy, 0., M_PI, 10u); + expectedVertices = 41u; // 4 sectors + 1 overlap at (-pi/pi) + BOOST_CHECK_EQUAL(vertices.size(), expectedVertices); +} + BOOST_AUTO_TEST_SUITE_END() } // namespace Acts::detail::Test diff --git a/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp b/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp index 7ef5373f41b..bce69cba0b2 100644 --- a/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp +++ b/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp @@ -1054,7 +1054,7 @@ BOOST_AUTO_TEST_CASE(Material) { ViewConfig viewContainer = {.color = {220, 220, 0}}; viewContainer.triangulate = triangulate; ViewConfig viewGrid = {.color = {220, 0, 0}}; - viewGrid.nSegments = 8; + viewGrid.quarterSegments = 8; viewGrid.offset = 3.; viewGrid.triangulate = triangulate; diff --git a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp index 36f823a02b6..bac538e4b58 100644 --- a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp +++ b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } - BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 1458); + BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 4924); } BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } - BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 973); + BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 3143); } BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) { @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } - BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 31010); + BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 103796); } BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) { @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } - BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 20521); + BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 66091); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/UnitTests/Core/Visualization/SurfaceView3DBase.hpp b/Tests/UnitTests/Core/Visualization/SurfaceView3DBase.hpp index be83a27cb7b..146935279f0 100644 --- a/Tests/UnitTests/Core/Visualization/SurfaceView3DBase.hpp +++ b/Tests/UnitTests/Core/Visualization/SurfaceView3DBase.hpp @@ -68,7 +68,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, coneSurfaces.push_back(cone); GeometryView3D::drawSurface(helper, *cone, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_ConeSurface") + tag); helper.write(cStream); helper.clear(); @@ -80,7 +80,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, coneSurfaces.push_back(cone); GeometryView3D::drawSurface(helper, *cone, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_ConeSurfaceSector") + tag); helper.write(cStream); helper.clear(); @@ -92,7 +92,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, coneSurfaces.push_back(cone); GeometryView3D::drawSurface(helper, *cone, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_ConeSurfaceSectorShifted") + tag); helper.write(cStream); helper.clear(); @@ -126,7 +126,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, cylinderSurfaces.push_back(cylinder); GeometryView3D::drawSurface(helper, *cylinder, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_CylinderSurface") + tag); helper.write(cStream); helper.clear(); @@ -138,7 +138,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, cylinderSurfaces.push_back(cylinder); GeometryView3D::drawSurface(helper, *cylinder, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_CylinderSurfaceSector") + tag); helper.write(cStream); helper.clear(); @@ -150,7 +150,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, cylinderSurfaces.push_back(cylinder); GeometryView3D::drawSurface(helper, *cylinder, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_CylinderSurfaceSectorShifted") + tag); helper.write(cStream); helper.clear(); @@ -179,7 +179,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, auto bbSurface = Surface::makeShared<PlaneSurface>(identity, bbBounds); GeometryView3D::drawSurface(helper, *bbSurface, gctx, Transform3::Identity(), sConfig); - ; + helper.write(bbPath); helper.write(cStream); helper.clear(); @@ -199,7 +199,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, radialSurfaces.push_back(disc); GeometryView3D::drawSurface(helper, *disc, gctx, Transform3::Identity(), sConfig); - ; + helper.write(std::string("Surfaces_DiscSurfaceFull") + tag); helper.write(cStream); helper.clear(); @@ -335,7 +335,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, planarSurfaces.push_back(plane); GeometryView3D::drawSurface(helper, *plane, gctx, Transform3::Identity(), sConfig); - ; + helper.write(name + tag); helper.write(cStream); helper.clear(); @@ -349,7 +349,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, planarSurfaces.push_back(plane); GeometryView3D::drawSurface(helper, *plane, gctx, Transform3::Identity(), sConfig); - ; + helper.write(name + tag); helper.write(cStream); helper.clear(); @@ -363,7 +363,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, planarSurfaces.push_back(plane); GeometryView3D::drawSurface(helper, *plane, gctx, Transform3::Identity(), sConfig); - ; + helper.write(name + tag); helper.write(cStream); helper.clear(); @@ -377,7 +377,7 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, planarSurfaces.push_back(plane); GeometryView3D::drawSurface(helper, *plane, gctx, Transform3::Identity(), sConfig); - ; + helper.write(name + tag); helper.write(cStream); helper.clear(); diff --git a/Tests/UnitTests/Core/Visualization/TrackingGeometryView3DBase.hpp b/Tests/UnitTests/Core/Visualization/TrackingGeometryView3DBase.hpp index b2fb89c0ee8..ea2e409222d 100644 --- a/Tests/UnitTests/Core/Visualization/TrackingGeometryView3DBase.hpp +++ b/Tests/UnitTests/Core/Visualization/TrackingGeometryView3DBase.hpp @@ -37,18 +37,22 @@ static inline std::string run(IVisualization3D& helper, bool triangulate, const std::string& tag) { std::stringstream cStream; - ViewConfig viewSensitive = {.color = {0, 180, 240}}; - viewSensitive.triangulate = triangulate; - ViewConfig viewPassive = {.color = {240, 280, 0}}; - viewPassive.triangulate = triangulate; - ViewConfig viewVolume = {.color = {220, 220, 0}}; - viewVolume.triangulate = triangulate; - ViewConfig viewContainer = {.color = {220, 220, 0}}; - viewContainer.triangulate = triangulate; - ViewConfig viewGrid = {.color = {220, 0, 0}}; - viewGrid.nSegments = 8; - viewGrid.offset = 3.; - viewGrid.triangulate = triangulate; + ViewConfig viewSensitive = {.color = {0, 180, 240}, + .quarterSegments = 72, + .triangulate = triangulate}; + ViewConfig viewPassive = {.color = {240, 280, 0}, + .quarterSegments = 72, + .triangulate = triangulate}; + ViewConfig viewVolume = {.color = {220, 220, 0}, + .quarterSegments = 72, + .triangulate = triangulate}; + ViewConfig viewContainer = {.color = {220, 220, 0}, + .quarterSegments = 72, + .triangulate = triangulate}; + ViewConfig viewGrid = {.color = {220, 0, 0}, + .offset = 3., + .quarterSegments = 8, + .triangulate = triangulate}; const Acts::TrackingVolume& tgVolume = *(tGeometry->highestTrackingVolume()); diff --git a/Tests/UnitTests/Examples/Io/Csv/MeasurementReaderWriterTests.cpp b/Tests/UnitTests/Examples/Io/Csv/MeasurementReaderWriterTests.cpp index 1a3d9662a2a..7786a5ec8a1 100644 --- a/Tests/UnitTests/Examples/Io/Csv/MeasurementReaderWriterTests.cpp +++ b/Tests/UnitTests/Examples/Io/Csv/MeasurementReaderWriterTests.cpp @@ -20,6 +20,7 @@ #include "ActsExamples/Io/Csv/CsvMeasurementReader.hpp" #include "ActsExamples/Io/Csv/CsvMeasurementWriter.hpp" +#include <algorithm> #include <fstream> #include <iostream> #include <random> @@ -152,7 +153,7 @@ BOOST_AUTO_TEST_CASE(CsvMeasurementRoundTrip) { std::abs(ca.activation - cb.activation) < 1.e-4; }; - BOOST_CHECK(std::any_of(b.channels.begin(), b.channels.end(), match)); + BOOST_CHECK(std::ranges::any_of(b.channels, match)); } } diff --git a/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp b/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp index 844122027d2..ad74a9024d1 100644 --- a/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp +++ b/Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp @@ -217,9 +217,9 @@ BOOST_DATA_TEST_CASE( ".csv"); /// Run the Segmentizer - auto cSegement = cl.segments(geoCtx, *surface, segmentation, {start, end}); + auto cSegments = cl.segments(geoCtx, *surface, segmentation, {start, end}); - for (const auto& cs : cSegement) { + for (const auto& cs : cSegments) { csvHelper.writeLine(segments, cs.path2D[0], cs.path2D[1]); } diff --git a/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp index bc33298431a..6f2c78620e9 100644 --- a/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/IndexedSurfacesSvgConverterTests.cpp @@ -42,7 +42,7 @@ IndexedSurfacesConverter::Options generateDrawOptions() { sensitiveStyle.highlights = {"onmouseover", "onmouseout"}; sensitiveStyle.strokeWidth = 0.5; sensitiveStyle.strokeColor = {0, 0, 0}; - sensitiveStyle.nSegments = 72u; + sensitiveStyle.quarterSegments = 72u; std::pair<GeometryIdentifier, Style> allSensitives = {GeometryIdentifier(0u), sensitiveStyle}; diff --git a/Tests/UnitTests/Plugins/ActSVG/LayerSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/LayerSvgConverterTests.cpp index 7dd3a93fe95..ff4afc789b6 100644 --- a/Tests/UnitTests/Plugins/ActSVG/LayerSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/LayerSvgConverterTests.cpp @@ -45,16 +45,17 @@ void setupTools() { std::shared_ptr<Acts::Layer> generateDiscLayer(Acts::ActsScalar rInner, Acts::ActsScalar rOuter, - unsigned int nSegments, + unsigned int quarterSegments, unsigned int nRings, bool useTrapezoids = false) { // Some preparations setupTools(); + unsigned int fullSegments = 4 * quarterSegments; std::vector<std::shared_ptr<const Acts::Surface>> moduleSurfaces; - Acts::ActsScalar phiStep = 2 * M_PI / nSegments; + Acts::ActsScalar phiStep = 2 * M_PI / fullSegments; Acts::ActsScalar rStep = (rOuter - rInner) / nRings; // Reserve & fill - moduleSurfaces.reserve(nSegments * nRings); + moduleSurfaces.reserve(fullSegments * nRings); // Radial disc if (!useTrapezoids) { for (unsigned int ir = 0; ir < nRings; ++ir) { @@ -62,7 +63,7 @@ std::shared_ptr<Acts::Layer> generateDiscLayer(Acts::ActsScalar rInner, rBounds = std::make_shared<Acts::RadialBounds>( rInner + ir * rStep - 0.025 * rInner, rInner + (ir + 1u) * rStep + 0.025 * rInner, 0.55 * phiStep, 0.); - for (unsigned int is = 0; is < nSegments; ++is) { + for (unsigned int is = 0; is < fullSegments; ++is) { // Place the module auto placement = Acts::Transform3::Identity(); if ((is % 2) != 0u) { @@ -82,14 +83,14 @@ std::shared_ptr<Acts::Layer> generateDiscLayer(Acts::ActsScalar rInner, Acts::ActsScalar yHalf = rStep * 0.5125; Acts::ActsScalar xHalfMin = - 1.15 * (rInner + ir * rStep) * M_PI / nSegments; + 1.15 * (rInner + ir * rStep) * M_PI / fullSegments; Acts::ActsScalar xHalfMax = - 1.15 * (rInner + (ir + 1) * rStep) * M_PI / nSegments; + 1.15 * (rInner + (ir + 1) * rStep) * M_PI / fullSegments; std::shared_ptr<const Acts::TrapezoidBounds> tBounds = std::make_shared<const Acts::TrapezoidBounds>(xHalfMin, xHalfMax, yHalf); - for (unsigned int is = 0; is < nSegments; ++is) { + for (unsigned int is = 0; is < fullSegments; ++is) { // Setting the phi Acts::ActsScalar cphi = -M_PI + is * phiStep; Acts::Vector3 center(radius * std::cos(cphi), radius * std::sin(cphi), @@ -111,7 +112,7 @@ std::shared_ptr<Acts::Layer> generateDiscLayer(Acts::ActsScalar rInner, } } // Let's create the disc layer - return lCreator->discLayer(tgContext, moduleSurfaces, nRings, nSegments); + return lCreator->discLayer(tgContext, moduleSurfaces, nRings, fullSegments); } } // namespace @@ -125,7 +126,7 @@ BOOST_AUTO_TEST_CASE(DiscLayerRadialSvg) { discLayerStyle.highlights = {"mouseover", "mouseout"}; discLayerStyle.strokeColor = {25, 25, 25}; discLayerStyle.strokeWidth = 0.5; - discLayerStyle.nSegments = 72u; + discLayerStyle.quarterSegments = 72u; Acts::GeometryIdentifier geoID{0}; @@ -155,7 +156,7 @@ BOOST_AUTO_TEST_CASE(DiscLayerTrapezoidSvg) { discLayerStyle.highlights = {"mouseover", "mouseout"}; discLayerStyle.strokeColor = {25, 25, 25}; discLayerStyle.strokeWidth = 0.5; - discLayerStyle.nSegments = 72u; + discLayerStyle.quarterSegments = 72u; Acts::GeometryIdentifier geoID{0}; @@ -185,7 +186,7 @@ BOOST_AUTO_TEST_CASE(CylinderLayerSvg) { cylinderLayerStyle.highlights = {"mouseover", "mouseout"}; cylinderLayerStyle.strokeColor = {25, 25, 25}; cylinderLayerStyle.strokeWidth = 0.5; - cylinderLayerStyle.nSegments = 72u; + cylinderLayerStyle.quarterSegments = 72u; Acts::GeometryIdentifier geoID{0}; diff --git a/Tests/UnitTests/Plugins/ActSVG/PortalSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/PortalSvgConverterTests.cpp index 7f4cfa5d425..9fb1fdffa40 100644 --- a/Tests/UnitTests/Plugins/ActSVG/PortalSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/PortalSvgConverterTests.cpp @@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(CylinderPortalsSvg) { portalStyle.highlights = {}; portalStyle.strokeColor = {25, 25, 25}; portalStyle.strokeWidth = 0.5; - portalStyle.nSegments = 72u; + portalStyle.quarterSegments = 72u; Acts::ActsScalar rInner = 10.; Acts::ActsScalar rOuter = 100.; @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(CylinderContainerPortalsSvg) { portalStyle.highlights = {}; portalStyle.strokeColor = {25, 25, 25}; portalStyle.strokeWidth = 0.5; - portalStyle.nSegments = 72u; + portalStyle.quarterSegments = 72u; Acts::ActsScalar rInner = 10.; Acts::ActsScalar rMiddle = 100.; diff --git a/Tests/UnitTests/Plugins/ActSVG/SurfaceSvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/SurfaceSvgConverterTests.cpp index 49c92f3aaf9..8450453720c 100644 --- a/Tests/UnitTests/Plugins/ActSVG/SurfaceSvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/SurfaceSvgConverterTests.cpp @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(PlanarSurfaces) { planarStyle.highlightColor = {255, 153, 51}; planarStyle.highlights = {"mouseover", "mouseout"}; planarStyle.strokeWidth = 0.5; - planarStyle.nSegments = 0u; + planarStyle.quarterSegments = 0u; // Rectangle case auto rectangleBounds = std::make_shared<Acts::RectangleBounds>(36., 64.); @@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfaces) { discStyle.highlightColor = {153, 204, 0}; discStyle.highlights = {"mouseover", "mouseout"}; discStyle.strokeWidth = 0.5; - discStyle.nSegments = 72u; + discStyle.quarterSegments = 72u; auto transform = Acts::Transform3::Identity(); transform.pretranslate(Acts::Vector3{20., 20., 100.}); diff --git a/Tests/UnitTests/Plugins/ActSVG/TrackingGeometrySvgConverterTests.cpp b/Tests/UnitTests/Plugins/ActSVG/TrackingGeometrySvgConverterTests.cpp index 7c869e90de7..3b7a8856875 100644 --- a/Tests/UnitTests/Plugins/ActSVG/TrackingGeometrySvgConverterTests.cpp +++ b/Tests/UnitTests/Plugins/ActSVG/TrackingGeometrySvgConverterTests.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometrySvg) { cylinderLayerStyle.highlights = {"mouseover", "mouseout"}; cylinderLayerStyle.strokeColor = {25, 25, 25}; cylinderLayerStyle.strokeWidth = 0.5; - cylinderLayerStyle.nSegments = 72u; + cylinderLayerStyle.quarterSegments = 72u; Acts::GeometryIdentifier geoID{0}; diff --git a/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp b/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp index 3309895866b..2f18c391958 100644 --- a/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp +++ b/Tests/UnitTests/Plugins/TGeo/TGeoTubeConversionTests.cpp @@ -99,7 +99,6 @@ BOOST_AUTO_TEST_CASE(TGeoTube_to_CylinderSurface) { objVis, center, center + 1.2 * bR * rotation.col(1), 4., 2.5, green); GeometryView3D::drawArrowForward( objVis, center, center + 1.2 * bhZ * rotation.col(2), 4., 2.5, blue); - objVis.write("TGeoConversion_TGeoTube_CylinderSurface_" + std::to_string(icyl)); objVis.clear();