diff --git a/Core/include/ACTS/Surfaces/ConeSurface.hpp b/Core/include/ACTS/Surfaces/ConeSurface.hpp index b2ddb4e0af874f0acefba688cb7067784d3e9df1..ec24bd9023f535559322667c95796024385865b6 100644 --- a/Core/include/ACTS/Surfaces/ConeSurface.hpp +++ b/Core/include/ACTS/Surfaces/ConeSurface.hpp @@ -77,6 +77,9 @@ public: /// @param htrans is the additional transfrom applied after copying ConeSurface(const ConeSurface& other, const Transform3D& htrans); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from ConeSurface(const variant_data& data); virtual ~ConeSurface(); @@ -224,6 +227,8 @@ public: virtual std::string name() const override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/CylinderBounds.hpp b/Core/include/ACTS/Surfaces/CylinderBounds.hpp index 89d465c16722247e7cc2ae949c815826b9a33443..c82538020e9d262d68fb5761c1ed37560ce7cf64 100644 --- a/Core/include/ACTS/Surfaces/CylinderBounds.hpp +++ b/Core/include/ACTS/Surfaces/CylinderBounds.hpp @@ -78,6 +78,9 @@ public: double halfPhi, double halfZ); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from CylinderBounds(const variant_data& data); virtual ~CylinderBounds(); @@ -138,6 +141,8 @@ public: double halflengthZ() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/CylinderSurface.hpp b/Core/include/ACTS/Surfaces/CylinderSurface.hpp index 733e76f98b4ea4892a7c9949523abd60062719a6..9315a84a5cdf1358f198b7280e85ff46c5bd2d19 100644 --- a/Core/include/ACTS/Surfaces/CylinderSurface.hpp +++ b/Core/include/ACTS/Surfaces/CylinderSurface.hpp @@ -91,6 +91,9 @@ public: /// cylinder CylinderSurface(const CylinderSurface& other, const Transform3D& htrans); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from CylinderSurface(const variant_data& data); /// Destructor @@ -240,6 +243,8 @@ public: virtual std::string name() const override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/DiamondBounds.hpp b/Core/include/ACTS/Surfaces/DiamondBounds.hpp index bf3bd7b9bbb7cb08799e3f8c1fa09ad4ce1be341..153d9c4aff77fc5d989ab24668992d65ebe2f2e6 100644 --- a/Core/include/ACTS/Surfaces/DiamondBounds.hpp +++ b/Core/include/ACTS/Surfaces/DiamondBounds.hpp @@ -54,6 +54,9 @@ public: double haley1, double haley2); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from DiamondBounds(const variant_data& data); virtual ~DiamondBounds(); @@ -122,6 +125,8 @@ public: double halflengthY2() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/DiscSurface.hpp b/Core/include/ACTS/Surfaces/DiscSurface.hpp index a3f3f16bfc668c24e10df911ef84460f9ec9d333..e7f67d65de495e3f5bade1c73fa38e377b9cf1b5 100644 --- a/Core/include/ACTS/Surfaces/DiscSurface.hpp +++ b/Core/include/ACTS/Surfaces/DiscSurface.hpp @@ -115,6 +115,9 @@ public: /// @param transf is the additional transform applied to the surface DiscSurface(const DiscSurface& other, const Transform3D& transf); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from DiscSurface(const variant_data& data); virtual ~DiscSurface(); @@ -314,6 +317,8 @@ public: virtual std::string name() const override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp b/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp index 452e96e9cb3d2f298b15a7289671069165f15068..3fb29e9a01fa4e605ba80ce8b1971cb7cff63d4a 100644 --- a/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp +++ b/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp @@ -62,6 +62,9 @@ public: double avephi = M_PI_2, double stereo = 0.); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from DiscTrapezoidalBounds(const variant_data& data); virtual ~DiscTrapezoidalBounds(); @@ -130,6 +133,8 @@ public: double halflengthY() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/EllipseBounds.hpp b/Core/include/ACTS/Surfaces/EllipseBounds.hpp index e55b708501c118642f5d56cef92326c9c22f659c..fbf2061ca15f5f1fc9828db786e9bedc9ca7bb5f 100644 --- a/Core/include/ACTS/Surfaces/EllipseBounds.hpp +++ b/Core/include/ACTS/Surfaces/EllipseBounds.hpp @@ -63,6 +63,9 @@ public: double averagePhi = 0., double halfPhi = M_PI); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from EllipseBounds(const variant_data& data); virtual ~EllipseBounds(); @@ -130,6 +133,8 @@ public: double halfPhiSector() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/InfiniteBounds.hpp b/Core/include/ACTS/Surfaces/InfiniteBounds.hpp index abff1d05f5de63a842bbf62ef6ae8b5bcb3f2667..db2dd01e859c257de9d07ecd1eb20eaa69ac03a8 100644 --- a/Core/include/ACTS/Surfaces/InfiniteBounds.hpp +++ b/Core/include/ACTS/Surfaces/InfiniteBounds.hpp @@ -76,6 +76,8 @@ public: return os; } + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; }; diff --git a/Core/include/ACTS/Surfaces/LineBounds.hpp b/Core/include/ACTS/Surfaces/LineBounds.hpp index 5ab63bf92a2b7a221dc6bdc41affc89f7b390d66..bc5c953ea50800d03ea9e8d0389a65fa6bbbc5d1 100644 --- a/Core/include/ACTS/Surfaces/LineBounds.hpp +++ b/Core/include/ACTS/Surfaces/LineBounds.hpp @@ -37,6 +37,9 @@ public: /// @param halez is the half length in z, defualt = 0. LineBounds(double radius = 0., double halez = 0.); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from LineBounds(const variant_data& data); virtual ~LineBounds(); @@ -84,6 +87,8 @@ public: virtual std::ostream& dump(std::ostream& sl) const final override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/LineSurface.hpp b/Core/include/ACTS/Surfaces/LineSurface.hpp index 63eba981b2e14158b5d09d43d702d0cb97510c37..b3dbe69dbede8d20d2e3d032be5f5e69cbdbdfe5 100644 --- a/Core/include/ACTS/Surfaces/LineSurface.hpp +++ b/Core/include/ACTS/Surfaces/LineSurface.hpp @@ -75,6 +75,9 @@ public: /// @param transf The additional transform applied after copying LineSurface(const LineSurface& other, const Transform3D& transf); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from LineSurface(const variant_data& data); virtual ~LineSurface(); @@ -275,6 +278,8 @@ public: virtual std::string name() const override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/PerigeeSurface.hpp b/Core/include/ACTS/Surfaces/PerigeeSurface.hpp index dff4e90469f550496c756bbe325d5eb016156960..ea0e8e85c91a7b595787ee9eafaeb8255db79e6f 100644 --- a/Core/include/ACTS/Surfaces/PerigeeSurface.hpp +++ b/Core/include/ACTS/Surfaces/PerigeeSurface.hpp @@ -54,6 +54,9 @@ public: /// @param transf is the transformed applied after copying PerigeeSurface(const PerigeeSurface& other, const Transform3D& transf); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from PerigeeSurface(const variant_data& data); virtual ~PerigeeSurface(); @@ -84,6 +87,8 @@ public: virtual std::ostream& dump(std::ostream& sl) const final override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; }; diff --git a/Core/include/ACTS/Surfaces/PlanarBounds.hpp b/Core/include/ACTS/Surfaces/PlanarBounds.hpp index 988f810db1fa5d4104ed50f4a66c2b946419e119..b37c060de40f7db8e73dadfec6d4c4325b7124b9 100644 --- a/Core/include/ACTS/Surfaces/PlanarBounds.hpp +++ b/Core/include/ACTS/Surfaces/PlanarBounds.hpp @@ -40,6 +40,8 @@ public: virtual const RectangleBounds& boundingBox() const = 0; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const = 0; }; diff --git a/Core/include/ACTS/Surfaces/PlaneSurface.hpp b/Core/include/ACTS/Surfaces/PlaneSurface.hpp index d3a684356c1815f327d6d15af16bfd937fa4be86..c4a0a9f5a4e99cb94ef601bf2438a3767f8ae70c 100644 --- a/Core/include/ACTS/Surfaces/PlaneSurface.hpp +++ b/Core/include/ACTS/Surfaces/PlaneSurface.hpp @@ -74,6 +74,9 @@ public: PlaneSurface(std::shared_ptr<const Transform3D> htrans, std::shared_ptr<const PlanarBounds> pbounds = nullptr); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from PlaneSurface(const variant_data& data); virtual ~PlaneSurface(); @@ -207,6 +210,8 @@ public: virtual std::string name() const override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/RadialBounds.hpp b/Core/include/ACTS/Surfaces/RadialBounds.hpp index 4ffaf456c5d942ee7907f409b3fb7d04026d1e88..38a4d9d8a6a5b5a28c20963b4c62ec060be6d717 100644 --- a/Core/include/ACTS/Surfaces/RadialBounds.hpp +++ b/Core/include/ACTS/Surfaces/RadialBounds.hpp @@ -62,6 +62,9 @@ public: /// coverage) RadialBounds(double minrad, double maxrad, double avephi, double hphisec); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from RadialBounds(const variant_data& data); virtual ~RadialBounds(); @@ -116,6 +119,8 @@ public: double halfPhiSector() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/RectangleBounds.hpp b/Core/include/ACTS/Surfaces/RectangleBounds.hpp index e0b5d0bb5929458019c441fcf1b6f8d47f318ef4..eb6aa2a7faa6568c8d1532574e8e4a07b0490d85 100644 --- a/Core/include/ACTS/Surfaces/RectangleBounds.hpp +++ b/Core/include/ACTS/Surfaces/RectangleBounds.hpp @@ -43,6 +43,9 @@ public: /// @param halfY halflength in Y RectangleBounds(double halfX, double halfY); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from RectangleBounds(const variant_data& data); virtual ~RectangleBounds(); @@ -96,6 +99,8 @@ public: double halflengthY() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/StrawSurface.hpp b/Core/include/ACTS/Surfaces/StrawSurface.hpp index 9c3ebf443becc7600932bae7e6e71931c9f6fae8..4335a0fd3d99527c826c17c78ed691d2108d2620 100644 --- a/Core/include/ACTS/Surfaces/StrawSurface.hpp +++ b/Core/include/ACTS/Surfaces/StrawSurface.hpp @@ -75,6 +75,9 @@ public: /// @param htrans is the additional transform applied after copying StrawSurface(const StrawSurface& other, const Transform3D& htrans); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from StrawSurface(const variant_data& data); virtual ~StrawSurface(); @@ -99,6 +102,8 @@ public: virtual std::string name() const final override; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const override; }; diff --git a/Core/include/ACTS/Surfaces/Surface.hpp b/Core/include/ACTS/Surfaces/Surface.hpp index 96632a748f7d58572d266f3d2643839e686dd569..3751c920ed02631f861c7198f6e3b8118a6bcfd8 100644 --- a/Core/include/ACTS/Surfaces/Surface.hpp +++ b/Core/include/ACTS/Surfaces/Surface.hpp @@ -392,6 +392,8 @@ public: virtual std::string name() const = 0; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const = 0; diff --git a/Core/include/ACTS/Surfaces/SurfaceArray.hpp b/Core/include/ACTS/Surfaces/SurfaceArray.hpp index d7d0ac045062edc1704f0c61ee6bdac04b159d89..af8d3bf141bddb19dfb2667ddd9e0a512879ca3a 100644 --- a/Core/include/ACTS/Surfaces/SurfaceArray.hpp +++ b/Core/include/ACTS/Surfaces/SurfaceArray.hpp @@ -17,9 +17,9 @@ #include "ACTS/Utilities/Definitions.hpp" #include "ACTS/Utilities/IAxis.hpp" #include "ACTS/Utilities/InstanceFactory.hpp" +#include "ACTS/Utilities/VariantDataFwd.hpp" #include "ACTS/Utilities/detail/Axis.hpp" #include "ACTS/Utilities/detail/Grid.hpp" -#include "ACTS/Utilities/VariantDataFwd.hpp" namespace Acts { @@ -491,6 +491,7 @@ public: /// its own /// @param surfaces The input vector of surfaces. This is only for /// bookkeeping, so we can ask + /// @param transform Optional additional transform for this SurfaceArray SurfaceArray(std::unique_ptr<ISurfaceGridLookup> gridLookup, SurfaceVector surfaces, std::shared_ptr<const Transform3D> transform = nullptr) @@ -504,6 +505,7 @@ public: /// @param gridLookup The grid storage. Is static casted to ISurfaceGridLookup /// @param surfaces The input vector of surfaces. This is only for /// bookkeeping, so we can ask + /// @param transform Optional additional transform for this SurfaceArray template <class SGL> SurfaceArray(std::unique_ptr<SGL> gridLookup, SurfaceVector surfaces, @@ -518,19 +520,28 @@ public: /// SingleElementLookup /// @param srf The one and only surface SurfaceArray(const Surface* srf) - : p_gridLookup(static_cast<ISurfaceGridLookup*>(new SingleElementLookup(srf))) + : p_gridLookup( + static_cast<ISurfaceGridLookup*>(new SingleElementLookup(srf))) , m_surfaces({srf}) { } + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from + /// @param g2l Callable that converts from global to local + /// @param l2g Callable that converts from local to global SurfaceArray(const variant_data& data_, std::function<Vector2D(const Vector3D&)> g2l, std::function<Vector3D(const Vector2D&)> l2g, std::shared_ptr<const Transform3D> transform = nullptr); - SurfaceArray(const variant_data& data_, + // This is here so that overload resolution can figure out + // we need std::array<double, 1> as local parameters here. + SurfaceArray(const variant_data& data_, std::function<std::array<double, 1>(const Vector3D&)> g2l, - std::function<Vector3D(const std::array<double, 1>&)> l2g); + std::function<Vector3D(const std::array<double, 1>&)> l2g, + std::shared_ptr<const Transform3D> transform = nullptr); /// @brief Get all surfaces in bin given by position. /// @param pos the lookup position diff --git a/Core/include/ACTS/Surfaces/SurfaceBounds.hpp b/Core/include/ACTS/Surfaces/SurfaceBounds.hpp index 1d853407d2dfef468cd7b89caaf09f7e86fba2ae..abbffe4ab8638faeb6503fcfb75a04d181dd0277 100644 --- a/Core/include/ACTS/Surfaces/SurfaceBounds.hpp +++ b/Core/include/ACTS/Surfaces/SurfaceBounds.hpp @@ -98,6 +98,8 @@ public: virtual std::ostream& dump(std::ostream& os) const = 0; + /// Produce a @c variant_data representation of this object + /// @return The representation virtual variant_data toVariantData() const = 0; }; diff --git a/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp b/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp index cbd74f2eabae0cbca206aa7736af6f4e9f9bfcde..808670404be26b044ff26a61ac4dfd4f12da6cd5 100644 --- a/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp @@ -52,6 +52,9 @@ public: /// @param haley half length Y - defined at x=0 TrapezoidBounds(double minhalex, double maxhalex, double haley); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from TrapezoidBounds(const variant_data& data); virtual ~TrapezoidBounds(); @@ -149,6 +152,8 @@ public: double halflengthY() const; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Surfaces/TriangleBounds.hpp b/Core/include/ACTS/Surfaces/TriangleBounds.hpp index 53d609adb3f18d495e1d6a556c29a4db23861ef1..c7d314380cead36537dceac88120ae633e53b9d0 100644 --- a/Core/include/ACTS/Surfaces/TriangleBounds.hpp +++ b/Core/include/ACTS/Surfaces/TriangleBounds.hpp @@ -51,6 +51,9 @@ public: /// @param vertices is the vector of vertices TriangleBounds(const std::array<Vector2D, 3>& vertices); + /// Constructor which accepts @c variant_data + /// + /// @param data the @c variant_data to build from TriangleBounds(const variant_data& data); virtual ~TriangleBounds(); @@ -95,6 +98,8 @@ public: virtual std::ostream& dump(std::ostream& sl) const final override; + /// Produce a @c variant_data representation of this object + /// @return The representation variant_data toVariantData() const override; diff --git a/Core/include/ACTS/Utilities/InstanceFactory.hpp b/Core/include/ACTS/Utilities/InstanceFactory.hpp index 07dbf6d6a6f609692f888b12e46816de8ec99d1a..03e691c439850e99325d8a9538d09a896527a981 100644 --- a/Core/include/ACTS/Utilities/InstanceFactory.hpp +++ b/Core/include/ACTS/Utilities/InstanceFactory.hpp @@ -27,15 +27,21 @@ namespace Acts { -using SurfaceBoundsPtr = std::shared_ptr<const SurfaceBounds>; -using PlanarBoundsPtr = std::shared_ptr<const PlanarBounds>; -using SurfaceBoundsFactory - = std::function<SurfaceBoundsPtr(const variant_data&)>; -using SurfaceFactory = std::function<const Surface*(const variant_data&)>; - +/// Class that creates instances for certain types of objects +/// from @c variant_data input. This is used to avoid duplicating +/// this type of code anywhere we construct from @c variant_data. class InstanceFactory { + // internal typedefs + using SurfaceBoundsPtr = std::shared_ptr<const SurfaceBounds>; + using PlanarBoundsPtr = std::shared_ptr<const PlanarBounds>; + using SurfaceBoundsFactory + = std::function<SurfaceBoundsPtr(const variant_data&)>; + using SurfaceFactory = std::function<const Surface*(const variant_data&)>; + public: + /// Default constructor. Sets up a map to lambdas which return + /// pointers to the newly constructor instances. InstanceFactory() { // set up map to store factories @@ -68,6 +74,9 @@ public: = [](auto const& data) { return new PlaneSurface(data); }; } + /// Method to produce planar bounds type objects + /// @param cname The class name + /// @param data The @c variant_data to construct from PlanarBoundsPtr planarBounds(const std::string& cname, const variant_data& data) const { @@ -79,6 +88,9 @@ public: return plnBnd_ptr; } + /// Method to produce disc bounds type objects + /// @param cname The class name + /// @param data The @c variant_data to construct from std::shared_ptr<const DiscBounds> discBounds(const std::string& cname, const variant_data& data) const { @@ -90,6 +102,9 @@ public: return discBnd_ptr; } + /// Method to produce surface bounds type objects + /// @param cname The class name + /// @param data The @c variant_data to construct from SurfaceBoundsPtr surfaceBounds(const std::string& cname, const variant_data& data) const { @@ -98,6 +113,9 @@ public: return m_surfaceBounds.at(cname)(data); } + /// Method to produce surface objects + /// @param cname The class name + /// @param data The @c variant_data to construct from const Surface* surface(const std::string& cname, const variant_data& data) const { diff --git a/Core/include/ACTS/Utilities/VariantDataFwd.hpp b/Core/include/ACTS/Utilities/VariantDataFwd.hpp index 90815390c6a2bc31a65c889a42a4be4b4221ff4f..9000720c7e67a67fc9f35a82dc8412d81cff05b0 100644 --- a/Core/include/ACTS/Utilities/VariantDataFwd.hpp +++ b/Core/include/ACTS/Utilities/VariantDataFwd.hpp @@ -22,6 +22,8 @@ namespace Acts { class variant_map; class variant_vector; +/// Forward declaration for the variant data structure +/// using boost's own forward variant. using variant_data = boost::variant<int, double, std::string, diff --git a/Core/src/Surfaces/SurfaceArray.cpp b/Core/src/Surfaces/SurfaceArray.cpp index 80a20f83f10a9668dc8236177f3e5aa6e1c4015b..c35f93b91fc2e4502051c74db31ce5e6cb528dcb 100644 --- a/Core/src/Surfaces/SurfaceArray.cpp +++ b/Core/src/Surfaces/SurfaceArray.cpp @@ -50,7 +50,7 @@ Acts::SurfaceArray::surfaceGridLookupToVariantData( for (const auto& axis : sgl.getAxes()) { variant_map ax_pl; - ax_pl["axistype"] = axis->isEquidistant() ? "equidistant"s : "variable"s; + ax_pl["axistype"] = axis->isEquidistant() ? "equidistant"s : "variable"s; if (axis->isEquidistant()) { ax_pl["min"] = axis->getMin(); @@ -210,8 +210,9 @@ Acts::SurfaceArray::SurfaceArray(const variant_data& data_, Acts::SurfaceArray::SurfaceArray( const variant_data& data_, std::function<std::array<double, 1>(const Vector3D&)> g2l, - std::function<Vector3D(const std::array<double, 1>&)> l2g) - : p_gridLookup(nullptr) + std::function<Vector3D(const std::array<double, 1>&)> l2g, + std::shared_ptr<const Transform3D> transform) + : p_gridLookup(nullptr), m_transform(transform) { const variant_map& data = boost::get<variant_map>(data_); throw_assert(data.get<std::string>("type") == "SurfaceArray", @@ -254,8 +255,8 @@ Acts::SurfaceArray::SurfaceArray( var_axis.get<double>("max"), var_axis.get<int>("nbins")); - p_gridLookup - = std::make_unique<SurfaceGridLookup<decltype(axis)>>(g2l, l2g, std::make_tuple(axis)); + p_gridLookup = std::make_unique<SurfaceGridLookup<decltype(axis)>>( + g2l, l2g, std::make_tuple(axis)); } else if (axistype == "equidistant" && axisbdt == "closed") { detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Closed> @@ -263,16 +264,16 @@ Acts::SurfaceArray::SurfaceArray( var_axis.get<double>("max"), var_axis.get<int>("nbins")); - p_gridLookup - = std::make_unique<SurfaceGridLookup<decltype(axis)>>(g2l, l2g, std::make_tuple(axis)); + p_gridLookup = std::make_unique<SurfaceGridLookup<decltype(axis)>>( + g2l, l2g, std::make_tuple(axis)); } else if (axistype == "equidistant" && axisbdt == "open") { detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Open> axis(var_axis.get<double>("min"), var_axis.get<double>("max"), var_axis.get<int>("nbins")); - p_gridLookup - = std::make_unique<SurfaceGridLookup<decltype(axis)>>(g2l, l2g, std::make_tuple(axis)); + p_gridLookup = std::make_unique<SurfaceGridLookup<decltype(axis)>>( + g2l, l2g, std::make_tuple(axis)); } else if (axistype == "variable") { std::vector<double> bin_edges; @@ -285,18 +286,18 @@ Acts::SurfaceArray::SurfaceArray( if (axisbdt == "bound") { detail::Axis<detail::AxisType::Variable, detail::AxisBoundaryType::Bound> axis(bin_edges); - p_gridLookup - = std::make_unique<SurfaceGridLookup<decltype(axis)>>(g2l, l2g, std::make_tuple(axis)); + p_gridLookup = std::make_unique<SurfaceGridLookup<decltype(axis)>>( + g2l, l2g, std::make_tuple(axis)); } else if (axisbdt == "closed") { detail::Axis<detail::AxisType::Variable, detail::AxisBoundaryType::Closed> axis(bin_edges); - p_gridLookup - = std::make_unique<SurfaceGridLookup<decltype(axis)>>(g2l, l2g, std::make_tuple(axis)); + p_gridLookup = std::make_unique<SurfaceGridLookup<decltype(axis)>>( + g2l, l2g, std::make_tuple(axis)); } else if (axisbdt == "open") { detail::Axis<detail::AxisType::Variable, detail::AxisBoundaryType::Open> axis(bin_edges); - p_gridLookup - = std::make_unique<SurfaceGridLookup<decltype(axis)>>(g2l, l2g, std::make_tuple(axis)); + p_gridLookup = std::make_unique<SurfaceGridLookup<decltype(axis)>>( + g2l, l2g, std::make_tuple(axis)); } } diff --git a/Core/src/Tools/SurfaceArrayCreator.cpp b/Core/src/Tools/SurfaceArrayCreator.cpp index 1dba01c30b2a3d0f13ab5e489b52c8dc0c8a4588..4f1e328393d14c170cd597ac3b154e84fe443f8c 100644 --- a/Core/src/Tools/SurfaceArrayCreator.cpp +++ b/Core/src/Tools/SurfaceArrayCreator.cpp @@ -36,7 +36,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ACTS_VERBOSE("Creating a SurfaceArray on a cylinder"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") ACTS_VERBOSE(" -- with phi x z = " << binsPhi << " x " << binsZ << " = " - << binsPhi * binsZ << " bins."); + << binsPhi * binsZ + << " bins."); Transform3D transform = _transform != nullptr ? *_transform : Transform3D::Identity(); @@ -100,8 +101,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( else pAxisZ = createVariableAxis(surfaces, binZ, protoLayer, transform); - Transform3D itransform = transform.inverse(); - auto globalToLocal = [transform](const Vector3D& pos) { + Transform3D itransform = transform.inverse(); + auto globalToLocal = [transform](const Vector3D& pos) { Vector3D loc = transform * pos; return Vector2D(loc.phi(), loc.z()); }; @@ -126,7 +127,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ACTS_VERBOSE("Creating a SurfaceArray on a cylinder"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") ACTS_VERBOSE(" -- with phi x z = " << bins0 << " x " << bins1 << " = " - << bins0 * bins1 << " bins."); + << bins0 * bins1 + << " bins."); return std::make_unique<SurfaceArray>( std::move(sl), surfaces, std::make_shared<const Transform3D>(transform)); @@ -179,7 +181,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") ACTS_VERBOSE(" -- with r x phi = " << bins0 << " x " << bins1 << " = " - << bins0 * bins1 << " bins."); + << bins0 * bins1 + << " bins."); sl->fill(surfaces); completeBinning(*sl, surfaces); @@ -263,7 +266,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") ACTS_VERBOSE(" -- with r x phi = " << bins0 << " x " << bins1 << " = " - << bins0 * bins1 << " bins."); + << bins0 * bins1 + << " bins."); sl->fill(surfaces); completeBinning(*sl, surfaces); @@ -288,7 +292,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( std::vector<const Acts::Surface*> Acts::SurfaceArrayCreator::findKeySurfaces( - const std::vector<const Surface*>& surfaces, + const std::vector<const Surface*>& surfaces, std::function<bool(const Surface*, const Surface*)> equal) const { std::vector<const Surface*> keys; @@ -353,9 +357,8 @@ Acts::SurfaceArrayCreator::createVariableAxis( < b->binningPosition(binPhi).phi()); }); - double maxPhi = 0.5 - * (keys.at(0)->binningPosition(binPhi).phi() - + keys.at(1)->binningPosition(binPhi).phi()); + double maxPhi = 0.5 * (keys.at(0)->binningPosition(binPhi).phi() + + keys.at(1)->binningPosition(binPhi).phi()); // create rotation, so that maxPhi is +pi double angle = -(M_PI + maxPhi); diff --git a/Plugins/JsonPlugin/include/ACTS/Plugins/JsonPlugin/FromJson.hpp b/Plugins/JsonPlugin/include/ACTS/Plugins/JsonPlugin/FromJson.hpp index c87ab1806fc30f58b90726a80425d322bccd5dfb..6e55bfce6fb190dd7c903a352b9c75e84e3cd7da 100644 --- a/Plugins/JsonPlugin/include/ACTS/Plugins/JsonPlugin/FromJson.hpp +++ b/Plugins/JsonPlugin/include/ACTS/Plugins/JsonPlugin/FromJson.hpp @@ -14,6 +14,8 @@ namespace Acts { +/// Method to turn an instance of @c nlohmann::json into @c variant_data +/// which can then be processed further. variant_data from_json(const nlohmann::json& node); diff --git a/Tests/Surfaces/SurfaceArrayTests.cpp b/Tests/Surfaces/SurfaceArrayTests.cpp index 09f21c80d61bcc0a6f12d83e9626dbba2c1729a9..b339f17b4da2c1d1504be65f656fd94eb75ee0ab 100644 --- a/Tests/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/Surfaces/SurfaceArrayTests.cpp @@ -291,10 +291,12 @@ namespace Test { R * std::sin(loc[0] - angleShift), loc[1]); }; - auto sl = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(phiAxis), decltype(zAxis)>>( - transform, - itransform, - std::make_tuple(std::move(phiAxis), std::move(zAxis))); + auto sl + = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(phiAxis), + decltype(zAxis)>>( + transform, + itransform, + std::make_tuple(std::move(phiAxis), std::move(zAxis))); sl->fill(brl); SurfaceArray sa(std::move(sl), brl); sa.dump(std::cout); @@ -353,8 +355,9 @@ namespace Test { auto itransform = [](const std::array<double, 1>& loc) { return Vector3D(0, 0, loc[0]); }; - auto sl = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(zAxis)>>( - transform, itransform, std::make_tuple(zAxis)); + auto sl + = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(zAxis)>>( + transform, itransform, std::make_tuple(zAxis)); // same thing in 1D SrfVec line = straightLineSurfaces(); diff --git a/Tests/Surfaces/SurfaceStub.hpp b/Tests/Surfaces/SurfaceStub.hpp index 42ca8bcc9671734de029b12f4eb600a6f5941ccd..41e728d66ef131682551984530bf194bf8f90a9f 100644 --- a/Tests/Surfaces/SurfaceStub.hpp +++ b/Tests/Surfaces/SurfaceStub.hpp @@ -121,6 +121,7 @@ public: return true; } + /// Conform to base class signature virtual variant_data toVariantData() const override {