diff --git a/CMakeLists.txt b/CMakeLists.txt index 601264badc0..04fb58d6825 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -550,13 +550,6 @@ if(ACTS_BUILD_DOCS) find_package(Sphinx REQUIRED) endif() -if(ACTS_CUSTOM_SCALARTYPE) - message( - STATUS - "Building Acts with custom scalar type: ${ACTS_CUSTOM_SCALARTYPE}" - ) -endif() - # core library, core plugins, and other components add_component(Core Core) add_subdirectory(Plugins) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 554656f514c..25af0f03d49 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -35,13 +35,6 @@ if(ACTS_SOURCELINK_SBO_SIZE) ) endif() -if(ACTS_CUSTOM_SCALARTYPE) - target_compile_definitions( - ActsCore - PUBLIC -DACTS_CUSTOM_SCALARTYPE=${ACTS_CUSTOM_SCALARTYPE} - ) -endif() - if(ACTS_LOG_FAILURE_THRESHOLD) message( STATUS diff --git a/Core/include/Acts/Clusterization/TimedClusterization.hpp b/Core/include/Acts/Clusterization/TimedClusterization.hpp index e92ebce44e2..a53e7793f56 100644 --- a/Core/include/Acts/Clusterization/TimedClusterization.hpp +++ b/Core/include/Acts/Clusterization/TimedClusterization.hpp @@ -17,16 +17,16 @@ namespace Acts::Ccl { template concept HasRetrievableTimeInfo = requires(Cell cell) { - { getCellTime(cell) } -> std::same_as; + { getCellTime(cell) } -> std::same_as; }; template struct TimedConnect : public Acts::Ccl::DefaultConnect { - Acts::ActsScalar timeTolerance{std::numeric_limits::max()}; + double timeTolerance{std::numeric_limits::max()}; TimedConnect() = default; - TimedConnect(Acts::ActsScalar time); - TimedConnect(Acts::ActsScalar time, bool commonCorner) + TimedConnect(double time); + TimedConnect(double time, bool commonCorner) requires(N == 2); ~TimedConnect() override = default; diff --git a/Core/include/Acts/Clusterization/TimedClusterization.ipp b/Core/include/Acts/Clusterization/TimedClusterization.ipp index 0e7b3e5bda8..556d02ccce1 100644 --- a/Core/include/Acts/Clusterization/TimedClusterization.ipp +++ b/Core/include/Acts/Clusterization/TimedClusterization.ipp @@ -9,11 +9,10 @@ namespace Acts::Ccl { template -TimedConnect::TimedConnect(Acts::ActsScalar time) - : timeTolerance(time) {} +TimedConnect::TimedConnect(double time) : timeTolerance(time) {} template -TimedConnect::TimedConnect(Acts::ActsScalar time, bool commonCorner) +TimedConnect::TimedConnect(double time, bool commonCorner) requires(N == 2) : Acts::Ccl::DefaultConnect(commonCorner), timeTolerance(time) {} diff --git a/Core/include/Acts/Definitions/Algebra.hpp b/Core/include/Acts/Definitions/Algebra.hpp index 843958a3282..5684ab44c73 100644 --- a/Core/include/Acts/Definitions/Algebra.hpp +++ b/Core/include/Acts/Definitions/Algebra.hpp @@ -41,30 +41,19 @@ namespace Acts { /// any conditions e.g. square size, for the dynamic-sized case. Consequently, /// no dynamic-sized symmetric matrix type is defined. Use the /// `ActsDynamicMatrix` instead. -/// - -/// Common scalar (floating point type used for the default algebra types. -/// -/// Defaults to `double` but can be customized by the user. -#ifdef ACTS_CUSTOM_SCALARTYPE -using ActsScalar = ACTS_CUSTOM_SCALARTYPE; -#else -using ActsScalar = double; -#endif template -using ActsVector = Eigen::Matrix; +using ActsVector = Eigen::Matrix; template -using ActsMatrix = Eigen::Matrix; +using ActsMatrix = Eigen::Matrix; template -using ActsSquareMatrix = Eigen::Matrix; +using ActsSquareMatrix = Eigen::Matrix; -using ActsDynamicVector = Eigen::Matrix; +using ActsDynamicVector = Eigen::Matrix; -using ActsDynamicMatrix = - Eigen::Matrix; +using ActsDynamicMatrix = Eigen::Matrix; /// @defgroup coordinates-types Fixed-size vector/matrix types for coordinates /// @@ -84,22 +73,22 @@ using SquareMatrix3 = ActsSquareMatrix<3>; using SquareMatrix4 = ActsSquareMatrix<4>; // pure translation transformations -using Translation2 = Eigen::Translation; -using Translation3 = Eigen::Translation; +using Translation2 = Eigen::Translation; +using Translation3 = Eigen::Translation; // linear (rotation) matrices using RotationMatrix2 = ActsMatrix<2, 2>; using RotationMatrix3 = ActsMatrix<3, 3>; // pure rotation defined by a rotation angle around a rotation axis -using AngleAxis3 = Eigen::AngleAxis; +using AngleAxis3 = Eigen::AngleAxis; // combined affine transformations. types are chosen for better data alignment: // - 2d affine compact stored as 2x3 matrix // - 3d affine stored as 4x4 matrix -using Transform2 = Eigen::Transform; -using Transform3 = Eigen::Transform; +using Transform2 = Eigen::Transform; +using Transform3 = Eigen::Transform; -constexpr ActsScalar s_transformEquivalentTolerance = 1e-9; +constexpr double s_transformEquivalentTolerance = 1e-9; } // namespace Acts diff --git a/Core/include/Acts/Definitions/Direction.hpp b/Core/include/Acts/Definitions/Direction.hpp index d07646bab26..985caac0e6c 100644 --- a/Core/include/Acts/Definitions/Direction.hpp +++ b/Core/include/Acts/Definitions/Direction.hpp @@ -41,7 +41,7 @@ class Direction final { /// @param scalar is the signed value /// /// @return a direction enum - static constexpr Direction fromScalar(ActsScalar scalar) { + static constexpr Direction fromScalar(double scalar) { assert(scalar != 0); return scalar >= 0 ? Value::Positive : Value::Negative; } @@ -53,7 +53,7 @@ class Direction final { /// @param scalar is the signed value /// /// @return a direction enum - static constexpr Direction fromScalarZeroAsPositive(ActsScalar scalar) { + static constexpr Direction fromScalarZeroAsPositive(double scalar) { return scalar >= 0 ? Value::Positive : Value::Negative; } diff --git a/Core/include/Acts/Definitions/Tolerance.hpp b/Core/include/Acts/Definitions/Tolerance.hpp index 0b8ef36e55f..3c6fb1e76c0 100644 --- a/Core/include/Acts/Definitions/Tolerance.hpp +++ b/Core/include/Acts/Definitions/Tolerance.hpp @@ -15,19 +15,18 @@ namespace Acts { /// Tolerance for being numerical equal for geometry building -static constexpr ActsScalar s_epsilon = - 3 * std::numeric_limits::epsilon(); +static constexpr double s_epsilon = 3 * std::numeric_limits::epsilon(); /// Tolerance for being on Surface /// /// @note This is intentionally given w/o an explicit unit to avoid having /// to include the units header unnecessarily. With the native length /// unit of mm this corresponds to 0.1um. -static constexpr ActsScalar s_onSurfaceTolerance = 1e-4; +static constexpr double s_onSurfaceTolerance = 1e-4; /// Tolerance for not being within curvilinear projection /// this allows using the same curvilinear frame to eta = 6, /// validity tested with IntegrationTests/PropagationTest -static constexpr ActsScalar s_curvilinearProjTolerance = 0.999995; +static constexpr double s_curvilinearProjTolerance = 0.999995; } // namespace Acts diff --git a/Core/include/Acts/Detector/Blueprint.hpp b/Core/include/Acts/Detector/Blueprint.hpp index 3be0d6353db..1e3ec527674 100644 --- a/Core/include/Acts/Detector/Blueprint.hpp +++ b/Core/include/Acts/Detector/Blueprint.hpp @@ -51,7 +51,7 @@ struct Node final { /// @param cs the children of the node /// @param e the estimated extent of the node (optional) Node(const std::string& n, const Transform3& t, VolumeBounds::BoundsType bt, - const std::vector& bv, const std::vector& bss, + const std::vector& bv, const std::vector& bss, std::vector> cs = {}, const Extent& e = Extent()) : name(n), transform(t), @@ -73,7 +73,7 @@ struct Node final { /// @param isb the internal structure builder (optional) /// @param e the estimated extent of the node (optional) Node(const std::string& n, const Transform3& t, VolumeBounds::BoundsType bt, - const std::vector& bv, + const std::vector& bv, std::shared_ptr isb = nullptr, const Extent& e = Extent()) : name(n), @@ -90,7 +90,7 @@ struct Node final { /// The boundary type VolumeBounds::BoundsType boundsType = VolumeBounds::eOther; /// The associated values - std::vector boundaryValues = {}; + std::vector boundaryValues = {}; /// Parent node - nullptr for root only const Node* parent = nullptr; /// Branch definitions: children diff --git a/Core/include/Acts/Detector/DetectorVolume.hpp b/Core/include/Acts/Detector/DetectorVolume.hpp index 1617721d62f..903532361f7 100644 --- a/Core/include/Acts/Detector/DetectorVolume.hpp +++ b/Core/include/Acts/Detector/DetectorVolume.hpp @@ -61,8 +61,8 @@ class Detector; class DetectorVolume : public std::enable_shared_from_this { public: using BoundingBox = - Acts::AxisAlignedBoundingBox; + Acts::AxisAlignedBoundingBox; friend class DetectorVolumeFactory; diff --git a/Core/include/Acts/Detector/KdtSurfacesProvider.hpp b/Core/include/Acts/Detector/KdtSurfacesProvider.hpp index fd7086e01df..72bea84737f 100644 --- a/Core/include/Acts/Detector/KdtSurfacesProvider.hpp +++ b/Core/include/Acts/Detector/KdtSurfacesProvider.hpp @@ -34,10 +34,10 @@ class KdtSurfaces { public: /// Broadcast the surface KDT type using KDTS = - KDTree, ActsScalar, std::array, bSize>; + KDTree, double, std::array, bSize>; /// Broadcast the query definition - using Query = std::array; + using Query = std::array; /// Broadcast the entry using Entry = std::pair>; @@ -86,7 +86,7 @@ class KdtSurfaces { /// /// @return the matching surfaces from the KDT structure std::vector> surfaces( - const RangeXD& range) const { + const RangeXD& range) const { // Strip the surfaces std::vector> surfacePtrs; auto surfaceQuery = m_kdt->rangeSearchWithKey(range); @@ -101,7 +101,7 @@ class KdtSurfaces { /// /// @return the matching surfaces fpulled from the KDT structure std::vector> surfaces(const Extent& extent) const { - RangeXD qRange; + RangeXD qRange; for (auto [ibv, v] : enumerate(m_casts)) { qRange[ibv] = extent.range(v); } @@ -148,7 +148,7 @@ class KdtSurfaces { float weight = 1. / cQueries.size(); for (auto& q : cQueries) { std::transform(c.begin(), c.end(), q.begin(), c.begin(), - std::plus()); + std::plus()); } std::for_each(c.begin(), c.end(), [&](auto& v) { v *= weight; }); return c; diff --git a/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp b/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp index 939388c223a..48159bf806c 100644 --- a/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp +++ b/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp @@ -38,7 +38,7 @@ class MultiWireStructureBuilder { Transform3 transform = Transform3::Identity(); /// The bounds of the multi-wire volume - std::vector mlBounds = {}; + std::vector mlBounds = {}; // The binning of the multi wire structure std::vector mlBinning = {}; diff --git a/Core/include/Acts/Detector/ProtoBinning.hpp b/Core/include/Acts/Detector/ProtoBinning.hpp index 371bfe60bd2..3700dfc4d6f 100644 --- a/Core/include/Acts/Detector/ProtoBinning.hpp +++ b/Core/include/Acts/Detector/ProtoBinning.hpp @@ -34,7 +34,7 @@ struct ProtoBinning { /// The axis boundary type: Open, Bound or Closed Acts::AxisBoundaryType boundaryType = Acts::AxisBoundaryType::Bound; /// The binning edges - std::vector edges = {}; + std::vector edges = {}; /// An expansion for the filling (in bins) std::size_t expansion = 0u; /// Indication if this is an auto-range binning @@ -47,7 +47,7 @@ struct ProtoBinning { /// @param e the bin edges (variable binning) /// @param exp the expansion (in bins) ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, - const std::vector& e, std::size_t exp = 0u) + const std::vector& e, std::size_t exp = 0u) : binValue(bValue), axisType(Acts::AxisType::Variable), boundaryType(bType), @@ -67,9 +67,8 @@ struct ProtoBinning { /// @param maxE the highest edge of the binning /// @param nbins the number of bins /// @param exp the expansion (in bins) - ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, - ActsScalar minE, ActsScalar maxE, std::size_t nbins, - std::size_t exp = 0u) + ProtoBinning(BinningValue bValue, Acts::AxisBoundaryType bType, double minE, + double maxE, std::size_t nbins, std::size_t exp = 0u) : binValue(bValue), boundaryType(bType), expansion(exp) { if (minE >= maxE) { std::string msg = "ProtoBinning: Invalid binning for value '"; @@ -84,7 +83,7 @@ struct ProtoBinning { "ProtoBinning: Invalid binning, at least one bin is needed."); } - ActsScalar stepE = (maxE - minE) / nbins; + double stepE = (maxE - minE) / nbins; edges.reserve(nbins + 1); for (std::size_t i = 0; i <= nbins; i++) { edges.push_back(minE + i * stepE); @@ -140,7 +139,7 @@ struct BinningDescription { Acts::AxisBoundaryType boundaryType = bData.option == open ? Acts::AxisBoundaryType::Bound : Acts::AxisBoundaryType::Closed; - std::vector edges; + std::vector edges; if (bData.type == equidistant) { bDesc.binning.push_back(ProtoBinning(bData.binvalue, boundaryType, bData.min, bData.max, bData.bins(), @@ -148,7 +147,7 @@ struct BinningDescription { } else { std::for_each(bData.boundaries().begin(), bData.boundaries().end(), - [&](ActsScalar edge) { edges.push_back(edge); }); + [&](double edge) { edges.push_back(edge); }); bDesc.binning.push_back( ProtoBinning(bData.binvalue, boundaryType, edges, 0u)); } @@ -170,7 +169,7 @@ struct BinningDescription { } else { std::vector edges; std::for_each(b.edges.begin(), b.edges.end(), - [&](ActsScalar edge) { edges.push_back(edge); }); + [&](double edge) { edges.push_back(edge); }); binUtility += BinUtility(edges, bOption, b.binValue); } } diff --git a/Core/include/Acts/Detector/ProtoSupport.hpp b/Core/include/Acts/Detector/ProtoSupport.hpp index 8f1e2581e77..abde3a71539 100644 --- a/Core/include/Acts/Detector/ProtoSupport.hpp +++ b/Core/include/Acts/Detector/ProtoSupport.hpp @@ -38,7 +38,7 @@ struct ProtoSupport { Surface::SurfaceType type = Surface::SurfaceType::Other; /// The offset of the support to an estimated position (e.g. from an extent) - ActsScalar offset = 0.; + double offset = 0.; /// A given extent from the volume, this allows to set support surfaces /// to fit into given volume extensions (flagged by the binning value diff --git a/Core/include/Acts/Detector/VolumeStructureBuilder.hpp b/Core/include/Acts/Detector/VolumeStructureBuilder.hpp index aede963c78c..bf236349b31 100644 --- a/Core/include/Acts/Detector/VolumeStructureBuilder.hpp +++ b/Core/include/Acts/Detector/VolumeStructureBuilder.hpp @@ -42,7 +42,7 @@ class VolumeStructureBuilder : public IExternalStructureBuilder { /// The starting transform Transform3 transform = Transform3::Identity(); /// The values (if already defined) - std::vector boundValues = {}; + std::vector boundValues = {}; /// The optional extent to feed into the values std::optional extent = std::nullopt; /// Some auxiliary information diff --git a/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp b/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp index c9ad46744d3..eda1da8452b 100644 --- a/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp +++ b/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp @@ -73,7 +73,7 @@ DetectorComponent::PortalContainer connect( /// @param logLevel is the screen logging level /// /// @return extracted boundary values -std::array, 3u> xyzBoundaries( +std::array, 3u> xyzBoundaries( const GeometryContext& gctx, const std::vector& volumes, Acts::Logging::Level logLevel = Acts::Logging::INFO); diff --git a/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp b/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp index 05815b1325f..d7cf4cb7831 100644 --- a/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp +++ b/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp @@ -174,7 +174,7 @@ DetectorComponent::PortalContainer wrapInZR( /// /// @return extracted boundary values template -std::array, 3u> rzphiBoundaries( +std::array, 3u> rzphiBoundaries( const GeometryContext& gctx, const volume_container_t& volumes, double precision = 0., Acts::Logging::Level logLevel = Acts::Logging::INFO) { @@ -185,8 +185,8 @@ std::array, 3u> rzphiBoundaries( << " volumes."); // The return boundaries - std::array, 3u> uniqueBoundaries; - auto insertWithPrecision = [&](std::size_t is, ActsScalar value) -> void { + std::array, 3u> uniqueBoundaries; + auto insertWithPrecision = [&](std::size_t is, double value) -> void { if (precision == 0.) { uniqueBoundaries[is].insert(value); return; @@ -199,19 +199,19 @@ std::array, 3u> rzphiBoundaries( if (v->volumeBounds().type() == VolumeBounds::BoundsType::eCylinder) { const auto& bValues = v->volumeBounds().values(); // The min/max values - ActsScalar rMin = bValues[CylinderVolumeBounds::BoundValues::eMinR]; - ActsScalar rMax = bValues[CylinderVolumeBounds::BoundValues::eMaxR]; - ActsScalar zCenter = v->transform(gctx).translation().z(); - ActsScalar zHalfLength = + double rMin = bValues[CylinderVolumeBounds::BoundValues::eMinR]; + double rMax = bValues[CylinderVolumeBounds::BoundValues::eMaxR]; + double zCenter = v->transform(gctx).translation().z(); + double zHalfLength = bValues[CylinderVolumeBounds::BoundValues::eHalfLengthZ]; - ActsScalar zMin = zCenter - zHalfLength; - ActsScalar zMax = zCenter + zHalfLength; - ActsScalar phiCenter = + double zMin = zCenter - zHalfLength; + double zMax = zCenter + zHalfLength; + double phiCenter = bValues[CylinderVolumeBounds::BoundValues::eAveragePhi]; - ActsScalar phiSector = + double phiSector = bValues[CylinderVolumeBounds::BoundValues::eHalfPhiSector]; - ActsScalar phiMin = phiCenter - phiSector; - ActsScalar phiMax = phiCenter + phiSector; + double phiMin = phiCenter - phiSector; + double phiMax = phiCenter + phiSector; // Fill the sets insertWithPrecision(0u, rMin); insertWithPrecision(0u, rMax); @@ -229,12 +229,12 @@ std::array, 3u> rzphiBoundaries( ACTS_VERBOSE("- did yield " << uniqueBoundaries[2u].size() << " boundaries in phi."); - return {{std::vector(uniqueBoundaries[0].begin(), - uniqueBoundaries[0].end()), - std::vector(uniqueBoundaries[1].begin(), - uniqueBoundaries[1].end()), - std::vector(uniqueBoundaries[2].begin(), - uniqueBoundaries[2].end())}}; + return {{std::vector(uniqueBoundaries[0].begin(), + uniqueBoundaries[0].end()), + std::vector(uniqueBoundaries[1].begin(), + uniqueBoundaries[1].end()), + std::vector(uniqueBoundaries[2].begin(), + uniqueBoundaries[2].end())}}; } } // namespace detail::CylindricalDetectorHelper diff --git a/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp b/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp index ebea6a7a4d6..f4de79980f3 100644 --- a/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp +++ b/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp @@ -45,7 +45,7 @@ void checkRotationAlignment( /// @note throws exception if the volumes are not ordered /// /// @return a vector with position differences (ordered) -std::vector checkCenterAlignment( +std::vector checkCenterAlignment( const GeometryContext& gctx, const std::vector>& volumes, BinningValue axisValue); diff --git a/Core/include/Acts/Detector/detail/PortalHelper.hpp b/Core/include/Acts/Detector/detail/PortalHelper.hpp index ec17c487098..ba54513976b 100644 --- a/Core/include/Acts/Detector/detail/PortalHelper.hpp +++ b/Core/include/Acts/Detector/detail/PortalHelper.hpp @@ -34,7 +34,7 @@ class Portal; /// gathered from the sub volumes, the binning description using PortalReplacement = std::tuple, unsigned int, Direction, - std::vector, BinningValue>; + std::vector, BinningValue>; namespace detail::PortalHelper { @@ -62,7 +62,7 @@ void attachExternalNavigationDelegate( void attachDetectorVolumesUpdater( const GeometryContext& gctx, Portal& portal, const std::vector>& volumes, - const Direction& direction, const std::vector& boundaries, + const Direction& direction, const std::vector& boundaries, const BinningValue& binning); /// @brief Create and attach the multi link updator, the portal will get diff --git a/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp b/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp index e956e215e4f..9c52e961498 100644 --- a/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp +++ b/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp @@ -32,7 +32,7 @@ using namespace UnitLiterals; namespace Experimental::detail::SupportSurfacesHelper { using SupportSurfaceComponents = - std::tuple, Acts::Transform3>; + std::tuple, Acts::Transform3>; /// @brief A support creator turns an extend into a vector of bound values using SurfaceComponentsCreator = @@ -44,15 +44,15 @@ struct CylindricalSupport { /// - negative indicates inner support /// - zero is centered (not recommended) /// - positive indicates outer support - ActsScalar rOffset = 0.; + double rOffset = 0.; /// Clearance in z in order to make the support surfaces /// not touch the volume boundaries - std::array zClearance = {1_mm, 1_mm}; + std::array zClearance = {1_mm, 1_mm}; /// Clearance in phi if a sectoral support is chosen /// not to touch the volume boundaries - std::array phiClearance = {0.0001_rad, 0.0001_rad}; + std::array phiClearance = {0.0001_rad, 0.0001_rad}; // Type is obviously a cylinder static constexpr Surface::SurfaceType type = Surface::SurfaceType::Cylinder; @@ -71,15 +71,15 @@ struct DiscSupport { /// - negative indicates support an z min /// - zero is centered /// - positive indicates support at z max - ActsScalar zOffset = 0.; + double zOffset = 0.; /// Clearance in r in order to make the support surfaces /// not touch the volume boundaries - std::array rClearance = {1_mm, 1_mm}; + std::array rClearance = {1_mm, 1_mm}; /// Clearance in phi if a sectoral support is chosen /// not to touch the volume boundaries - std::array phiClearance = {0.0001_rad, 0.0001_rad}; + std::array phiClearance = {0.0001_rad, 0.0001_rad}; // Type is obviously a disc static constexpr Surface::SurfaceType type = Surface::SurfaceType::Disc; @@ -98,14 +98,14 @@ struct RectangularSupport { BinningValue pPlacement = BinningValue::binZ; /// Offset in position placement - ActsScalar pOffset = 0.; + double pOffset = 0.; /// Clearance in first local direction - cyclic order - std::array loc0Clearance = {1_mm, 1_mm}; + std::array loc0Clearance = {1_mm, 1_mm}; /// Clearance in phi if a sectoral support is chosen /// not to touch the volume boundaries - std::array loc1Clearance = {1_mm, 1_mm}; + std::array loc1Clearance = {1_mm, 1_mm}; // Type is obviously a plane static constexpr Surface::SurfaceType type = Surface::SurfaceType::Plane; diff --git a/Core/include/Acts/EventData/Charge.hpp b/Core/include/Acts/EventData/Charge.hpp index 6ae62b3d963..64073538a3f 100644 --- a/Core/include/Acts/EventData/Charge.hpp +++ b/Core/include/Acts/EventData/Charge.hpp @@ -67,17 +67,16 @@ struct Neutral { constexpr float absQ() const noexcept { return 0; } - constexpr float extractCharge(ActsScalar /*qOverP*/) const noexcept { + constexpr float extractCharge(double /*qOverP*/) const noexcept { return 0.0f; } - constexpr ActsScalar extractMomentum(ActsScalar qOverP) const noexcept { + constexpr double extractMomentum(double qOverP) const noexcept { assert(qOverP >= 0 && "qOverP cannot be negative"); return 1.0f / qOverP; } - constexpr ActsScalar qOverP(ActsScalar momentum, - float signedQ) const noexcept { + constexpr double qOverP(double momentum, float signedQ) const noexcept { assert((signedQ != 0) && "charge must be 0"); (void)signedQ; return 1.0f / momentum; @@ -110,16 +109,15 @@ struct SinglyCharged { constexpr float absQ() const noexcept { return UnitConstants::e; } - constexpr float extractCharge(ActsScalar qOverP) const noexcept { + constexpr float extractCharge(double qOverP) const noexcept { return std::copysign(UnitConstants::e, qOverP); } - constexpr ActsScalar extractMomentum(ActsScalar qOverP) const noexcept { + constexpr double extractMomentum(double qOverP) const noexcept { return extractCharge(qOverP) / qOverP; } - constexpr ActsScalar qOverP(ActsScalar momentum, - float signedQ) const noexcept { + constexpr double qOverP(double momentum, float signedQ) const noexcept { assert((std::abs(signedQ) == UnitConstants::e) && "absolute charge must be e"); return signedQ / momentum; @@ -151,15 +149,14 @@ class NonNeutralCharge { constexpr float absQ() const noexcept { return m_absQ; } - constexpr float extractCharge(ActsScalar qOverP) const noexcept { + constexpr float extractCharge(double qOverP) const noexcept { return std::copysign(m_absQ, qOverP); } - constexpr ActsScalar extractMomentum(ActsScalar qOverP) const noexcept { + constexpr double extractMomentum(double qOverP) const noexcept { return extractCharge(qOverP) / qOverP; } - constexpr ActsScalar qOverP(ActsScalar momentum, - float signedQ) const noexcept { + constexpr double qOverP(double momentum, float signedQ) const noexcept { assert(std::abs(signedQ) == m_absQ && "inconsistent charge"); return signedQ / momentum; } @@ -194,15 +191,14 @@ class AnyCharge { constexpr float absQ() const noexcept { return m_absQ; } - constexpr float extractCharge(ActsScalar qOverP) const noexcept { + constexpr float extractCharge(double qOverP) const noexcept { return std::copysign(m_absQ, qOverP); } - constexpr ActsScalar extractMomentum(ActsScalar qOverP) const noexcept { + constexpr double extractMomentum(double qOverP) const noexcept { return (m_absQ != 0.0f) ? extractCharge(qOverP) / qOverP : 1.0f / qOverP; } - constexpr ActsScalar qOverP(ActsScalar momentum, - float signedQ) const noexcept { + constexpr double qOverP(double momentum, float signedQ) const noexcept { assert(std::abs(signedQ) == m_absQ && "inconsistent charge"); return (m_absQ != 0.0f) ? signedQ / momentum : 1.0f / momentum; } diff --git a/Core/include/Acts/EventData/MultiTrajectory.hpp b/Core/include/Acts/EventData/MultiTrajectory.hpp index 1c065fd7e12..e293c6c9c5f 100644 --- a/Core/include/Acts/EventData/MultiTrajectory.hpp +++ b/Core/include/Acts/EventData/MultiTrajectory.hpp @@ -8,6 +8,7 @@ #pragma once +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/EventData/MeasurementHelpers.hpp" #include "Acts/EventData/SourceLink.hpp" @@ -687,13 +688,24 @@ class MultiTrajectory { /// Allocate storage for a calibrated measurement of specified dimension /// @param istate The track state to store for /// @param measdim the dimension of the measurement to store - /// @note Is a noop if the track state already has an allocation - /// an the dimension is the same. + /// @note In case an allocation is already present, no additional allocation + /// will be performed, but the existing allocation will be zeroed. void allocateCalibrated(IndexType istate, std::size_t measdim) { throw_assert(measdim > 0 && measdim <= eBoundSize, "Invalid measurement dimension detected"); - self().allocateCalibrated_impl(istate, measdim); + visit_measurement(measdim, [this, istate]( + std::integral_constant) { + self().template allocateCalibrated_impl( + istate, ActsVector{ActsVector::Zero()}, + ActsSquareMatrix{ActsSquareMatrix::Zero()}); + }); + } + + template + void allocateCalibrated(IndexType istate, const Eigen::DenseBase& val, + const Eigen::DenseBase& cov) { + self().template allocateCalibrated_impl(istate, val, cov); } void setUncalibratedSourceLink(IndexType istate, SourceLink&& sourceLink) diff --git a/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp b/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp index 92ae47270bc..83f2593d647 100644 --- a/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp +++ b/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp @@ -130,7 +130,15 @@ concept MutableMultiTrajectoryBackend = { v.template addColumn_impl(col) }; { v.template addColumn_impl(col) }; - { v.allocateCalibrated_impl(istate, dim) }; + { + v.template allocateCalibrated_impl(istate, ActsVector<1>{}, + ActsSquareMatrix<1>{}) + }; + // Assuming intermediate values also work + { + v.template allocateCalibrated_impl(istate, ActsVector{}, + ActsSquareMatrix{}) + }; { v.setUncalibratedSourceLink_impl(istate, std::move(sl)) }; diff --git a/Core/include/Acts/EventData/TrackProxy.hpp b/Core/include/Acts/EventData/TrackProxy.hpp index 6ccb0f402b2..7e62eea943d 100644 --- a/Core/include/Acts/EventData/TrackProxy.hpp +++ b/Core/include/Acts/EventData/TrackProxy.hpp @@ -243,27 +243,27 @@ class TrackProxy { /// Access the theta parameter of the track at the reference surface /// @return The theta parameter - ActsScalar theta() const { return parameters()[eBoundTheta]; } + double theta() const { return parameters()[eBoundTheta]; } /// Access the phi parameter of the track at the reference surface /// @return The phi parameter - ActsScalar phi() const { return parameters()[eBoundPhi]; } + double phi() const { return parameters()[eBoundPhi]; } /// Access the loc0 parameter of the track at the reference surface /// @return The loc0 parameter - ActsScalar loc0() const { return parameters()[eBoundLoc0]; } + double loc0() const { return parameters()[eBoundLoc0]; } /// Access the loc1 parameter of the track at the reference surface /// @return The loc1 parameter - ActsScalar loc1() const { return parameters()[eBoundLoc1]; } + double loc1() const { return parameters()[eBoundLoc1]; } /// Access the time parameter of the track at the reference surface /// @return The time parameter - ActsScalar time() const { return parameters()[eBoundTime]; } + double time() const { return parameters()[eBoundTime]; } /// Access the q/p (curvature) parameter of the track at the reference surface /// @return The q/p parameter - ActsScalar qOverP() const { return parameters()[eBoundQOverP]; } + double qOverP() const { return parameters()[eBoundQOverP]; } /// Get the particle hypothesis /// @return the particle hypothesis @@ -284,17 +284,17 @@ class TrackProxy { /// Get the charge of the tack /// @note this depends on the charge hypothesis /// @return The absolute track momentum - ActsScalar charge() const { return particleHypothesis().qFromQOP(qOverP()); } + double charge() const { return particleHypothesis().qFromQOP(qOverP()); } /// Get the absolute momentum of the tack /// @return The absolute track momentum - ActsScalar absoluteMomentum() const { + double absoluteMomentum() const { return particleHypothesis().extractMomentum(qOverP()); } /// Get the transverse momentum of the track /// @return The track transverse momentum value - ActsScalar transverseMomentum() const { + double transverseMomentum() const { return std::sin(theta()) * absoluteMomentum(); } @@ -577,9 +577,6 @@ class TrackProxy { // append track states (cheap), but they're in the wrong order for (const auto& srcTrackState : other.trackStatesReversed()) { auto destTrackState = appendTrackState(srcTrackState.getMask()); - if (srcTrackState.hasCalibrated()) { - destTrackState.allocateCalibrated(srcTrackState.calibratedSize()); - } destTrackState.copyFrom(srcTrackState, Acts::TrackStatePropMask::All, true); } diff --git a/Core/include/Acts/EventData/TrackStateProxy.hpp b/Core/include/Acts/EventData/TrackStateProxy.hpp index b7b991fa2ee..3f7ddf1a028 100644 --- a/Core/include/Acts/EventData/TrackStateProxy.hpp +++ b/Core/include/Acts/EventData/TrackStateProxy.hpp @@ -865,10 +865,35 @@ class TrackStateProxy { /// Allocate storage to be able to store a measurement of size @p measdim. /// This must be called **before** setting the measurement content. + /// @note This does not allocate if an allocation of the same size already exists + /// @note This will zero-initialize the allocated storage + /// @note This is an error if an existing allocation has different size void allocateCalibrated(std::size_t measdim) { m_traj->allocateCalibrated(m_istate, measdim); } + /// Allocate storage and assign the given vector and covariance to it. + /// The dimension is inferred from the given vector and matrix. + /// @tparam val_t Type of the vector + /// @tparam cov_t Type of the covariance matrix + /// @param val The measurement vector + /// @param cov The covariance matrix + /// @note This does not allocate if an allocation of the same size already exists + /// @note This throws an exception if an existing allocation has different size + template + void allocateCalibrated(const Eigen::DenseBase& val, + const Eigen::DenseBase& cov) + requires(Eigen::PlainObjectBase::RowsAtCompileTime > 0 && + Eigen::PlainObjectBase::RowsAtCompileTime <= eBoundSize && + Eigen::PlainObjectBase::RowsAtCompileTime == + Eigen::PlainObjectBase::RowsAtCompileTime && + Eigen::PlainObjectBase::RowsAtCompileTime == + Eigen::PlainObjectBase::ColsAtCompileTime) + { + m_traj->template allocateCalibrated< + Eigen::PlainObjectBase::RowsAtCompileTime>(m_istate, val, cov); + } + /// @} /// @anchor track_state_share_copy @@ -993,17 +1018,14 @@ class TrackStateProxy { } if (ACTS_CHECK_BIT(src, PM::Calibrated)) { - allocateCalibrated(other.calibratedSize()); - // workaround for gcc8 bug: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86594 auto* self = this; visit_measurement(other.calibratedSize(), [&](auto N) { constexpr int measdim = decltype(N)::value; - self->template calibrated() = - other.template calibrated(); - self->template calibratedCovariance() = - other.template calibratedCovariance(); + self->allocateCalibrated( + other.template calibrated().eval(), + other.template calibratedCovariance().eval()); }); setBoundSubspaceIndices(other.boundSubspaceIndices()); @@ -1041,17 +1063,14 @@ class TrackStateProxy { // may be not yet allocated if (ACTS_CHECK_BIT(mask, PM::Calibrated) && other.template has()) { - allocateCalibrated(other.calibratedSize()); - // workaround for gcc8 bug: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86594 auto* self = this; visit_measurement(other.calibratedSize(), [&](auto N) { constexpr int measdim = decltype(N)::value; - self->template calibrated() = - other.template calibrated(); - self->template calibratedCovariance() = - other.template calibratedCovariance(); + self->allocateCalibrated( + other.template calibrated().eval(), + other.template calibratedCovariance().eval()); }); setBoundSubspaceIndices(other.boundSubspaceIndices()); diff --git a/Core/include/Acts/EventData/TrackStateProxyConcept.hpp b/Core/include/Acts/EventData/TrackStateProxyConcept.hpp index d148d3c4940..61e98adbc48 100644 --- a/Core/include/Acts/EventData/TrackStateProxyConcept.hpp +++ b/Core/include/Acts/EventData/TrackStateProxyConcept.hpp @@ -248,6 +248,13 @@ concept MutableTrackStateProxyConcept = { v.allocateCalibrated(measdim) }; + { v.allocateCalibrated(ActsVector<1>{}, ActsSquareMatrix<1>{}) }; + // Assuming intermediate values are also allowed + { + v.allocateCalibrated(ActsVector{}, + ActsSquareMatrix{}) + }; + { v.chi2() } -> std::same_as; { v.pathLength() } -> std::same_as; diff --git a/Core/include/Acts/EventData/TransformationHelpers.hpp b/Core/include/Acts/EventData/TransformationHelpers.hpp index e31e29fd3c0..e5877744c4b 100644 --- a/Core/include/Acts/EventData/TransformationHelpers.hpp +++ b/Core/include/Acts/EventData/TransformationHelpers.hpp @@ -69,7 +69,7 @@ FreeVector transformBoundToFreeParameters(const Surface& surface, /// @return Bound track parameters vector on the given surface Result transformFreeToBoundParameters( const FreeVector& freeParams, const Surface& surface, - const GeometryContext& geoCtx, ActsScalar tolerance = s_onSurfaceTolerance); + const GeometryContext& geoCtx, double tolerance = s_onSurfaceTolerance); /// Convert position and direction to bound track parameters. /// @@ -83,9 +83,9 @@ Result transformFreeToBoundParameters( /// /// @return Equivalent bound parameters vector on the given surface Result transformFreeToBoundParameters( - const Vector3& position, ActsScalar time, const Vector3& direction, - ActsScalar qOverP, const Surface& surface, const GeometryContext& geoCtx, - ActsScalar tolerance = s_onSurfaceTolerance); + const Vector3& position, double time, const Vector3& direction, + double qOverP, const Surface& surface, const GeometryContext& geoCtx, + double tolerance = s_onSurfaceTolerance); /// Convert direction to curvilinear track parameters. /// @@ -97,9 +97,9 @@ Result transformFreeToBoundParameters( /// @note The parameters are assumed to be defined at the origin of the /// curvilinear frame derived from the direction vector. The local /// coordinates are zero by construction. -BoundVector transformFreeToCurvilinearParameters(ActsScalar time, +BoundVector transformFreeToCurvilinearParameters(double time, const Vector3& direction, - ActsScalar qOverP); + double qOverP); /// Convert direction angles to curvilinear track parameters. /// @@ -112,9 +112,7 @@ BoundVector transformFreeToCurvilinearParameters(ActsScalar time, /// @note The parameters are assumed to be defined at the origin of the /// curvilinear frame derived from the direction angles. The local /// coordinates are zero by construction. -BoundVector transformFreeToCurvilinearParameters(ActsScalar time, - ActsScalar phi, - ActsScalar theta, - ActsScalar qOverP); +BoundVector transformFreeToCurvilinearParameters(double time, double phi, + double theta, double qOverP); } // namespace Acts diff --git a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp index 3859239ae69..e13498cea2c 100644 --- a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp +++ b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp @@ -47,6 +47,33 @@ using MultiTrajectoryTraits::IndexType; constexpr auto kInvalid = MultiTrajectoryTraits::kInvalid; constexpr auto MeasurementSizeMax = MultiTrajectoryTraits::MeasurementSizeMax; +template +struct NonInitializingAllocator { + using value_type = T; + + NonInitializingAllocator() noexcept = default; + + template + explicit NonInitializingAllocator( + const NonInitializingAllocator& /*other*/) noexcept {} + + template + bool operator==(const NonInitializingAllocator& /*other*/) const noexcept { + return true; + } + + T* allocate(std::size_t n) const { return std::allocator{}.allocate(n); } + + void deallocate(T* const p, std::size_t n) const noexcept { + std::allocator{}.deallocate(p, n); + } + + void construct(T* /*p*/) const { + // This construct function intentionally does not initialize the object! + // Be very careful when using this allocator. + } +}; + class VectorMultiTrajectoryBase { public: struct Statistics { @@ -320,9 +347,9 @@ class VectorMultiTrajectoryBase { m_params; std::vector::Covariance> m_cov; - std::vector m_meas; + std::vector> m_meas; std::vector m_measOffset; - std::vector m_measCov; + std::vector> m_measCov; std::vector m_measCovOffset; std::vector::Covariance> m_jac; @@ -464,23 +491,44 @@ class VectorMultiTrajectory final return detail_vmt::VectorMultiTrajectoryBase::hasColumn_impl(*this, key); } - void allocateCalibrated_impl(IndexType istate, std::size_t measdim) { - throw_assert(measdim > 0 && measdim <= eBoundSize, - "Invalid measurement dimension detected"); + template + void allocateCalibrated_impl(IndexType istate, + const Eigen::DenseBase& val, + const Eigen::DenseBase& cov) + + requires(Eigen::PlainObjectBase::RowsAtCompileTime > 0 && + Eigen::PlainObjectBase::RowsAtCompileTime <= eBoundSize && + Eigen::PlainObjectBase::RowsAtCompileTime == + Eigen::PlainObjectBase::RowsAtCompileTime && + Eigen::PlainObjectBase::RowsAtCompileTime == + Eigen::PlainObjectBase::ColsAtCompileTime) + { + constexpr std::size_t measdim = val_t::RowsAtCompileTime; + + if (m_index[istate].measdim != kInvalid && + m_index[istate].measdim != measdim) { + throw std::invalid_argument{ + "Measurement dimension does not match the allocated dimension"}; + } + + if (m_measOffset[istate] == kInvalid || + m_measCovOffset[istate] == kInvalid) { + m_measOffset[istate] = static_cast(m_meas.size()); + m_meas.resize(m_meas.size() + measdim); - if (m_measOffset[istate] != kInvalid && - m_measCovOffset[istate] != kInvalid && - m_index[istate].measdim == measdim) { - return; + m_measCovOffset[istate] = static_cast(m_measCov.size()); + m_measCov.resize(m_measCov.size() + measdim * measdim); } m_index[istate].measdim = measdim; - m_measOffset[istate] = static_cast(m_meas.size()); - m_meas.resize(m_meas.size() + measdim); + double* measPtr = &m_meas[m_measOffset[istate]]; + Eigen::Map> valMap(measPtr); + valMap = val; - m_measCovOffset[istate] = static_cast(m_measCov.size()); - m_measCov.resize(m_measCov.size() + measdim * measdim); + double* covPtr = &m_measCov[m_measCovOffset[istate]]; + Eigen::Map> covMap(covPtr); + covMap = cov; } void setUncalibratedSourceLink_impl(IndexType istate, diff --git a/Core/include/Acts/EventData/VectorTrackContainer.hpp b/Core/include/Acts/EventData/VectorTrackContainer.hpp index 8734f69eb4c..d0ce9cf402d 100644 --- a/Core/include/Acts/EventData/VectorTrackContainer.hpp +++ b/Core/include/Acts/EventData/VectorTrackContainer.hpp @@ -253,6 +253,7 @@ class VectorTrackContainer final : public detail_vtc::VectorTrackContainerBase { void reserve(IndexType size); void clear(); + std::size_t size() const; void setReferenceSurface_impl(IndexType itrack, std::shared_ptr surface) { diff --git a/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp b/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp index 58283dcfebe..72cb0965507 100644 --- a/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp +++ b/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp @@ -27,12 +27,12 @@ struct FreeToBoundCorrection { bool apply = false; /// UKF tuning parameters - ActsScalar alpha = 0.1; - ActsScalar beta = 2; + double alpha = 0.1; + double beta = 2; /// The cutoff of incident angles cosine for correction - ActsScalar cosIncidentAngleMinCutoff = 1e-5; - ActsScalar cosIncidentAngleMaxCutoff = 0.99500417; + double cosIncidentAngleMinCutoff = 1e-5; + double cosIncidentAngleMaxCutoff = 0.99500417; /// Default constructor FreeToBoundCorrection() = default; @@ -42,7 +42,7 @@ struct FreeToBoundCorrection { /// @param apply_ Whether to apply correction /// @param alpha_ The UKF tuning parameter alpha /// @param beta_ The UKF tuning parameter beta - FreeToBoundCorrection(bool apply_, ActsScalar alpha_, ActsScalar beta_); + FreeToBoundCorrection(bool apply_, double alpha_, double beta_); /// Construct from boolean only /// @@ -65,9 +65,9 @@ struct CorrectedFreeToBoundTransformer { /// @param beta The UKF tuning parameter beta /// @param cosIncidentAngleMinCutoff The cosine of max incident angle /// @param cosIncidentAngleMaxCutoff The cosine of min incident angle - CorrectedFreeToBoundTransformer(ActsScalar alpha, ActsScalar beta, - ActsScalar cosIncidentAngleMinCutoff, - ActsScalar cosIncidentAngleMaxCutoff); + CorrectedFreeToBoundTransformer(double alpha, double beta, + double cosIncidentAngleMinCutoff, + double cosIncidentAngleMaxCutoff); /// Construct from a FreeToBoundCorrection /// @@ -101,16 +101,16 @@ struct CorrectedFreeToBoundTransformer { private: /// The parameters to tune the weight in UKF (0 < alpha <=1) - ActsScalar m_alpha = 0.1; - ActsScalar m_beta = 2; + double m_alpha = 0.1; + double m_beta = 2; /// The maximum incident angle (i.e. minimum cos incident angle) cutoff for /// correction - ActsScalar m_cosIncidentAngleMinCutoff = 1e-5; + double m_cosIncidentAngleMinCutoff = 1e-5; /// The minimum incident angle (i.e. maximum cos incident angle) cutoff for /// correction, note cos(0.1) = 0.99500417 - ActsScalar m_cosIncidentAngleMaxCutoff = 0.99500417; + double m_cosIncidentAngleMaxCutoff = 0.99500417; }; } // namespace detail diff --git a/Core/include/Acts/EventData/detail/GenerateParameters.hpp b/Core/include/Acts/EventData/detail/GenerateParameters.hpp index 64e7bc3405b..b06d853faa6 100644 --- a/Core/include/Acts/EventData/detail/GenerateParameters.hpp +++ b/Core/include/Acts/EventData/detail/GenerateParameters.hpp @@ -236,7 +236,7 @@ template inline std::pair generateBoundParametersCovariance( generator_t& rng, const GenerateBoundParametersOptions& options) { auto params = generateBoundParameters(rng, options); - auto cov = generateCovariance(rng); + auto cov = generateCovariance(rng); return {params, cov}; } @@ -293,7 +293,7 @@ template inline std::pair generateFreeParametersCovariance( generator_t& rng, const GenerateFreeParametersOptions& options) { auto params = generateFreeParameters(rng, options); - auto cov = generateCovariance(rng); + auto cov = generateCovariance(rng); return {params, cov}; } diff --git a/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp b/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp index a2e374c0cc2..422dc58e053 100644 --- a/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp +++ b/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp @@ -10,6 +10,7 @@ #include +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/EventData/TrackStatePropMask.hpp" #include "Acts/EventData/VectorMultiTrajectory.hpp" @@ -20,6 +21,7 @@ #include "Acts/Utilities/HashedString.hpp" #include +#include namespace Acts::detail::Test { @@ -196,6 +198,9 @@ class MultiTrajectoryTestsCommon { alwaysPresent(ts); ts.allocateCalibrated(5); BOOST_CHECK(ts.hasCalibrated()); + BOOST_CHECK_EQUAL(ts.template calibrated<5>(), ActsVector<5>::Zero()); + BOOST_CHECK_EQUAL(ts.template calibratedCovariance<5>(), + ActsSquareMatrix<5>::Zero()); ts = t.getTrackState(t.addTrackState(PM::None)); BOOST_CHECK(!ts.hasPredicted()); @@ -242,6 +247,9 @@ class MultiTrajectoryTestsCommon { BOOST_CHECK(!ts.hasJacobian()); ts.allocateCalibrated(5); BOOST_CHECK(ts.hasCalibrated()); + BOOST_CHECK_EQUAL(ts.template calibrated<5>(), ActsVector<5>::Zero()); + BOOST_CHECK_EQUAL(ts.template calibratedCovariance<5>(), + ActsSquareMatrix<5>::Zero()); ts = t.getTrackState(t.addTrackState(PM::Jacobian)); BOOST_CHECK(!ts.hasPredicted()); @@ -300,6 +308,9 @@ class MultiTrajectoryTestsCommon { BOOST_CHECK(ts.hasSmoothed()); BOOST_CHECK(ts.hasCalibrated()); BOOST_CHECK(!ts.hasJacobian()); + BOOST_CHECK_EQUAL(ts.template calibrated<5>(), ActsVector<5>::Zero()); + BOOST_CHECK_EQUAL(ts.template calibratedCovariance<5>(), + ActsSquareMatrix<5>::Zero()); ts.addComponents(PM::Jacobian); BOOST_CHECK(ts.hasPredicted()); @@ -378,7 +389,13 @@ class MultiTrajectoryTestsCommon { { // reset measurements w/ full parameters auto [measPar, measCov] = generateBoundParametersCovariance(rng, {}); + // Explicitly unset to avoid error below + tsb.unset(TrackStatePropMask::Calibrated); tsb.allocateCalibrated(eBoundSize); + BOOST_CHECK_EQUAL(tsb.template calibrated(), + BoundVector::Zero()); + BOOST_CHECK_EQUAL(tsb.template calibratedCovariance(), + BoundMatrix::Zero()); tsb.template calibrated() = measPar; tsb.template calibratedCovariance() = measCov; BOOST_CHECK_EQUAL(tsa.template calibrated(), measPar); @@ -394,7 +411,15 @@ class MultiTrajectoryTestsCommon { std::size_t nMeasurements = tsb.effectiveCalibrated().rows(); auto effPar = measPar.head(nMeasurements); auto effCov = measCov.topLeftCorner(nMeasurements, nMeasurements); - tsb.allocateCalibrated(eBoundSize); + tsb.allocateCalibrated( + eBoundSize); // no allocation, but we expect it to be reset to zero + // with this overload + BOOST_CHECK_EQUAL(tsa.effectiveCalibrated(), BoundVector::Zero()); + BOOST_CHECK_EQUAL(tsa.effectiveCalibratedCovariance(), + BoundMatrix::Zero()); + BOOST_CHECK_EQUAL(tsa.effectiveCalibrated(), BoundVector::Zero()); + BOOST_CHECK_EQUAL(tsa.effectiveCalibratedCovariance(), + BoundMatrix::Zero()); tsb.effectiveCalibrated() = effPar; tsb.effectiveCalibratedCovariance() = effCov; BOOST_CHECK_EQUAL(tsa.effectiveCalibrated(), effPar); @@ -444,6 +469,8 @@ class MultiTrajectoryTestsCommon { BOOST_CHECK_EQUAL( ts.getUncalibratedSourceLink().template get().sourceId, pc.sourceLink.sourceId); + // Explicitly unset to avoid error below + ts.unset(TrackStatePropMask::Calibrated); testSourceLinkCalibratorReturn( gctx, cctx, SourceLink{ttsb.sourceLink}, ts); BOOST_CHECK_EQUAL( @@ -762,6 +789,8 @@ class MultiTrajectoryTestsCommon { BOOST_CHECK_NE(ts1.pathLength(), ts2.pathLength()); BOOST_CHECK_NE(&ts1.referenceSurface(), &ts2.referenceSurface()); + // Explicitly unset to avoid error below + ts1.unset(TrackStatePropMask::Calibrated); ts1.copyFrom(ts2); BOOST_CHECK_EQUAL(ts1.predicted(), ts2.predicted()); @@ -795,6 +824,8 @@ class MultiTrajectoryTestsCommon { ts2 = mkts(PM::Predicted | PM::Jacobian | PM::Calibrated); ts2.copyFrom(ots2, PM::Predicted | PM::Jacobian | PM::Calibrated); // copy into empty ts, only copy some + // explicitly unset to avoid error below + ts1.unset(TrackStatePropMask::Calibrated); ts1.copyFrom(ots1); // reset to original // is different again BOOST_CHECK_NE(ts1.predicted(), ts2.predicted()); @@ -816,6 +847,8 @@ class MultiTrajectoryTestsCommon { BOOST_CHECK_NE(ts1.pathLength(), ts2.pathLength()); BOOST_CHECK_NE(&ts1.referenceSurface(), &ts2.referenceSurface()); + // Explicitly unset to avoid error below + ts1.unset(TrackStatePropMask::Calibrated); ts1.copyFrom(ts2); // some components are same now @@ -1193,5 +1226,41 @@ class MultiTrajectoryTestsCommon { // runTest([](const std::string& c) { return c; }); // runTest([](std::string_view c) { return c; }); } + + void testMultiTrajectoryAllocateCalibratedInit( + std::default_random_engine& rng) { + trajectory_t traj = m_factory.create(); + auto ts = traj.makeTrackState(TrackStatePropMask::All); + + BOOST_CHECK_EQUAL(ts.calibratedSize(), MultiTrajectoryTraits::kInvalid); + + auto [par, cov] = generateBoundParametersCovariance(rng, {}); + + ts.template allocateCalibrated(par.head<3>(), cov.topLeftCorner<3, 3>()); + + BOOST_CHECK_EQUAL(ts.calibratedSize(), 3); + BOOST_CHECK_EQUAL(ts.template calibrated<3>(), par.head<3>()); + BOOST_CHECK_EQUAL(ts.template calibratedCovariance<3>(), + (cov.topLeftCorner<3, 3>())); + + auto [par2, cov2] = generateBoundParametersCovariance(rng, {}); + + ts.allocateCalibrated(3); + BOOST_CHECK_EQUAL(ts.template calibrated<3>(), ActsVector<3>::Zero()); + BOOST_CHECK_EQUAL(ts.template calibratedCovariance<3>(), + ActsSquareMatrix<3>::Zero()); + + ts.template allocateCalibrated(par2.head<3>(), cov2.topLeftCorner<3, 3>()); + BOOST_CHECK_EQUAL(ts.calibratedSize(), 3); + // The values are re-assigned + BOOST_CHECK_EQUAL(ts.template calibrated<3>(), par2.head<3>()); + BOOST_CHECK_EQUAL(ts.template calibratedCovariance<3>(), + (cov2.topLeftCorner<3, 3>())); + + // Re-allocation with a different measurement dimension is an error + BOOST_CHECK_THROW(ts.template allocateCalibrated( + par2.head<4>(), cov2.topLeftCorner<4, 4>()), + std::invalid_argument); + } }; } // namespace Acts::detail::Test diff --git a/Core/include/Acts/EventData/detail/PrintParameters.hpp b/Core/include/Acts/EventData/detail/PrintParameters.hpp index 38670c230e0..de4be653866 100644 --- a/Core/include/Acts/EventData/detail/PrintParameters.hpp +++ b/Core/include/Acts/EventData/detail/PrintParameters.hpp @@ -46,8 +46,8 @@ void printFreeParameters(std::ostream& os, const FreeVector& params, /// @param params Parameters vector data, must contain size elements /// @param cov Optional Covariance matrix data, must contain sizexsize elements void printMeasurement(std::ostream& os, BoundIndices size, - const std::uint8_t* indices, const ActsScalar* params, - const ActsScalar* cov); + const std::uint8_t* indices, const double* params, + const double* cov); /// Print free measurement content to the output stream. /// @@ -57,8 +57,8 @@ void printMeasurement(std::ostream& os, BoundIndices size, /// @param params Parameters vector data, must contain size elements /// @param cov Optional Covariance matrix data, must contain sizexsize elements void printMeasurement(std::ostream& os, FreeIndices size, - const std::uint8_t* indices, const ActsScalar* params, - const ActsScalar* cov); + const std::uint8_t* indices, const double* params, + const double* cov); } // namespace detail } // namespace Acts diff --git a/Core/include/Acts/EventData/detail/TestSourceLink.hpp b/Core/include/Acts/EventData/detail/TestSourceLink.hpp index affec84aafa..4a98b1a28a9 100644 --- a/Core/include/Acts/EventData/detail/TestSourceLink.hpp +++ b/Core/include/Acts/EventData/detail/TestSourceLink.hpp @@ -47,7 +47,7 @@ struct TestSourceLink final { Acts::ActsSquareMatrix<2> covariance; /// Construct a source link for a 1d measurement. - TestSourceLink(BoundIndices idx, ActsScalar val, ActsScalar var, + TestSourceLink(BoundIndices idx, double val, double var, GeometryIdentifier gid = GeometryIdentifier(), std::size_t sid = 0u) : m_geometryId(gid), diff --git a/Core/include/Acts/EventData/detail/TestTrackState.hpp b/Core/include/Acts/EventData/detail/TestTrackState.hpp index 514ae073c2f..26ef78d8084 100644 --- a/Core/include/Acts/EventData/detail/TestTrackState.hpp +++ b/Core/include/Acts/EventData/detail/TestTrackState.hpp @@ -46,7 +46,7 @@ struct TestTrackState { ParticleHypothesis::pion()), jacobian(BoundMatrix::Identity()), chi2(std::chi_squared_distribution(measdim)(rng)), - pathLength(std::uniform_real_distribution( + pathLength(std::uniform_real_distribution( 1 * Acts::UnitConstants::mm, 10 * Acts::UnitConstants::mm)(rng)) { // set a random geometry identifier to uniquely identify each surface auto geoId = @@ -55,10 +55,10 @@ struct TestTrackState { // create source link w/ inline 1d or 2d measurement data if (measdim == 1u) { - auto [par, cov] = generateParametersCovariance(rng); + auto [par, cov] = generateParametersCovariance(rng); sourceLink = TestSourceLink(eBoundLoc0, par[0], cov(0, 0), geoId); } else if (measdim == 2u) { - auto [par, cov] = generateParametersCovariance(rng); + auto [par, cov] = generateParametersCovariance(rng); sourceLink = TestSourceLink(eBoundLoc1, eBoundQOverP, par, cov, geoId); } else { throw std::runtime_error("invalid number of measurement dimensions"); @@ -85,7 +85,7 @@ struct TestTrackState { for (Eigen::Index c = 0; c < jacobian.cols(); ++c) { for (Eigen::Index r = 0; r < jacobian.rows(); ++r) { jacobian(c, r) += - std::uniform_real_distribution(-0.125, 0.125)(rng); + std::uniform_real_distribution(-0.125, 0.125)(rng); } } } diff --git a/Core/include/Acts/Geometry/ConeVolumeBounds.hpp b/Core/include/Acts/Geometry/ConeVolumeBounds.hpp index 23c8d33b26d..e3f0c36a25c 100644 --- a/Core/include/Acts/Geometry/ConeVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/ConeVolumeBounds.hpp @@ -56,10 +56,9 @@ class ConeVolumeBounds : public VolumeBounds { /// @param halflengthZ The minimum z value of the inner and outer cones /// @param averagePhi The phi orientation of the sector /// @param halfPhiSector The opening angle phi sector - ConeVolumeBounds(ActsScalar innerAlpha, ActsScalar innerOffsetZ, - ActsScalar outerAlpha, ActsScalar outerOffsetZ, - ActsScalar halflengthZ, ActsScalar averagePhi, - ActsScalar halfPhiSector) noexcept(false); + ConeVolumeBounds(double innerAlpha, double innerOffsetZ, double outerAlpha, + double outerOffsetZ, double halflengthZ, double averagePhi, + double halfPhiSector) noexcept(false); /// Constructor - for general cylidner-cone setups /// @@ -72,14 +71,14 @@ class ConeVolumeBounds : public VolumeBounds { /// /// @note depending on cylinderR > coneR it is constructing a cone with /// cylindrical cutout or a cylinder with conical cutout - ConeVolumeBounds(ActsScalar cylinderR, ActsScalar alpha, ActsScalar offsetZ, - ActsScalar halflengthZ, ActsScalar averagePhi, - ActsScalar halfPhiSector) noexcept(false); + ConeVolumeBounds(double cylinderR, double alpha, double offsetZ, + double halflengthZ, double averagePhi, + double halfPhiSector) noexcept(false); /// Constructor - from a fixed size array /// /// @param values The bound values - ConeVolumeBounds(const std::array& values) noexcept(false) + ConeVolumeBounds(const std::array& values) noexcept(false) : m_values(values) { checkConsistency(); buildSurfaceBounds(); @@ -94,14 +93,14 @@ class ConeVolumeBounds : public VolumeBounds { /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values - std::vector values() const final; + std::vector values() const final; /// This method checks if position in the 3D volume /// frame is inside the cylinder /// /// @param pos is the position in volume frame to be checked /// @param tol is the absolute tolerance to be applied - bool inside(const Vector3& pos, ActsScalar tol = 0.) const final; + bool inside(const Vector3& pos, double tol = 0.) const final; /// Oriented surfaces, i.e. the decomposed boundary surfaces and the /// according navigation direction into the volume given the normal @@ -127,25 +126,25 @@ class ConeVolumeBounds : public VolumeBounds { /// Access to the bound values /// @param bValue the class nested enum for the array access - ActsScalar get(BoundValues bValue) const { return m_values[bValue]; } + double get(BoundValues bValue) const { return m_values[bValue]; } // Return the derived innerRmin - ActsScalar innerRmin() const; + double innerRmin() const; // Return the derived innerRmin - ActsScalar innerRmax() const; + double innerRmax() const; // Return the derived inner tan(alpha) - ActsScalar innerTanAlpha() const; + double innerTanAlpha() const; // Return the derived outerRmin - ActsScalar outerRmin() const; + double outerRmin() const; // Return the derived outerRmax - ActsScalar outerRmax() const; + double outerRmax() const; // Return the derived outer tan(alpha) - ActsScalar outerTanAlpha() const; + double outerTanAlpha() const; /// Output Method for std::ostream /// @@ -161,7 +160,7 @@ class ConeVolumeBounds : public VolumeBounds { void buildSurfaceBounds(); /// The bound values - std::array m_values; + std::array m_values; std::shared_ptr m_innerCylinderBounds{nullptr}; std::shared_ptr m_innerConeBounds{nullptr}; std::shared_ptr m_outerConeBounds{nullptr}; @@ -171,12 +170,12 @@ class ConeVolumeBounds : public VolumeBounds { std::shared_ptr m_sectorBounds{nullptr}; /// Derived values - ActsScalar m_innerRmin = 0.; - ActsScalar m_innerRmax = 0.; - ActsScalar m_innerTanAlpha = 0.; - ActsScalar m_outerRmin = 0.; - ActsScalar m_outerRmax = 0.; - ActsScalar m_outerTanAlpha = 0.; + double m_innerRmin = 0.; + double m_innerRmax = 0.; + double m_innerTanAlpha = 0.; + double m_outerRmin = 0.; + double m_outerRmax = 0.; + double m_outerTanAlpha = 0.; }; } // namespace Acts diff --git a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp index 8b8437a91a5..bc3c75ac70d 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp @@ -63,13 +63,12 @@ class CuboidVolumeBounds : public VolumeBounds { /// @param halex is the half length of the cube in x /// @param haley is the half length of the cube in y /// @param halez is the half length of the cube in z - CuboidVolumeBounds(ActsScalar halex, ActsScalar haley, - ActsScalar halez) noexcept(false); + CuboidVolumeBounds(double halex, double haley, double halez) noexcept(false); /// Constructor - from a fixed size array /// /// @param values iw the bound values - CuboidVolumeBounds(const std::array& values); + CuboidVolumeBounds(const std::array& values); /// Copy Constructor /// @@ -88,14 +87,14 @@ class CuboidVolumeBounds : public VolumeBounds { /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values - std::vector values() const final; + std::vector values() const final; /// This method checks if position in the 3D volume /// frame is inside the cylinder /// /// @param pos is the position in volume frame to be checked /// @param tol is the absolute tolerance to be applied - bool inside(const Vector3& pos, ActsScalar tol = 0.) const override; + bool inside(const Vector3& pos, double tol = 0.) const override; /// Oriented surfaces, i.e. the decomposed boundary surfaces and the /// according navigation direction into the volume given the normal @@ -128,25 +127,25 @@ class CuboidVolumeBounds : public VolumeBounds { Acts::BinningValue::binZ}; }; - /// Binning borders in ActsScalar + /// Binning borders in double /// /// @param bValue is the binning schema used /// /// @return float offset to be used for the binning - ActsScalar binningBorder(BinningValue bValue) const final; + double binningBorder(BinningValue bValue) const final; /// Access to the bound values /// @param bValue the class nested enum for the array access - ActsScalar get(BoundValues bValue) const { return m_values[bValue]; } + double get(BoundValues bValue) const { return m_values[bValue]; } /// Set a bound value /// @param bValue the bound value identifier /// @param value the value to be set - void set(BoundValues bValue, ActsScalar value); + void set(BoundValues bValue, double value); /// Set a range of bound values /// @param keyValues the initializer list of key value pairs - void set(std::initializer_list> keyValues); + void set(std::initializer_list> keyValues); /// Output Method for std::ostream /// @@ -155,7 +154,7 @@ class CuboidVolumeBounds : public VolumeBounds { private: /// The bound values ordered in a fixed size array - std::array m_values; + std::array m_values; std::shared_ptr m_xyBounds{nullptr}; std::shared_ptr m_yzBounds{nullptr}; diff --git a/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp b/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp index 5912b21ed98..185d55f229d 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp @@ -74,11 +74,11 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { // Bins in Z direction std::size_t binsZ = 1; // Envelope in X - std::array envelopeX{0, 0}; + std::array envelopeX{0, 0}; // Envelope in Y - std::array envelopeY{0, 0}; + std::array envelopeY{0, 0}; // Envelope in Z - std::array envelopeZ{0, 0}; + std::array envelopeZ{0, 0}; // An optional rotation for this std::optional rotation{std::nullopt}; // Dimension for the binning diff --git a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp index 7f368442f40..3e5d8862cd8 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp @@ -105,27 +105,26 @@ class CylinderVolumeBounds : public VolumeBounds { /// @param avgphi The average phi value /// @param bevelMinZ The bevel angle, in radians, for the negative side /// @param bevelMaxZ The bevel angle, in radians, for the positive side - CylinderVolumeBounds(ActsScalar rmin, ActsScalar rmax, ActsScalar halfz, - ActsScalar halfphi = std::numbers::pi_v, - ActsScalar avgphi = 0., ActsScalar bevelMinZ = 0., - ActsScalar bevelMaxZ = 0.); + CylinderVolumeBounds(double rmin, double rmax, double halfz, + double halfphi = std::numbers::pi, double avgphi = 0., + double bevelMinZ = 0., double bevelMaxZ = 0.); /// Constructor - from a fixed size array /// /// @param values The bound values - CylinderVolumeBounds(const std::array& values); + CylinderVolumeBounds(const std::array& values); /// Constructor - extruded from cylinder bounds and thickness /// /// @param cBounds the cylinder bounds /// @param thickness of the extrusion - CylinderVolumeBounds(const CylinderBounds& cBounds, ActsScalar thickness); + CylinderVolumeBounds(const CylinderBounds& cBounds, double thickness); /// Constructor - extruded from radial bounds and thickness /// /// @param rBounds the Radial bounds /// @param thickness - CylinderVolumeBounds(const RadialBounds& rBounds, ActsScalar thickness); + CylinderVolumeBounds(const RadialBounds& rBounds, double thickness); /// Copy Constructor /// @@ -142,14 +141,14 @@ class CylinderVolumeBounds : public VolumeBounds { /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values - std::vector values() const final; + std::vector values() const final; /// This method checks if position in the 3D volume /// frame is inside the cylinder /// /// @param pos is a global position to be checked /// @param tol is the tolerance for the check - bool inside(const Vector3& pos, ActsScalar tol = 0.) const override; + bool inside(const Vector3& pos, double tol = 0.) const override; /// Oriented surfaces, i.e. the decomposed boundary surfaces and the /// according navigation direction into the volume given the normal @@ -187,10 +186,10 @@ class CylinderVolumeBounds : public VolumeBounds { /// @param bValue is the type used for the binning Vector3 binningOffset(BinningValue bValue) const override; - /// Binning borders in ActsScalar + /// Binning borders in double /// /// @param bValue is the type used for the binning - ActsScalar binningBorder(BinningValue bValue) const override; + double binningBorder(BinningValue bValue) const override; /// Output Method for std::ostream /// @param os is the output stream @@ -198,20 +197,20 @@ class CylinderVolumeBounds : public VolumeBounds { /// Access to the bound values /// @param bValue the class nested enum for the array access - ActsScalar get(BoundValues bValue) const { return m_values[bValue]; } + double get(BoundValues bValue) const { return m_values[bValue]; } /// Set a bound value /// @param bValue the bound value identifier /// @param value the value to be set - void set(BoundValues bValue, ActsScalar value); + void set(BoundValues bValue, double value); /// Set a range of bound values /// @param keyValues the initializer list of key value pairs - void set(std::initializer_list> keyValues); + void set(std::initializer_list> keyValues); private: - /// The internal version of the bounds can be float/ActsScalar - std::array m_values{}; + /// The internal version of the bounds can be float/double + std::array m_values{}; /// Bounds of the inner CylinderBounds std::shared_ptr m_innerCylinderBounds{nullptr}; diff --git a/Core/include/Acts/Geometry/CylinderVolumeStack.hpp b/Core/include/Acts/Geometry/CylinderVolumeStack.hpp index 3fcb8f1039b..06e1e75dd58 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeStack.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeStack.hpp @@ -149,7 +149,7 @@ class CylinderVolumeStack : public Volume { /// @param volumes is the vector of volumes /// @param logger is the logger /// @return tuple of the minimum and maximum radii - std::pair synchronizeRBounds( + std::pair synchronizeRBounds( std::vector& volumes, const Logger& logger); /// Helper function that checks overlaps and attaches in r direction @@ -165,7 +165,7 @@ class CylinderVolumeStack : public Volume { /// @param volumes is the vector of volumes /// @param logger is the logger /// @return tuple of the minimum and maximum z extent - std::pair synchronizeZBounds( + std::pair synchronizeZBounds( std::vector& volumes, const Logger& logger); /// Helper functions that checks if the cylinder volume bounds diff --git a/Core/include/Acts/Geometry/Extent.hpp b/Core/include/Acts/Geometry/Extent.hpp index 8728728996b..ca4d439e9ba 100644 --- a/Core/include/Acts/Geometry/Extent.hpp +++ b/Core/include/Acts/Geometry/Extent.hpp @@ -24,7 +24,7 @@ namespace Acts { -using Envelope = std::array; +using Envelope = std::array; constexpr Envelope zeroEnvelope = {0, 0}; @@ -182,19 +182,19 @@ class Extent { /// @param bValue the binning identification /// @param min the minimum parameter /// @param max the maximum parameter - void set(BinningValue bValue, ActsScalar min, ActsScalar max); + void set(BinningValue bValue, double min, double max); /// Set a min value for a dedicated binning value /// /// @param bValue the binning identification /// @param min the minimum parameter - void setMin(BinningValue bValue, ActsScalar min); + void setMin(BinningValue bValue, double min); /// Set a max value for a dedicated binning value /// /// @param bValue the binning identification /// @param max the maximum parameter - void setMax(BinningValue bValue, ActsScalar max); + void setMax(BinningValue bValue, double max); /// (re-)Set the envelope /// @@ -213,10 +213,10 @@ class Extent { /// @param bValue is the binning value to be returned /// /// @return a one dimensional arrange - Range1D range(BinningValue bValue) const; + Range1D range(BinningValue bValue) const; /// Return the N-dimension range - const RangeXD& range() const; + const RangeXD& range() const; /// Return an D-dimensional sub range according to the /// the given binvalues @@ -224,9 +224,9 @@ class Extent { /// @param binValues the binning values /// @return the sub range template - RangeXD range( + RangeXD range( const std::array& binValues) const { - RangeXD rRange; + RangeXD rRange; for (auto [i, v] : enumerate(binValues)) { rRange[i] = range(v); } @@ -242,27 +242,27 @@ class Extent { /// Return the histogram store /// /// The histogram store can be used for automated binning detection - const std::array, numBinningValues()>& - valueHistograms() const; + const std::array, numBinningValues()>& valueHistograms() + const; /// Access the minimum parameter /// /// @param bValue the binning identification - ActsScalar min(BinningValue bValue) const { + double min(BinningValue bValue) const { return m_range[toUnderlying(bValue)].min(); } /// Access the maximum parameter /// /// @param bValue the binning identification - ActsScalar max(BinningValue bValue) const { + double max(BinningValue bValue) const { return m_range[toUnderlying(bValue)].max(); } /// Access the midpoint /// /// @param bValue the binning identification - ActsScalar medium(BinningValue bValue) const { + double medium(BinningValue bValue) const { return 0.5 * (m_range[toUnderlying(bValue)].min() + m_range[toUnderlying(bValue)].max()); } @@ -270,7 +270,7 @@ class Extent { /// Access the parameter interval (i.e. the range span) /// /// @param bValue the binning identification - ActsScalar interval(BinningValue bValue) const { + double interval(BinningValue bValue) const { return m_range[toUnderlying(bValue)].size(); } @@ -318,18 +318,18 @@ class Extent { /// A bitset that remembers the constraint values std::bitset m_constrains{0}; /// The actual range store - RangeXD m_range; + RangeXD m_range; /// A potential envelope ExtentEnvelope m_envelope = ExtentEnvelope::Zero(); /// (Optional) Value histograms for bin detection - std::array, numBinningValues()> m_valueHistograms; + std::array, numBinningValues()> m_valueHistograms; }; -inline Range1D Acts::Extent::range(BinningValue bValue) const { +inline Range1D Acts::Extent::range(BinningValue bValue) const { return m_range[toUnderlying(bValue)]; } -inline const RangeXD& Extent::range() const { +inline const RangeXD& Extent::range() const { return m_range; } @@ -341,7 +341,7 @@ inline const ExtentEnvelope& Extent::envelope() const { return m_envelope; } -inline const std::array, numBinningValues()>& +inline const std::array, numBinningValues()>& Extent::valueHistograms() const { return m_valueHistograms; } diff --git a/Core/include/Acts/Geometry/KDTreeTrackingGeometryBuilder.hpp b/Core/include/Acts/Geometry/KDTreeTrackingGeometryBuilder.hpp index 25fc8ebf30b..4a7a01e214d 100644 --- a/Core/include/Acts/Geometry/KDTreeTrackingGeometryBuilder.hpp +++ b/Core/include/Acts/Geometry/KDTreeTrackingGeometryBuilder.hpp @@ -58,7 +58,7 @@ class KDTreeTrackingGeometryBuilder : public ITrackingGeometryBuilder { }; using SurfaceKDT = - KDTree<2u, std::shared_ptr, ActsScalar, std::array, 100>; + KDTree<2u, std::shared_ptr, double, std::array, 100>; /// Constructor /// diff --git a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp index c34234287c8..9ce660e5856 100644 --- a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp @@ -68,8 +68,8 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// @param maxhalex is the half length in x at maximal y /// @param haley is the half length in y /// @param halez is the half length in z - TrapezoidVolumeBounds(ActsScalar minhalex, ActsScalar maxhalex, - ActsScalar haley, ActsScalar halez) noexcept(false); + TrapezoidVolumeBounds(double minhalex, double maxhalex, double haley, + double halez) noexcept(false); /// Constructor - the trapezoid boundaries (arbitrary trapezoid) /// @@ -78,14 +78,13 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// @param halez is the half length in z /// @param alpha is the opening angle at -x,-y /// @param beta is the opening angle at +x,-y - TrapezoidVolumeBounds(ActsScalar minhalex, ActsScalar haley, ActsScalar halez, - ActsScalar alpha, ActsScalar beta) noexcept(false); + TrapezoidVolumeBounds(double minhalex, double haley, double halez, + double alpha, double beta) noexcept(false); /// Constructor - from a fixed size array /// /// @param values The bound values - TrapezoidVolumeBounds(const std::array& values) noexcept( - false) + TrapezoidVolumeBounds(const std::array& values) noexcept(false) : m_values(values) { checkConsistency(); buildSurfaceBounds(); @@ -103,7 +102,7 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values - std::vector values() const final; + std::vector values() const final; /// This method checks if position in the 3D volume frame /// is inside the cylinder @@ -112,7 +111,7 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// @param tol is the tolerance applied /// /// @return boolean indicator if position is inside - bool inside(const Vector3& pos, ActsScalar tol = 0.) const override; + bool inside(const Vector3& pos, double tol = 0.) const override; /// Oriented surfaces, i.e. the decomposed boundary surfaces and the /// according navigation direction into the volume given the normal @@ -142,11 +141,11 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// Access to the bound values /// @param bValue the class nested enum for the array access - ActsScalar get(BoundValues bValue) const { return m_values[bValue]; } + double get(BoundValues bValue) const { return m_values[bValue]; } private: - /// The internal version of the bounds can be float/ActsScalar - std::array m_values{}; + /// The internal version of the bounds can be float/double + std::array m_values{}; /// The face PlaneSurface parallel to local xy plane std::shared_ptr m_faceXYTrapezoidBounds{nullptr}; /// Thhe face PlaneSurface attached to alpha (negative local x) diff --git a/Core/include/Acts/Geometry/Volume.hpp b/Core/include/Acts/Geometry/Volume.hpp index da8932b1eab..92085819676 100644 --- a/Core/include/Acts/Geometry/Volume.hpp +++ b/Core/include/Acts/Geometry/Volume.hpp @@ -32,7 +32,7 @@ class VolumeBounds; /// information. class Volume : public GeometryObject { public: - using BoundingBox = AxisAlignedBoundingBox; + using BoundingBox = AxisAlignedBoundingBox; /// Explicit constructor with shared arguments /// @@ -106,7 +106,7 @@ class Volume : public GeometryObject { /// @param tol is the tolerance parameter /// /// @return boolean indicator if the position is inside - bool inside(const Vector3& gpos, ActsScalar tol = 0.) const; + bool inside(const Vector3& gpos, double tol = 0.) const; /// The binning position method /// - as default the center is given, but may be overloaded diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 4434f24e7d4..7a56086971a 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -92,9 +92,9 @@ class MultiLayerNavigation : public IInternalNavigation { /// Cast into a lookup position /// /// @param position is the position of the update call - std::array castPosition( + std::array castPosition( const Vector3& position) const { - std::array casted{}; + std::array casted{}; fillCasts(position, casted, std::make_integer_sequence{}); return casted; @@ -133,7 +133,7 @@ class MultiLayerNavigation : public IInternalNavigation { /// in the grid struct PathGridSurfacesGenerator { std::vector operator()(Vector3 startPosition, - const Vector3& direction, ActsScalar stepSize, + const Vector3& direction, double stepSize, std::size_t numberOfSteps) const { std::vector pathCoordinates = {}; pathCoordinates.reserve(numberOfSteps); diff --git a/Core/include/Acts/Navigation/NavigationState.hpp b/Core/include/Acts/Navigation/NavigationState.hpp index 6cfc8a17e46..0e0d8e5af9c 100644 --- a/Core/include/Acts/Navigation/NavigationState.hpp +++ b/Core/include/Acts/Navigation/NavigationState.hpp @@ -60,10 +60,10 @@ struct NavigationState { Vector3 direction = Vector3(0., 0., 0.); /// The current absolute momentum - ActsScalar absMomentum = 0.; + double absMomentum = 0.; /// The current absolute charge - ActsScalar absCharge = 0.; + double absCharge = 0.; /// The current magnetic field Vector3 magneticField = Vector3(0., 0., 0.); @@ -88,7 +88,7 @@ struct NavigationState { BoundaryTolerance surfaceBoundaryTolerance = BoundaryTolerance::None(); /// An overstep tolerance - ActsScalar overstepTolerance = -100 * UnitConstants::um; + double overstepTolerance = -100 * UnitConstants::um; /// Auxiliary attached information std::any auxiliary; diff --git a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp index df5e750db54..83b7bfd5016 100644 --- a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp +++ b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp @@ -50,7 +50,7 @@ inline void intitializeCandidates(const GeometryContext& gctx, const Surface& surface = sc.surface != nullptr ? *sc.surface : sc.portal->surface(); // Only allow overstepping if it's not a portal - ActsScalar overstepTolerance = + double overstepTolerance = sc.portal != nullptr ? s_onSurfaceTolerance : nState.overstepTolerance; // Boundary tolerance is forced to 0 for portals BoundaryTolerance boundaryTolerance = diff --git a/Core/include/Acts/Navigation/NavigationStream.hpp b/Core/include/Acts/Navigation/NavigationStream.hpp index d579c0d7392..067831b181e 100644 --- a/Core/include/Acts/Navigation/NavigationStream.hpp +++ b/Core/include/Acts/Navigation/NavigationStream.hpp @@ -63,7 +63,7 @@ class NavigationStream { /// Convenience access to surface const Surface& surface() const { return *intersection.object(); } /// Cinvencience access to the path length - ActsScalar pathLength() const { return intersection.pathLength(); } + double pathLength() const { return intersection.pathLength(); } /// Order along the path length /// @@ -156,7 +156,7 @@ class NavigationStream { bool initialize(const GeometryContext& gctx, const NavigationStream::QueryPoint& queryPoint, const BoundaryTolerance& cTolerance, - ActsScalar onSurfaceTolerance = s_onSurfaceTolerance); + double onSurfaceTolerance = s_onSurfaceTolerance); /// Convenience method to update a stream from a new query point, /// this could be called from navigation delegates that do not require @@ -169,7 +169,7 @@ class NavigationStream { /// @return true if the stream is active, false indicate no valid candidates left bool update(const GeometryContext& gctx, const NavigationStream::QueryPoint& queryPoint, - ActsScalar onSurfaceTolerance = s_onSurfaceTolerance); + double onSurfaceTolerance = s_onSurfaceTolerance); private: /// The candidates of this navigation stream diff --git a/Core/include/Acts/Navigation/PortalNavigation.hpp b/Core/include/Acts/Navigation/PortalNavigation.hpp index 638f2397760..b810e179c69 100644 --- a/Core/include/Acts/Navigation/PortalNavigation.hpp +++ b/Core/include/Acts/Navigation/PortalNavigation.hpp @@ -86,7 +86,7 @@ struct BoundVolumesGrid1Navigation : public IExternalNavigation { /// @param cVolumes the contained volumes /// @param bTransform is the optional transform BoundVolumesGrid1Navigation( - const std::vector& gBoundaries, BinningValue bValue, + const std::vector& gBoundaries, BinningValue bValue, const std::vector& cVolumes, const Transform3& bTransform = Transform3::Identity()) noexcept(false) : indexedUpdater(IndexedUpdater(VariableBoundIndexGrid1(std::make_tuple( diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index 50fd78de145..cb78e828f17 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -422,7 +422,7 @@ class AtlasStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - ActsScalar surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index 47f2db687b6..00cec761f3c 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -273,7 +273,7 @@ class EigenStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - ActsScalar surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index dff30746cf6..a5236e571e3 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -14,16 +14,12 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/Definitions/Units.hpp" #include "Acts/EventData/MultiComponentTrackParameters.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/EigenStepperError.hpp" -#include "Acts/Propagator/MultiStepperError.hpp" -#include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/StepperOptions.hpp" #include "Acts/Propagator/StepperStatistics.hpp" #include "Acts/Propagator/detail/LoopStepperUtils.hpp" @@ -36,7 +32,6 @@ #include #include #include -#include #include #include @@ -83,13 +78,13 @@ struct SingleComponentReducer { } template - static ActsScalar qOverP(const stepper_state_t& s) { + static double qOverP(const stepper_state_t& s) { const auto cmp = component_chooser_t{}(s.components); return cmp->state.pars[eFreeQOverP]; } template - static ActsScalar absoluteMomentum(const stepper_state_t& s) { + static double absoluteMomentum(const stepper_state_t& s) { const auto cmp = component_chooser_t{}(s.components); return s.particleHypothesis.extractMomentum(cmp->state.pars[eFreeQOverP]); } @@ -102,13 +97,13 @@ struct SingleComponentReducer { } template - static ActsScalar charge(const stepper_state_t& s) { + static double charge(const stepper_state_t& s) { const auto cmp = component_chooser_t{}(s.components); return s.particleHypothesis.extractCharge(cmp->state.pars[eFreeQOverP]); } template - static ActsScalar time(const stepper_state_t& s) { + static double time(const stepper_state_t& s) { return component_chooser_t{}(s.components)->state.pars[eFreeTime]; } @@ -170,11 +165,11 @@ class MultiEigenStepperLoop : public EigenStepper { /// @brief Define an own bound state using BoundState = - std::tuple; + std::tuple; /// @brief Define an own curvilinear state - using CurvilinearState = std::tuple; + using CurvilinearState = + std::tuple; /// @brief The reducer type using Reducer = component_reducer_t; @@ -196,7 +191,7 @@ class MultiEigenStepperLoop : public EigenStepper { /// The struct that stores the individual components struct Component { SingleState state; - ActsScalar weight; + double weight; IntersectionStatus status; }; @@ -398,7 +393,7 @@ class MultiEigenStepperLoop : public EigenStepper { void removeMissedComponents(State& state) const { auto new_end = std::remove_if( state.components.begin(), state.components.end(), [](const auto& cmp) { - return cmp.status == IntersectionStatus::missed; + return cmp.status == IntersectionStatus::unreachable; }); state.components.erase(new_end, state.components.end()); @@ -408,7 +403,7 @@ class MultiEigenStepperLoop : public EigenStepper { /// /// @param [in,out] state The stepping state (thread-local cache) void reweightComponents(State& state) const { - ActsScalar sumOfWeights = 0.0; + double sumOfWeights = 0.0; for (const auto& cmp : state.components) { sumOfWeights += cmp.weight; } @@ -523,7 +518,7 @@ class MultiEigenStepperLoop : public EigenStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - ActsScalar surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { using Status = IntersectionStatus; @@ -581,10 +576,8 @@ class MultiEigenStepperLoop : public EigenStepper { } else if (counts[static_cast(Status::onSurface)] > 0) { state.stepCounterAfterFirstComponentOnSurface.reset(); return Status::onSurface; - } else if (counts[static_cast(Status::unreachable)] > 0) { - return Status::unreachable; } else { - return Status::missed; + return Status::unreachable; } } diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp index 67aa98e94bb..3eac67c27b3 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/Propagator/MultiEigenStepperLoop.hpp" +#include "Acts/Propagator/MultiStepperError.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -67,8 +68,7 @@ auto MultiEigenStepperLoop::curvilinearState( State& state, bool transportCov) const -> CurvilinearState { assert(!state.components.empty()); - std::vector< - std::tuple> + std::vector> cmps; cmps.reserve(numberComponents(state)); double accumulatedPathLength = 0.0; @@ -112,7 +112,7 @@ Result MultiEigenStepperLoop::step( m_stepLimitAfterFirstComponentOnSurface) { for (auto& cmp : components) { if (cmp.status != Status::onSurface) { - cmp.status = Status::missed; + cmp.status = Status::unreachable; } } diff --git a/Core/include/Acts/Propagator/StepperConcept.hpp b/Core/include/Acts/Propagator/StepperConcept.hpp index d869b90b301..fb4ea187bcd 100644 --- a/Core/include/Acts/Propagator/StepperConcept.hpp +++ b/Core/include/Acts/Propagator/StepperConcept.hpp @@ -54,8 +54,7 @@ concept CommonStepper = requires { }; requires requires(const Surface& sf, std::uint8_t ui, Direction d, - const BoundaryTolerance& bt, ActsScalar sc, - const Logger& l) { + const BoundaryTolerance& bt, double sc, const Logger& l) { { s.updateSurfaceStatus(t, sf, ui, d, bt, sc, l) }; }; diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 59f10b1d980..1227397fefb 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -245,7 +245,7 @@ class StraightLineStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - ActsScalar surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index f5773a8a409..7d30c24b431 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -240,7 +240,7 @@ class SympyStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - ActsScalar surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, diff --git a/Core/include/Acts/Propagator/detail/NavigationHelpers.hpp b/Core/include/Acts/Propagator/detail/NavigationHelpers.hpp index 16e8c089e4f..8965dacae45 100644 --- a/Core/include/Acts/Propagator/detail/NavigationHelpers.hpp +++ b/Core/include/Acts/Propagator/detail/NavigationHelpers.hpp @@ -36,7 +36,7 @@ struct NavigationObjectCandidate { std::pair intersect( const GeometryContext& gctx, const Vector3& position, - const Vector3& direction, ActsScalar tolerance) const { + const Vector3& direction, double tolerance) const { if (std::holds_alternative(object)) { const auto& surface = std::get(object); auto intersection = representation->intersect( diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index c0589d739c7..5c79b4f9f0e 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -35,7 +35,7 @@ template Acts::IntersectionStatus updateSingleSurfaceStatus( const stepper_t& stepper, typename stepper_t::State& state, const Surface& surface, std::uint8_t index, Direction navDir, - const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance, + const BoundaryTolerance& boundaryTolerance, double surfaceTolerance, const Logger& logger) { ACTS_VERBOSE("Update single surface status for surface: " << surface.geometryId() << " index " << static_cast(index)); diff --git a/Core/include/Acts/Seeding/PathSeeder.hpp b/Core/include/Acts/Seeding/PathSeeder.hpp index d4475c022df..87ceda365c8 100644 --- a/Core/include/Acts/Seeding/PathSeeder.hpp +++ b/Core/include/Acts/Seeding/PathSeeder.hpp @@ -81,7 +81,7 @@ class PathSeeder { /// /// @return The path width in the bin0 and bin1 direction /// defined with respect to the surface normal - using PathWidthLookup = Delegate( + using PathWidthLookup = Delegate( const GeometryContext&, const GeometryIdentifier&)>; /// @brief The nested configuration struct @@ -146,10 +146,10 @@ class PathSeeder { m_cfg.pathWidthProvider(gctx, geoId); // Get the bounds of the path - ActsScalar top0 = refPoint[0] + pathWidth0; - ActsScalar bot0 = refPoint[0] - pathWidth0; - ActsScalar top1 = refPoint[1] + pathWidth1; - ActsScalar bot1 = refPoint[1] - pathWidth1; + double top0 = refPoint[0] + pathWidth0; + double bot0 = refPoint[0] - pathWidth0; + double top1 = refPoint[1] + pathWidth1; + double bot1 = refPoint[1] - pathWidth1; // Get the lookup table for the source links auto grid = sourceLinkGridLookup.at(geoId); diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.hpp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.hpp index a4129fad556..29405f0e222 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.hpp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.hpp @@ -48,7 +48,7 @@ class SeedFinderOrthogonal { * has leaf size 4. */ using tree_t = - KDTree; + KDTree; /** * @brief Construct a new orthogonal seed finder. diff --git a/Core/include/Acts/SpacePointFormation/detail/SpacePointBuilder.ipp b/Core/include/Acts/SpacePointFormation/detail/SpacePointBuilder.ipp index 532d2c90ec7..557b005fe6d 100644 --- a/Core/include/Acts/SpacePointFormation/detail/SpacePointBuilder.ipp +++ b/Core/include/Acts/SpacePointFormation/detail/SpacePointBuilder.ipp @@ -27,9 +27,9 @@ void SpacePointBuilder::buildSpacePoint( const unsigned int num_slinks = sourceLinks.size(); Acts::Vector3 gPos = Acts::Vector3::Zero(); - std::optional gTime = std::nullopt; + std::optional gTime = std::nullopt; Acts::Vector2 gCov = Acts::Vector2::Zero(); - std::optional gCovT = std::nullopt; + std::optional gCovT = std::nullopt; if (num_slinks == 1) { // pixel SP formation auto slink = sourceLinks.at(0); diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 53c52f13f50..971ff7039f7 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -198,7 +198,7 @@ class CylinderSurface : public RegularSurface { const Vector3& direction, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::Infinite(), - ActsScalar tolerance = s_onSurfaceTolerance) const final; + double tolerance = s_onSurfaceTolerance) const final; /// Path correction due to incident of the track /// diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index d2db14fc566..6a3144a00aa 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -294,7 +294,7 @@ class DiscSurface : public RegularSurface { const Vector3& direction, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::Infinite(), - ActsScalar tolerance = s_onSurfaceTolerance) const final; + double tolerance = s_onSurfaceTolerance) const final; /// Implement the binningValue /// diff --git a/Core/include/Acts/Surfaces/LineSurface.hpp b/Core/include/Acts/Surfaces/LineSurface.hpp index d07e9f6dc37..15af6aa6be8 100644 --- a/Core/include/Acts/Surfaces/LineSurface.hpp +++ b/Core/include/Acts/Surfaces/LineSurface.hpp @@ -248,7 +248,7 @@ class LineSurface : public Surface { const Vector3& direction, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::Infinite(), - ActsScalar tolerance = s_onSurfaceTolerance) const final; + double tolerance = s_onSurfaceTolerance) const final; /// the pathCorrection for derived classes with thickness /// is by definition 1 for LineSurfaces diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index 2bc65398f8d..e4fda361828 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -193,7 +193,7 @@ class PlaneSurface : public RegularSurface { const Vector3& direction, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::Infinite(), - ActsScalar tolerance = s_onSurfaceTolerance) const final; + double tolerance = s_onSurfaceTolerance) const final; /// Return a Polyhedron for the surfaces /// diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index 79153e8c98e..43d8161aa8c 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -399,7 +399,7 @@ class Surface : public virtual GeometryObject, const Vector3& direction, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::Infinite(), - ActsScalar tolerance = s_onSurfaceTolerance) const = 0; + double tolerance = s_onSurfaceTolerance) const = 0; /// Helper method for printing: the returned object captures the /// surface and the geometry context and will print the surface diff --git a/Core/include/Acts/Surfaces/detail/AnnulusBoundsHelper.hpp b/Core/include/Acts/Surfaces/detail/AnnulusBoundsHelper.hpp index 84f2d4ec61a..7f7db63086e 100644 --- a/Core/include/Acts/Surfaces/detail/AnnulusBoundsHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/AnnulusBoundsHelper.hpp @@ -33,7 +33,7 @@ namespace detail::AnnulusBoundsHelper { /// /// @return AnnulusBounds std::tuple, Transform3> create( - const Transform3& transform, ActsScalar rMin, ActsScalar rMax, + const Transform3& transform, double rMin, double rMax, std::vector vertices); } // namespace detail::AnnulusBoundsHelper diff --git a/Core/include/Acts/Surfaces/detail/IntersectionHelper2D.hpp b/Core/include/Acts/Surfaces/detail/IntersectionHelper2D.hpp index db6860006a3..cafa4349740 100644 --- a/Core/include/Acts/Surfaces/detail/IntersectionHelper2D.hpp +++ b/Core/include/Acts/Surfaces/detail/IntersectionHelper2D.hpp @@ -37,8 +37,7 @@ struct IntersectionHelper2D { /// @param dir The Direction of intersection line /// /// @return the intersection points - static std::array intersectEllipse(ActsScalar Rx, - ActsScalar Ry, + static std::array intersectEllipse(double Rx, double Ry, const Vector2& origin, const Vector2& dir); @@ -50,7 +49,7 @@ struct IntersectionHelper2D { /// /// @return the intersection points static inline std::array intersectCircle( - ActsScalar R, const Vector2& origin, const Vector2& dir) { + double R, const Vector2& origin, const Vector2& dir) { return intersectEllipse(R, R, origin, dir); } @@ -65,8 +64,8 @@ struct IntersectionHelper2D { /// @param dir The Direction of intersection line /// /// @return the intersection points - static Intersection2D intersectCircleSegment(ActsScalar R, ActsScalar phiMin, - ActsScalar phiMax, + static Intersection2D intersectCircleSegment(double R, double phiMin, + double phiMax, const Vector2& origin, const Vector2& dir); diff --git a/Core/include/Acts/Surfaces/detail/MergeHelper.hpp b/Core/include/Acts/Surfaces/detail/MergeHelper.hpp index a0121173591..ed396c9e6ad 100644 --- a/Core/include/Acts/Surfaces/detail/MergeHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/MergeHelper.hpp @@ -23,9 +23,9 @@ namespace Acts::detail { /// a half phi sector in the range [0,pi). The two /// ranges need to line up, i.e. that one of the sector /// ends exactly where the other one starts. -std::tuple mergedPhiSector( - ActsScalar hlPhi1, ActsScalar avgPhi1, ActsScalar hlPhi2, - ActsScalar avgPhi2, const Logger& logger = getDummyLogger(), - ActsScalar tolerance = s_onSurfaceTolerance); +std::tuple mergedPhiSector( + double hlPhi1, double avgPhi1, double hlPhi2, double avgPhi2, + const Logger& logger = getDummyLogger(), + double tolerance = s_onSurfaceTolerance); } // namespace Acts::detail diff --git a/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp b/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp index 99e1803126f..8faa345a213 100644 --- a/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp @@ -23,17 +23,16 @@ namespace Acts::PlanarHelper { /// @return The intersection inline Intersection3D intersect(const Transform3& transform, const Vector3& position, - const Vector3& direction, - ActsScalar tolerance) { + const Vector3& direction, double tolerance) { // Get the matrix from the transform (faster access) const auto& tMatrix = transform.matrix(); const Vector3 pnormal = tMatrix.block<3, 1>(0, 2).transpose(); const Vector3 pcenter = tMatrix.block<3, 1>(0, 3).transpose(); // It is solvable, so go on - ActsScalar denom = direction.dot(pnormal); + double denom = direction.dot(pnormal); if (denom != 0.0) { // Translate that into a path - ActsScalar path = (pnormal.dot((pcenter - position))) / (denom); + double path = (pnormal.dot((pcenter - position))) / (denom); // Is valid hence either on surface or reachable IntersectionStatus status = std::abs(path) < std::abs(tolerance) ? IntersectionStatus::onSurface diff --git a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp index 4384c17139c..24373a59c5c 100644 --- a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp @@ -30,11 +30,10 @@ namespace Acts::detail::VerticesHelper { /// @param quarterSegments number of segments used to approximate a segment quarter /// /// @return a vector of generated phi values -std::vector phiSegments( - ActsScalar phiMin = -std::numbers::pi_v, - ActsScalar phiMax = std::numbers::pi_v, - const std::vector& phiRefs = {}, - unsigned int quarterSegments = 2u); +std::vector phiSegments(double phiMin = -std::numbers::pi, + double phiMax = std::numbers::pi, + const std::vector& phiRefs = {}, + unsigned int quarterSegments = 2u); /// Helper method to create a regular 2 or 3 D segment /// between two phi values with a given number of segments @@ -56,15 +55,14 @@ std::vector phiSegments( /// @return a vector of vertices template std::vector segmentVertices( - std::pair rXY, ActsScalar phiMin, ActsScalar phiMax, - const std::vector& phiRefs = {}, - unsigned int quarterSegments = 2u, + std::pair rXY, double phiMin, double phiMax, + const std::vector& phiRefs = {}, unsigned int quarterSegments = 2u, const vertex_t& offset = vertex_t::Zero(), const transform_t& transform = transform_t::Identity()) { std::vector vertices; - std::vector phis = + std::vector phis = phiSegments(phiMin, phiMax, phiRefs, quarterSegments); - for (ActsScalar phi : phis) { + for (double phi : phis) { vertex_t vertex = vertex_t::Zero(); vertex(0) = rXY.first * std::cos(phi); vertex(1) = rXY.second * std::sin(phi); @@ -85,11 +83,11 @@ std::vector segmentVertices( /// @param quarterSegments number of segments used to approximate a segment quarter /// /// @return a vector of 2d-vectors -std::vector ellipsoidVertices( - ActsScalar innerRx, ActsScalar innerRy, ActsScalar outerRx, - ActsScalar outerRy, ActsScalar avgPhi = 0., - ActsScalar halfPhi = std::numbers::pi_v, - unsigned int quarterSegments = 2u); +std::vector ellipsoidVertices(double innerRx, double innerRy, + double outerRx, double outerRy, + double avgPhi = 0., + double halfPhi = std::numbers::pi, + unsigned int quarterSegments = 2u); /// Construct vertices on an disc/wheel-like bound object. /// @@ -100,10 +98,10 @@ std::vector ellipsoidVertices( /// @param quarterSegments number of segments used to approximate a segment quarter /// /// @return a vector of 2d-vectors -std::vector circularVertices( - ActsScalar innerR, ActsScalar outerR, ActsScalar avgPhi = 0., - ActsScalar halfPhi = std::numbers::pi_v, - unsigned int quarterSegments = 2u); +std::vector circularVertices(double innerR, double outerR, + double avgPhi = 0., + double halfPhi = std::numbers::pi, + unsigned int quarterSegments = 2u); /// Check if the point is inside the polygon w/o any tolerances. /// @@ -174,7 +172,7 @@ bool isInsideRectangle(const vertex_t& point, const vertex_t& lowerLeft, /// @param tolerance The allowed out of plane tolerance /// @return boolean to indicate if all points are inside/outside bool onHyperPlane(const std::vector& vertices, - ActsScalar tolerance = s_onSurfaceTolerance); + double tolerance = s_onSurfaceTolerance); /// Calculate the closest point on the polygon. inline Vector2 computeClosestPointOnPolygon(const Vector2& point, diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index 315dd2379b0..90a7ab5f134 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -464,7 +464,6 @@ class CombinatorialKalmanFilter { } // either copy ALL or everything except for predicted and jacobian - trackState.allocateCalibrated(candidateTrackState.calibratedSize()); trackState.copyFrom(candidateTrackState, mask, false); auto typeFlags = trackState.typeFlags(); @@ -747,7 +746,7 @@ class CombinatorialKalmanFilter { } // Transport the covariance to the surface - if (isHole || isMaterialOnly) { + if (isMaterialOnly) { stepper.transportCovarianceToCurvilinear(state.stepping); } else { stepper.transportCovarianceToBound(state.stepping, *surface); diff --git a/Core/include/Acts/TrackFitting/BetheHeitlerApprox.hpp b/Core/include/Acts/TrackFitting/BetheHeitlerApprox.hpp index 5d0c5601bea..543ac3e4376 100644 --- a/Core/include/Acts/TrackFitting/BetheHeitlerApprox.hpp +++ b/Core/include/Acts/TrackFitting/BetheHeitlerApprox.hpp @@ -31,9 +31,9 @@ namespace Acts { namespace detail { struct GaussianComponent { - ActsScalar weight = 0.0; - ActsScalar mean = 0.0; - ActsScalar var = 0.0; + double weight = 0.0; + double mean = 0.0; + double var = 0.0; }; /// Transform a gaussian component to a space where all values are defined from @@ -73,7 +73,7 @@ struct BetheHeitlerApproxSingleCmp { /// Checks if an input is valid for the parameterization. The threshold for /// x/x0 is 0.002 and orientates on the values used in ATLAS - constexpr bool validXOverX0(ActsScalar x) const { + constexpr bool validXOverX0(double x) const { return x < 0.002; ; } @@ -82,7 +82,7 @@ struct BetheHeitlerApproxSingleCmp { /// Bethe-Heitler-Distribution /// /// @param x pathlength in terms of the radiation length - static auto mixture(const ActsScalar x) { + static auto mixture(const double x) { std::array ret{}; ret[0].weight = 1.0; @@ -109,9 +109,9 @@ class AtlasBetheHeitlerApprox { public: struct PolyData { - std::array weightCoeffs; - std::array meanCoeffs; - std::array varCoeffs; + std::array weightCoeffs; + std::array meanCoeffs; + std::array varCoeffs; }; using Data = std::array; @@ -160,7 +160,7 @@ class AtlasBetheHeitlerApprox { /// Checks if an input is valid for the parameterization /// /// @param x pathlength in terms of the radiation length - constexpr bool validXOverX0(ActsScalar x) const { + constexpr bool validXOverX0(double x) const { if (m_clampToRange) { return true; } else { @@ -172,7 +172,7 @@ class AtlasBetheHeitlerApprox { /// that the sum of all weights is 1 /// /// @param x pathlength in terms of the radiation length - auto mixture(ActsScalar x) const { + auto mixture(double x) const { using Array = boost::container::static_vector; @@ -181,9 +181,9 @@ class AtlasBetheHeitlerApprox { } // Build a polynom - auto poly = [](ActsScalar xx, - const std::array &coeffs) { - ActsScalar sum{0.}; + auto poly = [](double xx, + const std::array &coeffs) { + double sum{0.}; for (const auto c : coeffs) { sum = xx * sum + c; } @@ -195,7 +195,7 @@ class AtlasBetheHeitlerApprox { auto make_mixture = [&](const Data &data, double xx, bool transform) { // Value initialization should garanuee that all is initialized to zero Array ret(NComponents); - ActsScalar weight_sum = 0; + double weight_sum = 0; for (int i = 0; i < NComponents; ++i) { // These transformations must be applied to the data according to ATHENA // (TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx:79) diff --git a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp index a7b28d5e8f3..eaa9020053d 100644 --- a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp +++ b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp @@ -251,7 +251,7 @@ struct ScatteringProperties { /// @param invCovarianceMaterial_ The inverse covariance of the material. /// @param materialIsValid_ A boolean flag indicating whether the material is valid. ScatteringProperties(const BoundVector& scatteringAngles_, - const ActsScalar invCovarianceMaterial_, + const double invCovarianceMaterial_, const bool materialIsValid_) : m_scatteringAngles(scatteringAngles_), m_invCovarianceMaterial(invCovarianceMaterial_), @@ -264,7 +264,7 @@ struct ScatteringProperties { BoundVector& scatteringAngles() { return m_scatteringAngles; } // Accessor for the inverse covariance of the material. - ActsScalar invCovarianceMaterial() const { return m_invCovarianceMaterial; } + double invCovarianceMaterial() const { return m_invCovarianceMaterial; } // Accessor for the material validity flag. bool materialIsValid() const { return m_materialIsValid; } @@ -276,7 +276,7 @@ struct ScatteringProperties { /// Inverse covariance of the material. Compute with e.g. the Highland /// formula. - ActsScalar m_invCovarianceMaterial; + double m_invCovarianceMaterial; /// Flag indicating whether the material is valid. Commonly vacuum and zero /// thickness material will be ignored. @@ -503,7 +503,7 @@ void addMaterialToGx2fSums( "No scattering angles found for material surface."); } - const ActsScalar sinThetaLoc = std::sin(trackState.smoothed()[eBoundTheta]); + const double sinThetaLoc = std::sin(trackState.smoothed()[eBoundTheta]); // The position, where we need to insert the values in aMatrix and bVector const std::size_t deltaPosition = eBoundSize + 2 * nMaterialsHandled; @@ -511,7 +511,7 @@ void addMaterialToGx2fSums( const BoundVector& scatteringAngles = scatteringMapId->second.scatteringAngles(); - const ActsScalar invCov = scatteringMapId->second.invCovarianceMaterial(); + const double invCov = scatteringMapId->second.invCovarianceMaterial(); // Phi contribution extendedSystem.aMatrix()(deltaPosition, deltaPosition) += diff --git a/Core/include/Acts/TrackFitting/GsfOptions.hpp b/Core/include/Acts/TrackFitting/GsfOptions.hpp index 4840b6b6184..88fb902daff 100644 --- a/Core/include/Acts/TrackFitting/GsfOptions.hpp +++ b/Core/include/Acts/TrackFitting/GsfOptions.hpp @@ -29,7 +29,7 @@ enum class ComponentMergeMethod { eMean, eMaxWeight }; /// /// Encapsulates a component of a Gaussian mixture as used by the GSF struct GsfComponent { - ActsScalar weight = 0; + double weight = 0; BoundVector boundPars = BoundVector::Zero(); BoundSquareMatrix boundCov = BoundSquareMatrix::Identity(); }; diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index eeb7636103b..6d5ac68d8b9 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -478,7 +478,7 @@ struct GsfActor { // we set ignored components to missed, so we can remove them after // the loop if (tmpStates.weights.at(idx) < m_cfg.weightCutoff) { - cmp.status() = IntersectionStatus::missed; + cmp.status() = IntersectionStatus::unreachable; continue; } diff --git a/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp b/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp index 501208b7e09..98605052bf6 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp @@ -150,7 +150,7 @@ class ScopedGsfInfoPrinterAndChecker { } }; -ActsScalar calculateDeterminant( +double calculateDeterminant( const double *fullCalibratedCovariance, TrackStateTraits::Covariance predictedCovariance, diff --git a/Core/include/Acts/TrackFitting/detail/SymmetricKlDistanceMatrix.hpp b/Core/include/Acts/TrackFitting/detail/SymmetricKlDistanceMatrix.hpp index f7fcfbd871e..e243840f5b9 100644 --- a/Core/include/Acts/TrackFitting/detail/SymmetricKlDistanceMatrix.hpp +++ b/Core/include/Acts/TrackFitting/detail/SymmetricKlDistanceMatrix.hpp @@ -66,7 +66,7 @@ auto mergeComponents(const component_t &a, const component_t &b, /// @brief Class representing a symmetric distance matrix class SymmetricKLDistanceMatrix { - using Array = Eigen::Array; + using Array = Eigen::Array; using Mask = Eigen::Array; Array m_distances; @@ -127,7 +127,7 @@ class SymmetricKLDistanceMatrix { } auto minDistancePair() const { - auto min = std::numeric_limits::max(); + auto min = std::numeric_limits::max(); std::size_t idx = 0; for (auto i = 0l; i < m_distances.size(); ++i) { diff --git a/Core/include/Acts/Utilities/Axis.hpp b/Core/include/Acts/Utilities/Axis.hpp index f843d0e7f92..5b55d27cd77 100644 --- a/Core/include/Acts/Utilities/Axis.hpp +++ b/Core/include/Acts/Utilities/Axis.hpp @@ -109,7 +109,7 @@ class Axis final : public IAxis { /// /// Divide the range \f$[\text{xmin},\text{xmax})\f$ into \f$\text{nBins}\f$ /// equidistant bins. - Axis(ActsScalar xmin, ActsScalar xmax, std::size_t nBins) + Axis(double xmin, double xmax, std::size_t nBins) : m_min(xmin), m_max(xmax), m_width((xmax - xmin) / nBins), @@ -124,7 +124,7 @@ class Axis final : public IAxis { /// /// Divide the range \f$[\text{xmin},\text{xmax})\f$ into \f$\text{nBins}\f$ /// equidistant bins. - Axis(AxisBoundaryTypeTag typeTag, ActsScalar xmin, ActsScalar xmax, + Axis(AxisBoundaryTypeTag typeTag, double xmin, double xmax, std::size_t nBins) : Axis(xmin, xmax, nBins) { static_cast(typeTag); @@ -306,7 +306,7 @@ class Axis final : public IAxis { /// bin with lower bound @c l and upper bound @c u. /// @note Bin indices start at @c 1. The underflow bin has the index @c 0 /// while the index nBins + 1 indicates the overflow bin . - std::size_t getBin(ActsScalar x) const { + std::size_t getBin(double x) const { return wrapBin( static_cast(std::floor((x - getMin()) / getBinWidth()) + 1)); } @@ -314,7 +314,7 @@ class Axis final : public IAxis { /// @brief get bin width /// /// @return constant width for all bins - ActsScalar getBinWidth(std::size_t /*bin*/ = 0) const { return m_width; } + double getBinWidth(std::size_t /*bin*/ = 0) const { return m_width; } /// @brief get lower bound of bin /// @@ -326,7 +326,7 @@ class Axis final : public IAxis { /// /// @note Bin intervals have a closed lower bound, i.e. the lower boundary /// belongs to the bin with the given bin index. - ActsScalar getBinLowerBound(std::size_t bin) const { + double getBinLowerBound(std::size_t bin) const { return getMin() + (bin - 1) * getBinWidth(); } @@ -340,7 +340,7 @@ class Axis final : public IAxis { /// /// @note Bin intervals have an open upper bound, i.e. the upper boundary /// does @b not belong to the bin with the given bin index. - ActsScalar getBinUpperBound(std::size_t bin) const { + double getBinUpperBound(std::size_t bin) const { return getMin() + bin * getBinWidth(); } @@ -351,19 +351,19 @@ class Axis final : public IAxis { /// /// @pre @c bin must be a valid bin index (excluding under-/overflow bins), /// i.e. \f$1 \le \text{bin} \le \text{nBins}\f$ - ActsScalar getBinCenter(std::size_t bin) const { + double getBinCenter(std::size_t bin) const { return getMin() + (bin - 0.5) * getBinWidth(); } /// @brief get maximum of binning range /// /// @return maximum of binning range - ActsScalar getMax() const override { return m_max; } + double getMax() const override { return m_max; } /// @brief get minimum of binning range /// /// @return minimum of binning range - ActsScalar getMin() const override { return m_min; } + double getMin() const override { return m_min; } /// @brief get total number of bins /// @@ -377,12 +377,12 @@ class Axis final : public IAxis { /// /// @post If @c true is returned, the bin containing the given value is a /// valid bin, i.e. it is neither the underflow nor the overflow bin. - bool isInside(ActsScalar x) const { return (m_min <= x) && (x < m_max); } + bool isInside(double x) const { return (m_min <= x) && (x < m_max); } /// @brief Return a vector of bin edges /// @return Vector which contains the bin edges - std::vector getBinEdges() const override { - std::vector binEdges; + std::vector getBinEdges() const override { + std::vector binEdges; for (std::size_t i = 1; i <= m_bins; i++) { binEdges.push_back(getBinLowerBound(i)); } @@ -403,11 +403,11 @@ class Axis final : public IAxis { private: /// minimum of binning range - ActsScalar m_min{}; + double m_min{}; /// maximum of binning range - ActsScalar m_max{}; + double m_max{}; /// constant bin width - ActsScalar m_width{}; + double m_width{}; /// number of bins (excluding under-/overflow bins) std::size_t m_bins{}; }; @@ -428,7 +428,7 @@ class Axis final : public IAxis { /// Create a binning structure with @c nBins variable-sized bins from the /// given bin boundaries. @c nBins is given by the number of bin edges /// reduced by one. - explicit Axis(std::vector binEdges) + explicit Axis(std::vector binEdges) : m_binEdges(std::move(binEdges)) {} /// @param [in] typeTag boundary type tag @@ -439,7 +439,7 @@ class Axis final : public IAxis { /// Create a binning structure with @c nBins variable-sized bins from the /// given bin boundaries. @c nBins is given by the number of bin edges /// reduced by one. - Axis(AxisBoundaryTypeTag typeTag, std::vector binEdges) + Axis(AxisBoundaryTypeTag typeTag, std::vector binEdges) : Axis(std::move(binEdges)) { static_cast(typeTag); } @@ -618,7 +618,7 @@ class Axis final : public IAxis { /// bin with lower bound @c l and upper bound @c u. /// @note Bin indices start at @c 1. The underflow bin has the index @c 0 /// while the index nBins + 1 indicates the overflow bin . - std::size_t getBin(ActsScalar x) const { + std::size_t getBin(double x) const { const auto it = std::upper_bound(std::begin(m_binEdges), std::end(m_binEdges), x); return wrapBin(std::distance(std::begin(m_binEdges), it)); @@ -631,7 +631,7 @@ class Axis final : public IAxis { /// /// @pre @c bin must be a valid bin index (excluding under-/overflow bins), /// i.e. \f$1 \le \text{bin} \le \text{nBins}\f$ - ActsScalar getBinWidth(std::size_t bin) const { + double getBinWidth(std::size_t bin) const { return m_binEdges.at(bin) - m_binEdges.at(bin - 1); } @@ -645,7 +645,7 @@ class Axis final : public IAxis { /// /// @note Bin intervals have a closed lower bound, i.e. the lower boundary /// belongs to the bin with the given bin index. - ActsScalar getBinLowerBound(std::size_t bin) const { + double getBinLowerBound(std::size_t bin) const { return m_binEdges.at(bin - 1); } @@ -659,9 +659,7 @@ class Axis final : public IAxis { /// /// @note Bin intervals have an open upper bound, i.e. the upper boundary /// does @b not belong to the bin with the given bin index. - ActsScalar getBinUpperBound(std::size_t bin) const { - return m_binEdges.at(bin); - } + double getBinUpperBound(std::size_t bin) const { return m_binEdges.at(bin); } /// @brief get bin center /// @@ -670,19 +668,19 @@ class Axis final : public IAxis { /// /// @pre @c bin must be a valid bin index (excluding under-/overflow bins), /// i.e. \f$1 \le \text{bin} \le \text{nBins}\f$ - ActsScalar getBinCenter(std::size_t bin) const { + double getBinCenter(std::size_t bin) const { return 0.5 * (getBinLowerBound(bin) + getBinUpperBound(bin)); } /// @brief get maximum of binning range /// /// @return maximum of binning range - ActsScalar getMax() const override { return m_binEdges.back(); } + double getMax() const override { return m_binEdges.back(); } /// @brief get minimum of binning range /// /// @return minimum of binning range - ActsScalar getMin() const override { return m_binEdges.front(); } + double getMin() const override { return m_binEdges.front(); } /// @brief get total number of bins /// @@ -696,13 +694,13 @@ class Axis final : public IAxis { /// /// @post If @c true is returned, the bin containing the given value is a /// valid bin, i.e. it is neither the underflow nor the overflow bin. - bool isInside(ActsScalar x) const { + bool isInside(double x) const { return (m_binEdges.front() <= x) && (x < m_binEdges.back()); } /// @brief Return a vector of bin edges /// @return Vector which contains the bin edges - std::vector getBinEdges() const override { return m_binEdges; } + std::vector getBinEdges() const override { return m_binEdges; } friend std::ostream& operator<<(std::ostream& os, const Axis& axis) { os << "Axis("; @@ -719,6 +717,6 @@ class Axis final : public IAxis { private: /// vector of bin edges (sorted in ascending order) - std::vector m_binEdges; + std::vector m_binEdges; }; } // namespace Acts diff --git a/Core/include/Acts/Utilities/AxisFwd.hpp b/Core/include/Acts/Utilities/AxisFwd.hpp index fefa980cbfd..ce31ff3f7b6 100644 --- a/Core/include/Acts/Utilities/AxisFwd.hpp +++ b/Core/include/Acts/Utilities/AxisFwd.hpp @@ -86,18 +86,18 @@ inline std::ostream& operator<<(std::ostream& os, AxisType type) { template class Axis; -Axis(ActsScalar min, ActsScalar max, +Axis(double min, double max, std::size_t bins) -> Axis; template -Axis(AxisBoundaryTypeTag /*bdt*/, ActsScalar min, ActsScalar max, +Axis(AxisBoundaryTypeTag /*bdt*/, double min, double max, std::size_t bins) -> Axis; -Axis(std::vector bins) +Axis(std::vector bins) -> Axis; template Axis(AxisBoundaryTypeTag /*bdt*/, - std::vector bins) -> Axis; + std::vector bins) -> Axis; } // namespace Acts diff --git a/Core/include/Acts/Utilities/Grid.hpp b/Core/include/Acts/Utilities/Grid.hpp index f6c5f9ddaf9..317fb3b123e 100644 --- a/Core/include/Acts/Utilities/Grid.hpp +++ b/Core/include/Acts/Utilities/Grid.hpp @@ -85,7 +85,7 @@ class Grid final : public IGrid { /// constant reference type to values stored using const_reference = const value_type&; /// type for points in d-dimensional grid space - using point_t = std::array; + using point_t = std::array; /// index type using local bin indices along each axis using index_t = std::array; /// global iterator type @@ -240,7 +240,7 @@ class Grid final : public IGrid { /// /// @pre All local bin indices must be a valid index for the corresponding /// axis (excluding the under-/overflow bins for each axis). - std::array binCenter(const index_t& localBins) const { + std::array binCenter(const index_t& localBins) const { return detail::grid_helper::getBinCenter(localBins, m_axes); } @@ -411,19 +411,19 @@ class Grid final : public IGrid { /// /// @note This function is available only if the following conditions are /// fulfilled: - /// - Given @c U and @c V of value type @c T as well as two @c ActsScalar + /// - Given @c U and @c V of value type @c T as well as two @c double /// @c a and @c b, then the following must be a valid expression a * U + b /// * V yielding an object which is (implicitly) convertible to @c T. /// - @c Point must represent a d-dimensional position and support /// coordinate access using @c operator[] which should return a @c - /// ActsScalar (or a value which is implicitly convertible). Coordinate + /// double (or a value which is implicitly convertible). Coordinate /// indices must start at 0. /// @note Bin values are interpreted as being the field values at the /// lower-left corner of the corresponding hyper-box. template T interpolate(const Point& point) const - requires(Concepts::interpolatable, - std::array>) + requires(Concepts::interpolatable, + std::array>) { // there are 2^DIM corner points used during the interpolation constexpr std::size_t nCorners = 1 << DIM; diff --git a/Core/include/Acts/Utilities/GridAccessHelpers.hpp b/Core/include/Acts/Utilities/GridAccessHelpers.hpp index 20755d01ff6..085ea318f26 100644 --- a/Core/include/Acts/Utilities/GridAccessHelpers.hpp +++ b/Core/include/Acts/Utilities/GridAccessHelpers.hpp @@ -144,7 +144,7 @@ class Affine3Transformed final : public IGlobalToGridLocal { template class GlobalSubspace final : public IGlobalToGridLocal { public: - using grid_local_t = std::array; + using grid_local_t = std::array; /// Assert that size has to be bigger than 0 static_assert(sizeof...(Args) > 0, @@ -181,7 +181,7 @@ class GlobalSubspace final : public IGlobalToGridLocal { template class LocalSubspace final : public IBoundToGridLocal { public: - using grid_local_t = std::array; + using grid_local_t = std::array; /// Assert that the accessors are unique static_assert(sizeof...(Args) == 1 || sizeof...(Args) == 2, @@ -214,15 +214,15 @@ class LocalSubspace final : public IBoundToGridLocal { class BoundCylinderToZPhi final : public IBoundToGridLocal { public: - ActsScalar radius = 1.; - ActsScalar shift = 0.; + double radius = 1.; + double shift = 0.; /// Constructor with arguments /// @param r the radius /// @param z the shift - BoundCylinderToZPhi(ActsScalar r, ActsScalar z) : radius(r), shift(z) {} + BoundCylinderToZPhi(double r, double z) : radius(r), shift(z) {} - std::array toGridLocal(const Vector2& local) const { + std::array toGridLocal(const Vector2& local) const { return {local[1u] + shift, local[0u] / radius}; } @@ -232,25 +232,25 @@ class BoundCylinderToZPhi final : public IBoundToGridLocal { // Definition of bound (on surface) to grid local representation delegate // 1 dimensional local grid using BoundToGridLocal1DimDelegate = - OwningDelegate(const Vector2&), + OwningDelegate(const Vector2&), GridAccess::IBoundToGridLocal>; // Definition of global to grid local representation delegate // 1 dimensional local grid using GlobalToGridLocal1DimDelegate = - OwningDelegate(const Vector3&), + OwningDelegate(const Vector3&), GridAccess::IGlobalToGridLocal>; // Definition of bound (on surface) to grid local representation delegate // 2 dimensional local grid using BoundToGridLocal2DimDelegate = - OwningDelegate(const Vector2&), + OwningDelegate(const Vector2&), GridAccess::IBoundToGridLocal>; // Definition of global to grid local representation delegate // 2 dimensional local grid using GlobalToGridLocal2DimDelegate = - OwningDelegate(const Vector3&), + OwningDelegate(const Vector3&), GridAccess::IGlobalToGridLocal>; } // namespace GridAccess diff --git a/Core/include/Acts/Utilities/GridAxisGenerators.hpp b/Core/include/Acts/Utilities/GridAxisGenerators.hpp index 18e6a1cdd2e..170108d2316 100644 --- a/Core/include/Acts/Utilities/GridAxisGenerators.hpp +++ b/Core/include/Acts/Utilities/GridAxisGenerators.hpp @@ -38,7 +38,7 @@ struct Eq { using grid_type = Acts::Grid>; - std::array range = {}; + std::array range = {}; std::size_t nBins = 0u; /// Call operator that generates the Axis @@ -66,7 +66,7 @@ struct Var { template using grid_type = Acts::Grid>; - std::vector edges = {}; + std::vector edges = {}; /// Call operator that generates the Axis return_type operator()() const { @@ -98,9 +98,9 @@ struct EqEq { Acts::Grid, Acts::Axis>; - std::array range0 = {}; + std::array range0 = {}; std::size_t nBins0 = 0u; - std::array range1 = {}; + std::array range1 = {}; std::size_t nBins1 = 1u; /// Call operator that generates the Axis @@ -151,9 +151,9 @@ struct EqVar { Acts::Grid, Acts::Axis>; - std::array range = {}; + std::array range = {}; std::size_t nBins = 0u; - std::vector edges = {}; + std::vector edges = {}; /// Call operator that generates the Axis return_type operator()() const { @@ -201,8 +201,8 @@ struct VarEq { using grid_type = Acts::Grid, Acts::Axis>; - std::vector edges = {}; - std::array range = {}; + std::vector edges = {}; + std::array range = {}; std::size_t nBins = 0u; /// Call operator that generates the Axis @@ -250,8 +250,8 @@ struct VarVar { using grid_type = Acts::Grid, Acts::Axis>; - std::vector edges0 = {}; - std::vector edges1 = {}; + std::vector edges0 = {}; + std::vector edges1 = {}; /// Call operator that generates the Axis return_type operator()() const { diff --git a/Core/include/Acts/Utilities/Helpers.hpp b/Core/include/Acts/Utilities/Helpers.hpp index c59555fd848..44bf23d9157 100644 --- a/Core/include/Acts/Utilities/Helpers.hpp +++ b/Core/include/Acts/Utilities/Helpers.hpp @@ -175,10 +175,10 @@ T clampValue(U value) { /// /// @return [ range, medium ] in an tuple template -std::tuple range_medium(const T& tseries) { +std::tuple range_medium(const T& tseries) { auto [minIt, maxIt] = std::ranges::minmax_element(tseries); typename T::value_type range = (*maxIt - *minIt); - ActsScalar medium = static_cast((*maxIt + *minIt) * 0.5); + double medium = static_cast((*maxIt + *minIt) * 0.5); return {range, medium}; } diff --git a/Core/include/Acts/Utilities/IAxis.hpp b/Core/include/Acts/Utilities/IAxis.hpp index e279b83ed1a..09c9fbd3a56 100644 --- a/Core/include/Acts/Utilities/IAxis.hpp +++ b/Core/include/Acts/Utilities/IAxis.hpp @@ -41,17 +41,17 @@ class IAxis { /// @brief Return a vector of bin edges /// @return Vector which contains the bin edges - virtual std::vector getBinEdges() const = 0; + virtual std::vector getBinEdges() const = 0; /// @brief get minimum of binning range /// /// @return minimum of binning range - virtual ActsScalar getMin() const = 0; + virtual double getMin() const = 0; /// @brief get maximum of binning range /// /// @return maximum of binning range - virtual ActsScalar getMax() const = 0; + virtual double getMax() const = 0; /// @brief get total number of bins /// diff --git a/Core/include/Acts/Utilities/Intersection.hpp b/Core/include/Acts/Utilities/Intersection.hpp index 11adf0bdece..1f7ee6d28b0 100644 --- a/Core/include/Acts/Utilities/Intersection.hpp +++ b/Core/include/Acts/Utilities/Intersection.hpp @@ -23,7 +23,6 @@ namespace Acts { /// Status enum enum class IntersectionStatus : int { - missed = 0, unreachable = 0, reachable = 1, onSurface = 2 @@ -58,14 +57,14 @@ class Intersection { /// Returns whether the intersection was successful or not constexpr bool isValid() const { - return m_status != IntersectionStatus::missed; + return m_status != IntersectionStatus::unreachable; } /// Returns the position of the interseciton constexpr const Position& position() const { return m_position; } /// Returns the path length to the interseciton - constexpr ActsScalar pathLength() const { return m_pathLength; } + constexpr double pathLength() const { return m_pathLength; } /// Returns the intersection status enum constexpr IntersectionStatus status() const { return m_status; } @@ -114,7 +113,7 @@ class Intersection { /// Position of the intersection Position m_position = Position::Zero(); /// Signed path length to the intersection (if valid) - ActsScalar m_pathLength = std::numeric_limits::infinity(); + double m_pathLength = std::numeric_limits::infinity(); /// The Status of the intersection IntersectionStatus m_status = IntersectionStatus::unreachable; @@ -155,9 +154,7 @@ class ObjectIntersection { } /// Returns the path length to the interseciton - constexpr ActsScalar pathLength() const { - return m_intersection.pathLength(); - } + constexpr double pathLength() const { return m_intersection.pathLength(); } /// Returns the status of the interseciton constexpr IntersectionStatus status() const { diff --git a/Core/include/Acts/Utilities/JacobianHelpers.hpp b/Core/include/Acts/Utilities/JacobianHelpers.hpp index b3b51b510fa..eace94fd096 100644 --- a/Core/include/Acts/Utilities/JacobianHelpers.hpp +++ b/Core/include/Acts/Utilities/JacobianHelpers.hpp @@ -53,7 +53,7 @@ inline ActsMatrix<2, 3> freeToSphericalDirectionJacobian( const Vector3& direction) { auto [cosPhi, sinPhi, cosTheta, sinTheta] = VectorHelpers::evaluateTrigonomics(direction); - ActsScalar invSinTheta = 1. / sinTheta; + double invSinTheta = 1. / sinTheta; // clang-format off ActsMatrix<2, 3> jacobian; diff --git a/Core/include/Acts/Utilities/Ray.hpp b/Core/include/Acts/Utilities/Ray.hpp index 3ec972847ff..6b6ad1940ae 100644 --- a/Core/include/Acts/Utilities/Ray.hpp +++ b/Core/include/Acts/Utilities/Ray.hpp @@ -78,7 +78,7 @@ std::ostream& operator<<(std::ostream& os, const Ray& ray) { return os; } -using Ray3D = Ray; +using Ray3D = Ray; } // namespace Acts diff --git a/Core/include/Acts/Utilities/SpacePointUtility.hpp b/Core/include/Acts/Utilities/SpacePointUtility.hpp index c995bfd3c36..f95ca4521f7 100644 --- a/Core/include/Acts/Utilities/SpacePointUtility.hpp +++ b/Core/include/Acts/Utilities/SpacePointUtility.hpp @@ -75,8 +75,7 @@ class SpacePointUtility { /// @param par local position /// @param cov local covariance /// @return vectors of the global coordinates and covariance of the SourceLink - std::tuple, Vector2, - std::optional> + std::tuple, Vector2, std::optional> globalCoords(const GeometryContext& gctx, const SourceLink& slink, const SourceLinkSurfaceAccessor& surfaceAccessor, const BoundVector& par, const BoundSquareMatrix& cov) const; diff --git a/Core/include/Acts/Utilities/StringHelpers.hpp b/Core/include/Acts/Utilities/StringHelpers.hpp index e77b317eb0d..16c4965e937 100644 --- a/Core/include/Acts/Utilities/StringHelpers.hpp +++ b/Core/include/Acts/Utilities/StringHelpers.hpp @@ -104,10 +104,10 @@ inline std::string toString(const Acts::Transform3& transform, return sout.str(); } -/// Print out a vector of ActsScalar +/// Print out a vector of double /// @param pVector The vector to print /// @param precision Numeric output precision -inline std::string toString(const std::vector& pVector, +inline std::string toString(const std::vector& pVector, int precision = 4) { std::ostringstream sout; sout << std::setiosflags(std::ios::fixed) << std::setprecision(precision); diff --git a/Core/include/Acts/Utilities/TrackHelpers.hpp b/Core/include/Acts/Utilities/TrackHelpers.hpp index 20cc1be8621..2e86a62910d 100644 --- a/Core/include/Acts/Utilities/TrackHelpers.hpp +++ b/Core/include/Acts/Utilities/TrackHelpers.hpp @@ -8,11 +8,15 @@ #pragma once +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" +#include "Acts/Definitions/TrackParametrization.hpp" +#include "Acts/EventData/MeasurementHelpers.hpp" #include "Acts/EventData/MultiTrajectoryHelpers.hpp" #include "Acts/EventData/TrackContainerFrontendConcept.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/TrackProxyConcept.hpp" +#include "Acts/EventData/TrackStateProxyConcept.hpp" #include "Acts/EventData/TrackStateType.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Propagator/StandardAborters.hpp" @@ -493,6 +497,216 @@ void trimTrack(track_proxy_t track, bool trimHoles, bool trimOutliers, trimTrackBack(track, trimHoles, trimOutliers, trimMaterial); } +/// Helper function to calculate the predicted residual and its covariance +/// @tparam nMeasurementDim the dimension of the measurement +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the residual from +/// @return a pair of the residual and its covariance +template +std::pair, ActsSquareMatrix> +calculatePredictedResidual(track_state_proxy_t trackState) { + using MeasurementVector = ActsVector; + using MeasurementMatrix = ActsSquareMatrix; + + if (!trackState.hasPredicted()) { + throw std::invalid_argument("track state has no predicted parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + auto subspaceHelper = + trackState.template fixedBoundSubspaceHelper(); + + auto measurement = trackState.calibrated(); + auto measurementCovariance = trackState.calibratedCovariance(); + MeasurementVector predicted = + subspaceHelper.projectVector(trackState.predicted()); + MeasurementMatrix predictedCovariance = + subspaceHelper.projectMatrix(trackState.predictedCovariance()); + + MeasurementVector residual = measurement - predicted; + MeasurementMatrix residualCovariance = + measurementCovariance + predictedCovariance; + + return std::pair(residual, residualCovariance); +} + +/// Helper function to calculate the filtered residual and its covariance +/// @tparam nMeasurementDim the dimension of the measurement +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the residual from +/// @return a pair of the residual and its covariance +template +std::pair, ActsSquareMatrix> +calculateFilteredResidual(track_state_proxy_t trackState) { + using MeasurementVector = ActsVector; + using MeasurementMatrix = ActsSquareMatrix; + + if (!trackState.hasFiltered()) { + throw std::invalid_argument("track state has no filtered parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + auto subspaceHelper = + trackState.template fixedBoundSubspaceHelper(); + + auto measurement = trackState.calibrated(); + auto measurementCovariance = trackState.calibratedCovariance(); + MeasurementVector filtered = + subspaceHelper.projectVector(trackState.filtered()); + MeasurementMatrix filteredCovariance = + subspaceHelper.projectMatrix(trackState.filteredCovariance()); + + MeasurementVector residual = measurement - filtered; + MeasurementMatrix residualCovariance = + measurementCovariance + filteredCovariance; + + return std::pair(residual, residualCovariance); +} + +/// Helper function to calculate the smoothed residual and its covariance +/// @tparam nMeasurementDim the dimension of the measurement +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the residual from +/// @return a pair of the residual and its covariance +template +std::pair, ActsSquareMatrix> +calculateSmoothedResidual(track_state_proxy_t trackState) { + using MeasurementVector = ActsVector; + using MeasurementMatrix = ActsSquareMatrix; + + if (!trackState.hasSmoothed()) { + throw std::invalid_argument("track state has no smoothed parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + auto subspaceHelper = + trackState.template fixedBoundSubspaceHelper(); + + auto measurement = trackState.calibrated(); + auto measurementCovariance = trackState.calibratedCovariance(); + MeasurementVector smoothed = + subspaceHelper.projectVector(trackState.smoothed()); + MeasurementMatrix smoothedCovariance = + subspaceHelper.projectMatrix(trackState.smoothedCovariance()); + + MeasurementVector residual = measurement - smoothed; + MeasurementMatrix residualCovariance = + measurementCovariance + smoothedCovariance; + + return std::pair(residual, residualCovariance); +} + +/// Helper function to calculate the predicted chi2 +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the chi2 from +/// @return the chi2 +template +double calculatePredictedChi2(track_state_proxy_t trackState) { + if (!trackState.hasPredicted()) { + throw std::invalid_argument("track state has no predicted parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + return visit_measurement( + trackState.calibratedSize(), + [&](std::integral_constant) { + auto [residual, residualCovariance] = + calculatePredictedResidual(trackState); + + return residual.transpose() * residualCovariance.inverse() * residual; + }); +} + +/// Helper function to calculate the filtered chi2 +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the chi2 from +/// @return the chi2 +template +double calculateFilteredChi2(track_state_proxy_t trackState) { + if (!trackState.hasFiltered()) { + throw std::invalid_argument("track state has no filtered parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + return visit_measurement( + trackState.calibratedSize(), + [&](std::integral_constant) { + auto [residual, residualCovariance] = + calculateFilteredResidual(trackState); + + return residual.transpose() * residualCovariance.inverse() * residual; + }); +} + +/// Helper function to calculate the smoothed chi2 +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the chi2 from +/// @return the chi2 +template +double calculateSmoothedChi2(track_state_proxy_t trackState) { + if (!trackState.hasSmoothed()) { + throw std::invalid_argument("track state has no smoothed parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + return visit_measurement( + trackState.calibratedSize(), + [&](std::integral_constant) { + auto [residual, residualCovariance] = + calculateSmoothedResidual(trackState); + + return residual.transpose() * residualCovariance.inverse() * residual; + }); +} + +/// Helper function to calculate the unbiased track parameters and their +/// covariance (i.e. fitted track parameters with this measurement removed) +/// using Eq.(12a)-Eq.(12c) of NIMA 262, 444 (1987) +/// @tparam track_state_proxy_t the track state proxy type +/// @param trackState the track state to calculate the unbiased parameters from +/// @return a pair of the unbiased parameters and their covariance +template +std::pair calculateUnbiasedParametersCovariance( + track_state_proxy_t trackState) { + if (!trackState.hasSmoothed()) { + throw std::invalid_argument("track state has no smoothed parameters"); + } + if (!trackState.hasCalibrated()) { + throw std::invalid_argument("track state has no calibrated parameters"); + } + + return visit_measurement( + trackState.calibratedSize(), + [&](std::integral_constant) { + auto H = trackState.projector() + .template topLeftCorner(); + auto s = trackState.smoothed(); + auto C = trackState.smoothedCovariance(); + auto m = trackState.template calibrated(); + auto V = trackState.template calibratedCovariance(); + auto K = + (C * H.transpose() * (H * C * H.transpose() - V).inverse()).eval(); + BoundVector unbiasedParamsVec = s + K * (m - H * s); + BoundMatrix unbiasedParamsCov = C - K * H * C; + return std::make_pair(unbiasedParamsVec, unbiasedParamsCov); + }); +} + } // namespace Acts namespace std { diff --git a/Core/include/Acts/Utilities/VectorHelpers.hpp b/Core/include/Acts/Utilities/VectorHelpers.hpp index 8f09a6d0591..bec3e874cf9 100644 --- a/Core/include/Acts/Utilities/VectorHelpers.hpp +++ b/Core/include/Acts/Utilities/VectorHelpers.hpp @@ -125,19 +125,19 @@ double eta(const Eigen::MatrixBase& v) noexcept { /// @param direction for this evaluatoin /// /// @return cos(phi), sin(phi), cos(theta), sin(theta), 1/sin(theta) -inline std::array evaluateTrigonomics(const Vector3& direction) { - const ActsScalar x = direction(0); // == cos(phi) * sin(theta) - const ActsScalar y = direction(1); // == sin(phi) * sin(theta) - const ActsScalar z = direction(2); // == cos(theta) +inline std::array evaluateTrigonomics(const Vector3& direction) { + const double x = direction(0); // == cos(phi) * sin(theta) + const double y = direction(1); // == sin(phi) * sin(theta) + const double z = direction(2); // == cos(theta) // can be turned into cosine/sine - const ActsScalar cosTheta = z; - const ActsScalar sinTheta = std::sqrt(1 - z * z); + const double cosTheta = z; + const double sinTheta = std::sqrt(1 - z * z); assert(sinTheta != 0 && "VectorHelpers: Vector is parallel to the z-axis " "which leads to division by zero"); - const ActsScalar invSinTheta = 1. / sinTheta; - const ActsScalar cosPhi = x * invSinTheta; - const ActsScalar sinPhi = y * invSinTheta; + const double invSinTheta = 1. / sinTheta; + const double cosPhi = x * invSinTheta; + const double sinPhi = y * invSinTheta; return {cosPhi, sinPhi, cosTheta, sinTheta}; } diff --git a/Core/include/Acts/Utilities/detail/grid_helper.hpp b/Core/include/Acts/Utilities/detail/grid_helper.hpp index efc0f0a70cf..287a9f69a08 100644 --- a/Core/include/Acts/Utilities/detail/grid_helper.hpp +++ b/Core/include/Acts/Utilities/detail/grid_helper.hpp @@ -162,7 +162,7 @@ template struct grid_helper_impl { template static void getBinCenter( - std::array& center, + std::array& center, const std::array& localIndices, const std::tuple& axes) { center.at(N) = std::get(axes).getBinCenter(localIndices.at(N)); @@ -203,7 +203,7 @@ struct grid_helper_impl { template static void getLowerLeftBinEdge( - std::array& llEdge, + std::array& llEdge, const std::array& localIndices, const std::tuple& axes) { llEdge.at(N) = std::get(axes).getBinLowerBound(localIndices.at(N)); @@ -235,7 +235,7 @@ struct grid_helper_impl { template static void getUpperRightBinEdge( - std::array& urEdge, + std::array& urEdge, const std::array& localIndices, const std::tuple& axes) { urEdge.at(N) = std::get(axes).getBinUpperBound(localIndices.at(N)); @@ -252,21 +252,21 @@ struct grid_helper_impl { template static void getMin(const std::tuple& axes, - std::array& minArray) { + std::array& minArray) { minArray[N] = std::get(axes).getMin(); grid_helper_impl::getMin(axes, minArray); } template static void getMax(const std::tuple& axes, - std::array& maxArray) { + std::array& maxArray) { maxArray[N] = std::get(axes).getMax(); grid_helper_impl::getMax(axes, maxArray); } template static void getWidth(const std::tuple& axes, - std::array& widthArray) { + std::array& widthArray) { widthArray[N] = std::get(axes).getBinWidth(); grid_helper_impl::getWidth(axes, widthArray); } @@ -328,7 +328,7 @@ template <> struct grid_helper_impl<0u> { template static void getBinCenter( - std::array& center, + std::array& center, const std::array& localIndices, const std::tuple& axes) { center.at(0u) = std::get<0u>(axes).getBinCenter(localIndices.at(0u)); @@ -361,7 +361,7 @@ struct grid_helper_impl<0u> { template static void getLowerLeftBinEdge( - std::array& llEdge, + std::array& llEdge, const std::array& localIndices, const std::tuple& axes) { llEdge.at(0u) = std::get<0u>(axes).getBinLowerBound(localIndices.at(0u)); @@ -389,7 +389,7 @@ struct grid_helper_impl<0u> { template static void getUpperRightBinEdge( - std::array& urEdge, + std::array& urEdge, const std::array& localIndices, const std::tuple& axes) { urEdge.at(0u) = std::get<0u>(axes).getBinUpperBound(localIndices.at(0u)); @@ -404,19 +404,19 @@ struct grid_helper_impl<0u> { template static void getMin(const std::tuple& axes, - std::array& minArray) { + std::array& minArray) { minArray[0u] = std::get<0u>(axes).getMin(); } template static void getMax(const std::tuple& axes, - std::array& maxArray) { + std::array& maxArray) { maxArray[0u] = std::get<0u>(axes).getMax(); } template static void getWidth(const std::tuple& axes, - std::array& widthArray) { + std::array& widthArray) { widthArray[0u] = std::get<0u>(axes).getBinWidth(); } @@ -518,10 +518,10 @@ struct grid_helper { /// @pre @c localIndices must only contain valid bin indices (i.e. excluding /// under-/overflow bins). template - static std::array getBinCenter( + static std::array getBinCenter( const std::array& localIndices, const std::tuple& axes) { - std::array center{}; + std::array center{}; constexpr std::size_t MAX = sizeof...(Axes) - 1; grid_helper_impl::getBinCenter(center, localIndices, axes); @@ -608,10 +608,10 @@ struct grid_helper { /// @pre @c localIndices must only contain valid bin indices (excluding /// underflow bins). template - static std::array getLowerLeftBinEdge( + static std::array getLowerLeftBinEdge( const std::array& localIndices, const std::tuple& axes) { - std::array llEdge{}; + std::array llEdge{}; constexpr std::size_t MAX = sizeof...(Axes) - 1; grid_helper_impl::getLowerLeftBinEdge(llEdge, localIndices, axes); @@ -682,10 +682,10 @@ struct grid_helper { /// @pre @c localIndices must only contain valid bin indices (excluding /// overflow bins). template - static std::array getUpperRightBinEdge( + static std::array getUpperRightBinEdge( const std::array& localIndices, const std::tuple& axes) { - std::array urEdge{}; + std::array urEdge{}; constexpr std::size_t MAX = sizeof...(Axes) - 1; grid_helper_impl::getUpperRightBinEdge(urEdge, localIndices, axes); @@ -722,9 +722,9 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return array returning the minima of all given axes template - static std::array getMin( + static std::array getMin( const std::tuple& axes) { - std::array minArray{}; + std::array minArray{}; grid_helper_impl::getMin(axes, minArray); return minArray; } @@ -735,9 +735,9 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return array returning the maxima of all given axes template - static std::array getMax( + static std::array getMax( const std::tuple& axes) { - std::array maxArray{}; + std::array maxArray{}; grid_helper_impl::getMax(axes, maxArray); return maxArray; } @@ -748,9 +748,9 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return array returning the maxima of all given axes template - static std::array getWidth( + static std::array getWidth( const std::tuple& axes) { - std::array widthArray{}; + std::array widthArray{}; grid_helper_impl::getWidth(axes, widthArray); return widthArray; } diff --git a/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp b/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp index fa1eef6d50a..0257d8ec730 100644 --- a/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp +++ b/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp @@ -53,7 +53,7 @@ class HelicalTrackLinearizer { /// Tolerance determining how close we need to get to the Perigee surface to /// reach it during propagation - ActsScalar targetTolerance = 1e-12; + double targetTolerance = 1e-12; }; /// @brief Constructor diff --git a/Core/include/Acts/Vertexing/NumericalTrackLinearizer.hpp b/Core/include/Acts/Vertexing/NumericalTrackLinearizer.hpp index 00d5cddf989..e9beca46f36 100644 --- a/Core/include/Acts/Vertexing/NumericalTrackLinearizer.hpp +++ b/Core/include/Acts/Vertexing/NumericalTrackLinearizer.hpp @@ -79,11 +79,11 @@ class NumericalTrackLinearizer { /// Tolerance determining how close we need to get to a surface to /// reach it during propagation - ActsScalar targetTolerance = 1e-12; + double targetTolerance = 1e-12; /// Setting size of the perturbation delta for calculation of numerical /// derivatives (i.e., f'(x) ~ (f(x+delta) - f(x)) / delta) - ActsScalar delta = 1e-8; + double delta = 1e-8; }; /// @brief Constructor diff --git a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.hpp b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.hpp index cc5bdf20289..cd05eb4eb0a 100644 --- a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.hpp @@ -39,47 +39,47 @@ class SingleSeedVertexFinder { struct Config { /// maximum deviation in phi between the near and middle spacepoints or /// middle and far spacepoints - Acts::ActsScalar maxPhideviation = 0.08; + double maxPhideviation = 0.08; /// maximum deviation in X-Y between the first 2 spacepoints and the last 2 /// spacepoints - Acts::ActsScalar maxXYdeviation = 0.08; + double maxXYdeviation = 0.08; /// maximum deviation in 3D between the first 2 spacepoints and the last 2 /// spacepoints - Acts::ActsScalar maxXYZdeviation = 0.08; + double maxXYZdeviation = 0.08; /// minimum angle between Z axis and a triplet, effectively removing /// triplets with large |eta| - Acts::ActsScalar minTheta = 1.; + double minTheta = 1.; /// thresholds for near, middle, and far spacepoints - Acts::ActsScalar rMinNear = 20.f * Acts::UnitConstants::mm; - Acts::ActsScalar rMaxNear = 60.f * Acts::UnitConstants::mm; - Acts::ActsScalar rMinMiddle = 150.f * Acts::UnitConstants::mm; - Acts::ActsScalar rMaxMiddle = 190.f * Acts::UnitConstants::mm; - Acts::ActsScalar rMinFar = 280.f * Acts::UnitConstants::mm; - Acts::ActsScalar rMaxFar = 320.f * Acts::UnitConstants::mm; + double rMinNear = 20.f * Acts::UnitConstants::mm; + double rMaxNear = 60.f * Acts::UnitConstants::mm; + double rMinMiddle = 150.f * Acts::UnitConstants::mm; + double rMaxMiddle = 190.f * Acts::UnitConstants::mm; + double rMinFar = 280.f * Acts::UnitConstants::mm; + double rMaxFar = 320.f * Acts::UnitConstants::mm; /// number of phi slices, at least 3 to avoid duplicities /// it should be less than 2*pi/maxPhideviation in order not to loop over /// triplets that will be rejected by maxPhideviation anyway std::uint32_t numPhiSlices = 60; /// use only a fraction of available phi slices to speed up calculations; - Acts::ActsScalar useFracPhiSlices = 0.5; + double useFracPhiSlices = 0.5; /// number of z slices std::uint32_t numZSlices = 150; /// use only a fraction of available z slices to speed up calculations; - Acts::ActsScalar useFracZSlices = 0.5; + double useFracZSlices = 0.5; /// maximum |z| to consider, z slices will be done within the range /// (-maxAbsZ,maxAbsZ) /// values of maxAbsZ, maxZPosition, rMaxFar, and minTheta should be /// set reasonably with respect to each other - Acts::ActsScalar maxAbsZ = 450. * Acts::UnitConstants::mm; + double maxAbsZ = 450. * Acts::UnitConstants::mm; /// maximum Z position of the vertex at the point closest to the Z axis - Acts::ActsScalar maxZPosition = 200.f * Acts::UnitConstants::mm; + double maxZPosition = 200.f * Acts::UnitConstants::mm; /// maximum R position of the vertex at the point closest to the Z axis - Acts::ActsScalar maxRPosition = 10.f * Acts::UnitConstants::mm; + double maxRPosition = 10.f * Acts::UnitConstants::mm; /// chi^2 minimalization will happen with respect to "planes" or "rays" std::string minimalizeWRT = "planes"; @@ -88,9 +88,9 @@ class SingleSeedVertexFinder { /// chi^2 std::uint32_t maxIterations = 20; /// each iteration, discard this fraction of triplets with the largest chi^2 - Acts::ActsScalar removeFraction = 0.10; + double removeFraction = 0.10; /// if the vertex estimation moves less than this, stop iterations - Acts::ActsScalar minVtxShift = 0.3f * Acts::UnitConstants::mm; + double minVtxShift = 0.3f * Acts::UnitConstants::mm; }; /// Const access to the config @@ -126,11 +126,11 @@ class SingleSeedVertexFinder { /// @brief Struct to store sorted spacepoints for each layer (near, middle, and far), for each slice of phi, and for each slice of z struct SortedSpacepoints { SortedSpacepoints(const int phiSize, const int zSize) { - std::vector> helper = {}; - std::vector>> - helperZ(zSize, helper); - std::vector>>> + std::vector> helper = {}; + std::vector>> helperZ( + zSize, helper); + std::vector< + std::vector>>> helperPhi(phiSize, helperZ); sortedSP.fill(helperPhi); } @@ -140,8 +140,9 @@ class SingleSeedVertexFinder { /// @param phi Index of the phi slice /// @param z Index of the z slice /// @return Non-const vector of spacepoints - inline std::vector>& addSP( - int layer, int phi, int z) { + inline std::vector>& addSP(int layer, + int phi, + int z) { return sortedSP[layer][phi][z]; } @@ -150,13 +151,13 @@ class SingleSeedVertexFinder { /// @param phi Index of the phi slice /// @param z Index of the z slice /// @return Const vector of spacepoints - inline const std::vector>& - getSP(int layer, int phi, int z) const { + inline const std::vector>& getSP( + int layer, int phi, int z) const { return sortedSP[layer][phi][z]; } - std::array>>>, + std::array>>>, 3> sortedSP; }; @@ -187,7 +188,7 @@ class SingleSeedVertexFinder { /// @brief Calculates equation of the plane (alpha*x + beta*y + gamma*z + delta = 0), given the three points /// @param triplet A single triplet (with 3 spacepoints) /// @return A pair of {{alpha,beta,gamma},delta} - static std::pair makePlaneFromTriplet( + static std::pair makePlaneFromTriplet( const Triplet& triplet); /// @brief Find a point (=the vertex) that has minimum chi^2 with respect to all planes defined by the triplets diff --git a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp index 83b13d37d57..6dd6a588898 100644 --- a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp @@ -85,7 +85,7 @@ Acts::SingleSeedVertexFinder::sortSpacepoints( for (const auto& sp : spacepoints) { // phi will be saved for later - Acts::ActsScalar phi = detail::radian_pos(std::atan2(sp.y(), sp.x())); + double phi = detail::radian_pos(std::atan2(sp.y(), sp.x())); std::uint32_t phislice = static_cast( phi / (2 * std::numbers::pi) * m_cfg.numPhiSlices); if (phislice >= m_cfg.numPhiSlices) { @@ -144,12 +144,12 @@ Acts::SingleSeedVertexFinder::findTriplets( Acts::Vector2 vecB = {vecA[1], -vecA[0]}; vecB /= std::tan(m_cfg.maxXYZdeviation); Acts::Vector2 posR = Acts::Vector2(-m_cfg.maxZPosition, 0.) + vecA + vecB; - Acts::ActsScalar R = vecA.norm() / std::sin(m_cfg.maxXYZdeviation); - Acts::ActsScalar constB = -2. * posR[0]; - Acts::ActsScalar constC = - posR[0] * posR[0] + - (posR[1] - m_cfg.rMaxNear) * (posR[1] - m_cfg.rMaxNear) - R * R; - Acts::ActsScalar maxZMiddle = + double R = vecA.norm() / std::sin(m_cfg.maxXYZdeviation); + double constB = -2. * posR[0]; + double constC = posR[0] * posR[0] + + (posR[1] - m_cfg.rMaxNear) * (posR[1] - m_cfg.rMaxNear) - + R * R; + double maxZMiddle = -1. * (-constB - sqrt(constB * constB - 4. * constC)) / 2.; if (maxZMiddle <= 0) { ACTS_WARNING( @@ -160,14 +160,14 @@ Acts::SingleSeedVertexFinder::findTriplets( } // save some constant values for later - Acts::ActsScalar rNearRatio[2] = {m_cfg.rMinNear / m_cfg.rMaxMiddle, - m_cfg.rMaxNear / m_cfg.rMinMiddle}; - Acts::ActsScalar rMiddle[2] = {m_cfg.rMaxMiddle, m_cfg.rMinMiddle}; - Acts::ActsScalar rFarDelta[2] = { + double rNearRatio[2] = {m_cfg.rMinNear / m_cfg.rMaxMiddle, + m_cfg.rMaxNear / m_cfg.rMinMiddle}; + double rMiddle[2] = {m_cfg.rMaxMiddle, m_cfg.rMinMiddle}; + double rFarDelta[2] = { m_cfg.rMaxFar - m_cfg.rMinMiddle, m_cfg.rMinFar - m_cfg.rMaxMiddle, }; - Acts::ActsScalar zBinLength = 2. * m_cfg.maxAbsZ / m_cfg.numZSlices; + double zBinLength = 2. * m_cfg.maxAbsZ / m_cfg.numZSlices; // limits in terms of slice numbers std::uint32_t limitMiddleSliceFrom = @@ -190,25 +190,24 @@ Acts::SingleSeedVertexFinder::findTriplets( // calculate limits for near spacepoints, assuming the middle spacepoints // are within some boundaries bool isLessFrom = (middleZ <= limitAbsZSliceFrom); - Acts::ActsScalar deltaZfrom = - (middleZ - limitAbsZSliceFrom - 1) * zBinLength; - Acts::ActsScalar angleZfrom = + double deltaZfrom = (middleZ - limitAbsZSliceFrom - 1) * zBinLength; + double angleZfrom = std::atan2(rMiddle[isLessFrom], deltaZfrom) + m_cfg.maxXYZdeviation; std::uint32_t nearZFrom = 0; - if (angleZfrom < std::numbers::pi_v) { - Acts::ActsScalar new_deltaZfrom = + if (angleZfrom < std::numbers::pi) { + double new_deltaZfrom = rMiddle[isLessFrom] / std::tan(angleZfrom) / zBinLength; nearZFrom = static_cast(std::max( new_deltaZfrom * rNearRatio[isLessFrom] + limitAbsZSliceFrom, 0.)); } bool isLessTo = (middleZ < limitAbsZSliceTo); - Acts::ActsScalar deltaZto = (middleZ - limitAbsZSliceTo + 1) * zBinLength; - Acts::ActsScalar angleZto = + double deltaZto = (middleZ - limitAbsZSliceTo + 1) * zBinLength; + double angleZto = std::atan2(rMiddle[!isLessTo], deltaZto) - m_cfg.maxXYZdeviation; std::uint32_t nearZTo = m_cfg.numZSlices; if (angleZto > 0) { - Acts::ActsScalar new_deltaZto = + double new_deltaZto = rMiddle[!isLessTo] / std::tan(angleZto) / zBinLength; nearZTo = static_cast(std::max( new_deltaZto * rNearRatio[!isLessTo] + limitAbsZSliceTo, 0.)); @@ -222,12 +221,11 @@ Acts::SingleSeedVertexFinder::findTriplets( // spacepoints are within some boundaries bool isMiddleLess = (middleZ <= nearZ); - Acts::ActsScalar delta2Zfrom = (middleZ - nearZ - 1) * zBinLength; - Acts::ActsScalar angle2Zfrom = - std::atan2(rFarDelta[isMiddleLess], delta2Zfrom) + - m_cfg.maxXYZdeviation; + double delta2Zfrom = (middleZ - nearZ - 1) * zBinLength; + double angle2Zfrom = std::atan2(rFarDelta[isMiddleLess], delta2Zfrom) + + m_cfg.maxXYZdeviation; std::uint32_t farZFrom = 0; - if (angle2Zfrom < std::numbers::pi_v) { + if (angle2Zfrom < std::numbers::pi) { farZFrom = static_cast(std::max( (rFarDelta[isMiddleLess] / std::tan(angle2Zfrom) / zBinLength) + middleZ, @@ -238,10 +236,9 @@ Acts::SingleSeedVertexFinder::findTriplets( } isMiddleLess = (middleZ < nearZ); - Acts::ActsScalar delta2Zto = (middleZ - nearZ + 1) * zBinLength; - Acts::ActsScalar angle2Zto = - std::atan2(rFarDelta[!isMiddleLess], delta2Zto) - - m_cfg.maxXYZdeviation; + double delta2Zto = (middleZ - nearZ + 1) * zBinLength; + double angle2Zto = std::atan2(rFarDelta[!isMiddleLess], delta2Zto) - + m_cfg.maxXYZdeviation; std::uint32_t farZTo = m_cfg.numZSlices; if (angle2Zto > 0) { farZTo = static_cast(std::max( @@ -282,13 +279,13 @@ Acts::SingleSeedVertexFinder::findTriplets( // for all near spacepoints in this slice for (const auto& nearSP : sortedSpacepoints.getSP(0, nearPhi, nearZ)) { - Acts::ActsScalar phiA = nearSP.second; + double phiA = nearSP.second; // for all middle spacepoints in this slice for (const auto& middleSP : sortedSpacepoints.getSP(1, middlePhi, middleZ)) { - Acts::ActsScalar phiB = middleSP.second; - Acts::ActsScalar deltaPhiAB = detail::difference_periodic( + double phiB = middleSP.second; + double deltaPhiAB = detail::difference_periodic( phiA, phiB, 2 * std::numbers::pi); if (std::abs(deltaPhiAB) > m_cfg.maxPhideviation) { continue; @@ -297,10 +294,9 @@ Acts::SingleSeedVertexFinder::findTriplets( // for all far spacepoints in this slice for (const auto& farSP : sortedSpacepoints.getSP(2, farPhi, farZ)) { - Acts::ActsScalar phiC = farSP.second; - Acts::ActsScalar deltaPhiBC = detail::difference_periodic( - phiB, phiC, - static_cast(2 * std::numbers::pi)); + double phiC = farSP.second; + double deltaPhiBC = detail::difference_periodic( + phiB, phiC, 2 * std::numbers::pi); if (std::abs(deltaPhiBC) > m_cfg.maxPhideviation) { continue; } @@ -328,14 +324,14 @@ template bool Acts::SingleSeedVertexFinder::tripletValidationAndUpdate( Acts::SingleSeedVertexFinder::Triplet& triplet) const { // slope for near+middle spacepoints - Acts::ActsScalar alpha1 = + double alpha1 = std::atan2(triplet.a.y() - triplet.b.y(), triplet.a.x() - triplet.b.x()); // slope for middle+far spacepoints - Acts::ActsScalar alpha2 = + double alpha2 = std::atan2(triplet.b.y() - triplet.c.y(), triplet.b.x() - triplet.c.x()); // these two slopes shouldn't be too different - Acts::ActsScalar deltaAlpha = detail::difference_periodic( - alpha1, alpha2, static_cast(2 * std::numbers::pi)); + double deltaAlpha = + detail::difference_periodic(alpha1, alpha2, 2 * std::numbers::pi); if (std::abs(deltaAlpha) > m_cfg.maxXYdeviation) { return false; } @@ -347,8 +343,8 @@ bool Acts::SingleSeedVertexFinder::tripletValidationAndUpdate( Acts::Vector3 bc{triplet.b.x() - triplet.c.x(), triplet.b.y() - triplet.c.y(), triplet.b.z() - triplet.c.z()}; // dot product of these two - Acts::ActsScalar cosTheta = (ab.dot(bc)) / (ab.norm() * bc.norm()); - Acts::ActsScalar theta = std::acos(cosTheta); + double cosTheta = (ab.dot(bc)) / (ab.norm() * bc.norm()); + double theta = std::acos(cosTheta); if (theta > m_cfg.maxXYZdeviation) { return false; } @@ -359,21 +355,21 @@ bool Acts::SingleSeedVertexFinder::tripletValidationAndUpdate( const Acts::Vector3& direction = ray.dir(); // norm to z-axis and to the ray Acts::Vector3 norm{-1. * direction[1], 1. * direction[0], 0}; - Acts::ActsScalar norm_size = norm.norm(); + double norm_size = norm.norm(); - Acts::ActsScalar tanTheta = norm_size / direction[2]; + double tanTheta = norm_size / direction[2]; if (std::abs(tanTheta) < std::tan(m_cfg.minTheta)) { return false; } // nearest distance from the ray to z-axis - Acts::ActsScalar dist = std::abs(startPoint.dot(norm)) / norm_size; + double dist = std::abs(startPoint.dot(norm)) / norm_size; if (dist > m_cfg.maxRPosition) { return false; } // z coordinate of the nearest distance from the ray to z-axis - Acts::ActsScalar zDist = + double zDist = direction.cross(norm).dot(startPoint) / (norm_size * norm_size); if (std::abs(zDist) > m_cfg.maxZPosition) { return false; @@ -388,7 +384,7 @@ bool Acts::SingleSeedVertexFinder::tripletValidationAndUpdate( } template -std::pair +std::pair Acts::SingleSeedVertexFinder::makePlaneFromTriplet( const Acts::SingleSeedVertexFinder::Triplet& triplet) { Acts::Vector3 a{triplet.a.x(), triplet.a.y(), triplet.a.z()}; @@ -399,7 +395,7 @@ Acts::SingleSeedVertexFinder::makePlaneFromTriplet( // vector (alpha,beta,gamma) normalized to unity for convenience Acts::Vector3 abg = ba.cross(ca).normalized(); - Acts::ActsScalar delta = -1. * abg.dot(a); + double delta = -1. * abg.dot(a); // plane (alpha*x + beta*y + gamma*z + delta = 0), split to {{alpha, beta, // gamma}, delta} for convenience @@ -423,8 +419,7 @@ Acts::SingleSeedVertexFinder::findClosestPointFromPlanes( Acts::Vector3 vtxPrev{m_cfg.rMaxFar, m_cfg.rMaxFar, m_cfg.maxAbsZ}; // (alpha-beta-gamma, delta), distance - std::vector< - std::pair, Acts::ActsScalar>> + std::vector, double>> tripletsWithPlanes; tripletsWithPlanes.reserve(triplets.size()); @@ -462,7 +457,7 @@ Acts::SingleSeedVertexFinder::findClosestPointFromPlanes( for (auto& triplet : tripletsWithPlanes) { const auto& abg = triplet.first.first; const auto& delta = triplet.first.second; - Acts::ActsScalar distance = std::abs(abg.dot(vtx) + delta); + double distance = std::abs(abg.dot(vtx) + delta); triplet.second = distance; } @@ -527,8 +522,7 @@ Acts::SingleSeedVertexFinder::findClosestPointFromRays( Acts::Vector3 vtxPrev{m_cfg.rMaxFar, m_cfg.rMaxFar, m_cfg.maxAbsZ}; // (startPoint, direction), distance - std::vector< - std::pair, Acts::ActsScalar>> + std::vector, double>> tripletsWithRays; tripletsWithRays.reserve(triplets.size()); @@ -568,7 +562,7 @@ Acts::SingleSeedVertexFinder::findClosestPointFromRays( for (auto& triplet : tripletsWithRays) { const auto& startPoint = triplet.first.first; const auto& direction = triplet.first.second; - Acts::ActsScalar distance = (vtx - startPoint).cross(direction).norm(); + double distance = (vtx - startPoint).cross(direction).norm(); triplet.second = distance; } diff --git a/Core/include/Acts/Vertexing/Vertex.hpp b/Core/include/Acts/Vertexing/Vertex.hpp index d656c7a199f..453fe34a9e0 100644 --- a/Core/include/Acts/Vertexing/Vertex.hpp +++ b/Core/include/Acts/Vertexing/Vertex.hpp @@ -50,7 +50,7 @@ class Vertex { Vector3 position() const; /// @return Returns time - ActsScalar time() const; + double time() const; /// @return Returns 4-position const Vector4& fullPosition() const; @@ -86,7 +86,7 @@ class Vertex { /// @brief Sets time /// /// @param time The time - void setTime(ActsScalar time); + void setTime(double time); /// @brief Sets 3x3 covariance /// diff --git a/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp b/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp index 0493750b9a3..ae1bee83e5d 100644 --- a/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp +++ b/Core/src/Detector/IndexedRootVolumeFinderBuilder.cpp @@ -21,15 +21,15 @@ void fillGridIndices2D( const Acts::GeometryContext& gctx, Grid2D& grid, const std::vector>& rootVolumes, - const std::array, 2u>& boundaries, + const std::array, 2u>& boundaries, const std::array& casts) { // Brute force loop over all bins & all volumes for (const auto [ic0, c0] : Acts::enumerate(boundaries[0u])) { if (ic0 > 0) { - Acts::ActsScalar v0 = 0.5 * (c0 + boundaries[0u][ic0 - 1]); + double v0 = 0.5 * (c0 + boundaries[0u][ic0 - 1]); for (const auto [ic1, c1] : Acts::enumerate(boundaries[1u])) { if (ic1 > 0) { - Acts::ActsScalar v1 = 0.5 * (c1 + boundaries[1u][ic1 - 1]); + double v1 = 0.5 * (c1 + boundaries[1u][ic1 - 1]); if (casts == std::array{Acts::BinningValue::binZ, Acts::BinningValue::binR}) { @@ -74,8 +74,7 @@ Acts::Experimental::IndexedRootVolumeFinderBuilder::construct( auto casts = std::array{m_casts[0u], m_casts[1u]}; - auto boundaries = - std::array, 2u>{rzphis[1], rzphis[0]}; + auto boundaries = std::array, 2u>{rzphis[1], rzphis[0]}; fillGridIndices2D(gctx, grid, rootVolumes, boundaries, casts); using IndexedDetectorVolumesImpl = diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index 94766a80d0d..76092582eea 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -48,8 +48,8 @@ void adaptBinningRange(std::vector& pBinning, const Acts::Extent& extent) { for (auto& pb : pBinning) { // Starting values - Acts::ActsScalar vmin = pb.edges.front(); - Acts::ActsScalar vmax = pb.edges.back(); + double vmin = pb.edges.front(); + double vmax = pb.edges.back(); // Get the number of bins std::size_t nBins = pb.bins(); // Check if extent overwrites that @@ -61,7 +61,7 @@ void adaptBinningRange(std::vector& pBinning, } // Possibly update the edges if (pb.axisType == Acts::AxisType::Equidistant) { - Acts::ActsScalar binWidth = (vmax - vmin) / nBins; + double binWidth = (vmax - vmin) / nBins; // Fill the edges pb.edges = {vmin}; pb.edges.resize(nBins + 1); diff --git a/Core/src/Detector/ProtoDetector.cpp b/Core/src/Detector/ProtoDetector.cpp index e305dc9052c..a1ec0009c57 100644 --- a/Core/src/Detector/ProtoDetector.cpp +++ b/Core/src/Detector/ProtoDetector.cpp @@ -99,13 +99,13 @@ void Acts::ProtoVolume::harmonize(bool legacy) { borders.push_back(static_cast(fVolume.extent.min(binValue))); for (unsigned int iv = 1; iv < cts.constituentVolumes.size(); ++iv) { auto& lv = cts.constituentVolumes[iv - 1u]; - ActsScalar zero = lv.extent.min(binValue); - ActsScalar low = lv.extent.max(binValue); + double zero = lv.extent.min(binValue); + double low = lv.extent.max(binValue); auto& hv = cts.constituentVolumes[iv]; - ActsScalar high = hv.extent.min(binValue); - ActsScalar mid = 0.5 * (low + high); - ActsScalar max = hv.extent.max(binValue); + double high = hv.extent.min(binValue); + double mid = 0.5 * (low + high); + double max = hv.extent.max(binValue); lv.extent.set(binValue, zero, mid); hv.extent.set(binValue, mid, max); borders.push_back(mid); @@ -118,7 +118,7 @@ void Acts::ProtoVolume::harmonize(bool legacy) { std::vector boundaries = {}; // New container vector std::vector updatedConstituents; - ActsScalar containerMin = extent.min(binValue); + double containerMin = extent.min(binValue); if (fVolume.extent.min(binValue) > containerMin) { ProtoVolume gap; gap.name = name + "-gap-" + std::to_string(gaps++); @@ -133,9 +133,9 @@ void Acts::ProtoVolume::harmonize(bool legacy) { updatedConstituents.push_back(lv); borders.push_back(static_cast(lv.extent.min(binValue))); // check if a gap to the next is needed - ActsScalar low = lv.extent.max(binValue); + double low = lv.extent.max(binValue); auto& hv = cts.constituentVolumes[iv]; - ActsScalar high = hv.extent.min(binValue); + double high = hv.extent.min(binValue); if (high > low) { ProtoVolume gap; gap.name = name + "-gap-" + std::to_string(gaps++); @@ -144,11 +144,11 @@ void Acts::ProtoVolume::harmonize(bool legacy) { borders.push_back(static_cast(low)); } } - ActsScalar constituentsMax = lVolume.extent.max(binValue); + double constituentsMax = lVolume.extent.max(binValue); updatedConstituents.push_back(lVolume); borders.push_back(static_cast(constituentsMax)); // Check the container min/max setting - ActsScalar containerMax = extent.max(binValue); + double containerMax = extent.max(binValue); if (constituentsMax < containerMax) { ProtoVolume gap; gap.name = name + "-gap-" + std::to_string(gaps++); diff --git a/Core/src/Detector/VolumeStructureBuilder.cpp b/Core/src/Detector/VolumeStructureBuilder.cpp index e63a13d5039..9103164ad58 100644 --- a/Core/src/Detector/VolumeStructureBuilder.cpp +++ b/Core/src/Detector/VolumeStructureBuilder.cpp @@ -50,7 +50,7 @@ Acts::Experimental::VolumeStructureBuilder::construct( // The transform from the extent auto eTransform = Transform3::Identity(); - std::vector boundValues = m_cfg.boundValues; + std::vector boundValues = m_cfg.boundValues; // This code dispatches into the dedicated volume types switch (m_cfg.boundsType) { @@ -64,8 +64,8 @@ Acts::Experimental::VolumeStructureBuilder::construct( "object. It needs at least 5 parameters, while " + std::to_string(boundValues.size()) + " where given"); } - auto bArray = toArray( - boundValues); + auto bArray = + toArray(boundValues); volumeBounds = std::make_unique(bArray); } break; case VolumeBounds::BoundsType::eCuboid: { @@ -144,7 +144,7 @@ Acts::Experimental::VolumeStructureBuilder::construct( } // Check if phi has been constraint, otherwise fill it with full coverage if (boundValues.size() == 3u) { - boundValues.push_back(std::numbers::pi_v); + boundValues.push_back(std::numbers::pi); boundValues.push_back(0.); } ACTS_VERBOSE(" - cylindrical shape with [iR, oR, hZ, sPhi, mPhi] = " diff --git a/Core/src/Detector/detail/BlueprintHelper.cpp b/Core/src/Detector/detail/BlueprintHelper.cpp index bf440c61acc..b0167188021 100644 --- a/Core/src/Detector/detail/BlueprintHelper.cpp +++ b/Core/src/Detector/detail/BlueprintHelper.cpp @@ -122,7 +122,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( unsigned int igap = 0; for (auto& child : node.children) { auto [neg, pos] = endPointsXYZ(*child, bVal); - ActsScalar gapSpan = (neg - negC).norm(); + double gapSpan = (neg - negC).norm(); if (gapSpan > s_onSurfaceTolerance) { // Fill a gap node auto gapName = node.name + "_gap_" + std::to_string(igap); @@ -131,7 +131,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( gapTransform.pretranslate(0.5 * (neg + negC)); auto gap = std::make_unique( gapName, gapTransform, VolumeBounds::eCylinder, - std::vector{cInnerR, cOuterR, 0.5 * gapSpan}); + std::vector{cInnerR, cOuterR, 0.5 * gapSpan}); gaps.push_back(std::move(gap)); ++igap; } @@ -139,7 +139,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( negC = pos; } // Check if a last one needs to be filled - ActsScalar gapSpan = (negC - posC).norm(); + double gapSpan = (negC - posC).norm(); if (gapSpan > s_onSurfaceTolerance) { // Fill a gap node auto gapName = node.name + "_gap_" + std::to_string(igap); @@ -148,7 +148,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( gapTransform.pretranslate(0.5 * (negC + posC)); auto gap = std::make_unique( gapName, gapTransform, VolumeBounds::eCylinder, - std::vector{cInnerR, cOuterR, 0.5 * gapSpan}); + std::vector{cInnerR, cOuterR, 0.5 * gapSpan}); gaps.push_back(std::move(gap)); } @@ -163,14 +163,13 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( } // Fill the gaps in R unsigned int igap = 0; - ActsScalar lastR = cInnerR; + double lastR = cInnerR; for (auto& child : node.children) { - ActsScalar iR = child->boundaryValues[0]; + double iR = child->boundaryValues[0]; if (std::abs(iR - lastR) > s_onSurfaceTolerance) { auto gap = std::make_unique( node.name + "_gap_" + std::to_string(igap), node.transform, - VolumeBounds::eCylinder, - std::vector{lastR, iR, cHalfZ}); + VolumeBounds::eCylinder, std::vector{lastR, iR, cHalfZ}); gaps.push_back(std::move(gap)); ++igap; } @@ -181,8 +180,7 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCylindrical( if (std::abs(lastR - cOuterR) > s_onSurfaceTolerance) { auto gap = std::make_unique( node.name + "_gap_" + std::to_string(igap), node.transform, - VolumeBounds::eCylinder, - std::vector{lastR, cOuterR, cHalfZ}); + VolumeBounds::eCylinder, std::vector{lastR, cOuterR, cHalfZ}); gaps.push_back(std::move(gap)); } } else { @@ -237,14 +235,14 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( unsigned int igap = 0; for (auto& child : node.children) { auto [neg, pos] = endPointsXYZ(*child, binVal); - ActsScalar gapSpan = (neg - negC).norm(); + double gapSpan = (neg - negC).norm(); if (gapSpan > s_onSurfaceTolerance) { // Fill a gap node auto gapName = node.name + "_gap_" + std::to_string(igap); auto gapTransform = Transform3::Identity(); gapTransform.rotate(node.transform.rotation()); gapTransform.pretranslate(0.5 * (neg + negC)); - std::vector gapBounds{0, 0, 0}; + std::vector gapBounds{0, 0, 0}; gapBounds[toUnderlying(binVal)] = 0.5 * gapSpan; for (auto bv : allowedBinVals) { if (bv != binVal) { @@ -260,14 +258,14 @@ void Acts::Experimental::detail::BlueprintHelper::fillGapsCuboidal( negC = pos; } // Check if a last one needs to be filled - ActsScalar gapSpan = (negC - posC).norm(); + double gapSpan = (negC - posC).norm(); if (gapSpan > s_onSurfaceTolerance) { // Fill a gap node auto gapName = node.name + "_gap_" + std::to_string(igap); auto gapTransform = Transform3::Identity(); gapTransform.rotate(node.transform.rotation()); gapTransform.pretranslate(0.5 * (negC + posC)); - std::vector gapBounds{0, 0, 0}; + std::vector gapBounds{0, 0, 0}; gapBounds[toUnderlying(binVal)] = 0.5 * gapSpan; for (auto bv : allowedBinVals) { if (bv != binVal) { diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index ac2acd2482a..cda12f02de2 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -53,8 +53,8 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( auto [sIndex, fIndex] = portalSets[toUnderlying(bValue)]; // Log the merge splits, i.e. the boundaries of the volumes - std::array, 3u> mergeSplits; - std::array mergeHalfLengths = { + std::array, 3u> mergeSplits; + std::array mergeHalfLengths = { 0., 0., 0., @@ -72,7 +72,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( // Things that can be done without a loop be first/last check // Estimate the merge parameters: the scalar and the transform - using MergeParameters = std::tuple; + using MergeParameters = std::tuple; std::map mergeParameters; auto& firstVolume = volumes.front(); auto& lastVolume = volumes.back(); @@ -93,8 +93,8 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( ->surface() .transform(gctx) .rotation(); - ActsScalar stepDown = firstBoundValues[toUnderlying(bValue)]; - ActsScalar stepUp = lastBoundValues[toUnderlying(bValue)]; + double stepDown = firstBoundValues[toUnderlying(bValue)]; + double stepUp = lastBoundValues[toUnderlying(bValue)]; // Take translation from first and last volume auto translationF = firstVolume->portalPtrs()[index] ->surface() @@ -113,7 +113,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( portalTransform.prerotate(rotation); portalTransform.pretranslate(translation); // The half length to be kept - ActsScalar keepHalfLength = + double keepHalfLength = firstBoundValues[toUnderlying(counterPart(mergeValue))]; mergeParameters[index] = MergeParameters(keepHalfLength, portalTransform); } @@ -183,7 +183,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( } // The stitch boundaries for portal pointing - std::vector stitchBoundaries; + std::vector stitchBoundaries; stitchBoundaries.push_back(-mergeHalfLengths[im]); for (auto step : mergeSplits[im]) { stitchBoundaries.push_back(stitchBoundaries.back() + step); @@ -322,7 +322,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::connect( return dShell; } -std::array, 3u> +std::array, 3u> Acts::Experimental::detail::CuboidalDetectorHelper::xyzBoundaries( [[maybe_unused]] const GeometryContext& gctx, [[maybe_unused]] const std::vector< @@ -332,16 +332,16 @@ Acts::Experimental::detail::CuboidalDetectorHelper::xyzBoundaries( ACTS_LOCAL_LOGGER(getDefaultLogger("CuboidalDetectorHelper", logLevel)); // The return boundaries - std::array, 3u> boundaries; + std::array, 3u> boundaries; // The map for collecting - std::array, 3u> valueMaps; + std::array, 3u> valueMaps; auto& xMap = valueMaps[0u]; auto& yMap = valueMaps[1u]; auto& zMap = valueMaps[2u]; - auto fillMap = [&](std::map& map, - const std::array& values) { + auto fillMap = [&](std::map& map, + const std::array& values) { for (auto v : values) { // This will insert v with a value of 0 if it doesn't exist ++map[v]; @@ -353,18 +353,18 @@ Acts::Experimental::detail::CuboidalDetectorHelper::xyzBoundaries( if (v->volumeBounds().type() == Acts::VolumeBounds::BoundsType::eCuboid) { auto bValues = v->volumeBounds().values(); // The min/max values - ActsScalar halfX = bValues[CuboidVolumeBounds::BoundValues::eHalfLengthX]; - ActsScalar halfY = bValues[CuboidVolumeBounds::BoundValues::eHalfLengthY]; - ActsScalar halfZ = bValues[CuboidVolumeBounds::BoundValues::eHalfLengthZ]; + double halfX = bValues[CuboidVolumeBounds::BoundValues::eHalfLengthX]; + double halfY = bValues[CuboidVolumeBounds::BoundValues::eHalfLengthY]; + double halfZ = bValues[CuboidVolumeBounds::BoundValues::eHalfLengthZ]; // Get the transform @todo use a center of gravity of the detector auto translation = v->transform(gctx).translation(); // The min/max values - ActsScalar xMin = translation.x() - halfX; - ActsScalar xMax = translation.x() + halfX; - ActsScalar yMin = translation.y() - halfY; - ActsScalar yMax = translation.y() + halfY; - ActsScalar zMin = translation.z() - halfZ; - ActsScalar zMax = translation.z() + halfZ; + double xMin = translation.x() - halfX; + double xMax = translation.x() + halfX; + double yMin = translation.y() - halfY; + double yMax = translation.y() + halfY; + double zMin = translation.z() - halfZ; + double zMax = translation.z() + halfZ; // Fill the maps fillMap(xMap, {xMin, xMax}); fillMap(yMap, {yMin, yMax}); diff --git a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp index 499d28c0785..545e0947797 100644 --- a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp @@ -80,9 +80,8 @@ namespace { /// /// @return a new portal replacement object Acts::Experimental::PortalReplacement createDiscReplacement( - const Acts::Transform3& transform, - const std::vector& rBoundaries, - const std::vector& phiBoundaries, unsigned int index, + const Acts::Transform3& transform, const std::vector& rBoundaries, + const std::vector& phiBoundaries, unsigned int index, Acts::Direction dir) { // Autodetector stitch value Acts::BinningValue stitchValue = phiBoundaries.size() == 2u @@ -117,9 +116,9 @@ Acts::Experimental::PortalReplacement createDiscReplacement( /// /// @return a new portal replacement object Acts::Experimental::PortalReplacement createCylinderReplacement( - const Acts::Transform3& transform, Acts::ActsScalar r, - const std::vector& zBoundaries, - const std::vector& phiBoundaries, unsigned int index, + const Acts::Transform3& transform, double r, + const std::vector& zBoundaries, + const std::vector& phiBoundaries, unsigned int index, Acts::Direction dir) { // Autodetector stitch value Acts::BinningValue stitchValue = phiBoundaries.size() == 2u @@ -155,9 +154,8 @@ Acts::Experimental::PortalReplacement createCylinderReplacement( /// @return a new portal replacement object Acts::Experimental::PortalReplacement createSectorReplacement( const Acts::GeometryContext& gctx, const Acts::Vector3& volumeCenter, - const Acts::Surface& refSurface, - const std::vector& boundaries, Acts::BinningValue binning, - unsigned int index, Acts::Direction dir) { + const Acts::Surface& refSurface, const std::vector& boundaries, + Acts::BinningValue binning, unsigned int index, Acts::Direction dir) { // Get a reference transform const auto& refTransform = refSurface.transform(gctx); auto refRotation = refTransform.rotation(); @@ -176,7 +174,7 @@ Acts::Experimental::PortalReplacement createSectorReplacement( Acts::Vector3 pCenter = volumeCenter + medium * refRotation.col(1u); transform.pretranslate(pCenter); // Create the halflength - Acts::ActsScalar halfX = + double halfX = 0.5 * (boundValues[Acts::RectangleBounds::BoundValues::eMaxX] - boundValues[Acts::RectangleBounds::BoundValues::eMinX]); // New joint bounds @@ -187,12 +185,12 @@ Acts::Experimental::PortalReplacement createSectorReplacement( // Center R calculation, using projection onto vector const auto& surfaceCenter = refSurface.center(gctx); Acts::Vector3 centerDiffs = (surfaceCenter - volumeCenter); - Acts::ActsScalar centerR = centerDiffs.dot(refRotation.col(2)); + double centerR = centerDiffs.dot(refRotation.col(2)); // New joint center Acts::Vector3 pCenter = volumeCenter + centerR * refRotation.col(2); transform.pretranslate(pCenter); // New joint bounds - Acts::ActsScalar halfY = + double halfY = 0.5 * (boundValues[Acts::RectangleBounds::BoundValues::eMaxY] - boundValues[Acts::RectangleBounds::BoundValues::eMinY]); bounds = std::make_unique(0.5 * range, halfY); @@ -318,7 +316,7 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInR( DetectorComponent::PortalContainer dShell; // Innermost volume boundaries - std::vector rBoundaries = {}; + std::vector rBoundaries = {}; auto refValues = volumes[0u]->volumeBounds().values(); // Reference boundary values @@ -329,9 +327,9 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInR( bool connectR = selectedOnly.empty() || rangeContainsValue(selectedOnly, 2u); // Get phi sector and average phi - ActsScalar phiSector = + double phiSector = refValues[CylinderVolumeBounds::BoundValues::eHalfPhiSector]; - ActsScalar avgPhi = refValues[CylinderVolumeBounds::BoundValues::eAveragePhi]; + double avgPhi = refValues[CylinderVolumeBounds::BoundValues::eAveragePhi]; // Fuse the cylinders for (unsigned int iv = 1; iv < volumes.size(); ++iv) { @@ -481,7 +479,7 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( auto addZboundary3D = [&](const Experimental::DetectorVolume& volume, int side) -> void { const auto boundValues = volume.volumeBounds().values(); - ActsScalar halflengthZ = + double halflengthZ = boundValues[CylinderVolumeBounds::BoundValues::eHalfLengthZ]; zBoundaries3D.push_back(volume.transform(gctx).translation() + side * halflengthZ * rotation.col(2)); @@ -534,11 +532,10 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( << toString(combinedCenter)); // Evaluate the series of z boundaries - std::vector zBoundaries = {}; + std::vector zBoundaries = {}; for (const auto& zb3D : zBoundaries3D) { auto proj3D = (zb3D - combinedCenter).dot(rotation.col(2)); - ActsScalar zBoundary = - std::copysign((zb3D - combinedCenter).norm(), proj3D); + double zBoundary = std::copysign((zb3D - combinedCenter).norm(), proj3D); zBoundaries.push_back(zBoundary); } @@ -551,11 +548,11 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( const auto refValues = refVolume->volumeBounds().values(); // Get phi sector and average phi - ActsScalar minR = refValues[CylinderVolumeBounds::BoundValues::eMinR]; - ActsScalar maxR = refValues[CylinderVolumeBounds::BoundValues::eMaxR]; - ActsScalar phiSector = + double minR = refValues[CylinderVolumeBounds::BoundValues::eMinR]; + double maxR = refValues[CylinderVolumeBounds::BoundValues::eMaxR]; + double phiSector = refValues[CylinderVolumeBounds::BoundValues::eHalfPhiSector]; - ActsScalar avgPhi = refValues[CylinderVolumeBounds::BoundValues::eAveragePhi]; + double avgPhi = refValues[CylinderVolumeBounds::BoundValues::eAveragePhi]; // Check if inner cylinder and sectors are present by the number of portals std::size_t nPortals = volumes[volumes.size() - 1u]->portals().size(); @@ -569,7 +566,7 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInZ( // Disc assignments are forward for negative disc, backward for positive std::vector cylinderDirs = {Acts::Direction::Backward}; // Cylinder radii - std::vector cylinderR = {maxR}; + std::vector cylinderR = {maxR}; if (innerPresent) { ACTS_VERBOSE("Inner surface present, tube geometry detected."); cylinderDirs.push_back(Direction::Forward); @@ -657,7 +654,7 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInPhi( // Sector offset unsigned int iSecOffset = innerPresent ? 4u : 3u; - std::vector phiBoundaries = {}; + std::vector phiBoundaries = {}; auto refValues = volumes[0u]->volumeBounds().values(); phiBoundaries.push_back( refValues[CylinderVolumeBounds::BoundValues::eAveragePhi] - @@ -679,10 +676,10 @@ Acts::Experimental::detail::CylindricalDetectorHelper::connectInPhi( // The current values auto curValues = volumes[iv]->volumeBounds().values(); // Bail out if they do not match - ActsScalar lowPhi = + double lowPhi = curValues[CylinderVolumeBounds::BoundValues::eAveragePhi] - curValues[CylinderVolumeBounds::BoundValues::eHalfPhiSector]; - ActsScalar highPhi = + double highPhi = curValues[CylinderVolumeBounds::BoundValues::eAveragePhi] + curValues[CylinderVolumeBounds::BoundValues::eHalfPhiSector]; // Check phi attachment @@ -816,12 +813,11 @@ Acts::Experimental::detail::CylindricalDetectorHelper::wrapInZR( "cylinder volume."); } // We need a new cylinder spanning over the entire inner tube - ActsScalar hlZ = cylVolBounds->get( + double hlZ = cylVolBounds->get( Acts::CylinderVolumeBounds::BoundValues::eHalfLengthZ); - ActsScalar HlZ = ccylVolBounds->get( + double HlZ = ccylVolBounds->get( Acts::CutoutCylinderVolumeBounds::BoundValues::eHalfLengthZ); - ActsScalar innerR = - cylVolBounds->get(CylinderVolumeBounds::BoundValues::eMinR); + double innerR = cylVolBounds->get(CylinderVolumeBounds::BoundValues::eMinR); // Create the inner replacement std::vector pReplacements; pReplacements.push_back(createCylinderReplacement( @@ -1112,17 +1108,15 @@ Acts::Experimental::detail::CylindricalDetectorHelper::wrapInZR( // Inner Container portal auto& centralSegment = innerContainer[3u]; auto centralValues = centralSegment->surface().bounds().values(); - ActsScalar centralHalfLengthZ = + double centralHalfLengthZ = centralValues[CylinderBounds::BoundValues::eHalfLengthZ]; // The two segments auto& nSegment = wrappingVolume->portalPtrs()[6u]; auto nValues = nSegment->surface().bounds().values(); - ActsScalar nHalfLengthZ = - nValues[CylinderBounds::BoundValues::eHalfLengthZ]; + double nHalfLengthZ = nValues[CylinderBounds::BoundValues::eHalfLengthZ]; auto& pSegment = wrappingVolume->portalPtrs()[7u]; auto pValues = pSegment->surface().bounds().values(); - ActsScalar pHalfLengthZ = - pValues[CylinderBounds::BoundValues::eHalfLengthZ]; + double pHalfLengthZ = pValues[CylinderBounds::BoundValues::eHalfLengthZ]; auto sideVolumes = PortalHelper::stripSideVolumes({innerContainer}, {3u}, {3u}, logLevel); @@ -1131,8 +1125,8 @@ Acts::Experimental::detail::CylindricalDetectorHelper::wrapInZR( std::vector> innerVolumes = { wrappingVolume->getSharedPtr()}; - std::vector zBoundaries = { - -centralHalfLengthZ - 2 * nHalfLengthZ, centralHalfLengthZ}; + std::vector zBoundaries = {-centralHalfLengthZ - 2 * nHalfLengthZ, + centralHalfLengthZ}; // Loop over side volume and register the z boundaries for (auto& svs : sideVolumes) { for (auto& v : svs.second) { @@ -1142,7 +1136,7 @@ Acts::Experimental::detail::CylindricalDetectorHelper::wrapInZR( throw std::invalid_argument( "CylindricalDetectorHelper: side volume must be a cylinder."); } - ActsScalar hlZ = + double hlZ = cylVolBounds->get(CylinderVolumeBounds::BoundValues::eHalfLengthZ); zBoundaries.push_back(zBoundaries.back() + 2 * hlZ); innerVolumes.push_back(v); diff --git a/Core/src/Detector/detail/DetectorVolumeConsistency.cpp b/Core/src/Detector/detail/DetectorVolumeConsistency.cpp index 1d9cae71402..999fe5fe6a8 100644 --- a/Core/src/Detector/detail/DetectorVolumeConsistency.cpp +++ b/Core/src/Detector/detail/DetectorVolumeConsistency.cpp @@ -35,12 +35,12 @@ void Acts::Experimental::detail::DetectorVolumeConsistency:: } } -std::vector +std::vector Acts::Experimental::detail::DetectorVolumeConsistency::checkCenterAlignment( const GeometryContext& gctx, const std::vector>& volumes, BinningValue axisValue) { - std::vector distances = {}; + std::vector distances = {}; // First it needs to surfive the rotation check checkRotationAlignment(gctx, volumes); diff --git a/Core/src/Detector/detail/PortalHelper.cpp b/Core/src/Detector/detail/PortalHelper.cpp index 72d4d8ac7f1..a24b74308cf 100644 --- a/Core/src/Detector/detail/PortalHelper.cpp +++ b/Core/src/Detector/detail/PortalHelper.cpp @@ -35,7 +35,7 @@ void Acts::Experimental::detail::PortalHelper::attachExternalNavigationDelegate( void Acts::Experimental::detail::PortalHelper::attachDetectorVolumesUpdater( const GeometryContext& gctx, Portal& portal, const std::vector>& volumes, - const Direction& direction, const std::vector& boundaries, + const Direction& direction, const std::vector& boundaries, const BinningValue& binning) { // Check if the boundaries need a transform const auto pTransform = portal.surface().transform(gctx); diff --git a/Core/src/Detector/detail/SupportSurfacesHelper.cpp b/Core/src/Detector/detail/SupportSurfacesHelper.cpp index 62916abe39c..1d06294e6a3 100644 --- a/Core/src/Detector/detail/SupportSurfacesHelper.cpp +++ b/Core/src/Detector/detail/SupportSurfacesHelper.cpp @@ -36,17 +36,17 @@ operator()(const Extent& lExtent) const { } // Min / Max z with clearances adapted - ActsScalar minZ = lExtent.min(BinningValue::binZ) + std::abs(zClearance[0u]); - ActsScalar maxZ = lExtent.max(BinningValue::binZ) - std::abs(zClearance[1u]); + double minZ = lExtent.min(BinningValue::binZ) + std::abs(zClearance[0u]); + double maxZ = lExtent.max(BinningValue::binZ) - std::abs(zClearance[1u]); // Phi sector - ActsScalar hPhiSector = std::numbers::pi_v; - ActsScalar avgPhi = 0.; + double hPhiSector = std::numbers::pi; + double avgPhi = 0.; if (lExtent.constrains(BinningValue::binPhi)) { // Min / Max phi with clearances adapted - ActsScalar minPhi = + double minPhi = lExtent.min(BinningValue::binPhi) + std::abs(phiClearance[0u]); - ActsScalar maxPhi = + double maxPhi = lExtent.max(BinningValue::binPhi) - std::abs(phiClearance[1u]); hPhiSector = 0.5 * (maxPhi - minPhi); avgPhi = 0.5 * (minPhi + maxPhi); @@ -58,8 +58,8 @@ operator()(const Extent& lExtent) const { } // The Radius estimation - ActsScalar r = rOffset < 0 ? lExtent.min(BinningValue::binR) + rOffset - : lExtent.max(BinningValue::binR) + rOffset; + double r = rOffset < 0 ? lExtent.min(BinningValue::binR) + rOffset + : lExtent.max(BinningValue::binR) + rOffset; if (rOffset == 0.) { r = lExtent.medium(BinningValue::binR); } @@ -80,25 +80,25 @@ Acts::Experimental::detail::SupportSurfacesHelper::DiscSupport::operator()( } // Min / Max r with clearances adapted - ActsScalar minR = lExtent.min(BinningValue::binR) + std::abs(rClearance[0u]); - ActsScalar maxR = lExtent.max(BinningValue::binR) - std::abs(rClearance[1u]); + double minR = lExtent.min(BinningValue::binR) + std::abs(rClearance[0u]); + double maxR = lExtent.max(BinningValue::binR) - std::abs(rClearance[1u]); // Phi sector - ActsScalar hPhiSector = std::numbers::pi_v; - ActsScalar avgPhi = 0.; + double hPhiSector = std::numbers::pi; + double avgPhi = 0.; if (lExtent.constrains(BinningValue::binPhi)) { // Min / Max phi with clearances adapted - ActsScalar minPhi = + double minPhi = lExtent.min(BinningValue::binPhi) + std::abs(phiClearance[0u]); - ActsScalar maxPhi = + double maxPhi = lExtent.max(BinningValue::binPhi) - std::abs(phiClearance[1u]); hPhiSector = 0.5 * (maxPhi - minPhi); avgPhi = 0.5 * (minPhi + maxPhi); } // The z position estimate - ActsScalar z = zOffset < 0 ? lExtent.min(BinningValue::binZ) + zOffset - : lExtent.max(BinningValue::binZ) + zOffset; + double z = zOffset < 0 ? lExtent.min(BinningValue::binZ) + zOffset + : lExtent.max(BinningValue::binZ) + zOffset; if (zOffset == 0.) { z = lExtent.medium(BinningValue::binZ); } @@ -131,12 +131,12 @@ operator()(const Extent& lExtent) const { } // Make the rectangular shape - ActsScalar minX = lExtent.min(locals[0]) + std::abs(loc0Clearance[0u]); - ActsScalar maxX = lExtent.max(locals[0]) - std::abs(loc0Clearance[1u]); - ActsScalar minY = lExtent.min(locals[1]) + std::abs(loc1Clearance[0u]); - ActsScalar maxY = lExtent.max(locals[1]) - std::abs(loc1Clearance[1u]); + double minX = lExtent.min(locals[0]) + std::abs(loc0Clearance[0u]); + double maxX = lExtent.max(locals[0]) - std::abs(loc0Clearance[1u]); + double minY = lExtent.min(locals[1]) + std::abs(loc1Clearance[0u]); + double maxY = lExtent.max(locals[1]) - std::abs(loc1Clearance[1u]); - ActsScalar gPlacement = lExtent.medium(pPlacement) + pOffset; + double gPlacement = lExtent.medium(pPlacement) + pOffset; Vector3 placement = Vector3::Zero(); placement[toUnderlying(pPlacement)] = gPlacement; @@ -166,7 +166,7 @@ Acts::Experimental::detail::SupportSurfacesHelper::cylindricalSupport( "surface type is not a cylinder."); } - std::array bounds = {}; + std::array bounds = {}; std::copy_n(values.begin(), 6u, bounds.begin()); // Return vector for generated surfaces @@ -177,28 +177,27 @@ Acts::Experimental::detail::SupportSurfacesHelper::cylindricalSupport( transform, std::make_shared(bounds))); } else { // Split into n(splits) planar surfaces, prep work: - ActsScalar r = bounds[0u]; - ActsScalar halfZ = bounds[1u]; - ActsScalar minPhi = bounds[3u] - bounds[2u]; - ActsScalar maxPhi = bounds[3u] + bounds[2u]; - ActsScalar dHalfPhi = (maxPhi - minPhi) / (2 * splits); - ActsScalar cosPhiHalf = std::cos(dHalfPhi); - ActsScalar sinPhiHalf = std::sin(dHalfPhi); - ActsScalar planeR = r * cosPhiHalf; - ActsScalar planeHalfX = r * sinPhiHalf; - ActsScalar planeZ = transform.translation().z(); + double r = bounds[0u]; + double halfZ = bounds[1u]; + double minPhi = bounds[3u] - bounds[2u]; + double maxPhi = bounds[3u] + bounds[2u]; + double dHalfPhi = (maxPhi - minPhi) / (2 * splits); + double cosPhiHalf = std::cos(dHalfPhi); + double sinPhiHalf = std::sin(dHalfPhi); + double planeR = r * cosPhiHalf; + double planeHalfX = r * sinPhiHalf; + double planeZ = transform.translation().z(); auto sRectangle = std::make_shared(planeHalfX, halfZ); // Now create the Trapezoids for (unsigned int iphi = 0; iphi < splits; ++iphi) { // Get the moduleTransform - ActsScalar phi = - -std::numbers::pi_v + (2 * iphi + 1) * dHalfPhi; - ActsScalar cosPhi = std::cos(phi); - ActsScalar sinPhi = std::sin(phi); - ActsScalar planeX = planeR * cosPhi; - ActsScalar planeY = planeR * sinPhi; + double phi = -std::numbers::pi + (2 * iphi + 1) * dHalfPhi; + double cosPhi = std::cos(phi); + double sinPhi = std::sin(phi); + double planeX = planeR * cosPhi; + double planeY = planeR * sinPhi; Acts::Vector3 planeCenter(planeX, planeY, planeZ); Acts::Vector3 planeAxisZ(cosPhi, sinPhi, 0.); @@ -241,7 +240,7 @@ Acts::Experimental::detail::SupportSurfacesHelper::discSupport( "surface type is not a disc."); } - std::array bounds = {}; + std::array bounds = {}; std::copy_n(values.begin(), 4u, bounds.begin()); // Return vector for generated surfaces @@ -252,33 +251,31 @@ Acts::Experimental::detail::SupportSurfacesHelper::discSupport( transform, std::make_shared(bounds))); } else { // Split into n(splits) planar surfaces in phi, prep work: - ActsScalar minR = bounds[0u]; - ActsScalar maxR = bounds[1u]; - ActsScalar minPhi = bounds[3u] - bounds[2u]; - ActsScalar maxPhi = bounds[3u] + bounds[2u]; - ActsScalar dHalfPhi = (maxPhi - minPhi) / (2 * splits); - ActsScalar cosPhiHalf = std::cos(dHalfPhi); - ActsScalar sinPhiHalf = std::sin(dHalfPhi); - ActsScalar maxLocY = maxR * cosPhiHalf; - ActsScalar minLocY = minR * cosPhiHalf; - ActsScalar hR = 0.5 * (maxLocY + minLocY); - ActsScalar hY = 0.5 * (maxLocY - minLocY); - ActsScalar hXminY = minR * sinPhiHalf; - ActsScalar hXmaxY = maxR * sinPhiHalf; + double minR = bounds[0u]; + double maxR = bounds[1u]; + double minPhi = bounds[3u] - bounds[2u]; + double maxPhi = bounds[3u] + bounds[2u]; + double dHalfPhi = (maxPhi - minPhi) / (2 * splits); + double cosPhiHalf = std::cos(dHalfPhi); + double sinPhiHalf = std::sin(dHalfPhi); + double maxLocY = maxR * cosPhiHalf; + double minLocY = minR * cosPhiHalf; + double hR = 0.5 * (maxLocY + minLocY); + double hY = 0.5 * (maxLocY - minLocY); + double hXminY = minR * sinPhiHalf; + double hXmaxY = maxR * sinPhiHalf; // Split trapezoid auto sTrapezoid = std::make_shared(hXminY, hXmaxY, hY); Vector3 zAxis = transform.rotation().col(2); - ActsScalar zPosition = transform.translation().z(); + double zPosition = transform.translation().z(); // Now create the Trapezoids for (unsigned int iphi = 0; iphi < splits; ++iphi) { // Create the split module transform - ActsScalar phi = - -std::numbers::pi_v + (2 * iphi + 1) * dHalfPhi; + double phi = -std::numbers::pi + (2 * iphi + 1) * dHalfPhi; auto sTransform = Transform3( Translation3(hR * std::cos(phi), hR * std::sin(phi), zPosition) * - AngleAxis3(phi - static_cast(std::numbers::pi / 2.), - zAxis)); + AngleAxis3(phi - std::numbers::pi / 2., zAxis)); // Place it dSupport.push_back( Surface::makeShared(sTransform, sTrapezoid)); @@ -307,7 +304,7 @@ Acts::Experimental::detail::SupportSurfacesHelper::rectangularSupport( "surface type is not a plane."); } - std::array bounds = {}; + std::array bounds = {}; std::copy_n(values.begin(), 4u, bounds.begin()); return {Surface::makeShared( diff --git a/Core/src/EventData/CorrectedTransformationFreeToBound.cpp b/Core/src/EventData/CorrectedTransformationFreeToBound.cpp index ebeb73c00ba..405fea01e3b 100644 --- a/Core/src/EventData/CorrectedTransformationFreeToBound.cpp +++ b/Core/src/EventData/CorrectedTransformationFreeToBound.cpp @@ -25,9 +25,8 @@ #include #include -Acts::FreeToBoundCorrection::FreeToBoundCorrection(bool apply_, - ActsScalar alpha_, - ActsScalar beta_) +Acts::FreeToBoundCorrection::FreeToBoundCorrection(bool apply_, double alpha_, + double beta_) : apply(apply_), alpha(alpha_), beta(beta_) {} Acts::FreeToBoundCorrection::FreeToBoundCorrection(bool apply_) @@ -38,8 +37,8 @@ Acts::FreeToBoundCorrection::operator bool() const { } Acts::detail::CorrectedFreeToBoundTransformer::CorrectedFreeToBoundTransformer( - ActsScalar alpha, ActsScalar beta, ActsScalar cosIncidentAngleMinCutoff, - ActsScalar cosIncidentAngleMaxCutoff) + double alpha, double beta, double cosIncidentAngleMinCutoff, + double cosIncidentAngleMaxCutoff) : m_alpha(alpha), m_beta(beta), m_cosIncidentAngleMinCutoff(cosIncidentAngleMinCutoff), @@ -63,7 +62,7 @@ Acts::detail::CorrectedFreeToBoundTransformer::operator()( Vector3 dir = freeParams.segment<3>(eFreeDir0); Vector3 normal = surface.normal(geoContext, freeParams.segment<3>(eFreePos0), dir); - ActsScalar absCosIncidenceAng = std::abs(dir.dot(normal)); + double absCosIncidenceAng = std::abs(dir.dot(normal)); // No correction if the incidentAngle is small enough (not necessary ) or too // large (correction could be invalid). Fall back to nominal free to bound // transformation @@ -78,7 +77,7 @@ Acts::detail::CorrectedFreeToBoundTransformer::operator()( std::size_t sampleSize = 2 * eFreeSize + 1; // The sampled free parameters, the weight for measurement W_m and weight for // covariance, W_c - std::vector> sampledFreeParams; + std::vector> sampledFreeParams; sampledFreeParams.reserve(sampleSize); // Initialize the covariance sqrt root matrix @@ -99,11 +98,11 @@ Acts::detail::CorrectedFreeToBoundTransformer::operator()( covSqrt = U * D; // Define kappa = alpha*alpha*N - ActsScalar kappa = m_alpha * m_alpha * static_cast(eFreeSize); + double kappa = m_alpha * m_alpha * static_cast(eFreeSize); // lambda = alpha*alpha*N - N - ActsScalar lambda = kappa - static_cast(eFreeSize); + double lambda = kappa - static_cast(eFreeSize); // gamma = sqrt(labmda + N) - ActsScalar gamma = std::sqrt(kappa); + double gamma = std::sqrt(kappa); // Sample the free parameters // 1. the nominal parameter @@ -125,7 +124,7 @@ Acts::detail::CorrectedFreeToBoundTransformer::operator()( // The transformed bound parameters and weight for each sampled free // parameters - std::vector> transformedBoundParams; + std::vector> transformedBoundParams; // 1. The nominal one // The sampled free parameters, the weight for measurement W_m and weight for diff --git a/Core/src/EventData/PrintParameters.cpp b/Core/src/EventData/PrintParameters.cpp index 01d62694c66..a076ea17027 100644 --- a/Core/src/EventData/PrintParameters.cpp +++ b/Core/src/EventData/PrintParameters.cpp @@ -188,8 +188,7 @@ void Acts::detail::printFreeParameters(std::ostream& os, void Acts::detail::printMeasurement(std::ostream& os, BoundIndices size, const std::uint8_t* indices, - const ActsScalar* params, - const ActsScalar* cov) { + const double* params, const double* cov) { auto s = static_cast(size); printParametersCovariance(os, makeBoundNames(), indices, ParametersMap(params, s), CovarianceMap(cov, s, s)); @@ -197,8 +196,7 @@ void Acts::detail::printMeasurement(std::ostream& os, BoundIndices size, void Acts::detail::printMeasurement(std::ostream& os, FreeIndices size, const std::uint8_t* indices, - const ActsScalar* params, - const ActsScalar* cov) { + const double* params, const double* cov) { auto s = static_cast(size); printParametersCovariance(os, makeFreeNames(), indices, ParametersMap(params, s), CovarianceMap(cov, s, s)); diff --git a/Core/src/EventData/TransformationHelpers.cpp b/Core/src/EventData/TransformationHelpers.cpp index 90014814073..ea6dcf061d1 100644 --- a/Core/src/EventData/TransformationHelpers.cpp +++ b/Core/src/EventData/TransformationHelpers.cpp @@ -42,7 +42,7 @@ Acts::FreeVector Acts::transformBoundToFreeParameters( Acts::Result Acts::transformFreeToBoundParameters( const FreeVector& freeParams, const Surface& surface, - const GeometryContext& geoCtx, ActsScalar tolerance) { + const GeometryContext& geoCtx, double tolerance) { // initialize the bound vector BoundVector bp = BoundVector::Zero(); // convert global to local position on the surface @@ -65,10 +65,9 @@ Acts::Result Acts::transformFreeToBoundParameters( } Acts::Result Acts::transformFreeToBoundParameters( - const Acts::Vector3& position, ActsScalar time, - const Acts::Vector3& direction, ActsScalar qOverP, - const Acts::Surface& surface, const Acts::GeometryContext& geoCtx, - ActsScalar tolerance) { + const Acts::Vector3& position, double time, const Acts::Vector3& direction, + double qOverP, const Acts::Surface& surface, + const Acts::GeometryContext& geoCtx, double tolerance) { // initialize the bound vector BoundVector bp = BoundVector::Zero(); // convert global to local position on the surface @@ -88,8 +87,10 @@ Acts::Result Acts::transformFreeToBoundParameters( return Result::success(bp); } -Acts::BoundVector Acts::transformFreeToCurvilinearParameters( - ActsScalar time, ActsScalar phi, ActsScalar theta, ActsScalar qOverP) { +Acts::BoundVector Acts::transformFreeToCurvilinearParameters(double time, + double phi, + double theta, + double qOverP) { BoundVector bp = BoundVector::Zero(); // local coordinates are zero by construction bp[eBoundTime] = time; @@ -100,7 +101,7 @@ Acts::BoundVector Acts::transformFreeToCurvilinearParameters( } Acts::BoundVector Acts::transformFreeToCurvilinearParameters( - ActsScalar time, const Vector3& direction, ActsScalar qOverP) { + double time, const Vector3& direction, double qOverP) { BoundVector bp = BoundVector::Zero(); // local coordinates are zero by construction bp[eBoundTime] = time; diff --git a/Core/src/EventData/VectorMultiTrajectory.cpp b/Core/src/EventData/VectorMultiTrajectory.cpp index 66629d65f12..f25d64db4c5 100644 --- a/Core/src/EventData/VectorMultiTrajectory.cpp +++ b/Core/src/EventData/VectorMultiTrajectory.cpp @@ -212,6 +212,7 @@ void VectorMultiTrajectory::unset_impl(TrackStatePropMask target, case PM::Calibrated: m_measOffset[istate] = kInvalid; m_measCovOffset[istate] = kInvalid; + m_index[istate].measdim = kInvalid; break; default: throw std::domain_error{"Unable to unset this component"}; diff --git a/Core/src/EventData/VectorTrackContainer.cpp b/Core/src/EventData/VectorTrackContainer.cpp index dc7cca761d1..5be40fae6c8 100644 --- a/Core/src/EventData/VectorTrackContainer.cpp +++ b/Core/src/EventData/VectorTrackContainer.cpp @@ -167,4 +167,8 @@ void VectorTrackContainer::clear() { } } +std::size_t VectorTrackContainer::size() const { + return m_tipIndex.size(); +} + } // namespace Acts diff --git a/Core/src/Geometry/CompositePortalLink.cpp b/Core/src/Geometry/CompositePortalLink.cpp index d8010bbbce2..108db95c192 100644 --- a/Core/src/Geometry/CompositePortalLink.cpp +++ b/Core/src/Geometry/CompositePortalLink.cpp @@ -228,9 +228,9 @@ std::unique_ptr CompositePortalLink::makeGrid( const auto& bounds = dynamic_cast(child->surface().bounds()); Transform3 ltransform = itransform * child->surface().transform(gctx); - ActsScalar hlZ = bounds.get(CylinderBounds::eHalfLengthZ); - ActsScalar minZ = ltransform.translation()[eZ] - hlZ; - ActsScalar maxZ = ltransform.translation()[eZ] + hlZ; + double hlZ = bounds.get(CylinderBounds::eHalfLengthZ); + double minZ = ltransform.translation()[eZ] - hlZ; + double maxZ = ltransform.translation()[eZ] + hlZ; if (i == 0) { edges.push_back(minZ); } diff --git a/Core/src/Geometry/ConeVolumeBounds.cpp b/Core/src/Geometry/ConeVolumeBounds.cpp index 31339ca4779..ebc1262c1b8 100644 --- a/Core/src/Geometry/ConeVolumeBounds.cpp +++ b/Core/src/Geometry/ConeVolumeBounds.cpp @@ -30,10 +30,10 @@ #include namespace Acts { -ConeVolumeBounds::ConeVolumeBounds( - ActsScalar innerAlpha, ActsScalar innerOffsetZ, ActsScalar outerAlpha, - ActsScalar outerOffsetZ, ActsScalar halflengthZ, ActsScalar averagePhi, - ActsScalar halfPhiSector) noexcept(false) +ConeVolumeBounds::ConeVolumeBounds(double innerAlpha, double innerOffsetZ, + double outerAlpha, double outerOffsetZ, + double halflengthZ, double averagePhi, + double halfPhiSector) noexcept(false) : VolumeBounds(), m_values() { m_values[eInnerAlpha] = innerAlpha; m_values[eInnerOffsetZ] = innerOffsetZ; @@ -46,10 +46,10 @@ ConeVolumeBounds::ConeVolumeBounds( checkConsistency(); } -ConeVolumeBounds::ConeVolumeBounds(ActsScalar cylinderR, ActsScalar alpha, - ActsScalar offsetZ, ActsScalar halflengthZ, - ActsScalar averagePhi, - ActsScalar halfPhiSector) noexcept(false) +ConeVolumeBounds::ConeVolumeBounds(double cylinderR, double alpha, + double offsetZ, double halflengthZ, + double averagePhi, + double halfPhiSector) noexcept(false) : VolumeBounds(), m_values() { m_values[eInnerAlpha] = 0.; m_values[eInnerOffsetZ] = 0.; @@ -60,11 +60,11 @@ ConeVolumeBounds::ConeVolumeBounds(ActsScalar cylinderR, ActsScalar alpha, m_values[eHalfPhiSector] = halfPhiSector; // Cone parameters - ActsScalar tanAlpha = std::tan(alpha); - ActsScalar zmin = offsetZ - halflengthZ; - ActsScalar zmax = offsetZ + halflengthZ; - ActsScalar rmin = std::abs(zmin) * tanAlpha; - ActsScalar rmax = std::abs(zmax) * tanAlpha; + double tanAlpha = std::tan(alpha); + double zmin = offsetZ - halflengthZ; + double zmax = offsetZ + halflengthZ; + double rmin = std::abs(zmin) * tanAlpha; + double rmax = std::abs(zmax) * tanAlpha; if (rmin >= cylinderR) { // Cylindrical cut-out of a cone @@ -192,36 +192,35 @@ void ConeVolumeBounds::checkConsistency() noexcept(false) { } } -bool ConeVolumeBounds::inside(const Vector3& pos, ActsScalar tol) const { - ActsScalar z = pos.z(); - ActsScalar zmin = z + tol; - ActsScalar zmax = z - tol; +bool ConeVolumeBounds::inside(const Vector3& pos, double tol) const { + double z = pos.z(); + double zmin = z + tol; + double zmax = z - tol; // Quick check outside z if (zmin < -get(eHalfLengthZ) || zmax > get(eHalfLengthZ)) { return false; } - ActsScalar r = VectorHelpers::perp(pos); + double r = VectorHelpers::perp(pos); if (std::abs(get(eHalfPhiSector) - std::numbers::pi) > s_onSurfaceTolerance) { // need to check the phi sector - approximate phi tolerance - ActsScalar phitol = tol / r; - ActsScalar phi = VectorHelpers::phi(pos); - ActsScalar phimin = phi - phitol; - ActsScalar phimax = phi + phitol; + double phitol = tol / r; + double phi = VectorHelpers::phi(pos); + double phimin = phi - phitol; + double phimax = phi + phitol; if (phimin < get(eAveragePhi) - get(eHalfPhiSector) || phimax > get(eAveragePhi) + get(eHalfPhiSector)) { return false; } } // We are within phi sector check box r quickly - ActsScalar rmin = r + tol; - ActsScalar rmax = r - tol; + double rmin = r + tol; + double rmax = r - tol; if (rmin > innerRmax() && rmax < outerRmin()) { return true; } // Finally we need to check the cone if (m_innerConeBounds != nullptr) { - ActsScalar innerConeR = - m_innerConeBounds->r(std::abs(z + get(eInnerOffsetZ))); + double innerConeR = m_innerConeBounds->r(std::abs(z + get(eInnerOffsetZ))); if (innerConeR > rmin) { return false; } @@ -230,8 +229,7 @@ bool ConeVolumeBounds::inside(const Vector3& pos, ActsScalar tol) const { } // And the outer cone if (m_outerConeBounds != nullptr) { - ActsScalar outerConeR = - m_outerConeBounds->r(std::abs(z + get(eOuterOffsetZ))); + double outerConeR = m_outerConeBounds->r(std::abs(z + get(eOuterOffsetZ))); if (outerConeR < rmax) { return false; } @@ -245,8 +243,8 @@ void ConeVolumeBounds::buildSurfaceBounds() { // Build inner cone or inner cylinder if (get(eInnerAlpha) > s_epsilon) { m_innerTanAlpha = std::tan(get(eInnerAlpha)); - ActsScalar innerZmin = get(eInnerOffsetZ) - get(eHalfLengthZ); - ActsScalar innerZmax = get(eInnerOffsetZ) + get(eHalfLengthZ); + double innerZmin = get(eInnerOffsetZ) - get(eHalfLengthZ); + double innerZmax = get(eInnerOffsetZ) + get(eHalfLengthZ); m_innerRmin = std::abs(innerZmin) * m_innerTanAlpha; m_innerRmax = std::abs(innerZmax) * m_innerTanAlpha; m_innerConeBounds = @@ -259,8 +257,8 @@ void ConeVolumeBounds::buildSurfaceBounds() { if (get(eOuterAlpha) > s_epsilon) { m_outerTanAlpha = std::tan(get(eOuterAlpha)); - ActsScalar outerZmin = get(eOuterOffsetZ) - get(eHalfLengthZ); - ActsScalar outerZmax = get(eOuterOffsetZ) + get(eHalfLengthZ); + double outerZmin = get(eOuterOffsetZ) - get(eHalfLengthZ); + double outerZmax = get(eOuterOffsetZ) + get(eHalfLengthZ); m_outerRmin = std::abs(outerZmin) * m_outerTanAlpha; m_outerRmax = std::abs(outerZmax) * m_outerTanAlpha; m_outerConeBounds = @@ -312,32 +310,32 @@ Volume::BoundingBox ConeVolumeBounds::boundingBox(const Transform3* trf, return trf == nullptr ? box : box.transformed(*trf); } -ActsScalar ConeVolumeBounds::innerRmin() const { +double ConeVolumeBounds::innerRmin() const { return m_innerRmin; } -ActsScalar ConeVolumeBounds::innerRmax() const { +double ConeVolumeBounds::innerRmax() const { return m_innerRmax; } -ActsScalar ConeVolumeBounds::innerTanAlpha() const { +double ConeVolumeBounds::innerTanAlpha() const { return m_innerTanAlpha; } -ActsScalar ConeVolumeBounds::outerRmin() const { +double ConeVolumeBounds::outerRmin() const { return m_outerRmin; } -ActsScalar ConeVolumeBounds::outerRmax() const { +double ConeVolumeBounds::outerRmax() const { return m_outerRmax; } -ActsScalar ConeVolumeBounds::outerTanAlpha() const { +double ConeVolumeBounds::outerTanAlpha() const { return m_outerTanAlpha; } -std::vector ConeVolumeBounds::values() const { - std::vector valvector; +std::vector ConeVolumeBounds::values() const { + std::vector valvector; valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); return valvector; } diff --git a/Core/src/Geometry/CuboidVolumeBounds.cpp b/Core/src/Geometry/CuboidVolumeBounds.cpp index 64b0b67f8d7..be2443c9691 100644 --- a/Core/src/Geometry/CuboidVolumeBounds.cpp +++ b/Core/src/Geometry/CuboidVolumeBounds.cpp @@ -18,15 +18,13 @@ namespace Acts { -CuboidVolumeBounds::CuboidVolumeBounds(ActsScalar halex, ActsScalar haley, - ActsScalar halez) +CuboidVolumeBounds::CuboidVolumeBounds(double halex, double haley, double halez) : VolumeBounds(), m_values({halex, haley, halez}) { checkConsistency(); buildSurfaceBounds(); } -CuboidVolumeBounds::CuboidVolumeBounds( - const std::array& values) +CuboidVolumeBounds::CuboidVolumeBounds(const std::array& values) : m_values(values) { checkConsistency(); buildSurfaceBounds(); @@ -102,7 +100,7 @@ void CuboidVolumeBounds::buildSurfaceBounds() { get(eHalfLengthX)); } -ActsScalar CuboidVolumeBounds::binningBorder(BinningValue bValue) const { +double CuboidVolumeBounds::binningBorder(BinningValue bValue) const { if (bValue <= BinningValue::binZ) { return m_values[toUnderlying(bValue)]; } @@ -115,14 +113,14 @@ ActsScalar CuboidVolumeBounds::binningBorder(BinningValue bValue) const { return 0.0; } -bool CuboidVolumeBounds::inside(const Vector3& pos, ActsScalar tol) const { +bool CuboidVolumeBounds::inside(const Vector3& pos, double tol) const { return (std::abs(pos.x()) <= get(eHalfLengthX) + tol && std::abs(pos.y()) <= get(eHalfLengthY) + tol && std::abs(pos.z()) <= get(eHalfLengthZ) + tol); } -std::vector CuboidVolumeBounds::values() const { - std::vector valvector; +std::vector CuboidVolumeBounds::values() const { + std::vector valvector; valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); return valvector; } @@ -135,13 +133,13 @@ void CuboidVolumeBounds::checkConsistency() noexcept(false) { } } -void CuboidVolumeBounds::set(BoundValues bValue, ActsScalar value) { +void CuboidVolumeBounds::set(BoundValues bValue, double value) { set({{bValue, value}}); } void CuboidVolumeBounds::set( - std::initializer_list> keyValues) { - std::array previous = m_values; + std::initializer_list> keyValues) { + std::array previous = m_values; for (const auto& [key, value] : keyValues) { m_values[key] = value; } diff --git a/Core/src/Geometry/CylinderVolumeBounds.cpp b/Core/src/Geometry/CylinderVolumeBounds.cpp index b4f8084a4c0..1e3bba1d67f 100644 --- a/Core/src/Geometry/CylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CylinderVolumeBounds.cpp @@ -26,11 +26,10 @@ namespace Acts { -CylinderVolumeBounds::CylinderVolumeBounds(ActsScalar rmin, ActsScalar rmax, - ActsScalar halfz, ActsScalar halfphi, - ActsScalar avgphi, - ActsScalar bevelMinZ, - ActsScalar bevelMaxZ) +CylinderVolumeBounds::CylinderVolumeBounds(double rmin, double rmax, + double halfz, double halfphi, + double avgphi, double bevelMinZ, + double bevelMaxZ) : m_values() { m_values[eMinR] = rmin; m_values[eMaxR] = rmax; @@ -44,16 +43,16 @@ CylinderVolumeBounds::CylinderVolumeBounds(ActsScalar rmin, ActsScalar rmax, } CylinderVolumeBounds::CylinderVolumeBounds( - const std::array& values) + const std::array& values) : m_values(values) { checkConsistency(); buildSurfaceBounds(); } CylinderVolumeBounds::CylinderVolumeBounds(const CylinderBounds& cBounds, - ActsScalar thickness) + double thickness) : VolumeBounds() { - ActsScalar cR = cBounds.get(CylinderBounds::eR); + double cR = cBounds.get(CylinderBounds::eR); if (thickness <= 0. || (cR - 0.5 * thickness) < 0.) { throw(std::invalid_argument( "CylinderVolumeBounds: invalid extrusion thickness.")); @@ -69,7 +68,7 @@ CylinderVolumeBounds::CylinderVolumeBounds(const CylinderBounds& cBounds, } CylinderVolumeBounds::CylinderVolumeBounds(const RadialBounds& rBounds, - ActsScalar thickness) + double thickness) : VolumeBounds() { if (thickness <= 0.) { throw(std::invalid_argument( @@ -93,11 +92,11 @@ std::vector CylinderVolumeBounds::orientedSurfaces( Translation3 vMinZ(0., 0., -get(eHalfLengthZ)); Translation3 vMaxZ(0., 0., get(eHalfLengthZ)); // Set up transform for beveled edges if they are defined - ActsScalar bevelMinZ = get(eBevelMinZ); - ActsScalar bevelMaxZ = get(eBevelMaxZ); + double bevelMinZ = get(eBevelMinZ); + double bevelMaxZ = get(eBevelMaxZ); Transform3 transMinZ, transMaxZ; if (bevelMinZ != 0.) { - ActsScalar sy = 1 - 1 / std::cos(bevelMinZ); + double sy = 1 - 1 / std::cos(bevelMinZ); transMinZ = transform * vMinZ * Eigen::AngleAxisd(-bevelMinZ, Eigen::Vector3d(1., 0., 0.)) * Eigen::Scaling(1., 1. + sy, 1.); @@ -105,7 +104,7 @@ std::vector CylinderVolumeBounds::orientedSurfaces( transMinZ = transform * vMinZ; } if (bevelMaxZ != 0.) { - ActsScalar sy = 1 - 1 / std::cos(bevelMaxZ); + double sy = 1 - 1 / std::cos(bevelMaxZ); transMaxZ = transform * vMaxZ * Eigen::AngleAxisd(bevelMaxZ, Eigen::Vector3d(1., 0., 0.)) * Eigen::Scaling(1., 1. + sy, 1.); @@ -195,7 +194,7 @@ std::ostream& CylinderVolumeBounds::toStream(std::ostream& os) const { Volume::BoundingBox CylinderVolumeBounds::boundingBox( const Transform3* trf, const Vector3& envelope, const Volume* entity) const { - ActsScalar xmax = 0, xmin = 0, ymax = 0, ymin = 0; + double xmax = 0, xmin = 0, ymax = 0, ymin = 0; xmax = get(eMaxR); if (get(eHalfPhiSector) > std::numbers::pi / 2.) { @@ -219,10 +218,10 @@ Volume::BoundingBox CylinderVolumeBounds::boundingBox( return trf == nullptr ? box : box.transformed(*trf); } -bool CylinderVolumeBounds::inside(const Vector3& pos, ActsScalar tol) const { +bool CylinderVolumeBounds::inside(const Vector3& pos, double tol) const { using VectorHelpers::perp; using VectorHelpers::phi; - ActsScalar ros = perp(pos); + double ros = perp(pos); bool insidePhi = cos(phi(pos)) >= cos(get(eHalfPhiSector)) - tol; bool insideR = insidePhi ? ((ros >= get(eMinR) - tol) && (ros <= get(eMaxR) + tol)) @@ -241,7 +240,7 @@ Vector3 CylinderVolumeBounds::binningOffset(BinningValue bValue) return VolumeBounds::binningOffset(bValue); } -ActsScalar CylinderVolumeBounds::binningBorder(BinningValue bValue) const { +double CylinderVolumeBounds::binningBorder(BinningValue bValue) const { if (bValue == Acts::BinningValue::binR) { return 0.5 * (get(eMaxR) - get(eMinR)); } @@ -251,8 +250,8 @@ ActsScalar CylinderVolumeBounds::binningBorder(BinningValue bValue) const { return VolumeBounds::binningBorder(bValue); } -std::vector CylinderVolumeBounds::values() const { - std::vector valvector; +std::vector CylinderVolumeBounds::values() const { + std::vector valvector; valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); return valvector; } @@ -291,13 +290,13 @@ void CylinderVolumeBounds::checkConsistency() { } } -void CylinderVolumeBounds::set(BoundValues bValue, ActsScalar value) { +void CylinderVolumeBounds::set(BoundValues bValue, double value) { set({{bValue, value}}); } void CylinderVolumeBounds::set( - std::initializer_list> keyValues) { - std::array previous = m_values; + std::initializer_list> keyValues) { + std::array previous = m_values; for (const auto& [key, value] : keyValues) { m_values[key] = value; } diff --git a/Core/src/Geometry/CylinderVolumeHelper.cpp b/Core/src/Geometry/CylinderVolumeHelper.cpp index f5b244983ef..77d9dcaee8f 100644 --- a/Core/src/Geometry/CylinderVolumeHelper.cpp +++ b/Core/src/Geometry/CylinderVolumeHelper.cpp @@ -638,7 +638,7 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( std::const_pointer_cast(*(++tVolIter)); // re-evalueate rGlueMin - ActsScalar rGlueR = + double rGlueR = 0.5 * (tVol1->volumeBounds() .values()[CylinderVolumeBounds::BoundValues::eMaxR] + tVol2->volumeBounds() diff --git a/Core/src/Geometry/CylinderVolumeStack.cpp b/Core/src/Geometry/CylinderVolumeStack.cpp index 5dd0949ac79..5350c3e764e 100644 --- a/Core/src/Geometry/CylinderVolumeStack.cpp +++ b/Core/src/Geometry/CylinderVolumeStack.cpp @@ -40,23 +40,23 @@ struct CylinderVolumeStack::VolumeTuple { updatedBounds = std::make_shared(*bounds); } - ActsScalar midZ() const { return localTransform.translation()[eZ]; } - ActsScalar halfLengthZ() const { + double midZ() const { return localTransform.translation()[eZ]; } + double halfLengthZ() const { return updatedBounds->get(CylinderVolumeBounds::eHalfLengthZ); } - ActsScalar minZ() const { return midZ() - halfLengthZ(); } - ActsScalar maxZ() const { return midZ() + halfLengthZ(); } + double minZ() const { return midZ() - halfLengthZ(); } + double maxZ() const { return midZ() + halfLengthZ(); } - ActsScalar minR() const { + double minR() const { return updatedBounds->get(CylinderVolumeBounds::eMinR); } - ActsScalar maxR() const { + double maxR() const { return updatedBounds->get(CylinderVolumeBounds::eMaxR); } - ActsScalar midR() const { return (minR() + maxR()) / 2.0; } + double midR() const { return (minR() + maxR()) / 2.0; } void set(std::initializer_list< - std::pair> + std::pair> keyValues) { updatedBounds->set(keyValues); } @@ -204,11 +204,11 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_DEBUG("*** Volume configuration after final z sorting:"); printVolumeSequence(volumeTuples, logger, Acts::Logging::DEBUG); - ActsScalar minZ = volumeTuples.front().minZ(); - ActsScalar maxZ = volumeTuples.back().maxZ(); + double minZ = volumeTuples.front().minZ(); + double maxZ = volumeTuples.back().maxZ(); - ActsScalar midZ = (minZ + maxZ) / 2.0; - ActsScalar hlZ = (maxZ - minZ) / 2.0; + double midZ = (minZ + maxZ) / 2.0; + double hlZ = (maxZ - minZ) / 2.0; m_transform = m_groupTransform * Translation3{0, 0, midZ}; @@ -261,11 +261,11 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_DEBUG("*** Volume configuration after final r sorting:"); printVolumeSequence(volumeTuples, logger, Acts::Logging::DEBUG); - ActsScalar minR = volumeTuples.front().minR(); - ActsScalar maxR = volumeTuples.back().maxR(); + double minR = volumeTuples.front().minR(); + double maxR = volumeTuples.back().maxR(); - ActsScalar midZ = (minZ + maxZ) / 2.0; - ActsScalar hlZ = (maxZ - minZ) / 2.0; + double midZ = (minZ + maxZ) / 2.0; + double hlZ = (maxZ - minZ) / 2.0; m_transform = m_groupTransform * Translation3{0, 0, midZ}; @@ -349,7 +349,7 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( if (std::abs(a.maxZ() - b.minZ()) < tolerance) { ACTS_VERBOSE("No gap between volumes, no attachment needed"); } else { - ActsScalar gapWidth = b.minZ() - a.maxZ(); + double gapWidth = b.minZ() - a.maxZ(); ACTS_VERBOSE("Gap width: " << gapWidth); ACTS_VERBOSE("Synchronizing bounds in z with strategy: " << strategy); @@ -357,8 +357,8 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( case AttachmentStrategy::Midpoint: { ACTS_VERBOSE(" -> Strategy: Expand both volumes to midpoint"); - ActsScalar aZMidNew = (a.minZ() + a.maxZ()) / 2.0 + gapWidth / 4.0; - ActsScalar aHlZNew = a.halfLengthZ() + gapWidth / 4.0; + double aZMidNew = (a.minZ() + a.maxZ()) / 2.0 + gapWidth / 4.0; + double aHlZNew = a.halfLengthZ() + gapWidth / 4.0; ACTS_VERBOSE(" - New halflength for first volume: " << aHlZNew); ACTS_VERBOSE(" - New bounds for first volume: [" << (aZMidNew - aHlZNew) << " <- " << aZMidNew << " -> " @@ -368,8 +368,8 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( "Volume shrunk"); assert(aHlZNew >= a.halfLengthZ() && "Volume shrunk"); - ActsScalar bZMidNew = (b.minZ() + b.maxZ()) / 2.0 - gapWidth / 4.0; - ActsScalar bHlZNew = b.halfLengthZ() + gapWidth / 4.0; + double bZMidNew = (b.minZ() + b.maxZ()) / 2.0 - gapWidth / 4.0; + double bHlZNew = b.halfLengthZ() + gapWidth / 4.0; ACTS_VERBOSE(" - New halflength for second volume: " << bHlZNew); ACTS_VERBOSE(" - New bounds for second volume: [" << (bZMidNew - bHlZNew) << " <- " << bZMidNew << " -> " @@ -391,8 +391,8 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( } case AttachmentStrategy::First: { ACTS_VERBOSE(" -> Strategy: Expand first volume"); - ActsScalar aZMidNew = (a.minZ() + b.minZ()) / 2.0; - ActsScalar aHlZNew = (b.minZ() - a.minZ()) / 2.0; + double aZMidNew = (a.minZ() + b.minZ()) / 2.0; + double aHlZNew = (b.minZ() - a.minZ()) / 2.0; ACTS_VERBOSE(" - Gap width: " << gapWidth); ACTS_VERBOSE(" - New bounds for first volume: [" << (aZMidNew - aHlZNew) << " <- " << aZMidNew << " -> " @@ -410,8 +410,8 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( } case AttachmentStrategy::Second: { ACTS_VERBOSE(" -> Strategy: Expand second volume"); - ActsScalar bZMidNew = (a.maxZ() + b.maxZ()) / 2.0; - ActsScalar bHlZNew = (b.maxZ() - a.maxZ()) / 2.0; + double bZMidNew = (a.maxZ() + b.maxZ()) / 2.0; + double bHlZNew = (b.maxZ() - a.maxZ()) / 2.0; ACTS_VERBOSE(" - New halflength for second volume: " << bHlZNew); ACTS_VERBOSE(" - New bounds for second volume: [" << (bZMidNew - bHlZNew) << " <- " << bZMidNew << " -> " @@ -428,14 +428,14 @@ CylinderVolumeStack::checkOverlapAndAttachInZ( } case AttachmentStrategy::Gap: { ACTS_VERBOSE(" -> Strategy: Create a gap volume"); - ActsScalar gapHlZ = (b.minZ() - a.maxZ()) / 2.0; - ActsScalar gapMidZ = (b.minZ() + a.maxZ()) / 2.0; + double gapHlZ = (b.minZ() - a.maxZ()) / 2.0; + double gapMidZ = (b.minZ() + a.maxZ()) / 2.0; ACTS_VERBOSE(" - Gap half length: " << gapHlZ << " at z: " << gapMidZ); - ActsScalar minR = std::min(a.minR(), b.minR()); - ActsScalar maxR = std::max(a.maxR(), b.maxR()); + double minR = std::min(a.minR(), b.minR()); + double maxR = std::max(a.maxR(), b.maxR()); Transform3 gapLocalTransform{Translation3{0, 0, gapMidZ}}; Transform3 gapGlobalTransform = m_groupTransform * gapLocalTransform; @@ -483,7 +483,7 @@ CylinderVolumeStack::checkOverlapAndAttachInR( if (std::abs(a.maxR() - b.minR()) < tolerance) { ACTS_VERBOSE("No gap between volumes, no attachment needed"); } else { - ActsScalar gapWidth = b.minR() - a.maxR(); + double gapWidth = b.minR() - a.maxR(); ACTS_VERBOSE("Gap width: " << gapWidth); ACTS_VERBOSE("Synchronizing bounds in r with strategy: " << strategy); @@ -592,9 +592,9 @@ void CylinderVolumeStack::checkVolumeAlignment( } } -std::pair CylinderVolumeStack::synchronizeRBounds( +std::pair CylinderVolumeStack::synchronizeRBounds( std::vector& volumes, const Logger& logger) { - const ActsScalar minR = + const double minR = std::min_element(volumes.begin(), volumes.end(), [](const auto& a, const auto& b) { return a.bounds->get(CylinderVolumeBounds::eMinR) < @@ -602,7 +602,7 @@ std::pair CylinderVolumeStack::synchronizeRBounds( }) ->bounds->get(CylinderVolumeBounds::eMinR); - const ActsScalar maxR = + const double maxR = std::max_element(volumes.begin(), volumes.end(), [](const auto& a, const auto& b) { return a.bounds->get(CylinderVolumeBounds::eMaxR) < @@ -621,21 +621,21 @@ std::pair CylinderVolumeStack::synchronizeRBounds( return {minR, maxR}; } -std::pair CylinderVolumeStack::synchronizeZBounds( +std::pair CylinderVolumeStack::synchronizeZBounds( std::vector& volumes, const Logger& logger) { - const ActsScalar minZ = std::min_element(volumes.begin(), volumes.end(), - [](const auto& a, const auto& b) { - return a.minZ() < b.minZ(); - }) - ->minZ(); - - const ActsScalar maxZ = std::max_element(volumes.begin(), volumes.end(), - [](const auto& a, const auto& b) { - return a.maxZ() < b.maxZ(); - }) - ->maxZ(); - const ActsScalar midZ = (minZ + maxZ) / 2.0; - const ActsScalar hlZ = (maxZ - minZ) / 2.0; + const double minZ = std::min_element(volumes.begin(), volumes.end(), + [](const auto& a, const auto& b) { + return a.minZ() < b.minZ(); + }) + ->minZ(); + + const double maxZ = std::max_element(volumes.begin(), volumes.end(), + [](const auto& a, const auto& b) { + return a.maxZ() < b.maxZ(); + }) + ->maxZ(); + const double midZ = (minZ + maxZ) / 2.0; + const double hlZ = (maxZ - minZ) / 2.0; ACTS_DEBUG("Found overall z bounds: [ " << minZ << " <- " << midZ << " -> " << maxZ << " ]"); const Transform3 transform{Translation3{0, 0, midZ}}; @@ -703,19 +703,19 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, checkNoPhiOrBevel(*cylBounds, logger); - const ActsScalar newMinR = newVolume.minR(); - const ActsScalar newMaxR = newVolume.maxR(); - const ActsScalar newMinZ = newVolume.minZ(); - const ActsScalar newMaxZ = newVolume.maxZ(); - const ActsScalar newMidZ = newVolume.midZ(); - const ActsScalar newHlZ = newVolume.halfLengthZ(); + const double newMinR = newVolume.minR(); + const double newMaxR = newVolume.maxR(); + const double newMinZ = newVolume.minZ(); + const double newMaxZ = newVolume.maxZ(); + const double newMidZ = newVolume.midZ(); + const double newHlZ = newVolume.halfLengthZ(); - const ActsScalar oldMinR = oldVolume.minR(); - const ActsScalar oldMaxR = oldVolume.maxR(); - const ActsScalar oldMinZ = oldVolume.minZ(); - const ActsScalar oldMaxZ = oldVolume.maxZ(); - const ActsScalar oldMidZ = oldVolume.midZ(); - const ActsScalar oldHlZ = oldVolume.halfLengthZ(); + const double oldMinR = oldVolume.minR(); + const double oldMaxR = oldVolume.maxR(); + const double oldMinZ = oldVolume.minZ(); + const double oldMaxZ = oldVolume.maxZ(); + const double oldMidZ = oldVolume.midZ(); + const double oldHlZ = oldVolume.halfLengthZ(); ACTS_VERBOSE("Previous bounds are: z: [ " << oldMinZ << " <- " << oldMidZ << " -> " << oldMaxZ << " ] (" @@ -727,9 +727,7 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, << " ]"); constexpr auto tolerance = s_onSurfaceTolerance; - auto same = [](ActsScalar a, ActsScalar b) { - return std::abs(a - b) < tolerance; - }; + auto same = [](double a, double b) { return std::abs(a - b) < tolerance; }; if (!same(newMinZ, oldMinZ) && newMinZ > oldMinZ) { ACTS_ERROR("Shrinking the stack size in z is not supported: " @@ -796,9 +794,9 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, ACTS_VERBOSE("Expanding first volume to new z bounds"); auto& first = volumeTuples.front(); - ActsScalar newMinZFirst = newVolume.minZ(); - ActsScalar newMidZFirst = (newMinZFirst + first.maxZ()) / 2.0; - ActsScalar newHlZFirst = (first.maxZ() - newMinZFirst) / 2.0; + double newMinZFirst = newVolume.minZ(); + double newMidZFirst = (newMinZFirst + first.maxZ()) / 2.0; + double newHlZFirst = (first.maxZ() - newMinZFirst) / 2.0; ACTS_VERBOSE(" -> first z: [ " << newMinZFirst << " <- " << newMidZFirst << " -> " @@ -813,9 +811,9 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, ACTS_VERBOSE("Expanding last volume to new z bounds"); auto& last = volumeTuples.back(); - ActsScalar newMaxZLast = newVolume.maxZ(); - ActsScalar newMidZLast = (last.minZ() + newMaxZLast) / 2.0; - ActsScalar newHlZLast = (newMaxZLast - last.minZ()) / 2.0; + double newMaxZLast = newVolume.maxZ(); + double newMidZLast = (last.minZ() + newMaxZLast) / 2.0; + double newHlZLast = (newMaxZLast - last.minZ()) / 2.0; ACTS_VERBOSE(" -> last z: [ " << last.minZ() << " <- " << newMidZLast << " -> " << newMaxZLast @@ -837,10 +835,10 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, }; if (!same(newMinZ, oldMinZ) && newMinZ < oldMinZ) { - ActsScalar gap1MinZ = newVolume.minZ(); - ActsScalar gap1MaxZ = oldVolume.minZ(); - ActsScalar gap1HlZ = (gap1MaxZ - gap1MinZ) / 2.0; - ActsScalar gap1PZ = (gap1MaxZ + gap1MinZ) / 2.0; + double gap1MinZ = newVolume.minZ(); + double gap1MaxZ = oldVolume.minZ(); + double gap1HlZ = (gap1MaxZ - gap1MinZ) / 2.0; + double gap1PZ = (gap1MaxZ + gap1MinZ) / 2.0; // // check if we need a new gap volume or reuse an existing one auto& candidate = volumeTuples.front(); @@ -875,10 +873,10 @@ void CylinderVolumeStack::update(std::shared_ptr volbounds, } if (!same(newMaxZ, oldMaxZ) && newMaxZ > oldMaxZ) { - ActsScalar gap2MinZ = oldVolume.maxZ(); - ActsScalar gap2MaxZ = newVolume.maxZ(); - ActsScalar gap2HlZ = (gap2MaxZ - gap2MinZ) / 2.0; - ActsScalar gap2PZ = (gap2MaxZ + gap2MinZ) / 2.0; + double gap2MinZ = oldVolume.maxZ(); + double gap2MaxZ = newVolume.maxZ(); + double gap2HlZ = (gap2MaxZ - gap2MinZ) / 2.0; + double gap2PZ = (gap2MaxZ + gap2MinZ) / 2.0; // check if we need a new gap volume or reuse an existing one auto& candidate = volumeTuples.back(); diff --git a/Core/src/Geometry/Extent.cpp b/Core/src/Geometry/Extent.cpp index bd50d8536ef..8dfc33c1203 100644 --- a/Core/src/Geometry/Extent.cpp +++ b/Core/src/Geometry/Extent.cpp @@ -20,13 +20,13 @@ Acts::Extent::Extent(const ExtentEnvelope& envelope) : m_constrains(0), m_envelope(envelope) { m_range[toUnderlying(BinningValue::binR)] = - Range1D(0., std::numeric_limits::max()); - m_range[toUnderlying(BinningValue::binPhi)] = Range1D( - -std::numbers::pi_v, std::numbers::pi_v); + Range1D(0., std::numeric_limits::max()); + m_range[toUnderlying(BinningValue::binPhi)] = + Range1D(-std::numbers::pi, std::numbers::pi); m_range[toUnderlying(BinningValue::binRPhi)] = - Range1D(0., std::numeric_limits::max()); + Range1D(0., std::numeric_limits::max()); m_range[toUnderlying(BinningValue::binMag)] = - Range1D(0., std::numeric_limits::max()); + Range1D(0., std::numeric_limits::max()); } void Acts::Extent::extend(const Vector3& vtx, @@ -34,14 +34,14 @@ void Acts::Extent::extend(const Vector3& vtx, bool applyEnv, bool fillHistograms) { for (auto bValue : bValues) { // Get the casted value given the binning value description - ActsScalar cValue = VectorHelpers::cast(vtx, bValue); + double cValue = VectorHelpers::cast(vtx, bValue); if (fillHistograms) { m_valueHistograms[toUnderlying(bValue)].push_back(cValue); } // Apply envelope as suggested - ActsScalar lEnv = applyEnv ? m_envelope[bValue][0] : 0.; - ActsScalar hEnv = applyEnv ? m_envelope[bValue][1] : 0.; - ActsScalar mValue = cValue - lEnv; + double lEnv = applyEnv ? m_envelope[bValue][0] : 0.; + double hEnv = applyEnv ? m_envelope[bValue][1] : 0.; + double mValue = cValue - lEnv; // Special protection for radial value if (bValue == BinningValue::binR && mValue < 0.) { mValue = std::max(mValue, 0.); @@ -61,8 +61,8 @@ void Acts::Extent::extend(const Extent& rhs, for (auto bValue : bValues) { // The value is constraint, envelope can be optional if (rhs.constrains(bValue)) { - ActsScalar lEnv = applyEnv ? m_envelope[bValue][0] : 0.; - ActsScalar hEnv = applyEnv ? m_envelope[bValue][1] : 0.; + double lEnv = applyEnv ? m_envelope[bValue][0] : 0.; + double hEnv = applyEnv ? m_envelope[bValue][1] : 0.; if (constrains(bValue)) { m_range[toUnderlying(bValue)].expand( rhs.range()[toUnderlying(bValue)].min() - lEnv, @@ -95,17 +95,17 @@ void Acts::Extent::addConstrain(const Acts::Extent& rhs, } } -void Acts::Extent::set(BinningValue bValue, ActsScalar min, ActsScalar max) { - ActsScalar minval = min; +void Acts::Extent::set(BinningValue bValue, double min, double max) { + double minval = min; if (bValue == BinningValue::binR && minval < 0.) { minval = 0.; } - m_range[toUnderlying(bValue)] = Range1D{minval, max}; + m_range[toUnderlying(bValue)] = Range1D{minval, max}; m_constrains.set(toUnderlying(bValue)); } -void Acts::Extent::setMin(BinningValue bValue, ActsScalar min) { - ActsScalar minval = min; +void Acts::Extent::setMin(BinningValue bValue, double min) { + double minval = min; if (bValue == BinningValue::binR && minval < 0.) { minval = 0.; } @@ -113,7 +113,7 @@ void Acts::Extent::setMin(BinningValue bValue, ActsScalar min) { m_constrains.set(toUnderlying(bValue)); } -void Acts::Extent::setMax(BinningValue bValue, ActsScalar max) { +void Acts::Extent::setMax(BinningValue bValue, double max) { m_range[toUnderlying(bValue)].setMax(0u, max); m_constrains.set(toUnderlying(bValue)); } @@ -126,7 +126,7 @@ bool Acts::Extent::contains(const Vector3& vtx) const { Extent checkExtent; for (const auto& bv : allBinningValues()) { if (constrains(bv)) { - ActsScalar vtxVal = VectorHelpers::cast(vtx, bv); + double vtxVal = VectorHelpers::cast(vtx, bv); checkExtent.set(bv, vtxVal, vtxVal); } } diff --git a/Core/src/Geometry/GridPortalLink.cpp b/Core/src/Geometry/GridPortalLink.cpp index 632289d9dc3..ae6168e11cf 100644 --- a/Core/src/Geometry/GridPortalLink.cpp +++ b/Core/src/Geometry/GridPortalLink.cpp @@ -24,20 +24,19 @@ std::unique_ptr GridPortalLink::make( dynamic_cast(surface.get()); cylinder != nullptr) { if (direction == BinningValue::binRPhi) { - ActsScalar r = cylinder->bounds().get(CylinderBounds::eR); + double r = cylinder->bounds().get(CylinderBounds::eR); if (cylinder->bounds().coversFullAzimuth()) { grid = GridPortalLink::make( surface, direction, Axis{AxisClosed, -std::numbers::pi * r, std::numbers::pi * r, 1}); } else { - ActsScalar hlPhi = - cylinder->bounds().get(CylinderBounds::eHalfPhiSector); + double hlPhi = cylinder->bounds().get(CylinderBounds::eHalfPhiSector); grid = GridPortalLink::make(surface, direction, Axis{AxisBound, -hlPhi * r, hlPhi * r, 1}); } } else if (direction == BinningValue::binZ) { - ActsScalar hlZ = cylinder->bounds().get(CylinderBounds::eHalfLengthZ); + double hlZ = cylinder->bounds().get(CylinderBounds::eHalfLengthZ); grid = GridPortalLink::make(surface, direction, Axis{AxisBound, -hlZ, hlZ, 1}); } else { @@ -47,8 +46,8 @@ std::unique_ptr GridPortalLink::make( disc != nullptr) { const auto& bounds = dynamic_cast(disc->bounds()); if (direction == BinningValue::binR) { - ActsScalar minR = bounds.get(RadialBounds::eMinR); - ActsScalar maxR = bounds.get(RadialBounds::eMaxR); + double minR = bounds.get(RadialBounds::eMinR); + double maxR = bounds.get(RadialBounds::eMaxR); grid = GridPortalLink::make(surface, direction, Axis{AxisBound, minR, maxR, 1}); } else if (direction == BinningValue::binPhi) { @@ -57,7 +56,7 @@ std::unique_ptr GridPortalLink::make( surface, direction, Axis{AxisClosed, -std::numbers::pi, std::numbers::pi, 1}); } else { - ActsScalar hlPhi = bounds.get(RadialBounds::eHalfPhiSector); + double hlPhi = bounds.get(RadialBounds::eHalfPhiSector); grid = GridPortalLink::make(surface, direction, Axis{AxisBound, -hlPhi, hlPhi, 1}); } @@ -90,7 +89,7 @@ void GridPortalLink::checkConsistency(const CylinderSurface& cyl) const { auto same = [](auto a, auto b) { return std::abs(a - b) < tolerance; }; auto checkZ = [&cyl, same](const IAxis& axis) { - ActsScalar hlZ = cyl.bounds().get(CylinderBounds::eHalfLengthZ); + double hlZ = cyl.bounds().get(CylinderBounds::eHalfLengthZ); if (!same(axis.getMin(), -hlZ) || !same(axis.getMax(), hlZ)) { throw std::invalid_argument( "GridPortalLink: CylinderBounds: invalid length setup: " + @@ -100,9 +99,9 @@ void GridPortalLink::checkConsistency(const CylinderSurface& cyl) const { } }; auto checkRPhi = [&cyl, same](const IAxis& axis) { - ActsScalar hlPhi = cyl.bounds().get(CylinderBounds::eHalfPhiSector); - ActsScalar r = cyl.bounds().get(CylinderBounds::eR); - if (ActsScalar hlRPhi = r * hlPhi; + double hlPhi = cyl.bounds().get(CylinderBounds::eHalfPhiSector); + double r = cyl.bounds().get(CylinderBounds::eR); + if (double hlRPhi = r * hlPhi; !same(axis.getMin(), -hlRPhi) || !same(axis.getMax(), hlRPhi)) { throw std::invalid_argument( "GridPortalLink: CylinderBounds: invalid phi sector setup: axes " @@ -157,8 +156,8 @@ void GridPortalLink::checkConsistency(const DiscSurface& disc) const { } auto checkR = [&bounds, same](const IAxis& axis) { - ActsScalar minR = bounds->get(RadialBounds::eMinR); - ActsScalar maxR = bounds->get(RadialBounds::eMaxR); + double minR = bounds->get(RadialBounds::eMinR); + double maxR = bounds->get(RadialBounds::eMaxR); if (!same(axis.getMin(), minR) || !same(axis.getMax(), maxR)) { throw std::invalid_argument( "GridPortalLink: DiscBounds: invalid radius setup."); @@ -166,7 +165,7 @@ void GridPortalLink::checkConsistency(const DiscSurface& disc) const { }; auto checkPhi = [&bounds, same](const IAxis& axis) { - ActsScalar hlPhi = bounds->get(RadialBounds::eHalfPhiSector); + double hlPhi = bounds->get(RadialBounds::eHalfPhiSector); if (!same(axis.getMin(), -hlPhi) || !same(axis.getMax(), hlPhi)) { throw std::invalid_argument( "GridPortalLink: DiscBounds: invalid phi sector setup."); @@ -322,7 +321,7 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( if (direction() == BinningValue::binRPhi) { const auto& axisRPhi = *grid().axes().front(); // 1D direction is binRPhi, so add a Z axis - ActsScalar hlZ = surface->bounds().get(CylinderBounds::eHalfLengthZ); + double hlZ = surface->bounds().get(CylinderBounds::eHalfLengthZ); auto grid = axisRPhi.visit([&](const auto& axis0) { Axis axisZ{AxisBound, -hlZ, hlZ, 1}; @@ -340,9 +339,9 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( } else { const auto& axisZ = *grid().axes().front(); // 1D direction is binZ, so add an rPhi axis - ActsScalar r = surface->bounds().get(CylinderBounds::eR); - ActsScalar hlPhi = surface->bounds().get(CylinderBounds::eHalfPhiSector); - ActsScalar hlRPhi = r * hlPhi; + double r = surface->bounds().get(CylinderBounds::eR); + double hlPhi = surface->bounds().get(CylinderBounds::eHalfPhiSector); + double hlRPhi = r * hlPhi; auto makeGrid = [&](auto bdt) { auto grid = axisZ.visit([&](const auto& axis1) { @@ -379,7 +378,7 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( if (direction() == BinningValue::binR) { const auto& axisR = *grid().axes().front(); // 1D direction is binR, so add a phi axis - ActsScalar hlPhi = bounds->get(RadialBounds::eHalfPhiSector); + double hlPhi = bounds->get(RadialBounds::eHalfPhiSector); auto makeGrid = [&](auto bdt) { auto grid = axisR.visit([&](const auto& axis0) { @@ -403,8 +402,8 @@ std::unique_ptr GridPortalLink::extendTo2dImpl( } else { const auto& axisPhi = *grid().axes().front(); // 1D direction is binPhi, so add an R axis - ActsScalar rMin = bounds->get(RadialBounds::eMinR); - ActsScalar rMax = bounds->get(RadialBounds::eMaxR); + double rMin = bounds->get(RadialBounds::eMinR); + double rMax = bounds->get(RadialBounds::eMaxR); auto grid = axisPhi.visit([&](const auto& axis1) { Axis axisR{AxisBound, rMin, rMax, 1}; diff --git a/Core/src/Geometry/GridPortalLinkMerging.cpp b/Core/src/Geometry/GridPortalLinkMerging.cpp index 1a828e71176..f475822876b 100644 --- a/Core/src/Geometry/GridPortalLinkMerging.cpp +++ b/Core/src/Geometry/GridPortalLinkMerging.cpp @@ -88,14 +88,14 @@ std::unique_ptr makeGrid( std::unique_ptr mergeVariable( const std::shared_ptr& mergedSurface, const IAxis& axisA, - const IAxis& axisB, ActsScalar /*tolerance*/, BinningValue direction, + const IAxis& axisB, double /*tolerance*/, BinningValue direction, const Logger& logger, const IAxis* otherAxis, bool prepend) { ACTS_VERBOSE("Variable merge: direction is " << direction); ACTS_VERBOSE("~> axis a: " << axisA); ACTS_VERBOSE("~> axis b: " << axisB); - std::vector binEdges; + std::vector binEdges; binEdges.reserve(axisA.getNBins() + axisB.getNBins() + 1); @@ -107,23 +107,23 @@ std::unique_ptr mergeVariable( } else { ACTS_VERBOSE("Performing symmetrized merge"); - ActsScalar halfWidth = + double halfWidth = (axisA.getMax() - axisA.getMin() + axisB.getMax() - axisB.getMin()) / 2.0; ACTS_VERBOSE(" ~> half width: " << halfWidth); - ActsScalar shift = axisA.getMax() - halfWidth; + double shift = axisA.getMax() - halfWidth; ACTS_VERBOSE(" ~> shift: " << shift); std::ranges::transform(edgesA, std::back_inserter(binEdges), - [&](ActsScalar edge) { return edge + shift; }); + [&](double edge) { return edge + shift; }); } - ActsScalar stitchPoint = binEdges.back(); + double stitchPoint = binEdges.back(); auto edgesB = axisB.getBinEdges(); std::transform( std::next(edgesB.begin()), edgesB.end(), std::back_inserter(binEdges), - [&](ActsScalar edge) { return edge - axisB.getMin() + stitchPoint; }); + [&](double edge) { return edge - axisB.getMin() + stitchPoint; }); return makeGrid(mergedSurface, direction, logger, std::tuple{std::move(binEdges)}, otherAxis, prepend); @@ -131,25 +131,25 @@ std::unique_ptr mergeVariable( std::unique_ptr mergeEquidistant( const std::shared_ptr& mergedSurface, const IAxis& axisA, - const IAxis& axisB, ActsScalar tolerance, BinningValue direction, + const IAxis& axisB, double tolerance, BinningValue direction, const Logger& logger, const IAxis* otherAxis, bool prepend) { ACTS_VERBOSE("===> potentially equidistant merge: checking bin widths"); ACTS_VERBOSE("~> axis a: " << axisA); ACTS_VERBOSE("~> axis b: " << axisB); - ActsScalar binsWidthA = (axisA.getMax() - axisA.getMin()) / - static_cast(axisA.getNBins()); - ActsScalar binsWidthB = (axisB.getMax() - axisB.getMin()) / - static_cast(axisB.getNBins()); + double binsWidthA = + (axisA.getMax() - axisA.getMin()) / static_cast(axisA.getNBins()); + double binsWidthB = + (axisB.getMax() - axisB.getMin()) / static_cast(axisB.getNBins()); ACTS_VERBOSE(" ~> binWidths: " << binsWidthA << " vs " << binsWidthB); if (std::abs(binsWidthA - binsWidthB) < tolerance) { ACTS_VERBOSE("==> binWidths same: " << binsWidthA); - ActsScalar min = std::numeric_limits::signaling_NaN(); - ActsScalar max = std::numeric_limits::signaling_NaN(); + double min = std::numeric_limits::signaling_NaN(); + double max = std::numeric_limits::signaling_NaN(); if (direction == BinningValue::binR) { ACTS_VERBOSE("Performing asymmetric merge"); @@ -158,7 +158,7 @@ std::unique_ptr mergeEquidistant( } else { ACTS_VERBOSE("Performing symmetrized merge"); - ActsScalar halfWidth = + double halfWidth = (axisA.getMax() - axisA.getMin() + axisB.getMax() - axisB.getMin()) / 2.0; @@ -183,7 +183,7 @@ std::unique_ptr mergeEquidistant( std::unique_ptr colinearMerge( const std::shared_ptr& mergedSurface, const IAxis& axisA, - const IAxis& axisB, ActsScalar tolerance, BinningValue direction, + const IAxis& axisB, double tolerance, BinningValue direction, const Logger& logger, const IAxis* otherAxis, bool prepend) { AxisType aType = axisA.getType(); AxisType bType = axisB.getType(); diff --git a/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp b/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp index 75e2d50d4fa..c0a45763372 100644 --- a/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp +++ b/Core/src/Geometry/KDTreeTrackingGeometryBuilder.cpp @@ -45,16 +45,16 @@ std::unique_ptr Acts::KDTreeTrackingGeometryBuilder::trackingGeometry( const GeometryContext& gctx) const { using MeasuredSurface = - std::pair, std::shared_ptr>; + std::pair, std::shared_ptr>; // Prepare all the surfaces std::vector surfacesMeasured; surfacesMeasured.reserve(m_cfg.surfaces.size()); for (auto& s : m_cfg.surfaces) { auto ext = s->polyhedronRepresentation(gctx, 1u).extent(); - surfacesMeasured.push_back(MeasuredSurface{ - std::array{ext.medium(BinningValue::binZ), - ext.medium(BinningValue::binR)}, - s}); + surfacesMeasured.push_back( + MeasuredSurface{std::array{ext.medium(BinningValue::binZ), + ext.medium(BinningValue::binR)}, + s}); } // Create the KDTree @@ -157,7 +157,7 @@ Acts::KDTreeTrackingGeometryBuilder::translateLayer( auto& its = plVolume.internal.value(); // Try to pull from the kd tree - RangeXD<2u, ActsScalar> zrRange; + RangeXD<2u, double> zrRange; zrRange[0u] = plVolume.extent.range(Acts::BinningValue::binZ); zrRange[1u] = plVolume.extent.range(Acts::BinningValue::binR); diff --git a/Core/src/Geometry/TrapezoidVolumeBounds.cpp b/Core/src/Geometry/TrapezoidVolumeBounds.cpp index 96d682a35dc..f03af8c85c0 100644 --- a/Core/src/Geometry/TrapezoidVolumeBounds.cpp +++ b/Core/src/Geometry/TrapezoidVolumeBounds.cpp @@ -23,9 +23,8 @@ namespace Acts { -TrapezoidVolumeBounds::TrapezoidVolumeBounds(ActsScalar minhalex, - ActsScalar maxhalex, - ActsScalar haley, ActsScalar halez) +TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double maxhalex, + double haley, double halez) : VolumeBounds() { m_values[eHalfLengthXnegY] = minhalex; m_values[eHalfLengthXposY] = maxhalex; @@ -37,9 +36,9 @@ TrapezoidVolumeBounds::TrapezoidVolumeBounds(ActsScalar minhalex, buildSurfaceBounds(); } -TrapezoidVolumeBounds::TrapezoidVolumeBounds(ActsScalar minhalex, - ActsScalar haley, ActsScalar halez, - ActsScalar alpha, ActsScalar beta) +TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double haley, + double halez, double alpha, + double beta) : VolumeBounds() { m_values[eHalfLengthXnegY] = minhalex; m_values[eHalfLengthY] = haley; @@ -47,8 +46,8 @@ TrapezoidVolumeBounds::TrapezoidVolumeBounds(ActsScalar minhalex, m_values[eAlpha] = alpha; m_values[eBeta] = beta; // now calculate the remaining max half X - ActsScalar gamma = (alpha > beta) ? (alpha - std::numbers::pi / 2.) - : (beta - std::numbers::pi / 2.); + double gamma = (alpha > beta) ? (alpha - std::numbers::pi / 2.) + : (beta - std::numbers::pi / 2.); m_values[eHalfLengthXposY] = minhalex + (2. * haley) * tan(gamma); checkConsistency(); @@ -78,9 +77,9 @@ std::vector TrapezoidVolumeBounds::orientedSurfaces( oSurfaces.push_back( OrientedSurface{std::move(sf), Direction::OppositeNormal}); - ActsScalar poshOffset = get(eHalfLengthY) / std::tan(get(eAlpha)); - ActsScalar neghOffset = get(eHalfLengthY) / std::tan(get(eBeta)); - ActsScalar topShift = poshOffset + neghOffset; + double poshOffset = get(eHalfLengthY) / std::tan(get(eAlpha)); + double neghOffset = get(eHalfLengthY) / std::tan(get(eBeta)); + double topShift = poshOffset + neghOffset; // Face surfaces yz // (3) - At point B, attached to beta opening angle @@ -141,7 +140,7 @@ void TrapezoidVolumeBounds::buildSurfaceBounds() { get(eHalfLengthZ), get(eHalfLengthXposY)); } -bool TrapezoidVolumeBounds::inside(const Vector3& pos, ActsScalar tol) const { +bool TrapezoidVolumeBounds::inside(const Vector3& pos, double tol) const { if (std::abs(pos.z()) > get(eHalfLengthZ) + tol) { return false; } @@ -168,10 +167,10 @@ std::ostream& TrapezoidVolumeBounds::toStream(std::ostream& os) const { Volume::BoundingBox TrapezoidVolumeBounds::boundingBox( const Transform3* trf, const Vector3& envelope, const Volume* entity) const { - ActsScalar minx = get(eHalfLengthXnegY); - ActsScalar maxx = get(eHalfLengthXposY); - ActsScalar haley = get(eHalfLengthY); - ActsScalar halez = get(eHalfLengthZ); + double minx = get(eHalfLengthXnegY); + double maxx = get(eHalfLengthXposY); + double haley = get(eHalfLengthY); + double halez = get(eHalfLengthZ); std::array vertices = {{{-minx, -haley, -halez}, {+minx, -haley, -halez}, @@ -199,8 +198,8 @@ Volume::BoundingBox TrapezoidVolumeBounds::boundingBox( return {entity, vmin - envelope, vmax + envelope}; } -std::vector TrapezoidVolumeBounds::values() const { - std::vector valvector; +std::vector TrapezoidVolumeBounds::values() const { + std::vector valvector; valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); return valvector; } diff --git a/Core/src/Geometry/Volume.cpp b/Core/src/Geometry/Volume.cpp index 97a026b039f..7aac6f8b9d6 100644 --- a/Core/src/Geometry/Volume.cpp +++ b/Core/src/Geometry/Volume.cpp @@ -55,7 +55,7 @@ Volume& Volume::operator=(const Volume& vol) { return *this; } -bool Volume::inside(const Vector3& gpos, ActsScalar tol) const { +bool Volume::inside(const Vector3& gpos, double tol) const { Vector3 posInVolFrame((transform().inverse()) * gpos); return (volumeBounds()).inside(posInVolFrame, tol); } diff --git a/Core/src/Material/MaterialInteractionAssignment.cpp b/Core/src/Material/MaterialInteractionAssignment.cpp index 8d4b4b0ac60..32e93bcef1a 100644 --- a/Core/src/Material/MaterialInteractionAssignment.cpp +++ b/Core/src/Material/MaterialInteractionAssignment.cpp @@ -49,7 +49,7 @@ Acts::MaterialInteractionAssignment::assign( // Walk along the sorted intersections auto [cSurface, cPosition, cDirection] = intersectedSurfaces[is]; - ActsScalar cDistance = (cPosition - materialInteraction.position).norm(); + double cDistance = (cPosition - materialInteraction.position).norm(); // Peak forward to check if you have a closer intersection while ( @@ -57,9 +57,9 @@ Acts::MaterialInteractionAssignment::assign( (((intersectedSurfaces[is + 1]).position - materialInteraction.position) .norm() < cDistance)) { // Recalculate the new distance - ActsScalar nDistance = ((intersectedSurfaces[is + 1]).position - - materialInteraction.position) - .norm(); + double nDistance = ((intersectedSurfaces[is + 1]).position - + materialInteraction.position) + .norm(); ++is; cDistance = nDistance; } @@ -68,8 +68,7 @@ Acts::MaterialInteractionAssignment::assign( auto [surface, position, direction] = intersectedSurfaces[is]; // Calculate the path correction - ActsScalar pathCorrection = - surface->pathCorrection(gctx, position, direction); + double pathCorrection = surface->pathCorrection(gctx, position, direction); // A local veta veto kicked in GeometryIdentifier intersectionID = surface->geometryId(); diff --git a/Core/src/Navigation/NavigationStream.cpp b/Core/src/Navigation/NavigationStream.cpp index c36eed12bbe..3ea28dd748c 100644 --- a/Core/src/Navigation/NavigationStream.cpp +++ b/Core/src/Navigation/NavigationStream.cpp @@ -18,7 +18,7 @@ namespace Acts { bool NavigationStream::initialize(const GeometryContext& gctx, const QueryPoint& queryPoint, const BoundaryTolerance& cTolerance, - ActsScalar onSurfaceTolerance) { + double onSurfaceTolerance) { // Position and direction from the query point const Vector3& position = queryPoint.position; const Vector3& direction = queryPoint.direction; @@ -95,7 +95,7 @@ bool NavigationStream::initialize(const GeometryContext& gctx, bool NavigationStream::update(const GeometryContext& gctx, const QueryPoint& queryPoint, - ActsScalar onSurfaceTolerance) { + double onSurfaceTolerance) { // Loop over the (currently valid) candidates and update for (; m_currentIndex < m_candidates.size(); ++m_currentIndex) { // Get the candidate, and resolve the tuple diff --git a/Core/src/Seeding/EstimateTrackParamsFromSeed.cpp b/Core/src/Seeding/EstimateTrackParamsFromSeed.cpp index b071d5dd7e6..6d11d82e124 100644 --- a/Core/src/Seeding/EstimateTrackParamsFromSeed.cpp +++ b/Core/src/Seeding/EstimateTrackParamsFromSeed.cpp @@ -48,27 +48,27 @@ Acts::FreeVector Acts::estimateTrackParamsFromSeed(const Vector3& sp0, Vector2 circleCenter; circleCenter(0) = 0.5 * local1(0); - ActsScalar deltaX21 = local2(0) - local1(0); - ActsScalar sumX21 = local2(0) + local1(0); + double deltaX21 = local2(0) - local1(0); + double sumX21 = local2(0) + local1(0); // straight line connecting the two points // y = a * x + c (we don't care about c right now) // we simply need the slope // we compute 1./a since this is what we need for the following computation - ActsScalar ia = deltaX21 / local2(1); + double ia = deltaX21 / local2(1); // Perpendicular line is then y = -1/a *x + b // we can evaluate b given we know a already by imposing // the line passes through P = (0.5 * (x2 + x1), 0.5 * y2) - ActsScalar b = 0.5 * (local2(1) + ia * sumX21); + double b = 0.5 * (local2(1) + ia * sumX21); circleCenter(1) = -ia * circleCenter(0) + b; // Radius is a signed distance between circleCenter and first sp, which is at // (0, 0) in the new frame. Sign depends on the slope a (positive vs negative) int sign = ia > 0 ? -1 : 1; - const ActsScalar R = circleCenter.norm(); - ActsScalar invTanTheta = + const double R = circleCenter.norm(); + double invTanTheta = local2.z() / (2 * R * std::asin(local2.head<2>().norm() / (2 * R))); // The momentum direction in the new frame (the center of the circle has the // coordinate (-1.*A/(2*B), 1./(2*B))) - ActsScalar A = -circleCenter(0) / circleCenter(1); + double A = -circleCenter(0) / circleCenter(1); Vector3 transDirection(1., A, fastHypot(1, A) * invTanTheta); // Transform it back to the original frame Vector3 direction = rotation * transDirection.normalized(); @@ -84,7 +84,7 @@ Acts::FreeVector Acts::estimateTrackParamsFromSeed(const Vector3& sp0, // The estimated q/pt in [GeV/c]^-1 (note that the pt is the projection of // momentum on the transverse plane of the new frame) - ActsScalar qOverPt = sign / (bField.norm() * R); + double qOverPt = sign / (bField.norm() * R); // The estimated q/p in [GeV/c]^-1 params[eFreeQOverP] = qOverPt / fastHypot(1., invTanTheta); diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 34c7b5c468b..593184816ac 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -107,11 +107,11 @@ std::vector Acts::AnnulusBounds::vertices( if (quarterSegments > 0u) { using VectorHelpers::phi; - ActsScalar phiMinInner = phi(m_inRightStripXY - m_moduleOrigin); - ActsScalar phiMaxInner = phi(m_inLeftStripXY - m_moduleOrigin); + double phiMinInner = phi(m_inRightStripXY - m_moduleOrigin); + double phiMaxInner = phi(m_inLeftStripXY - m_moduleOrigin); - ActsScalar phiMinOuter = phi(m_outRightStripXY - m_moduleOrigin); - ActsScalar phiMaxOuter = phi(m_outLeftStripXY - m_moduleOrigin); + double phiMinOuter = phi(m_outRightStripXY - m_moduleOrigin); + double phiMaxOuter = phi(m_outLeftStripXY - m_moduleOrigin); // Inner bow from phi_min -> phi_max (needs to be reversed) std::vector rvertices = @@ -355,10 +355,7 @@ Acts::Vector2 Acts::AnnulusBounds::closestOnSegment( // weighted scalar product of line to point and segment line auto u = ((p - a).transpose() * weight * n).value() / f; // clamp to [0, 1], convert to point - return std::min(std::max(u, static_cast(0)), - static_cast(1)) * - n + - a; + return std::min(std::max(u, 0.), 1.) * n + a; } double Acts::AnnulusBounds::squaredNorm(const Vector2& v, @@ -367,7 +364,7 @@ double Acts::AnnulusBounds::squaredNorm(const Vector2& v, } Acts::Vector2 Acts::AnnulusBounds::moduleOrigin() const { - return Eigen::Rotation2D(get(eAveragePhi)) * m_moduleOrigin; + return Eigen::Rotation2D(get(eAveragePhi)) * m_moduleOrigin; } // Ostream operator overload diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 0ad869f2a4e..5dddd1527bf 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -189,8 +189,8 @@ Acts::Polyhedron Acts::ConeSurface::polyhedronRepresentation( std::vector vertices; std::vector faces; std::vector triangularMesh; - ActsScalar minZ = bounds().get(ConeBounds::eMinZ); - ActsScalar maxZ = bounds().get(ConeBounds::eMaxZ); + double minZ = bounds().get(ConeBounds::eMinZ); + double maxZ = bounds().get(ConeBounds::eMaxZ); if (minZ == -std::numeric_limits::infinity() || maxZ == std::numeric_limits::infinity()) { @@ -208,15 +208,15 @@ Acts::Polyhedron Acts::ConeSurface::polyhedronRepresentation( } // Cone parameters - ActsScalar hPhiSec = bounds().get(ConeBounds::eHalfPhiSector); - ActsScalar avgPhi = bounds().get(ConeBounds::eAveragePhi); - std::vector refPhi = {}; - if (bool fullCone = (hPhiSec == std::numbers::pi_v); !fullCone) { + double hPhiSec = bounds().get(ConeBounds::eHalfPhiSector); + double avgPhi = bounds().get(ConeBounds::eAveragePhi); + std::vector refPhi = {}; + if (bool fullCone = (hPhiSec == std::numbers::pi); !fullCone) { refPhi = {avgPhi}; } // Add the cone sizes - std::vector coneSides; + std::vector coneSides; if (std::abs(minZ) > s_onSurfaceTolerance) { coneSides.push_back(minZ); } @@ -284,7 +284,7 @@ Acts::detail::RealQuadraticEquation Acts::ConeSurface::intersectionSolver( Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, - ActsScalar tolerance) const { + double tolerance) const { // Solve the quadratic equation auto qe = intersectionSolver(gctx, position, direction); @@ -301,7 +301,7 @@ Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( if (!boundaryTolerance.isInfinite() && !isOnSurface(gctx, solution1, direction, boundaryTolerance)) { - status1 = IntersectionStatus::missed; + status1 = IntersectionStatus::unreachable; } // Check the validity of the second solution @@ -311,7 +311,7 @@ Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( : IntersectionStatus::reachable; if (!boundaryTolerance.isInfinite() && !isOnSurface(gctx, solution2, direction, boundaryTolerance)) { - status2 = IntersectionStatus::missed; + status2 = IntersectionStatus::unreachable; } const auto& tf = transform(gctx); diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index 82f809c6c5b..c538b5c170b 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -112,9 +112,9 @@ std::vector Acts::CylinderBounds::circleVertices( double avgPhi = get(eAveragePhi); double halfPhi = get(eHalfPhiSector); - std::vector phiRef = {}; + std::vector phiRef = {}; if (bool fullCylinder = coversFullAzimuth(); fullCylinder) { - phiRef = {static_cast(avgPhi)}; + phiRef = {avgPhi}; } // Write the two bows/circles on either side @@ -127,13 +127,13 @@ std::vector Acts::CylinderBounds::circleVertices( vertices.insert(vertices.end(), svertices.begin(), svertices.end()); } - ActsScalar bevelMinZ = get(eBevelMinZ); - ActsScalar bevelMaxZ = get(eBevelMaxZ); + double bevelMinZ = get(eBevelMinZ); + double 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; - ActsScalar mult{1}; + double mult{1}; auto invTransform = transform.inverse(); auto func = [&mult, &transform, &invTransform](Vector3& v) { v = invTransform * v; diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index d34726c2a7f..23bb74e49f8 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -230,7 +230,7 @@ Acts::detail::RealQuadraticEquation Acts::CylinderSurface::intersectionSolver( Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, - ActsScalar tolerance) const { + double tolerance) const { const auto& gctxTransform = transform(gctx); // Solve the quadratic equation @@ -265,11 +265,12 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( double cZ = vecLocal.dot(tMatrix.block<3, 1>(0, 2)); double modifiedTolerance = tolerance + absoluteBound->tolerance1; double hZ = cBounds.get(CylinderBounds::eHalfLengthZ) + modifiedTolerance; - return std::abs(cZ) < std::abs(hZ) ? status : IntersectionStatus::missed; + return std::abs(cZ) < std::abs(hZ) ? status + : IntersectionStatus::unreachable; } return isOnSurface(gctx, solution, direction, boundaryTolerance) ? status - : IntersectionStatus::missed; + : IntersectionStatus::unreachable; }; // Check first solution for boundary compatibility status1 = boundaryCheck(solution1, status1); @@ -428,7 +429,7 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, "CylinderSurface::merge: surfaces have different radii"); } - ActsScalar r = bounds().get(CylinderBounds::eR); + double r = bounds().get(CylinderBounds::eR); // no translation in x/z is allowed Vector3 translation = otherLocal.translation(); @@ -442,20 +443,20 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, "CylinderSurface::merge: surfaces have relative translation in x/y"); } - ActsScalar hlZ = bounds().get(CylinderBounds::eHalfLengthZ); - ActsScalar minZ = -hlZ; - ActsScalar maxZ = hlZ; + double hlZ = bounds().get(CylinderBounds::eHalfLengthZ); + double minZ = -hlZ; + double maxZ = hlZ; - ActsScalar zShift = translation[2]; - ActsScalar otherHlZ = other.bounds().get(CylinderBounds::eHalfLengthZ); - ActsScalar otherMinZ = -otherHlZ + zShift; - ActsScalar otherMaxZ = otherHlZ + zShift; + double zShift = translation[2]; + double otherHlZ = other.bounds().get(CylinderBounds::eHalfLengthZ); + double otherMinZ = -otherHlZ + zShift; + double otherMaxZ = otherHlZ + zShift; - ActsScalar hlPhi = bounds().get(CylinderBounds::eHalfPhiSector); - ActsScalar avgPhi = bounds().get(CylinderBounds::eAveragePhi); + double hlPhi = bounds().get(CylinderBounds::eHalfPhiSector); + double avgPhi = bounds().get(CylinderBounds::eAveragePhi); - ActsScalar otherHlPhi = other.bounds().get(CylinderBounds::eHalfPhiSector); - ActsScalar otherAvgPhi = other.bounds().get(CylinderBounds::eAveragePhi); + double otherHlPhi = other.bounds().get(CylinderBounds::eHalfPhiSector); + double otherAvgPhi = other.bounds().get(CylinderBounds::eAveragePhi); if (direction == Acts::BinningValue::binZ) { // z shift must match the bounds @@ -489,10 +490,10 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, "different phi sectors"); } - ActsScalar newMaxZ = std::max(maxZ, otherMaxZ); - ActsScalar newMinZ = std::min(minZ, otherMinZ); - ActsScalar newHlZ = (newMaxZ - newMinZ) / 2.0; - ActsScalar newMidZ = (newMaxZ + newMinZ) / 2.0; + double newMaxZ = std::max(maxZ, otherMaxZ); + double newMinZ = std::min(minZ, otherMinZ); + double newHlZ = (newMaxZ - newMinZ) / 2.0; + double newMidZ = (newMaxZ + newMinZ) / 2.0; ACTS_VERBOSE("merged: [" << newMinZ << ", " << newMaxZ << "] ~> " << newMidZ << " +- " << newHlZ); @@ -524,7 +525,7 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, // Figure out signed relative rotation Vector2 rotatedX = otherLocal.linear().col(eX).head<2>(); - ActsScalar zrotation = std::atan2(rotatedX[1], rotatedX[0]); + double zrotation = std::atan2(rotatedX[1], rotatedX[0]); ACTS_VERBOSE("this: [" << avgPhi / 1_degree << " +- " << hlPhi / 1_degree << "]"); @@ -533,7 +534,7 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, ACTS_VERBOSE("Relative rotation around local z: " << zrotation / 1_degree); - ActsScalar prevOtherAvgPhi = otherAvgPhi; + double prevOtherAvgPhi = otherAvgPhi; otherAvgPhi = detail::radian_sym(otherAvgPhi + zrotation); ACTS_VERBOSE("~> local other average phi: " << otherAvgPhi / 1_degree diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index 9e957346965..ac3c188fd7d 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -278,7 +278,7 @@ Acts::FreeToBoundMatrix Acts::DiscSurface::freeToBoundJacobian( Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, - ActsScalar tolerance) const { + double tolerance) const { // Get the contextual transform auto gctxTransform = transform(gctx); // Use the intersection helper for planar surfaces @@ -297,11 +297,11 @@ Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( double modifiedTolerance = tolerance + absoluteBound->tolerance0; if (!m_bounds->insideRadialBounds(VectorHelpers::perp(lcartesian), modifiedTolerance)) { - status = IntersectionStatus::missed; + status = IntersectionStatus::unreachable; } } else if (!insideBounds(localCartesianToPolar(lcartesian), boundaryTolerance)) { - status = IntersectionStatus::missed; + status = IntersectionStatus::unreachable; } } return {{Intersection3D(intersection.position(), intersection.pathLength(), @@ -425,25 +425,25 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, "DiscSurface::merge: surfaces have bounds other than radial"); } - ActsScalar minR = bounds->get(RadialBounds::eMinR); - ActsScalar maxR = bounds->get(RadialBounds::eMaxR); + double minR = bounds->get(RadialBounds::eMinR); + double maxR = bounds->get(RadialBounds::eMaxR); - ActsScalar hlPhi = bounds->get(RadialBounds::eHalfPhiSector); - ActsScalar avgPhi = bounds->get(RadialBounds::eAveragePhi); - ActsScalar minPhi = detail::radian_sym(-hlPhi + avgPhi); - ActsScalar maxPhi = detail::radian_sym(hlPhi + avgPhi); + double hlPhi = bounds->get(RadialBounds::eHalfPhiSector); + double avgPhi = bounds->get(RadialBounds::eAveragePhi); + double minPhi = detail::radian_sym(-hlPhi + avgPhi); + double maxPhi = detail::radian_sym(hlPhi + avgPhi); ACTS_VERBOSE(" this: r = [" << minR << ", " << maxR << "]"); ACTS_VERBOSE(" phi = [" << minPhi / 1_degree << ", " << maxPhi / 1_degree << "] ~> " << avgPhi / 1_degree << " +- " << hlPhi / 1_degree); - ActsScalar otherMinR = otherBounds->get(RadialBounds::eMinR); - ActsScalar otherMaxR = otherBounds->get(RadialBounds::eMaxR); - ActsScalar otherAvgPhi = otherBounds->get(RadialBounds::eAveragePhi); - ActsScalar otherHlPhi = otherBounds->get(RadialBounds::eHalfPhiSector); - ActsScalar otherMinPhi = detail::radian_sym(-otherHlPhi + otherAvgPhi); - ActsScalar otherMaxPhi = detail::radian_sym(otherHlPhi + otherAvgPhi); + double otherMinR = otherBounds->get(RadialBounds::eMinR); + double otherMaxR = otherBounds->get(RadialBounds::eMaxR); + double otherAvgPhi = otherBounds->get(RadialBounds::eAveragePhi); + double otherHlPhi = otherBounds->get(RadialBounds::eHalfPhiSector); + double otherMinPhi = detail::radian_sym(-otherHlPhi + otherAvgPhi); + double otherMaxPhi = detail::radian_sym(otherHlPhi + otherAvgPhi); ACTS_VERBOSE("other: r = [" << otherMinR << ", " << otherMaxR << "]"); ACTS_VERBOSE(" phi = [" << otherMinPhi / 1_degree << ", " @@ -481,8 +481,8 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, "DiscSurface::merge: surfaces have different half phi sector"); } - ActsScalar newMinR = std::min(minR, otherMinR); - ActsScalar newMaxR = std::max(maxR, otherMaxR); + double newMinR = std::min(minR, otherMinR); + double newMaxR = std::max(maxR, otherMaxR); ACTS_VERBOSE(" new: r = [" << newMinR << ", " << newMaxR << "]"); auto newBounds = @@ -502,7 +502,7 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, // Figure out signed relative rotation Vector2 rotatedX = otherLocal.linear().col(eX).head<2>(); - ActsScalar zrotation = std::atan2(rotatedX[1], rotatedX[0]); + double zrotation = std::atan2(rotatedX[1], rotatedX[0]); ACTS_VERBOSE("this: [" << avgPhi / 1_degree << " +- " << hlPhi / 1_degree << "]"); @@ -511,7 +511,7 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, ACTS_VERBOSE("Relative rotation around local z: " << zrotation / 1_degree); - ActsScalar prevOtherAvgPhi = otherAvgPhi; + double prevOtherAvgPhi = otherAvgPhi; otherAvgPhi = detail::radian_sym(otherAvgPhi + zrotation); ACTS_VERBOSE("~> local other average phi: " << otherAvgPhi / 1_degree diff --git a/Core/src/Surfaces/IntersectionHelper2D.cpp b/Core/src/Surfaces/IntersectionHelper2D.cpp index c196b1a4131..458a54a2262 100644 --- a/Core/src/Surfaces/IntersectionHelper2D.cpp +++ b/Core/src/Surfaces/IntersectionHelper2D.cpp @@ -17,11 +17,11 @@ Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectSegment( const Vector2& s0, const Vector2& s1, const Vector2& origin, const Vector2& dir, bool boundCheck) { - using Line = Eigen::ParametrizedLine; - using Plane = Eigen::Hyperplane; + using Line = Eigen::ParametrizedLine; + using Plane = Eigen::Hyperplane; Vector2 edge(s1 - s0); - ActsScalar det = edge.x() * dir.y() - edge.y() * dir.x(); + double det = edge.x() * dir.y() - edge.y() * dir.x(); if (std::abs(det) < s_epsilon) { return Intersection2D::invalid(); } @@ -41,8 +41,7 @@ Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectSegment( } std::array -Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, - ActsScalar Ry, +Acts::detail::IntersectionHelper2D::intersectEllipse(double Rx, double Ry, const Vector2& origin, const Vector2& dir) { auto createSolution = @@ -51,8 +50,8 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, Vector2 toSolD(sol - origin); Vector2 toAltD(alt - origin); - ActsScalar solD = std::copysign(toSolD.norm(), toSolD.dot(dir)); - ActsScalar altD = std::copysign(toAltD.norm(), toAltD.dot(dir)); + double solD = std::copysign(toSolD.norm(), toSolD.dot(dir)); + double altD = std::copysign(toAltD.norm(), toAltD.dot(dir)); if (std::abs(solD) < std::abs(altD)) { return {Intersection2D(sol, solD, IntersectionStatus::reachable), @@ -64,10 +63,10 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, // Special cases first if (std::abs(dir.x()) < s_epsilon) { - ActsScalar solx = origin.x(); - ActsScalar D = 1. - solx * solx / (Rx * Rx); + double solx = origin.x(); + double D = 1. - solx * solx / (Rx * Rx); if (D > 0.) { - ActsScalar sqrtD = std::sqrt(D); + double sqrtD = std::sqrt(D); Vector2 sol(solx, Ry * sqrtD); Vector2 alt(solx, -Ry * sqrtD); return createSolution(sol, alt); @@ -78,10 +77,10 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, } return {Intersection2D::invalid(), Intersection2D::invalid()}; } else if (std::abs(dir.y()) < s_epsilon) { - ActsScalar soly = origin.y(); - ActsScalar D = 1. - soly * soly / (Ry * Ry); + double soly = origin.y(); + double D = 1. - soly * soly / (Ry * Ry); if (D > 0.) { - ActsScalar sqrtD = std::sqrt(D); + double sqrtD = std::sqrt(D); Vector2 sol(Rx * sqrtD, soly); Vector2 alt(-Rx * sqrtD, soly); return createSolution(sol, alt); @@ -93,23 +92,23 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, return {Intersection2D::invalid(), Intersection2D::invalid()}; } // General solution - ActsScalar k = dir.y() / dir.x(); - ActsScalar d = origin.y() - k * origin.x(); - ActsScalar Ry2 = Ry * Ry; - ActsScalar alpha = 1. / (Rx * Rx) + k * k / Ry2; - ActsScalar beta = 2. * k * d / Ry2; - ActsScalar gamma = d * d / Ry2 - 1; + double k = dir.y() / dir.x(); + double d = origin.y() - k * origin.x(); + double Ry2 = Ry * Ry; + double alpha = 1. / (Rx * Rx) + k * k / Ry2; + double beta = 2. * k * d / Ry2; + double gamma = d * d / Ry2 - 1; Acts::detail::RealQuadraticEquation solver(alpha, beta, gamma); if (solver.solutions == 1) { - ActsScalar x = solver.first; + double x = solver.first; Vector2 sol(x, k * x + d); Vector2 toSolD(sol - origin); - ActsScalar solD = std::copysign(toSolD.norm(), toSolD.dot(dir)); + double solD = std::copysign(toSolD.norm(), toSolD.dot(dir)); return {Intersection2D(sol, solD, IntersectionStatus::reachable), Intersection2D::invalid()}; } else if (solver.solutions > 1) { - ActsScalar x0 = solver.first; - ActsScalar x1 = solver.second; + double x0 = solver.first; + double x1 = solver.second; Vector2 sol(x0, k * x0 + d); Vector2 alt(x1, k * x1 + d); return createSolution(sol, alt); @@ -118,12 +117,12 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, } Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectCircleSegment( - ActsScalar R, ActsScalar phiMin, ActsScalar phiMax, const Vector2& origin, + double R, double phiMin, double phiMax, const Vector2& origin, const Vector2& dir) { auto intersections = intersectCircle(R, origin, dir); for (const auto& candidate : intersections) { if (candidate.pathLength() > 0.) { - ActsScalar phi = Acts::VectorHelpers::phi(candidate.position()); + double phi = Acts::VectorHelpers::phi(candidate.position()); if (phi > phiMin && phi < phiMax) { return candidate; } diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index 00d1fc6dd17..166a36bf630 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -149,7 +149,7 @@ const Acts::SurfaceBounds& Acts::LineSurface::bounds() const { Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, - ActsScalar tolerance) const { + double tolerance) const { // The nomenclature is following the header file and doxygen documentation const Vector3& ma = position; @@ -185,7 +185,7 @@ Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( double cZ = vecLocal.dot(eb); double cR = (vecLocal - cZ * eb).norm(); if (!m_bounds->inside({cR, cZ}, boundaryTolerance)) { - status = IntersectionStatus::missed; + status = IntersectionStatus::unreachable; } } diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index db21709a192..b4ebb77956c 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -160,7 +160,7 @@ double Acts::PlaneSurface::pathCorrection(const GeometryContext& gctx, Acts::SurfaceMultiIntersection Acts::PlaneSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, - ActsScalar tolerance) const { + double tolerance) const { // Get the contextual transform const auto& gctxTransform = transform(gctx); // Use the intersection helper for planar surfaces @@ -175,7 +175,7 @@ Acts::SurfaceMultiIntersection Acts::PlaneSurface::intersect( const Vector3 vecLocal(intersection.position() - tMatrix.block<3, 1>(0, 3)); if (!insideBounds(tMatrix.block<3, 2>(0, 0).transpose() * vecLocal, boundaryTolerance)) { - status = IntersectionStatus::missed; + status = IntersectionStatus::unreachable; } } return {{Intersection3D(intersection.position(), intersection.pathLength(), diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index cadef176cda..0fbfe6bc982 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -314,7 +314,7 @@ Acts::FreeToPathMatrix Acts::Surface::freeToPathDerivative( // The measurement frame z axis const Vector3 refZAxis = rframe.col(2); // Cosine of angle between momentum direction and measurement frame z axis - const ActsScalar dz = refZAxis.dot(direction); + const double dz = refZAxis.dot(direction); // Initialize the derivative FreeToPathMatrix freeToPath = FreeToPathMatrix::Zero(); freeToPath.segment<3>(eFreePos0) = -1.0 * refZAxis.transpose() / dz; diff --git a/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp b/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp index 47cb4e2e9a6..b46bfaf5b8a 100644 --- a/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp +++ b/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp @@ -16,7 +16,7 @@ std::tuple, Acts::Transform3> Acts::detail::AnnulusBoundsHelper::create(const Transform3& transform, - ActsScalar rMin, ActsScalar rMax, + double rMin, double rMax, std::vector vertices) { using Line2D = Eigen::Hyperplane; diff --git a/Core/src/Surfaces/detail/MergeHelper.cpp b/Core/src/Surfaces/detail/MergeHelper.cpp index 414e5761686..ca394efd4e8 100644 --- a/Core/src/Surfaces/detail/MergeHelper.cpp +++ b/Core/src/Surfaces/detail/MergeHelper.cpp @@ -12,9 +12,10 @@ namespace Acts::detail { -std::tuple mergedPhiSector( - ActsScalar hlPhi1, ActsScalar avgPhi1, ActsScalar hlPhi2, - ActsScalar avgPhi2, const Logger& logger, ActsScalar tolerance) { +std::tuple mergedPhiSector(double hlPhi1, double avgPhi1, + double hlPhi2, double avgPhi2, + const Logger& logger, + double tolerance) { using namespace Acts::UnitLiterals; if (std::abs(hlPhi1 - std::numbers::pi / 2.) < tolerance && @@ -33,8 +34,8 @@ std::tuple mergedPhiSector( "Phi sectors cover half a circle but are not opposite"); } - ActsScalar newAvgPhi = detail::radian_sym(avgPhi1 + std::numbers::pi / 2.); - ActsScalar newHlPhi = std::numbers::pi; + double newAvgPhi = detail::radian_sym(avgPhi1 + std::numbers::pi / 2.); + double newHlPhi = std::numbers::pi; ACTS_VERBOSE("merged: [" << detail::radian_sym(newAvgPhi - newHlPhi) / 1_degree << ", " << detail::radian_sym(newAvgPhi + newHlPhi) / 1_degree @@ -43,27 +44,27 @@ std::tuple mergedPhiSector( return {newHlPhi, newAvgPhi, false}; } - ActsScalar minPhi1 = detail::radian_sym(-hlPhi1 + avgPhi1); - ActsScalar maxPhi1 = detail::radian_sym(hlPhi1 + avgPhi1); + double minPhi1 = detail::radian_sym(-hlPhi1 + avgPhi1); + double maxPhi1 = detail::radian_sym(hlPhi1 + avgPhi1); ACTS_VERBOSE("one: [" << minPhi1 / 1_degree << ", " << maxPhi1 / 1_degree << "] ~> " << avgPhi1 / 1_degree << " +- " << hlPhi1 / 1_degree); - ActsScalar maxPhi2 = detail::radian_sym(hlPhi2 + avgPhi2); - ActsScalar minPhi2 = detail::radian_sym(-hlPhi2 + avgPhi2); + double maxPhi2 = detail::radian_sym(hlPhi2 + avgPhi2); + double minPhi2 = detail::radian_sym(-hlPhi2 + avgPhi2); ACTS_VERBOSE("two: [" << minPhi2 / 1_degree << ", " << maxPhi2 / 1_degree << "] ~> " << avgPhi2 / 1_degree << " +- " << hlPhi2 / 1_degree); ACTS_VERBOSE("Checking for CCW or CW ordering"); - auto same = [tolerance](ActsScalar a, ActsScalar b) { + auto same = [tolerance](double a, double b) { return std::abs(a - b) < tolerance; }; - ActsScalar newMaxPhi{}, newMinPhi{}; - ActsScalar newHlPhi = hlPhi1 + hlPhi2; + double newMaxPhi{}, newMinPhi{}; + double newHlPhi = hlPhi1 + hlPhi2; bool reversed = false; if (same(minPhi1, maxPhi2)) { @@ -81,7 +82,7 @@ std::tuple mergedPhiSector( throw std::invalid_argument("Phi ranges are incompatible"); } - ActsScalar newAvgPhi = detail::radian_sym(newMinPhi + newHlPhi); + double newAvgPhi = detail::radian_sym(newMinPhi + newHlPhi); ACTS_VERBOSE("merged: [" << newMinPhi / 1_degree << ", " << newMaxPhi / 1_degree << "] ~> " diff --git a/Core/src/Surfaces/detail/VerticesHelper.cpp b/Core/src/Surfaces/detail/VerticesHelper.cpp index e97d75d45bf..98a00deb142 100644 --- a/Core/src/Surfaces/detail/VerticesHelper.cpp +++ b/Core/src/Surfaces/detail/VerticesHelper.cpp @@ -13,9 +13,9 @@ #include #include -std::vector Acts::detail::VerticesHelper::phiSegments( - ActsScalar phiMin, ActsScalar phiMax, - const std::vector& phiRefs, unsigned int quarterSegments) { +std::vector Acts::detail::VerticesHelper::phiSegments( + double phiMin, double phiMax, const std::vector& phiRefs, + unsigned int quarterSegments) { // Check that the phi range is valid if (phiMin > phiMax) { throw std::invalid_argument( @@ -24,7 +24,7 @@ std::vector Acts::detail::VerticesHelper::phiSegments( } // First check that no reference phi is outside the range - for (ActsScalar phiRef : phiRefs) { + for (double phiRef : phiRefs) { if (phiRef < phiMin || phiRef > phiMax) { throw std::invalid_argument( "VerticesHelper::phiSegments ... Reference phi is outside the range " @@ -36,16 +36,16 @@ std::vector Acts::detail::VerticesHelper::phiSegments( "VerticesHelper::phiSegments ... Number of segments must be larger " "than 0."); } - std::vector phiSegments = {phiMin, phiMax}; + std::vector 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 = + double phiExt = -std::numbers::pi + i * 2 * std::numbers::pi / (4 * quarterSegments); if (phiExt > phiMin && phiExt < phiMax && - std::ranges::none_of(phiSegments, [&phiExt](ActsScalar phi) { + std::ranges::none_of(phiSegments, [&phiExt](double phi) { return std::abs(phi - phiExt) < - std::numeric_limits::epsilon(); + std::numeric_limits::epsilon(); })) { phiSegments.push_back(phiExt); } @@ -53,9 +53,9 @@ std::vector Acts::detail::VerticesHelper::phiSegments( // Add the reference phis for (const auto& phiRef : phiRefs) { if (phiRef > phiMin && phiRef < phiMax) { - if (std::ranges::none_of(phiSegments, [&phiRef](ActsScalar phi) { + if (std::ranges::none_of(phiSegments, [&phiRef](double phi) { return std::abs(phi - phiRef) < - std::numeric_limits::epsilon(); + std::numeric_limits::epsilon(); })) { phiSegments.push_back(phiRef); } @@ -68,9 +68,8 @@ std::vector Acts::detail::VerticesHelper::phiSegments( } std::vector Acts::detail::VerticesHelper::ellipsoidVertices( - ActsScalar innerRx, ActsScalar innerRy, ActsScalar outerRx, - ActsScalar outerRy, ActsScalar avgPhi, ActsScalar halfPhi, - unsigned int quarterSegments) { + double innerRx, double innerRy, double outerRx, double outerRy, + double avgPhi, double halfPhi, unsigned int quarterSegments) { // List of vertices counter-clockwise starting at smallest phi w.r.t center, // for both inner/outer ring/segment std::vector rvertices; // return vertices @@ -80,7 +79,7 @@ std::vector Acts::detail::VerticesHelper::ellipsoidVertices( bool innerExists = (innerRx > 0. && innerRy > 0.); bool closed = std::abs(halfPhi - std::numbers::pi) < s_onSurfaceTolerance; - std::vector refPhi = {}; + std::vector refPhi = {}; if (avgPhi != 0.) { refPhi.push_back(avgPhi); } @@ -113,20 +112,20 @@ std::vector Acts::detail::VerticesHelper::ellipsoidVertices( } std::vector Acts::detail::VerticesHelper::circularVertices( - ActsScalar innerR, ActsScalar outerR, ActsScalar avgPhi, ActsScalar halfPhi, + double innerR, double outerR, double avgPhi, double halfPhi, unsigned int quarterSegments) { return ellipsoidVertices(innerR, innerR, outerR, outerR, avgPhi, halfPhi, quarterSegments); } bool Acts::detail::VerticesHelper::onHyperPlane( - const std::vector& vertices, ActsScalar tolerance) { + const std::vector& vertices, double tolerance) { // Obvious always on one surface if (vertices.size() < 4) { return true; } // Create the hyperplane - auto hyperPlane = Eigen::Hyperplane::Through( + auto hyperPlane = Eigen::Hyperplane::Through( vertices[0], vertices[1], vertices[2]); for (std::size_t ip = 3; ip < vertices.size(); ++ip) { if (hyperPlane.absDistance(vertices[ip]) > tolerance) { diff --git a/Core/src/TrackFitting/GsfUtils.cpp b/Core/src/TrackFitting/GsfUtils.cpp index ae5b47ca700..b70544e47c6 100644 --- a/Core/src/TrackFitting/GsfUtils.cpp +++ b/Core/src/TrackFitting/GsfUtils.cpp @@ -17,10 +17,10 @@ namespace Acts::detail { using TrackStateTraits = TrackStateTraits; -ActsScalar calculateDeterminant( - const double* fullCalibratedCovariance, - TrackStateTraits::Covariance predictedCovariance, - TrackStateTraits::Projector projector, unsigned int calibratedSize) { +double calculateDeterminant(const double* fullCalibratedCovariance, + TrackStateTraits::Covariance predictedCovariance, + TrackStateTraits::Projector projector, + unsigned int calibratedSize) { return visit_measurement(calibratedSize, [&](auto N) { constexpr std::size_t kMeasurementSize = decltype(N)::value; diff --git a/Core/src/TrackFitting/MbfSmoother.cpp b/Core/src/TrackFitting/MbfSmoother.cpp index 2614834aadb..e260a578e38 100644 --- a/Core/src/TrackFitting/MbfSmoother.cpp +++ b/Core/src/TrackFitting/MbfSmoother.cpp @@ -44,11 +44,11 @@ void MbfSmoother::visitMeasurement(const InternalTrackState& ts, constexpr std::size_t kMeasurementSize = decltype(N)::value; using MeasurementMatrix = - Eigen::Matrix; + Eigen::Matrix; using CovarianceMatrix = - Eigen::Matrix; + Eigen::Matrix; using KalmanGainMatrix = - Eigen::Matrix; + Eigen::Matrix; typename TrackStateTraits::Calibrated calibrated{ measurement.calibrated}; @@ -71,12 +71,12 @@ void MbfSmoother::visitMeasurement(const InternalTrackState& ts, const KalmanGainMatrix K = (ts.predictedCovariance * H.transpose() * SInv); const Acts::BoundMatrix CHat = (Acts::BoundMatrix::Identity() - K * H); - const Eigen::Matrix y = + const Eigen::Matrix y = (calibrated - H * ts.predicted); const Acts::BoundMatrix bigLambdaTilde = (H.transpose() * SInv * H + CHat.transpose() * bigLambdaHat * CHat); - const Eigen::Matrix smallLambdaTilde = + const Eigen::Matrix smallLambdaTilde = (-H.transpose() * SInv * y + CHat.transpose() * smallLambdaHat); bigLambdaHat = F.transpose() * bigLambdaTilde * F; diff --git a/Core/src/Utilities/SpacePointUtility.cpp b/Core/src/Utilities/SpacePointUtility.cpp index 7018db37830..32470e1ebb9 100644 --- a/Core/src/Utilities/SpacePointUtility.cpp +++ b/Core/src/Utilities/SpacePointUtility.cpp @@ -51,8 +51,7 @@ Result SpacePointUtility::differenceOfMeasurementsChecked( return Result::success(diffTheta2 + diffPhi2); } -std::tuple, Vector2, - std::optional> +std::tuple, Vector2, std::optional> SpacePointUtility::globalCoords( const GeometryContext& gctx, const SourceLink& slink, const SourceLinkSurfaceAccessor& surfaceAccessor, const BoundVector& par, @@ -93,8 +92,8 @@ SpacePointUtility::globalCoords( // optionally set time // TODO the current condition of checking the covariance is not optional but // should do for now - std::optional globalTime = par[eBoundTime]; - std::optional tcov = cov(eBoundTime, eBoundTime); + std::optional globalTime = par[eBoundTime]; + std::optional tcov = cov(eBoundTime, eBoundTime); if (tcov.value() <= 0) { globalTime = std::nullopt; tcov = std::nullopt; diff --git a/Core/src/Vertexing/HelicalTrackLinearizer.cpp b/Core/src/Vertexing/HelicalTrackLinearizer.cpp index 9d529745559..e42bc9d0aad 100644 --- a/Core/src/Vertexing/HelicalTrackLinearizer.cpp +++ b/Core/src/Vertexing/HelicalTrackLinearizer.cpp @@ -68,40 +68,40 @@ Acts::HelicalTrackLinearizer::linearizeTrack( // Extracting Perigee parameters and compute functions of them for later // usage - ActsScalar d0 = paramsAtPCA(BoundIndices::eBoundLoc0); + double d0 = paramsAtPCA(BoundIndices::eBoundLoc0); - ActsScalar phi = paramsAtPCA(BoundIndices::eBoundPhi); - ActsScalar sinPhi = std::sin(phi); - ActsScalar cosPhi = std::cos(phi); + double phi = paramsAtPCA(BoundIndices::eBoundPhi); + double sinPhi = std::sin(phi); + double cosPhi = std::cos(phi); - ActsScalar theta = paramsAtPCA(BoundIndices::eBoundTheta); - ActsScalar sinTheta = std::sin(theta); - ActsScalar tanTheta = std::tan(theta); + double theta = paramsAtPCA(BoundIndices::eBoundTheta); + double sinTheta = std::sin(theta); + double tanTheta = std::tan(theta); // q over p - ActsScalar qOvP = paramsAtPCA(BoundIndices::eBoundQOverP); + double qOvP = paramsAtPCA(BoundIndices::eBoundQOverP); // Rest mass - ActsScalar m0 = params.particleHypothesis().mass(); + double m0 = params.particleHypothesis().mass(); // Momentum - ActsScalar p = params.particleHypothesis().extractMomentum(qOvP); + double p = params.particleHypothesis().extractMomentum(qOvP); // Speed in units of c - ActsScalar beta = p / fastHypot(p, m0); + double beta = p / fastHypot(p, m0); // Transverse speed (i.e., speed in the x-y plane) - ActsScalar betaT = beta * sinTheta; + double betaT = beta * sinTheta; // Momentum direction at the PCA Vector3 momentumAtPCA(phi, theta, qOvP); // Particle charge - ActsScalar absoluteCharge = params.particleHypothesis().absoluteCharge(); + double absoluteCharge = params.particleHypothesis().absoluteCharge(); // get the z-component of the B-field at the PCA auto field = m_cfg.bField->getField(VectorHelpers::position(pca), fieldCache); if (!field.ok()) { return field.error(); } - ActsScalar Bz = (*field)[eZ]; + double Bz = (*field)[eZ]; // Complete Jacobian (consists of positionJacobian and momentumJacobian) ActsMatrix completeJacobian = @@ -142,24 +142,24 @@ Acts::HelicalTrackLinearizer::linearizeTrack( completeJacobian(eBoundTime, eLinPhi) = -d0 / betaT; } else { // Helix radius - ActsScalar rho = sinTheta * (1. / qOvP) / Bz; + double rho = sinTheta * (1. / qOvP) / Bz; // Sign of helix radius - ActsScalar h = (rho < 0.) ? -1 : 1; + double h = (rho < 0.) ? -1 : 1; // Quantities from Eq. 5.34 in Ref. (1) (see .hpp) - ActsScalar X = pca(0) - perigeeSurface.center(gctx).x() + rho * sinPhi; - ActsScalar Y = pca(1) - perigeeSurface.center(gctx).y() - rho * cosPhi; - ActsScalar S2 = (X * X + Y * Y); + double X = pca(0) - perigeeSurface.center(gctx).x() + rho * sinPhi; + double Y = pca(1) - perigeeSurface.center(gctx).y() - rho * cosPhi; + double S2 = (X * X + Y * Y); // S is the 2D distance from the helix center to the reference point // in the x-y plane - ActsScalar S = std::sqrt(S2); + double S = std::sqrt(S2); - ActsScalar XoverS2 = X / S2; - ActsScalar YoverS2 = Y / S2; - ActsScalar rhoCotTheta = rho / tanTheta; - ActsScalar rhoOverBetaT = rho / betaT; + double XoverS2 = X / S2; + double YoverS2 = Y / S2; + double rhoCotTheta = rho / tanTheta; + double rhoOverBetaT = rho / betaT; // Absolute value of rho over S - ActsScalar absRhoOverS = h * rho / S; + double absRhoOverS = h * rho / S; // Derivatives can be found in Eq. 5.36 in Ref. (1) // Since we propagated to the PCA (point P in Ref. (1)), the points diff --git a/Core/src/Vertexing/ImpactPointEstimator.cpp b/Core/src/Vertexing/ImpactPointEstimator.cpp index 3caac09b57b..df9f75fd9fa 100644 --- a/Core/src/Vertexing/ImpactPointEstimator.cpp +++ b/Core/src/Vertexing/ImpactPointEstimator.cpp @@ -193,7 +193,7 @@ Result> getDistanceAndMomentumImpl( Vector3 positionOnTrack = trkParams.position(gctx); // Distance between positionOnTrack and the 3D PCA - ActsScalar distanceToPca = + double distanceToPca = (vtxPos.template head<3>() - positionOnTrack).dot(momDirStraightTrack); // 3D PCA @@ -204,11 +204,11 @@ Result> getDistanceAndMomentumImpl( // Track time at positionOnTrack double timeOnTrack = trkParams.parameters()[BoundIndices::eBoundTime]; - ActsScalar m0 = trkParams.particleHypothesis().mass(); - ActsScalar p = trkParams.particleHypothesis().extractMomentum(qOvP); + double m0 = trkParams.particleHypothesis().mass(); + double p = trkParams.particleHypothesis().extractMomentum(qOvP); // Speed in units of c - ActsScalar beta = p / fastHypot(p, m0); + double beta = p / fastHypot(p, m0); pcaStraightTrack[3] = timeOnTrack + distanceToPca / beta; } @@ -279,11 +279,11 @@ Result> getDistanceAndMomentumImpl( // Time at the 2D PCA P double tP = trkParams.parameters()[BoundIndices::eBoundTime]; - ActsScalar m0 = trkParams.particleHypothesis().mass(); - ActsScalar p = trkParams.particleHypothesis().extractMomentum(qOvP); + double m0 = trkParams.particleHypothesis().mass(); + double p = trkParams.particleHypothesis().extractMomentum(qOvP); // Speed in units of c - ActsScalar beta = p / fastHypot(p, m0); + double beta = p / fastHypot(p, m0); pca[3] = tP - rho / (beta * sinTheta) * (phi - phiP); } diff --git a/Core/src/Vertexing/NumericalTrackLinearizer.cpp b/Core/src/Vertexing/NumericalTrackLinearizer.cpp index ca9af5825e4..c7928a23258 100644 --- a/Core/src/Vertexing/NumericalTrackLinearizer.cpp +++ b/Core/src/Vertexing/NumericalTrackLinearizer.cpp @@ -78,10 +78,10 @@ Acts::NumericalTrackLinearizer::linearizeTrack( // Fill "paramVec", "pca", and "momentumAtPCA" { Vector3 globalCoords = endParams.position(gctx); - ActsScalar globalTime = endParams.time(); - ActsScalar phi = perigeeParams(BoundIndices::eBoundPhi); - ActsScalar theta = perigeeParams(BoundIndices::eBoundTheta); - ActsScalar qOvP = perigeeParams(BoundIndices::eBoundQOverP); + double globalTime = endParams.time(); + double phi = perigeeParams(BoundIndices::eBoundPhi); + double theta = perigeeParams(BoundIndices::eBoundTheta); + double qOvP = perigeeParams(BoundIndices::eBoundQOverP); paramVec << globalCoords, globalTime, phi, theta, qOvP; pca << globalCoords, globalTime; diff --git a/Core/src/Vertexing/Vertex.cpp b/Core/src/Vertexing/Vertex.cpp index 0a8eda8c279..7c2c54cc7ac 100644 --- a/Core/src/Vertexing/Vertex.cpp +++ b/Core/src/Vertexing/Vertex.cpp @@ -37,7 +37,7 @@ Vector3 Vertex::position() const { return VectorHelpers::position(m_position); } -ActsScalar Vertex::time() const { +double Vertex::time() const { return m_position[eTime]; } @@ -85,7 +85,7 @@ void Vertex::setFullPosition(const Vector4& fullPosition) { m_position = fullPosition; } -void Vertex::setTime(ActsScalar time) { +void Vertex::setTime(double time) { m_position[eTime] = time; } diff --git a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/GeometricConfig.hpp b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/GeometricConfig.hpp index 6b4348e20f6..5df64bc4326 100644 --- a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/GeometricConfig.hpp +++ b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/GeometricConfig.hpp @@ -58,10 +58,10 @@ struct GeometricConfig { bool strip = false; /// The variances for this digitization - std::map> varianceMap = {}; + std::map> varianceMap = {}; /// Charge generation (configurable via the chargeSmearer) - Acts::ActsScalar charge(Acts::ActsScalar path, RandomEngine &rng) const { + double charge(double path, RandomEngine &rng) const { if (!chargeSmearer) { return path; } @@ -82,9 +82,8 @@ struct GeometricConfig { /// @param cmins is the cluster minimum in the different dimensions /// /// @return a vector of variances for the cluster - std::vector variances( - const std::array &csizes, - const std::array &cmins) const; + std::vector variances(const std::array &csizes, + const std::array &cmins) const; /// Drift generation (currently not implemented) /// Takes as an argument the position, and a random engine diff --git a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/MeasurementCreation.hpp b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/MeasurementCreation.hpp index 667e0c9f4c3..ce139065e20 100644 --- a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/MeasurementCreation.hpp +++ b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/MeasurementCreation.hpp @@ -26,8 +26,8 @@ namespace ActsExamples { /// Is public as it is also used by the I/O system struct DigitizedParameters { std::vector indices = {}; - std::vector values = {}; - std::vector variances = {}; + std::vector values = {}; + std::vector variances = {}; Cluster cluster; }; diff --git a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/ModuleClusters.hpp b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/ModuleClusters.hpp index 452111db2eb..b93d6980ced 100644 --- a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/ModuleClusters.hpp +++ b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/ModuleClusters.hpp @@ -27,8 +27,8 @@ struct DigitizedParameters; struct ModuleValue { std::vector paramIndices = {}; - std::vector paramValues = {}; - std::vector paramVariances = {}; + std::vector paramValues = {}; + std::vector paramVariances = {}; std::variant value; std::set sources = {}; Acts::Ccl::Label label = {Acts::Ccl::NO_LABEL}; diff --git a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp index 07019be74ca..08b19b34ba1 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp @@ -317,7 +317,7 @@ DigitizedParameters DigitizationAlgorithm::localParameters( const auto& binningData = geoCfg.segmentation.binningData(); - Acts::ActsScalar totalWeight = 0.; + double totalWeight = 0.; Acts::Vector2 m(0., 0.); std::size_t b0min = std::numeric_limits::max(); std::size_t b0max = 0; @@ -326,8 +326,7 @@ DigitizedParameters DigitizationAlgorithm::localParameters( // Combine the channels for (const auto& ch : channels) { auto bin = ch.bin; - Acts::ActsScalar charge = - geoCfg.digital ? 1. : geoCfg.charge(ch.activation, rng); + double charge = geoCfg.digital ? 1. : geoCfg.charge(ch.activation, rng); if (geoCfg.digital || charge > geoCfg.threshold) { totalWeight += charge; std::size_t b0 = bin[0]; diff --git a/Examples/Algorithms/Digitization/src/DigitizationConfig.cpp b/Examples/Algorithms/Digitization/src/DigitizationConfig.cpp index 8c23ba729d1..232ae598cc7 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationConfig.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationConfig.cpp @@ -10,12 +10,12 @@ namespace ActsExamples { -std::vector GeometricConfig::variances( +std::vector GeometricConfig::variances( const std::array& csizes, const std::array& cmins) const { - std::vector rVariances; + std::vector rVariances; for (const auto& bIndex : indices) { - Acts::ActsScalar var = 0.; + double var = 0.; if (varianceMap.contains(bIndex)) { // Try to find the variance for this cluster size std::size_t lsize = diff --git a/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp b/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp index bbf6ec7583b..8542b2fdd5b 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationConfigurator.cpp @@ -82,8 +82,8 @@ void ActsExamples::DigitizationConfigurator::operator()( case Acts::SurfaceBounds::eRectangle: { if (inputSegmentation.binningData()[0].binvalue == Acts::BinningValue::binX) { - Acts::ActsScalar minX = boundValues[Acts::RectangleBounds::eMinX]; - Acts::ActsScalar maxX = boundValues[Acts::RectangleBounds::eMaxX]; + double minX = boundValues[Acts::RectangleBounds::eMinX]; + double maxX = boundValues[Acts::RectangleBounds::eMaxX]; unsigned int nBins = static_cast(std::round( (maxX - minX) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( @@ -95,8 +95,8 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; - Acts::ActsScalar minY = boundValues[Acts::RectangleBounds::eMinY]; - Acts::ActsScalar maxY = boundValues[Acts::RectangleBounds::eMaxY]; + double minY = boundValues[Acts::RectangleBounds::eMinY]; + double maxY = boundValues[Acts::RectangleBounds::eMaxY]; unsigned int nBins = static_cast( std::round((maxY - minY) / inputSegmentation.binningData()[accessBin].step)); @@ -110,7 +110,7 @@ void ActsExamples::DigitizationConfigurator::operator()( case Acts::SurfaceBounds::eTrapezoid: { if (inputSegmentation.binningData()[0].binvalue == Acts::BinningValue::binX) { - Acts::ActsScalar maxX = std::max( + double maxX = std::max( boundValues[Acts::TrapezoidBounds::eHalfLengthXnegY], boundValues[Acts::TrapezoidBounds::eHalfLengthXposY]); unsigned int nBins = static_cast(std::round( @@ -124,8 +124,7 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; - Acts::ActsScalar maxY = - boundValues[Acts::TrapezoidBounds::eHalfLengthY]; + double maxY = boundValues[Acts::TrapezoidBounds::eHalfLengthY]; unsigned int nBins = static_cast( std::round((2 * maxY) / inputSegmentation.binningData()[accessBin].step)); @@ -139,8 +138,8 @@ void ActsExamples::DigitizationConfigurator::operator()( case Acts::SurfaceBounds::eAnnulus: { if (inputSegmentation.binningData()[0].binvalue == Acts::BinningValue::binR) { - Acts::ActsScalar minR = boundValues[Acts::AnnulusBounds::eMinR]; - Acts::ActsScalar maxR = boundValues[Acts::AnnulusBounds::eMaxR]; + double minR = boundValues[Acts::AnnulusBounds::eMinR]; + double maxR = boundValues[Acts::AnnulusBounds::eMaxR]; unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( @@ -152,11 +151,10 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; - Acts::ActsScalar averagePhi = - boundValues[Acts::AnnulusBounds::eAveragePhi]; - Acts::ActsScalar minPhi = + double averagePhi = boundValues[Acts::AnnulusBounds::eAveragePhi]; + double minPhi = averagePhi - boundValues[Acts::AnnulusBounds::eMinPhiRel]; - Acts::ActsScalar maxPhi = + double maxPhi = averagePhi + boundValues[Acts::AnnulusBounds::eMaxPhiRel]; unsigned int nBins = static_cast( std::round((maxPhi - minPhi) / @@ -170,10 +168,8 @@ void ActsExamples::DigitizationConfigurator::operator()( // The module is a Disc Trapezoid case Acts::SurfaceBounds::eDiscTrapezoid: { - Acts::ActsScalar minR = - boundValues[Acts::DiscTrapezoidBounds::eMinR]; - Acts::ActsScalar maxR = - boundValues[Acts::DiscTrapezoidBounds::eMaxR]; + double minR = boundValues[Acts::DiscTrapezoidBounds::eMinR]; + double maxR = boundValues[Acts::DiscTrapezoidBounds::eMaxR]; if (inputSegmentation.binningData()[0].binvalue == Acts::BinningValue::binR) { @@ -188,16 +184,16 @@ void ActsExamples::DigitizationConfigurator::operator()( inputSegmentation.dimensions() == 2) { unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; - Acts::ActsScalar hxMinR = + double hxMinR = boundValues[Acts::DiscTrapezoidBounds::eHalfLengthXminR]; - Acts::ActsScalar hxMaxR = + double hxMaxR = boundValues[Acts::DiscTrapezoidBounds::eHalfLengthXmaxR]; - Acts::ActsScalar averagePhi = + double averagePhi = boundValues[Acts::DiscTrapezoidBounds::eAveragePhi]; - Acts::ActsScalar alphaMinR = std::atan2(minR, hxMinR); - Acts::ActsScalar alphaMaxR = std::atan2(maxR, hxMaxR); - Acts::ActsScalar alpha = std::max(alphaMinR, alphaMaxR); + double alphaMinR = std::atan2(minR, hxMinR); + double alphaMaxR = std::atan2(maxR, hxMaxR); + double alpha = std::max(alphaMinR, alphaMaxR); unsigned int nBins = static_cast(std::round( 2 * alpha / inputSegmentation.binningData()[accessBin].step)); outputSegmentation += Acts::BinUtility( @@ -211,8 +207,8 @@ void ActsExamples::DigitizationConfigurator::operator()( case Acts::SurfaceBounds::eDisc: { if (inputSegmentation.binningData()[0].binvalue == Acts::BinningValue::binR) { - Acts::ActsScalar minR = boundValues[Acts::RadialBounds::eMinR]; - Acts::ActsScalar maxR = boundValues[Acts::RadialBounds::eMaxR]; + double minR = boundValues[Acts::RadialBounds::eMinR]; + double maxR = boundValues[Acts::RadialBounds::eMaxR]; unsigned int nBins = static_cast(std::round( (maxR - minR) / inputSegmentation.binningData()[0].step)); outputSegmentation += Acts::BinUtility( @@ -225,12 +221,11 @@ void ActsExamples::DigitizationConfigurator::operator()( unsigned int accessBin = inputSegmentation.dimensions() == 2 ? 1 : 0; - Acts::ActsScalar averagePhi = - boundValues[Acts::RadialBounds::eAveragePhi]; - Acts::ActsScalar halfPhiSector = + double averagePhi = boundValues[Acts::RadialBounds::eAveragePhi]; + double halfPhiSector = boundValues[Acts::RadialBounds::eHalfPhiSector]; - Acts::ActsScalar minPhi = averagePhi - halfPhiSector; - Acts::ActsScalar maxPhi = averagePhi + halfPhiSector; + double minPhi = averagePhi - halfPhiSector; + double maxPhi = averagePhi + halfPhiSector; unsigned int nBins = static_cast( std::round((maxPhi - minPhi) / diff --git a/Examples/Algorithms/Digitization/src/ModuleClusters.cpp b/Examples/Algorithms/Digitization/src/ModuleClusters.cpp index fbe7bb2a901..d8c456c427c 100644 --- a/Examples/Algorithms/Digitization/src/ModuleClusters.cpp +++ b/Examples/Algorithms/Digitization/src/ModuleClusters.cpp @@ -186,12 +186,12 @@ std::vector> ModuleClusters::mergeParameters( for (ModuleValue& thisval : thisvec) { // Loop over non-geometric dimensions for (auto k : nonGeoEntries(thisval.paramIndices)) { - Acts::ActsScalar p_i = thisval.paramValues.at(k); - Acts::ActsScalar p_j = values.at(j).paramValues.at(k); - Acts::ActsScalar v_i = thisval.paramVariances.at(k); - Acts::ActsScalar v_j = values.at(j).paramVariances.at(k); + double p_i = thisval.paramValues.at(k); + double p_j = values.at(j).paramValues.at(k); + double v_i = thisval.paramVariances.at(k); + double v_j = values.at(j).paramVariances.at(k); - Acts::ActsScalar left = 0, right = 0; + double left = 0, right = 0; if (p_i < p_j) { left = p_i + m_nsigma * std::sqrt(v_i); right = p_j - m_nsigma * std::sqrt(v_j); @@ -225,9 +225,9 @@ std::vector> ModuleClusters::mergeParameters( ModuleValue ModuleClusters::squash(std::vector& values) { ModuleValue mval; - Acts::ActsScalar tot = 0; - Acts::ActsScalar tot2 = 0; - std::vector weights; + double tot = 0; + double tot2 = 0; + std::vector weights; // First, start by computing cell weights for (ModuleValue& other : values) { @@ -253,9 +253,8 @@ ModuleValue ModuleClusters::squash(std::vector& values) { mval.paramValues.push_back(0); mval.paramVariances.push_back(0); } - Acts::ActsScalar f = weights.at(i) / (tot > 0 ? tot : 1); - Acts::ActsScalar f2 = - weights.at(i) * weights.at(i) / (tot2 > 0 ? tot2 : 1); + double f = weights.at(i) / (tot > 0 ? tot : 1); + double f2 = weights.at(i) * weights.at(i) / (tot2 > 0 ? tot2 : 1); mval.paramValues.at(j) += f * other.paramValues.at(j); mval.paramVariances.at(j) += f2 * other.paramVariances.at(j); } diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp index 54c590ac4d3..6706b5c20e4 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/DDG4/DDG4DetectorConstruction.hpp @@ -20,17 +20,16 @@ class G4VPhysicalVolume; namespace dd4hep { class Detector; } + namespace ActsExamples { -namespace DD4hep { struct DD4hepDetector; -} /// Construct the Geant4 detector from a DD4hep description. class DDG4DetectorConstruction final : public G4VUserDetectorConstruction { public: DDG4DetectorConstruction( - std::shared_ptr detector, + std::shared_ptr detector, std::vector> regionCreators = {}); ~DDG4DetectorConstruction() final; @@ -45,7 +44,7 @@ class DDG4DetectorConstruction final : public G4VUserDetectorConstruction { private: /// The Acts DD4hep detector instance - std::shared_ptr m_detector; + std::shared_ptr m_detector; /// Region creators std::vector> m_regionCreators; /// The world volume @@ -59,7 +58,7 @@ class DDG4DetectorConstructionFactory final : public Geant4::DetectorConstructionFactory { public: DDG4DetectorConstructionFactory( - std::shared_ptr detector, + std::shared_ptr detector, std::vector> regionCreators = {}); ~DDG4DetectorConstructionFactory() final; @@ -67,7 +66,7 @@ class DDG4DetectorConstructionFactory final private: /// The Acts DD4hep detector instance - std::shared_ptr m_detector; + std::shared_ptr m_detector; /// Region creators std::vector> m_regionCreators; }; diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp index 0d0fc522217..dba44638152 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp @@ -17,7 +17,7 @@ class G4VPhysicalVolume; class G4LogicalVolume; -namespace ActsExamples::Telescope { +namespace ActsExamples { class TelescopeG4DetectorConstruction final : public G4VUserDetectorConstruction { @@ -53,4 +53,4 @@ class TelescopeG4DetectorConstructionFactory final std::vector> m_regionCreators; }; -} // namespace ActsExamples::Telescope +} // namespace ActsExamples diff --git a/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp index 2868fbb3a63..1b24da8f273 100644 --- a/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/DDG4DetectorConstruction.cpp @@ -25,7 +25,7 @@ class G4VPhysicalVolume; namespace ActsExamples { DDG4DetectorConstruction::DDG4DetectorConstruction( - std::shared_ptr detector, + std::shared_ptr detector, std::vector> regionCreators) : G4VUserDetectorConstruction(), m_detector(std::move(detector)), @@ -60,7 +60,7 @@ G4VPhysicalVolume* DDG4DetectorConstruction::Construct() { } DDG4DetectorConstructionFactory::DDG4DetectorConstructionFactory( - std::shared_ptr detector, + std::shared_ptr detector, std::vector> regionCreators) : m_detector(std::move(detector)), m_regionCreators(std::move(regionCreators)) {} diff --git a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp index 098cce7b3aa..7050bef8f7f 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp @@ -69,19 +69,19 @@ ActsFatras::Hit hitFromStep(const G4StepPoint* preStepPoint, G4ThreeVector postStepMomentum = convertEnergy * postStepPoint->GetMomentum(); G4double postStepEnergy = convertEnergy * postStepPoint->GetTotalEnergy(); - Acts::ActsScalar hX = 0.5 * (preStepPosition[0] + postStepPosition[0]); - Acts::ActsScalar hY = 0.5 * (preStepPosition[1] + postStepPosition[1]); - Acts::ActsScalar hZ = 0.5 * (preStepPosition[2] + postStepPosition[2]); - Acts::ActsScalar hT = 0.5 * (preStepTime + postStepTime); - - Acts::ActsScalar mXpre = preStepMomentum[0]; - Acts::ActsScalar mYpre = preStepMomentum[1]; - Acts::ActsScalar mZpre = preStepMomentum[2]; - Acts::ActsScalar mEpre = preStepEnergy; - Acts::ActsScalar mXpost = postStepMomentum[0]; - Acts::ActsScalar mYpost = postStepMomentum[1]; - Acts::ActsScalar mZpost = postStepMomentum[2]; - Acts::ActsScalar mEpost = postStepEnergy; + double hX = 0.5 * (preStepPosition[0] + postStepPosition[0]); + double hY = 0.5 * (preStepPosition[1] + postStepPosition[1]); + double hZ = 0.5 * (preStepPosition[2] + postStepPosition[2]); + double hT = 0.5 * (preStepTime + postStepTime); + + double mXpre = preStepMomentum[0]; + double mYpre = preStepMomentum[1]; + double mZpre = preStepMomentum[2]; + double mEpre = preStepEnergy; + double mXpost = postStepMomentum[0]; + double mYpost = postStepMomentum[1]; + double mZpost = postStepMomentum[2]; + double mEpost = postStepEnergy; Acts::Vector4 particlePosition(hX, hY, hZ, hT); Acts::Vector4 beforeMomentum(mXpre, mYpre, mZpre, mEpre); diff --git a/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp b/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp index 9d309932fbe..e8412a18c93 100644 --- a/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp +++ b/Examples/Algorithms/Geant4/src/TelescopeG4DetectorConstruction.cpp @@ -28,16 +28,15 @@ namespace ActsExamples { -Telescope::TelescopeG4DetectorConstruction::TelescopeG4DetectorConstruction( +TelescopeG4DetectorConstruction::TelescopeG4DetectorConstruction( const TelescopeDetector::Config& cfg, std::vector> regionCreators) : m_cfg(cfg), m_regionCreators(std::move(regionCreators)) { - throw_assert(cfg.surfaceType == - static_cast(Telescope::TelescopeSurfaceType::Plane), + throw_assert(cfg.surfaceType == static_cast(TelescopeSurfaceType::Plane), "only plan is supported right now"); } -G4VPhysicalVolume* Telescope::TelescopeG4DetectorConstruction::Construct() { +G4VPhysicalVolume* TelescopeG4DetectorConstruction::Construct() { if (m_world != nullptr) { return m_world; } @@ -168,14 +167,13 @@ G4VPhysicalVolume* Telescope::TelescopeG4DetectorConstruction::Construct() { return m_world; } -Telescope::TelescopeG4DetectorConstructionFactory:: - TelescopeG4DetectorConstructionFactory( - const TelescopeDetector::Config& cfg, - std::vector> regionCreators) +TelescopeG4DetectorConstructionFactory::TelescopeG4DetectorConstructionFactory( + const TelescopeDetector::Config& cfg, + std::vector> regionCreators) : m_cfg(cfg), m_regionCreators(std::move(regionCreators)) {} std::unique_ptr -Telescope::TelescopeG4DetectorConstructionFactory::factorize() const { +TelescopeG4DetectorConstructionFactory::factorize() const { return std::make_unique(m_cfg, m_regionCreators); } diff --git a/Examples/Algorithms/Geometry/include/ActsExamples/Geometry/VolumeAssociationTest.hpp b/Examples/Algorithms/Geometry/include/ActsExamples/Geometry/VolumeAssociationTest.hpp index c86720c340a..a468051aff2 100644 --- a/Examples/Algorithms/Geometry/include/ActsExamples/Geometry/VolumeAssociationTest.hpp +++ b/Examples/Algorithms/Geometry/include/ActsExamples/Geometry/VolumeAssociationTest.hpp @@ -33,7 +33,7 @@ class VolumeAssociationTest final : public IAlgorithm { /// The random number service std::shared_ptr randomNumbers = nullptr; /// The random number range - std::vector randomRange = {}; + std::vector randomRange = {}; /// The detector std::shared_ptr detector = nullptr; }; diff --git a/Examples/Algorithms/Geometry/src/VolumeAssociationTest.cpp b/Examples/Algorithms/Geometry/src/VolumeAssociationTest.cpp index 353bcf94bac..dbb5ac2bc79 100644 --- a/Examples/Algorithms/Geometry/src/VolumeAssociationTest.cpp +++ b/Examples/Algorithms/Geometry/src/VolumeAssociationTest.cpp @@ -38,18 +38,17 @@ ActsExamples::ProcessCode ActsExamples::VolumeAssociationTest::execute( auto rng = m_cfg.randomNumbers->spawnGenerator(ctx); // Setup random number distributions for some quantities - std::uniform_real_distribution phiDist(-std::numbers::pi, - std::numbers::pi); - std::uniform_real_distribution rDist(0., - m_cfg.randomRange[0u]); - std::uniform_real_distribution zDist(-m_cfg.randomRange[1u], - m_cfg.randomRange[1u]); + std::uniform_real_distribution phiDist(-std::numbers::pi, + std::numbers::pi); + std::uniform_real_distribution rDist(0., m_cfg.randomRange[0u]); + std::uniform_real_distribution zDist(-m_cfg.randomRange[1u], + m_cfg.randomRange[1u]); // Lemma for vector creation auto testPosition = [&]() -> Acts::Vector3 { - Acts::ActsScalar r = rDist(rng); - Acts::ActsScalar phi = phiDist(rng); - Acts::ActsScalar z = zDist(rng); + double r = rDist(rng); + double phi = phiDist(rng); + double z = zDist(rng); return Acts::Vector3(r * cos(phi), r * sin(phi), z); }; diff --git a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialValidation.hpp b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialValidation.hpp index ad1a7a93dff..69558244027 100644 --- a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialValidation.hpp +++ b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialValidation.hpp @@ -37,11 +37,10 @@ class MaterialValidation : public IAlgorithm { Acts::Vector3 startPosition = Acts::Vector3(0., 0., 0.); /// Start direction for the scan: phi - std::pair phiRange = {-std::numbers::pi, - std::numbers::pi}; + std::pair phiRange = {-std::numbers::pi, std::numbers::pi}; /// Start direction for the scan: eta - std::pair etaRange = {-4., 4.}; + std::pair etaRange = {-4., 4.}; /// Random number service std::shared_ptr randomNumberSvc = nullptr; diff --git a/Examples/Algorithms/MaterialMapping/src/MaterialValidation.cpp b/Examples/Algorithms/MaterialMapping/src/MaterialValidation.cpp index c75c654ed2b..a162edd2129 100644 --- a/Examples/Algorithms/MaterialMapping/src/MaterialValidation.cpp +++ b/Examples/Algorithms/MaterialMapping/src/MaterialValidation.cpp @@ -47,9 +47,9 @@ ProcessCode MaterialValidation::execute(const AlgorithmContext& context) const { // Loop over the number of tracks for (std::size_t iTrack = 0; iTrack < m_cfg.ntracks; ++iTrack) { // Generate a random phi and eta - Acts::ActsScalar phi = phiDist(rng); - Acts::ActsScalar eta = etaDist(rng); - Acts::ActsScalar theta = 2 * std::atan(std::exp(-eta)); + double phi = phiDist(rng); + double eta = etaDist(rng); + double theta = 2 * std::atan(std::exp(-eta)); Acts::Vector3 direction(std::cos(phi) * std::sin(theta), std::sin(phi) * std::sin(theta), std::cos(theta)); diff --git a/Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp b/Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp index 2d90a2bc8ac..a653794dec1 100644 --- a/Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp +++ b/Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp @@ -29,7 +29,7 @@ Acts::detail::Step concatenateSteps( concatStep.position += step.position; concatStep.momentum += step.momentum; } - Acts::ActsScalar weight = 1.0 / static_cast(steps.size()); + double weight = 1. / steps.size(); concatStep.position *= weight; concatStep.momentum *= weight; } else { @@ -92,9 +92,9 @@ ActsExamples::ProcessCode ActsExamples::SimHitToSummaryConversion::execute( if (!moduleSteps.contains(paritcleId)) { moduleSteps[paritcleId] = std::vector(); } - Acts::ActsScalar hx = simHit.fourPosition().x() / Acts::UnitConstants::mm; - Acts::ActsScalar hy = simHit.fourPosition().y() / Acts::UnitConstants::mm; - Acts::ActsScalar hz = simHit.fourPosition().z() / Acts::UnitConstants::mm; + double hx = simHit.fourPosition().x() / Acts::UnitConstants::mm; + double hy = simHit.fourPosition().y() / Acts::UnitConstants::mm; + double hz = simHit.fourPosition().z() / Acts::UnitConstants::mm; Acts::detail::Step step; step.position = Acts::Vector3(hx, hy, hz); step.momentum = simHit.direction(); diff --git a/Examples/Algorithms/TrackFinding/src/MuonHoughSeeder.cpp b/Examples/Algorithms/TrackFinding/src/MuonHoughSeeder.cpp index b074d14ab91..dda3349d254 100644 --- a/Examples/Algorithms/TrackFinding/src/MuonHoughSeeder.cpp +++ b/Examples/Algorithms/TrackFinding/src/MuonHoughSeeder.cpp @@ -88,10 +88,9 @@ ActsExamples::ProcessCode ActsExamples::MuonHoughSeeder::execute( // create the function parametrising the drift radius uncertainty auto houghWidth_fromDC = [](double, const DriftCircle& DC) { - return std::min(DC.rDriftError() * 3., - 1.0); // scale reported errors up to at least 1mm or 3 - // times the reported error as drift circle calib not - // fully reliable at this stage + // scale reported errors up to at least 1mm or 3 times the reported error as + // drift circle calib not fully reliable at this stage + return std::min(DC.rDriftError() * 3., 1.0); }; // store the true parameters @@ -100,12 +99,12 @@ ActsExamples::ProcessCode ActsExamples::MuonHoughSeeder::execute( // instantiate the hough plane Acts::HoughTransformUtils::HoughPlane houghPlane(planeCfg); - // also insantiate the peak finder + // also instantiate the peak finder Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< Acts::GeometryIdentifier::Value> peakFinder(peakFinderCfg); - // loop pver true hirs + // loop over true hits for (auto& SH : gotSH) { // read the identifier MuonMdtIdentifierFields detailedInfo = @@ -113,10 +112,9 @@ ActsExamples::ProcessCode ActsExamples::MuonHoughSeeder::execute( // store the true parameters truePatterns.emplace_back(SH.direction().y() / SH.direction().z(), SH.fourPosition().y()); - // std::cout<<"station name=" << - // static_cast(SH.stationName)< graphConstructor; + /// List of edge classifiers std::vector> edgeClassifiers; + /// The track builder std::shared_ptr trackBuilder; /// Node features @@ -81,7 +120,10 @@ class TrackFindingAlgorithmExaTrkX final : public IAlgorithm { std::vector featureScales = {1.f, 1.f, 1.f}; /// Remove track candidates with 2 or less hits - bool filterShortTracks = false; + std::size_t minMeasurementsPerTrack = 3; + + /// Optionally remap the geometry Ids that are put into the chain + std::shared_ptr geometryIdMap; }; /// Constructor of the track finding algorithm @@ -111,13 +153,17 @@ class TrackFindingAlgorithmExaTrkX final : public IAlgorithm { mutable std::mutex m_mutex; using Accumulator = boost::accumulators::accumulator_set< - float, boost::accumulators::features>; + float, + boost::accumulators::features< + boost::accumulators::tag::mean, boost::accumulators::tag::variance, + boost::accumulators::tag::max, boost::accumulators::tag::min>>; mutable struct { + Accumulator preprocessingTime; Accumulator graphBuildingTime; std::vector classifierTimes; Accumulator trackBuildingTime; + Accumulator postprocessingTime; } m_timing; ReadDataHandle m_inputSpacePoints{this, diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp index df4b8998540..858b90359da 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/TrackFindingAlgorithmExaTrkX.cpp @@ -20,8 +20,11 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" #include +#include #include +#include "createFeatures.hpp" + using namespace ActsExamples; using namespace Acts::UnitLiterals; @@ -87,8 +90,9 @@ ActsExamples::TrackFindingAlgorithmExaTrkX::TrackFindingAlgorithmExaTrkX( // Check if we want cluster features but do not have them const static std::array clFeatures = { - NodeFeature::eClusterX, NodeFeature::eClusterY, NodeFeature::eCellCount, - NodeFeature::eCellSum, NodeFeature::eCluster1R, NodeFeature::eCluster2R}; + NodeFeature::eClusterLoc0, NodeFeature::eClusterLoc0, + NodeFeature::eCellCount, NodeFeature::eChargeSum, + NodeFeature::eCluster1R, NodeFeature::eCluster2R}; auto wantClFeatures = std::ranges::any_of( m_cfg.nodeFeatures, @@ -108,6 +112,10 @@ ActsExamples::TrackFindingAlgorithmExaTrkX::TrackFindingAlgorithmExaTrkX( ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithmExaTrkX::execute( const ActsExamples::AlgorithmContext& ctx) const { + using Clock = std::chrono::high_resolution_clock; + using Duration = std::chrono::duration; + auto t0 = Clock::now(); + // Setup hooks LoopHook hook; @@ -139,10 +147,11 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithmExaTrkX::execute( ACTS_DEBUG("Received " << numSpacepoints << " spacepoints"); ACTS_DEBUG("Construct " << numFeatures << " node features"); - std::vector features(numSpacepoints * numFeatures); std::vector spacepointIDs; + std::vector moduleIds; spacepointIDs.reserve(spacepoints.size()); + moduleIds.reserve(spacepoints.size()); for (auto isp = 0ul; isp < numSpacepoints; ++isp) { const auto& sp = spacepoints[isp]; @@ -157,54 +166,25 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithmExaTrkX::execute( // to the pipeline spacepointIDs.push_back(isp); - // This should be fine, because check in constructor - Cluster* cl1 = clusters ? &clusters->at(sl1.index()) : nullptr; - Cluster* cl2 = cl1; - - if (sp.sourceLinks().size() == 2) { - const auto& sl2 = sp.sourceLinks()[1].template get(); - cl2 = clusters ? &clusters->at(sl2.index()) : nullptr; + if (m_cfg.geometryIdMap != nullptr) { + moduleIds.push_back(m_cfg.geometryIdMap->right.at(sl1.geometryId())); + } else { + moduleIds.push_back(sl1.geometryId().value()); } + } - // I would prefer to use a std::span or boost::span here once available - float* f = features.data() + isp * numFeatures; - - using NF = NodeFeature; - - for (auto ift = 0ul; ift < numFeatures; ++ift) { - // clang-format off - switch(m_cfg.nodeFeatures[ift]) { - break; case NF::eR: f[ift] = std::hypot(sp.x(), sp.y()); - break; case NF::ePhi: f[ift] = std::atan2(sp.y(), sp.x()); - break; case NF::eZ: f[ift] = sp.z(); - break; case NF::eX: f[ift] = sp.x(); - break; case NF::eY: f[ift] = sp.y(); - break; case NF::eEta: f[ift] = Acts::VectorHelpers::eta(Acts::Vector3{sp.x(), sp.y(), sp.z()}); - break; case NF::eClusterX: f[ift] = cl1->sizeLoc0; - break; case NF::eClusterY: f[ift] = cl1->sizeLoc1; - break; case NF::eCellSum: f[ift] = cl1->sumActivations(); - break; case NF::eCellCount: f[ift] = cl1->channels.size(); - break; case NF::eCluster1R: f[ift] = std::hypot(cl1->globalPosition[Acts::ePos0], cl1->globalPosition[Acts::ePos1]); - break; case NF::eCluster2R: f[ift] = std::hypot(cl2->globalPosition[Acts::ePos0], cl2->globalPosition[Acts::ePos1]); - break; case NF::eCluster1Phi: f[ift] = std::atan2(cl1->globalPosition[Acts::ePos1], cl1->globalPosition[Acts::ePos0]); - break; case NF::eCluster2Phi: f[ift] = std::atan2(cl2->globalPosition[Acts::ePos1], cl2->globalPosition[Acts::ePos0]); - break; case NF::eCluster1Z: f[ift] = cl1->globalPosition[Acts::ePos2]; - break; case NF::eCluster2Z: f[ift] = cl2->globalPosition[Acts::ePos2]; - break; case NF::eCluster1Eta: f[ift] = Acts::VectorHelpers::eta(Acts::Vector3{cl1->globalPosition[Acts::ePos0], cl1->globalPosition[Acts::ePos1], cl1->globalPosition[Acts::ePos2]}); - break; case NF::eCluster2Eta: f[ift] = Acts::VectorHelpers::eta(Acts::Vector3{cl2->globalPosition[Acts::ePos0], cl2->globalPosition[Acts::ePos1], cl2->globalPosition[Acts::ePos2]}); - } - // clang-format on + auto features = createFeatures(spacepoints, clusters, m_cfg.nodeFeatures, + m_cfg.featureScales); - f[ift] /= m_cfg.featureScales[ift]; - } - } + auto t1 = Clock::now(); // Run the pipeline const auto trackCandidates = [&]() { std::lock_guard lock(m_mutex); Acts::ExaTrkXTiming timing; - auto res = m_pipeline.run(features, spacepointIDs, hook, &timing); + auto res = + m_pipeline.run(features, moduleIds, spacepointIDs, hook, &timing); m_timing.graphBuildingTime(timing.graphBuildingTime.count()); @@ -219,6 +199,8 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithmExaTrkX::execute( return res; }(); + auto t2 = Clock::now(); + ACTS_DEBUG("Done with pipeline, received " << trackCandidates.size() << " candidates"); @@ -228,20 +210,28 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithmExaTrkX::execute( int nShortTracks = 0; - for (auto& x : trackCandidates) { - if (m_cfg.filterShortTracks && x.size() < 3) { + /// TODO the whole conversion back to meas idxs should be pulled out of the + /// track trackBuilder + for (auto& candidate : trackCandidates) { + ProtoTrack onetrack; + onetrack.reserve(candidate.size()); + + for (auto i : candidate) { + for (const auto& sl : spacepoints[i].sourceLinks()) { + onetrack.push_back(sl.template get().index()); + } + } + + if (onetrack.size() < m_cfg.minMeasurementsPerTrack) { nShortTracks++; continue; } - ProtoTrack onetrack; - onetrack.reserve(x.size()); - - std::copy(x.begin(), x.end(), std::back_inserter(onetrack)); protoTracks.push_back(std::move(onetrack)); } - ACTS_INFO("Removed " << nShortTracks << " with less then 3 hits"); + ACTS_INFO("Removed " << nShortTracks << " with less then " + << m_cfg.minMeasurementsPerTrack << " hits"); ACTS_INFO("Created " << protoTracks.size() << " proto tracks"); m_outputProtoTracks(ctx, std::move(protoTracks)); @@ -253,27 +243,33 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithmExaTrkX::execute( m_outputGraph(ctx, {graph.first, graph.second}); } + auto t3 = Clock::now(); + m_timing.preprocessingTime(Duration(t1 - t0).count()); + m_timing.postprocessingTime(Duration(t3 - t2).count()); + return ActsExamples::ProcessCode::SUCCESS; } ActsExamples::ProcessCode TrackFindingAlgorithmExaTrkX::finalize() { namespace ba = boost::accumulators; + auto print = [](const auto& t) { + std::stringstream ss; + ss << ba::mean(t) << " +- " << std::sqrt(ba::variance(t)) << " "; + ss << "[" << ba::min(t) << ", " << ba::max(t) << "]"; + return ss.str(); + }; + ACTS_INFO("Exa.TrkX timing info"); - { - const auto& t = m_timing.graphBuildingTime; - ACTS_INFO("- graph building: " << ba::mean(t) << " +- " - << std::sqrt(ba::variance(t))); - } + ACTS_INFO("- preprocessing: " << print(m_timing.preprocessingTime)); + ACTS_INFO("- graph building: " << print(m_timing.graphBuildingTime)); + // clang-format off for (const auto& t : m_timing.classifierTimes) { - ACTS_INFO("- classifier: " << ba::mean(t) << " +- " - << std::sqrt(ba::variance(t))); - } - { - const auto& t = m_timing.trackBuildingTime; - ACTS_INFO("- track building: " << ba::mean(t) << " +- " - << std::sqrt(ba::variance(t))); + ACTS_INFO("- classifier: " << print(t)); } + // clang-format on + ACTS_INFO("- track building: " << print(m_timing.trackBuildingTime)); + ACTS_INFO("- postprocessing: " << print(m_timing.postprocessingTime)); return {}; } diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/createFeatures.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/createFeatures.cpp new file mode 100644 index 00000000000..426a27428f0 --- /dev/null +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/createFeatures.cpp @@ -0,0 +1,108 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 CERN for the benefit of the ACTS project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#include "createFeatures.hpp" + +#include "Acts/Utilities/AngleHelpers.hpp" +#include "Acts/Utilities/VectorHelpers.hpp" + +namespace ActsExamples { + +std::vector createFeatures( + const SimSpacePointContainer& spacepoints, + const std::optional& clusters, + const std::vector& nodeFeatures, + const std::vector& featureScales) { + using namespace ActsExamples; + + assert(nodeFeatures.size() == featureScales.size()); + std::vector features(spacepoints.size() * nodeFeatures.size()); + + for (auto isp = 0ul; isp < spacepoints.size(); ++isp) { + const auto& sp = spacepoints[isp]; + + // For now just take the first index since does require one single index + // per spacepoint + // TODO does it work for the module map construction to use only the first + // sp? + const auto& sl1 = sp.sourceLinks()[0].template get(); + + // This should be fine, because check in constructor + const Cluster* cl1 = clusters ? &clusters->at(sl1.index()) : nullptr; + const Cluster* cl2 = cl1; + + if (sp.sourceLinks().size() == 2) { + const auto& sl2 = sp.sourceLinks()[1].template get(); + cl2 = clusters ? &clusters->at(sl2.index()) : nullptr; + } + + // I would prefer to use a std::span or boost::span here once available + float* f = features.data() + isp * nodeFeatures.size(); + + using NF = TrackFindingAlgorithmExaTrkX::NodeFeature; + + using namespace Acts::VectorHelpers; + using namespace Acts::AngleHelpers; + + // clang-format off +#define MAKE_CLUSTER_FEATURES(n) \ + break; case NF::eCluster##n##X: f[ift] = cl##n->globalPosition[Acts::ePos0]; \ + break; case NF::eCluster##n##Y: f[ift] = cl##n->globalPosition[Acts::ePos1]; \ + break; case NF::eCluster##n##R: f[ift] = perp(cl##n->globalPosition); \ + break; case NF::eCluster##n##Phi: f[ift] = phi(cl##n->globalPosition); \ + break; case NF::eCluster##n##Z: f[ift] = cl##n->globalPosition[Acts::ePos2]; \ + break; case NF::eCluster##n##Eta: f[ift] = eta(cl##n->globalPosition); \ + break; case NF::eCellCount##n: f[ift] = cl##n->channels.size(); \ + break; case NF::eChargeSum##n: f[ift] = cl##n->sumActivations(); \ + break; case NF::eLocDir0##n: f[ift] = cl##n->localDirection[0]; \ + break; case NF::eLocDir1##n: f[ift] = cl##n->localDirection[1]; \ + break; case NF::eLocDir2##n: f[ift] = cl##n->localDirection[2]; \ + break; case NF::eLengthDir0##n: f[ift] = cl##n->lengthDirection[0]; \ + break; case NF::eLengthDir1##n: f[ift] = cl##n->lengthDirection[1]; \ + break; case NF::eLengthDir2##n: f[ift] = cl##n->lengthDirection[2]; \ + break; case NF::eLocEta##n: f[ift] = cl##n->localEta; \ + break; case NF::eLocPhi##n: f[ift] = cl##n->localPhi; \ + break; case NF::eGlobEta##n: f[ift] = cl##n->globalEta; \ + break; case NF::eGlobPhi##n: f[ift] = cl##n->globalPhi; \ + break; case NF::eEtaAngle##n: f[ift] = cl##n->etaAngle; \ + break; case NF::ePhiAngle##n: f[ift] = cl##n->phiAngle; + // clang-format on + + Acts::Vector3 spPos{sp.x(), sp.y(), sp.z()}; + + for (auto ift = 0ul; ift < nodeFeatures.size(); ++ift) { + // clang-format off + switch(nodeFeatures[ift]) { + // Spacepoint features + break; case NF::eR: f[ift] = perp(spPos); + break; case NF::ePhi: f[ift] = phi(spPos); + break; case NF::eZ: f[ift] = sp.z(); + break; case NF::eX: f[ift] = sp.x(); + break; case NF::eY: f[ift] = sp.y(); + break; case NF::eEta: f[ift] = eta(spPos); + // Single cluster features + break; case NF::eClusterLoc0: f[ift] = cl1->sizeLoc0; + break; case NF::eClusterLoc1: f[ift] = cl1->sizeLoc1; + break; case NF::eCellCount: f[ift] = cl1->channels.size(); + break; case NF::eChargeSum: f[ift] = cl1->sumActivations(); + // Features for split clusters + MAKE_CLUSTER_FEATURES(1) + MAKE_CLUSTER_FEATURES(2) + } + // clang-format on + + assert(std::isfinite(f[ift])); + f[ift] /= featureScales[ift]; + } +#undef MAKE_CLUSTER_FEATURES + } + + return features; +} + +} // namespace ActsExamples diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/createFeatures.hpp b/Examples/Algorithms/TrackFindingExaTrkX/src/createFeatures.hpp new file mode 100644 index 00000000000..dede5f3c11c --- /dev/null +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/createFeatures.hpp @@ -0,0 +1,21 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 CERN for the benefit of the ACTS project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#pragma once + +#include "ActsExamples/TrackFindingExaTrkX/TrackFindingAlgorithmExaTrkX.hpp" + +namespace ActsExamples { + +std::vector createFeatures( + const SimSpacePointContainer &spacepoints, + const std::optional &clusters, + const std::vector &nodeFeatures, + const std::vector &featureScales); + +} diff --git a/Examples/Algorithms/TrackFitting/src/RefittingCalibrator.cpp b/Examples/Algorithms/TrackFitting/src/RefittingCalibrator.cpp index b54efd0dcb4..eaf2f74bffa 100644 --- a/Examples/Algorithms/TrackFitting/src/RefittingCalibrator.cpp +++ b/Examples/Algorithms/TrackFitting/src/RefittingCalibrator.cpp @@ -30,11 +30,9 @@ void RefittingCalibrator::calibrate(const Acts::GeometryContext& /*gctx*/, using namespace Acts; constexpr int Size = decltype(N)::value; - trackState.allocateCalibrated(Size); - trackState.template calibrated() = - sl.state.template calibrated(); - trackState.template calibratedCovariance() = - sl.state.template calibratedCovariance(); + trackState.allocateCalibrated( + sl.state.template calibrated().eval(), + sl.state.template calibratedCovariance().eval()); }); trackState.setBoundSubspaceIndices(sl.state.boundSubspaceIndices()); diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/HitSelector.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/HitSelector.cpp new file mode 100644 index 00000000000..a494957a589 --- /dev/null +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/HitSelector.cpp @@ -0,0 +1,97 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 CERN for the benefit of the ACTS project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#include "ActsExamples/TruthTracking/HitSelector.hpp" + +#include "Acts/Utilities/MathHelpers.hpp" +#include "ActsExamples/EventData/SimHit.hpp" +#include "ActsExamples/EventData/SimParticle.hpp" + +namespace ActsExamples { + +HitSelector::HitSelector(const Config& config, Acts::Logging::Level level) + : IAlgorithm("HitSelector", level), m_cfg(config) { + if (m_cfg.minX >= m_cfg.maxX || m_cfg.minY >= m_cfg.maxY || + m_cfg.minZ >= m_cfg.maxZ || m_cfg.minR >= m_cfg.maxR || + m_cfg.minTime >= m_cfg.maxTime || + m_cfg.minEnergyLoss >= m_cfg.maxEnergyLoss || + m_cfg.minPrimaryVertexId >= m_cfg.maxPrimaryVertexId) { + throw std::invalid_argument( + "Invalid bounds configuration: min values must be less than max " + "values"); + } + m_inputHits.initialize(m_cfg.inputHits); + m_inputParticlesSelected.maybeInitialize(m_cfg.inputParticlesSelected); + m_outputHits.initialize(m_cfg.outputHits); + + ACTS_DEBUG("selection particles " << m_cfg.inputParticlesSelected); + ACTS_DEBUG("selection hit x [" << m_cfg.minX << "," << m_cfg.maxX << ")"); + ACTS_DEBUG("selection hit y [" << m_cfg.minY << "," << m_cfg.maxY << ")"); + ACTS_DEBUG("selection hit z [" << m_cfg.minZ << "," << m_cfg.maxZ << ")"); + ACTS_DEBUG("selection hit r [" << m_cfg.minR << "," << m_cfg.maxR << ")"); + ACTS_DEBUG("selection hit time [" << m_cfg.minTime << "," << m_cfg.maxTime + << ")"); + ACTS_DEBUG("selection hit energy loss [" << m_cfg.minEnergyLoss << "," + << m_cfg.maxEnergyLoss << ")"); + ACTS_DEBUG("selection primary vertex ID [" << m_cfg.minPrimaryVertexId << "," + << m_cfg.maxPrimaryVertexId + << ")"); +} + +ProcessCode HitSelector::execute(const AlgorithmContext& ctx) const { + const SimHitContainer& hits = m_inputHits(ctx); + const SimParticleContainer* particlesSelected = + m_inputParticlesSelected.isInitialized() ? &m_inputParticlesSelected(ctx) + : nullptr; + + std::vector unorderedHits; + unorderedHits.reserve(hits.size()); + + for (const auto& hit : hits) { + const double r = Acts::fastHypot(hit.position().x(), hit.position().y()); + const std::uint64_t primaryVertexId = hit.particleId().vertexPrimary(); + + const bool validParticle = (particlesSelected == nullptr) || + particlesSelected->contains(hit.particleId()); + const bool validX = + (m_cfg.minX <= hit.position().x()) && (hit.position().x() < m_cfg.maxX); + const bool validY = + (m_cfg.minY <= hit.position().y()) && (hit.position().y() < m_cfg.maxY); + const bool validZ = + (m_cfg.minZ <= hit.position().z()) && (hit.position().z() < m_cfg.maxZ); + const bool validR = (m_cfg.minR <= r) && (r < m_cfg.maxR); + const bool validTime = + (m_cfg.minTime <= hit.time()) && (hit.time() < m_cfg.maxTime); + const bool validEnergyLoss = + (m_cfg.minEnergyLoss <= hit.depositedEnergy()) && + (hit.depositedEnergy() < m_cfg.maxEnergyLoss); + const bool validPrimaryVertexId = + (m_cfg.minPrimaryVertexId <= primaryVertexId) && + (primaryVertexId < m_cfg.maxPrimaryVertexId); + + const bool validHit = validParticle && validX && validY && validZ && + validR && validTime && validEnergyLoss && + validPrimaryVertexId; + if (validHit) { + unorderedHits.push_back(hit); + } + } + + // hits are still sorted after filtering + SimHitContainer selectedHits(boost::container::ordered_range_t{}, + unorderedHits.begin(), unorderedHits.end()); + + ACTS_DEBUG("selected " << selectedHits.size() << " from " << hits.size() + << " hits"); + + m_outputHits(ctx, std::move(selectedHits)); + + return ProcessCode::SUCCESS; +} + +} // namespace ActsExamples diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/HitSelector.hpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/HitSelector.hpp new file mode 100644 index 00000000000..37a4e8131ec --- /dev/null +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/HitSelector.hpp @@ -0,0 +1,86 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 CERN for the benefit of the ACTS project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#pragma once + +#include "Acts/Utilities/Logger.hpp" +#include "ActsExamples/EventData/SimHit.hpp" +#include "ActsExamples/EventData/SimParticle.hpp" +#include "ActsExamples/Framework/DataHandle.hpp" +#include "ActsExamples/Framework/IAlgorithm.hpp" + +#include +#include + +namespace ActsExamples { + +/// Select hits by applying some selection cuts. +class HitSelector final : public IAlgorithm { + public: + struct Config { + /// Input hit collection. + std::string inputHits; + /// Optional input particle collection. + std::string inputParticlesSelected; + /// Output hit collection + std::string outputHits; + + /// Min x cut + double minX = -std::numeric_limits::max(); + /// Max x cut + double maxX = std::numeric_limits::max(); + + /// Min y cut + double minY = -std::numeric_limits::max(); + /// Max y cut + double maxY = std::numeric_limits::max(); + + /// Min z cut + double minZ = -std::numeric_limits::max(); + /// Max z cut + double maxZ = std::numeric_limits::max(); + + /// Min r cut + double minR = 0.0; + /// Max r cut + double maxR = std::numeric_limits::max(); + + /// Min time cut + double minTime = -std::numeric_limits::max(); + /// Max time cut + double maxTime = std::numeric_limits::max(); + + /// Min energy loss cut + double minEnergyLoss = 0; + /// Max energy loss cut + double maxEnergyLoss = std::numeric_limits::max(); + + /// Min primary vertex ID cut + std::uint64_t minPrimaryVertexId = 0; + /// Max primary vertex ID cut + std::uint64_t maxPrimaryVertexId = + std::numeric_limits::max(); + }; + + HitSelector(const Config& config, Acts::Logging::Level level); + + ProcessCode execute(const AlgorithmContext& ctx) const final; + + /// Get readonly access to the config parameters + const Config& config() const { return m_cfg; } + + private: + Config m_cfg; + + ReadDataHandle m_inputHits{this, "InputHits"}; + ReadDataHandle m_inputParticlesSelected{ + this, "InputParticlesSelected"}; + WriteDataHandle m_outputHits{this, "OutputHits"}; +}; + +} // namespace ActsExamples diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.cpp index 738399a1e42..b4ef0928da0 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.cpp @@ -46,9 +46,17 @@ ActsExamples::ParticleSelector::ParticleSelector(const Config& config, << ")"); ACTS_DEBUG("selection particle m [" << m_cfg.mMin << "," << m_cfg.mMax << ")"); + ACTS_DEBUG("selection particle measurements [" + << m_cfg.measurementsMin << "," << m_cfg.measurementsMax << ")"); ACTS_DEBUG("remove charged particles " << m_cfg.removeCharged); ACTS_DEBUG("remove neutral particles " << m_cfg.removeNeutral); ACTS_DEBUG("remove secondary particles " << m_cfg.removeSecondaries); + ACTS_DEBUG("exclude pdgs: "); + for (auto pdg : m_cfg.excludeAbsPdgs) { + ACTS_DEBUG(" " << pdg); + } + ACTS_DEBUG("primary vertex ID [" << m_cfg.minPrimaryVertexId << "," + << m_cfg.maxPrimaryVertexId << ")"); } ActsExamples::ProcessCode ActsExamples::ParticleSelector::execute( @@ -73,6 +81,9 @@ ActsExamples::ProcessCode ActsExamples::ParticleSelector::execute( const bool validCharged = (p.charge() != 0) && !m_cfg.removeCharged; const bool validCharge = validNeutral || validCharged; const bool validSecondary = !m_cfg.removeSecondaries || !p.isSecondary(); + const bool validPrimaryVertexId = + within(p.particleId().vertexPrimary(), m_cfg.minPrimaryVertexId, + m_cfg.maxPrimaryVertexId); nInvalidCharge += static_cast(!validCharge); @@ -91,7 +102,8 @@ ActsExamples::ProcessCode ActsExamples::ParticleSelector::execute( } } - return validPdg && validCharge && validSecondary && validMeasurementCount && + return validPdg && validCharge && validSecondary && validPrimaryVertexId && + validMeasurementCount && within(p.transverseMomentum(), m_cfg.ptMin, m_cfg.ptMax) && within(std::abs(eta), m_cfg.absEtaMin, m_cfg.absEtaMax) && within(eta, m_cfg.etaMin, m_cfg.etaMax) && diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.hpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.hpp index 78326844f19..4bd465d1b4d 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.hpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSelector.hpp @@ -62,6 +62,12 @@ class ParticleSelector final : public IAlgorithm { bool removeSecondaries = false; /// Exclude particles depending on absolute pdg value std::vector excludeAbsPdgs; + + /// Min primary vertex ID cut + std::uint64_t minPrimaryVertexId = 0; + /// Max primary vertex ID cut + std::uint64_t maxPrimaryVertexId = + std::numeric_limits::max(); }; ParticleSelector(const Config& config, Acts::Logging::Level level); diff --git a/Examples/Algorithms/TruthTracking/CMakeLists.txt b/Examples/Algorithms/TruthTracking/CMakeLists.txt index 4594cdb7480..280e1104ce2 100644 --- a/Examples/Algorithms/TruthTracking/CMakeLists.txt +++ b/Examples/Algorithms/TruthTracking/CMakeLists.txt @@ -9,6 +9,7 @@ add_library( ActsExamples/TruthTracking/TruthTrackFinder.cpp ActsExamples/TruthTracking/TruthVertexFinder.cpp ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp + ActsExamples/TruthTracking/HitSelector.cpp ) target_include_directories( ActsExamplesTruthTracking diff --git a/Examples/Algorithms/Utilities/CMakeLists.txt b/Examples/Algorithms/Utilities/CMakeLists.txt index ba9419c1914..309ff662bc6 100644 --- a/Examples/Algorithms/Utilities/CMakeLists.txt +++ b/Examples/Algorithms/Utilities/CMakeLists.txt @@ -7,7 +7,6 @@ add_library( src/TrackSelectorAlgorithm.cpp src/TracksToTrajectories.cpp src/PrototracksToTracks.cpp - src/HitSelector.cpp src/TracksToParameters.cpp ) target_include_directories( diff --git a/Examples/Algorithms/Utilities/include/ActsExamples/Utilities/HitSelector.hpp b/Examples/Algorithms/Utilities/include/ActsExamples/Utilities/HitSelector.hpp deleted file mode 100644 index bb1f7ba24e8..00000000000 --- a/Examples/Algorithms/Utilities/include/ActsExamples/Utilities/HitSelector.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#pragma once - -#include "Acts/TrackFinding/TrackSelector.hpp" -#include "Acts/Utilities/Logger.hpp" -#include "ActsExamples/EventData/SimHit.hpp" -#include "ActsExamples/Framework/DataHandle.hpp" -#include "ActsExamples/Framework/IAlgorithm.hpp" - -#include -#include -#include - -namespace ActsExamples { - -/// Select tracks by applying some selection cuts. -class HitSelector final : public IAlgorithm { - public: - struct Config { - /// Input track collection. - std::string inputHits; - /// Output track collection - std::string outputHits; - - /// Time cut - double maxTime = std::numeric_limits::max(); - }; - - HitSelector(const Config& config, Acts::Logging::Level level); - - ProcessCode execute(const AlgorithmContext& ctx) const final; - - /// Get readonly access to the config parameters - const Config& config() const { return m_cfg; } - - private: - Config m_cfg; - - ReadDataHandle m_inputHits{this, "InputHits"}; - WriteDataHandle m_outputHits{this, "OutputHits"}; -}; - -} // namespace ActsExamples diff --git a/Examples/Algorithms/Utilities/src/HitSelector.cpp b/Examples/Algorithms/Utilities/src/HitSelector.cpp deleted file mode 100644 index c9a33b5f65a..00000000000 --- a/Examples/Algorithms/Utilities/src/HitSelector.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#include "ActsExamples/Utilities/HitSelector.hpp" - -ActsExamples::HitSelector::HitSelector(const Config& config, - Acts::Logging::Level level) - : IAlgorithm("HitSelector", level), m_cfg(config) { - m_inputHits.initialize(m_cfg.inputHits); - m_outputHits.initialize(m_cfg.outputHits); -} - -ActsExamples::ProcessCode ActsExamples::HitSelector::execute( - const ActsExamples::AlgorithmContext& ctx) const { - const auto& hits = m_inputHits(ctx); - SimHitContainer selectedHits; - - std::copy_if(hits.begin(), hits.end(), - std::inserter(selectedHits, selectedHits.begin()), - [&](const auto& hit) { return hit.time() < m_cfg.maxTime; }); - - ACTS_DEBUG("selected " << selectedHits.size() << " from " << hits.size() - << " hits"); - - m_outputHits(ctx, std::move(selectedHits)); - - return {}; -} diff --git a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignedDetector.hpp b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignedDetector.hpp index 66a0f3b6b42..cfd12568d63 100644 --- a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignedDetector.hpp +++ b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignedDetector.hpp @@ -23,20 +23,16 @@ class IMaterialDecorator; } // namespace Acts namespace ActsExamples { + class IContextDecorator; -namespace Generic { class GenericDetectorElement; -} // namespace Generic -} // namespace ActsExamples -namespace ActsExamples::Contextual { class InternallyAlignedDetectorElement; class InternalAlignmentDecorator; class AlignedDetector { public: - using ContextDecorators = - std::vector>; + using ContextDecorators = std::vector>; using TrackingGeometryPtr = std::shared_ptr; struct Config : public GenericDetector::Config { @@ -69,15 +65,15 @@ class AlignedDetector { const Config& cfg, std::shared_ptr mdecorator); - std::vector>>& + std::vector>>& detectorStore() { return m_detectorStore; } private: /// The Store of the detector elements (lifetime: job) - std::vector>> + std::vector>> m_detectorStore; }; -} // namespace ActsExamples::Contextual +} // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignmentDecorator.hpp b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignmentDecorator.hpp index 1edf7e03d06..27bc1272fcf 100644 --- a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignmentDecorator.hpp +++ b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignmentDecorator.hpp @@ -9,17 +9,10 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Utilities/Logger.hpp" -#include "ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp" -#include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Framework/IContextDecorator.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" -#include -#include -#include - -namespace ActsExamples::Contextual { +namespace ActsExamples { /// @brief A mockup service that rotates the modules in a /// simple tracking geometry @@ -85,4 +78,5 @@ class AlignmentDecorator : public IContextDecorator { } } }; -} // namespace ActsExamples::Contextual + +} // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternalAlignmentDecorator.hpp b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternalAlignmentDecorator.hpp index de3f58b7e0a..6b873a0bdc9 100644 --- a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternalAlignmentDecorator.hpp +++ b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternalAlignmentDecorator.hpp @@ -9,12 +9,10 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/ContextualDetector/AlignmentDecorator.hpp" #include "ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" -#include "ActsExamples/Framework/IContextDecorator.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" #include @@ -31,8 +29,6 @@ class TrackingGeometry; namespace ActsExamples { struct AlgorithmContext; -namespace Contextual { - /// @brief A mockup service that rotates the modules in a /// simple tracking geometry /// @@ -96,6 +92,5 @@ class ExternalAlignmentDecorator : public AlignmentDecorator { /// @param tGeometry the tracking geometry void parseGeometry(const Acts::TrackingGeometry& tGeometry); }; -} // namespace Contextual } // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp index 7456b9bb61e..f504b3a7c4a 100644 --- a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp +++ b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp @@ -10,13 +10,9 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/Geometry/GeometryIdentifier.hpp" -#include "Acts/Surfaces/Surface.hpp" #include "ActsExamples/GenericDetector/GenericDetectorElement.hpp" -#include - -namespace ActsExamples::Contextual { +namespace ActsExamples { /// @class ExternallyAlignedDetectorElement extends GenericDetectorElement /// @@ -34,8 +30,7 @@ namespace ActsExamples::Contextual { /// In this simple implementation, it does rely on the Identifier /// to be orderded from 0 to N-1, as the identifier is simply taken /// as a vector index for the alignment store -class ExternallyAlignedDetectorElement - : public Generic::GenericDetectorElement { +class ExternallyAlignedDetectorElement : public GenericDetectorElement { public: struct AlignmentStore { // GenericDetector identifiers are sequential @@ -50,7 +45,7 @@ class ExternallyAlignedDetectorElement std::shared_ptr alignmentStore{nullptr}; }; - using Generic::GenericDetectorElement::GenericDetectorElement; + using GenericDetectorElement::GenericDetectorElement; /// Return local to global transform associated with this identifier /// @@ -80,4 +75,4 @@ inline const Acts::Transform3& ExternallyAlignedDetectorElement::transform( return alignContext.alignmentStore->transforms[idValue]; } -} // namespace ActsExamples::Contextual +} // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternalAlignmentDecorator.hpp b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternalAlignmentDecorator.hpp index e9af06d7755..d571c02ec2c 100644 --- a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternalAlignmentDecorator.hpp +++ b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternalAlignmentDecorator.hpp @@ -8,12 +8,10 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/ContextualDetector/AlignmentDecorator.hpp" #include "ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" -#include "ActsExamples/Framework/IContextDecorator.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" @@ -25,9 +23,6 @@ #include namespace ActsExamples { -struct AlgorithmContext; - -namespace Contextual { class InternallyAlignedDetectorElement; /// @brief A mockup service that rotates the modules in a @@ -87,5 +82,5 @@ class InternalAlignmentDecorator : public AlignmentDecorator { /// Private access to the logging instance const Acts::Logger& logger() const { return *m_logger; } }; -} // namespace Contextual + } // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp index aaa1c8d9b98..68c958e87b0 100644 --- a/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp +++ b/Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp @@ -10,16 +10,12 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/Geometry/GeometryIdentifier.hpp" -#include "Acts/Surfaces/Surface.hpp" #include "ActsExamples/GenericDetector/GenericDetectorElement.hpp" -#include -#include #include #include -namespace ActsExamples::Contextual { +namespace ActsExamples { /// @class InternallyAlignedDetectorElement extends GenericDetectorElement /// @@ -33,8 +29,7 @@ namespace ActsExamples::Contextual { /// store and then in a contextual call the actual detector element /// position is taken internal multi component store - the latter /// has to be filled though from an external source -class InternallyAlignedDetectorElement - : public Generic::GenericDetectorElement { +class InternallyAlignedDetectorElement : public GenericDetectorElement { public: struct ContextType { /// The current interval of validity @@ -43,7 +38,7 @@ class InternallyAlignedDetectorElement }; // Inherit constructor - using Generic::GenericDetectorElement::GenericDetectorElement; + using GenericDetectorElement::GenericDetectorElement; /// Return local to global transform associated with this identifier /// @@ -117,4 +112,4 @@ inline void InternallyAlignedDetectorElement::clearAlignedTransform( } } -} // namespace ActsExamples::Contextual +} // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/src/AlignedDetector.cpp b/Examples/Detectors/ContextualDetector/src/AlignedDetector.cpp index 044cc943a81..84e050c8470 100644 --- a/Examples/Detectors/ContextualDetector/src/AlignedDetector.cpp +++ b/Examples/Detectors/ContextualDetector/src/AlignedDetector.cpp @@ -8,8 +8,7 @@ #include "ActsExamples/ContextualDetector/AlignedDetector.hpp" -#include "Acts/Definitions/Units.hpp" -#include "Acts/Geometry/ILayerBuilder.hpp" +#include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/ContextualDetector/AlignmentDecorator.hpp" @@ -19,10 +18,8 @@ #include "ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" #include "ActsExamples/GenericDetector/BuildGenericDetector.hpp" -#include "ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp" -using namespace Acts::UnitLiterals; -namespace ActsExamples::Contextual { +namespace ActsExamples { auto AlignedDetector::finalize( const Config& cfg, @@ -31,10 +28,9 @@ auto AlignedDetector::finalize( ContextDecorators aContextDecorators; // Let's create a random number service - ActsExamples::RandomNumbers::Config randomNumberConfig; + RandomNumbers::Config randomNumberConfig; randomNumberConfig.seed = cfg.seed; - auto randomNumberSvc = - std::make_shared(randomNumberConfig); + auto randomNumberSvc = std::make_shared(randomNumberConfig); auto fillDecoratorConfig = [&](AlignmentDecorator::Config& config) { config.iovSize = cfg.iovSize; @@ -55,6 +51,7 @@ auto AlignedDetector::finalize( TrackingGeometryPtr aTrackingGeometry; if (cfg.mode == Config::Mode::External) { ExternallyAlignedDetectorElement::ContextType nominalContext; + Acts::GeometryContext geometryContext(nominalContext); ExternalAlignmentDecorator::Config agcsConfig; fillDecoratorConfig(agcsConfig); @@ -63,8 +60,8 @@ auto AlignedDetector::finalize( detectorStore; aTrackingGeometry = - ActsExamples::Generic::buildDetector( - nominalContext, detectorStore, cfg.buildLevel, + Generic::buildDetector( + geometryContext, detectorStore, cfg.buildLevel, std::move(mdecorator), cfg.buildProto, cfg.surfaceLogLevel, cfg.layerLogLevel, cfg.volumeLogLevel); @@ -84,13 +81,14 @@ auto AlignedDetector::finalize( } else { InternallyAlignedDetectorElement::ContextType nominalContext; nominalContext.nominal = true; + Acts::GeometryContext geometryContext(nominalContext); InternalAlignmentDecorator::Config agcsConfig; fillDecoratorConfig(agcsConfig); aTrackingGeometry = - ActsExamples::Generic::buildDetector( - nominalContext, agcsConfig.detectorStore, cfg.buildLevel, + Generic::buildDetector( + geometryContext, agcsConfig.detectorStore, cfg.buildLevel, std::move(mdecorator), cfg.buildProto, cfg.surfaceLogLevel, cfg.layerLogLevel, cfg.volumeLogLevel); @@ -112,4 +110,4 @@ auto AlignedDetector::finalize( std::move(aTrackingGeometry), std::move(aContextDecorators)); } -} // namespace ActsExamples::Contextual +} // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp b/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp index bca56249419..5120a29c334 100644 --- a/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp +++ b/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp @@ -10,7 +10,6 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Surfaces/SurfaceArray.hpp" #include "ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" @@ -20,9 +19,10 @@ #include #include -ActsExamples::Contextual::ExternalAlignmentDecorator:: - ExternalAlignmentDecorator(const Config& cfg, - std::unique_ptr logger) +namespace ActsExamples { + +ExternalAlignmentDecorator::ExternalAlignmentDecorator( + const Config& cfg, std::unique_ptr logger) : m_cfg(cfg), m_logger(std::move(logger)) { if (m_cfg.trackingGeometry != nullptr) { // parse and populate @@ -30,9 +30,7 @@ ActsExamples::Contextual::ExternalAlignmentDecorator:: } } -ActsExamples::ProcessCode -ActsExamples::Contextual::ExternalAlignmentDecorator::decorate( - AlgorithmContext& context) { +ProcessCode ExternalAlignmentDecorator::decorate(AlgorithmContext& context) { // Iov map access needs to be synchronized std::lock_guard lock{m_iovMutex}; @@ -96,7 +94,7 @@ ActsExamples::Contextual::ExternalAlignmentDecorator::decorate( return ProcessCode::SUCCESS; } -void ActsExamples::Contextual::ExternalAlignmentDecorator::parseGeometry( +void ExternalAlignmentDecorator::parseGeometry( const Acts::TrackingGeometry& tGeometry) { // Double-visit - first count std::size_t nTransforms = 0; @@ -125,3 +123,5 @@ void ActsExamples::Contextual::ExternalAlignmentDecorator::parseGeometry( tGeometry.visitSurfaces(fillTransforms); m_nominalStore = std::move(aStore); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/ContextualDetector/src/InternalAlignmentDecorator.cpp b/Examples/Detectors/ContextualDetector/src/InternalAlignmentDecorator.cpp index 0ce8dd80f1c..c1b44ed0747 100644 --- a/Examples/Detectors/ContextualDetector/src/InternalAlignmentDecorator.cpp +++ b/Examples/Detectors/ContextualDetector/src/InternalAlignmentDecorator.cpp @@ -9,7 +9,6 @@ #include "ActsExamples/ContextualDetector/InternalAlignmentDecorator.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Geometry/GeometryContext.hpp" #include "ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" @@ -18,14 +17,13 @@ #include #include -ActsExamples::Contextual::InternalAlignmentDecorator:: - InternalAlignmentDecorator(const Config& cfg, - std::unique_ptr logger) +namespace ActsExamples { + +InternalAlignmentDecorator::InternalAlignmentDecorator( + const Config& cfg, std::unique_ptr logger) : m_cfg(cfg), m_logger(std::move(logger)) {} -ActsExamples::ProcessCode -ActsExamples::Contextual::InternalAlignmentDecorator::decorate( - AlgorithmContext& context) { +ProcessCode InternalAlignmentDecorator::decorate(AlgorithmContext& context) { // We need to lock the Decorator std::lock_guard alignmentLock(m_alignmentMutex); @@ -92,3 +90,5 @@ ActsExamples::Contextual::InternalAlignmentDecorator::decorate( return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp index 015b511825f..422af198ff5 100644 --- a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp +++ b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp @@ -8,7 +8,6 @@ #pragma once -#include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp" #include "Acts/Plugins/DD4hep/DD4hepDetectorStructure.hpp" #include "ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp" @@ -32,15 +31,12 @@ class Detector; } // namespace Acts namespace ActsExamples { -class IContextDecorator; -} // namespace ActsExamples -namespace ActsExamples::DD4hep { +class IContextDecorator; struct DD4hepDetector { /// @brief The context decorators - using ContextDecorators = - std::vector>; + using ContextDecorators = std::vector>; /// @brief The tracking geometry using TrackingGeometryPtr = std::shared_ptr; @@ -92,4 +88,4 @@ struct DD4hepDetector { std::shared_ptr field() const; }; -} // namespace ActsExamples::DD4hep +} // namespace ActsExamples diff --git a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp index edbb720825c..1111f8de8e7 100644 --- a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp +++ b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp @@ -35,7 +35,7 @@ namespace dd4hep { class Detector; } // namespace dd4hep -namespace ActsExamples::DD4hep { +namespace ActsExamples { void sortFCChhDetElements(std::vector& det); @@ -115,11 +115,10 @@ class DD4hepGeometryService { private: /// Private method to initiate building of the DD4hep geometry - ActsExamples::ProcessCode buildDD4hepGeometry(); + ProcessCode buildDD4hepGeometry(); /// Private method to initiate building of the ACTS tracking geometry - ActsExamples::ProcessCode buildTrackingGeometry( - const Acts::GeometryContext& gctx); + ProcessCode buildTrackingGeometry(const Acts::GeometryContext& gctx); /// The config class Config m_cfg; @@ -135,4 +134,4 @@ class DD4hepGeometryService { std::unique_ptr m_logger; }; -} // namespace ActsExamples::DD4hep +} // namespace ActsExamples diff --git a/Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp b/Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp index a6494ce0860..4ecae308134 100644 --- a/Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp +++ b/Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp @@ -9,11 +9,9 @@ #include "ActsExamples/DD4hepDetector/DD4hepDetector.hpp" #include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp" #include "ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp" -#include #include #include #include @@ -23,20 +21,19 @@ #include #include -namespace ActsExamples::DD4hep { +namespace ActsExamples { DD4hepDetector::DD4hepDetector( std::shared_ptr _geometryService) : geometryService(std::move(_geometryService)) {} auto DD4hepDetector::finalize( - ActsExamples::DD4hep::DD4hepGeometryService::Config config, + DD4hepGeometryService::Config config, std::shared_ptr mdecorator) -> std::pair { Acts::GeometryContext dd4HepContext; config.matDecorator = std::move(mdecorator); - geometryService = - std::make_shared(config); + geometryService = std::make_shared(config); TrackingGeometryPtr dd4tGeometry = geometryService->trackingGeometry(dd4HepContext); if (!dd4tGeometry) { @@ -85,4 +82,4 @@ std::shared_ptr DD4hepDetector::field() const { return std::make_shared(detector.field()); } -} // namespace ActsExamples::DD4hep +} // namespace ActsExamples diff --git a/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp b/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp index 2912e39b757..c746dd84343 100644 --- a/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp +++ b/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp @@ -22,10 +22,9 @@ #include #include -class TGeoNode; +namespace ActsExamples { -ActsExamples::DD4hep::DD4hepGeometryService::DD4hepGeometryService( - const ActsExamples::DD4hep::DD4hepGeometryService::Config& cfg) +DD4hepGeometryService::DD4hepGeometryService(const Config& cfg) : m_cfg(cfg), m_logger{Acts::getDefaultLogger("DD4hepGeometryService", cfg.logLevel)} { if (m_cfg.xmlFileNames.empty()) { @@ -33,12 +32,11 @@ ActsExamples::DD4hep::DD4hepGeometryService::DD4hepGeometryService( } } -ActsExamples::DD4hep::DD4hepGeometryService::~DD4hepGeometryService() { +DD4hepGeometryService::~DD4hepGeometryService() { drop(); } -ActsExamples::ProcessCode -ActsExamples::DD4hep::DD4hepGeometryService::buildDD4hepGeometry() { +ProcessCode DD4hepGeometryService::buildDD4hepGeometry() { const int old_gErrorIgnoreLevel = gErrorIgnoreLevel; switch (m_cfg.dd4hepLogLevel) { case Acts::Logging::Level::VERBOSE: @@ -83,33 +81,31 @@ ActsExamples::DD4hep::DD4hepGeometryService::buildDD4hepGeometry() { gErrorIgnoreLevel = old_gErrorIgnoreLevel; std::cout.clear(); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } -dd4hep::Detector& -ActsExamples::DD4hep::DD4hepGeometryService::DD4hepGeometryService::detector() { +dd4hep::Detector& DD4hepGeometryService::detector() { if (m_detector == nullptr) { buildDD4hepGeometry(); } return *m_detector; } -dd4hep::DetElement& ActsExamples::DD4hep::DD4hepGeometryService::geometry() { +dd4hep::DetElement& DD4hepGeometryService::geometry() { if (!m_geometry) { buildDD4hepGeometry(); } return m_geometry; } -TGeoNode& ActsExamples::DD4hep::DD4hepGeometryService::tgeoGeometry() { +TGeoNode& DD4hepGeometryService::tgeoGeometry() { if (!m_geometry) { buildDD4hepGeometry(); } return *m_geometry.placement().ptr(); } -ActsExamples::ProcessCode -ActsExamples::DD4hep::DD4hepGeometryService::buildTrackingGeometry( +ProcessCode DD4hepGeometryService::buildTrackingGeometry( const Acts::GeometryContext& gctx) { // Set the tracking geometry auto logger = Acts::getDefaultLogger("DD4hepConversion", m_cfg.logLevel); @@ -118,19 +114,18 @@ ActsExamples::DD4hep::DD4hepGeometryService::buildTrackingGeometry( m_cfg.envelopeR, m_cfg.envelopeZ, m_cfg.defaultLayerThickness, m_cfg.sortDetectors, gctx, m_cfg.matDecorator, m_cfg.geometryIdentifierHook); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } std::shared_ptr -ActsExamples::DD4hep::DD4hepGeometryService::trackingGeometry( - const Acts::GeometryContext& gctx) { +DD4hepGeometryService::trackingGeometry(const Acts::GeometryContext& gctx) { if (!m_trackingGeometry) { buildTrackingGeometry(gctx); } return m_trackingGeometry; } -void ActsExamples::DD4hep::DD4hepGeometryService::drop() { +void DD4hepGeometryService::drop() { if (m_detector == nullptr) { return; } @@ -140,12 +135,12 @@ void ActsExamples::DD4hep::DD4hepGeometryService::drop() { m_trackingGeometry = nullptr; } -void ActsExamples::DD4hep::sortFCChhDetElements( - std::vector& det) { +void sortFCChhDetElements(std::vector& det) { std::vector tracker; std::vector eCal; std::vector hCal; std::vector muon; + for (auto& detElement : det) { std::string detName = detElement.name(); if (detName.find("Muon") != std::string::npos) { @@ -158,22 +153,16 @@ void ActsExamples::DD4hep::sortFCChhDetElements( tracker.push_back(detElement); } } - sort(muon.begin(), muon.end(), - [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); - sort(eCal.begin(), eCal.end(), - [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); - sort(hCal.begin(), hCal.end(), - [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); - sort(tracker.begin(), tracker.end(), - [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); + + auto byId = [](const dd4hep::DetElement& a, + const dd4hep::DetElement& b) -> bool { + return a.id() < b.id(); + }; + sort(muon.begin(), muon.end(), byId); + sort(eCal.begin(), eCal.end(), byId); + sort(hCal.begin(), hCal.end(), byId); + sort(tracker.begin(), tracker.end(), byId); + det.clear(); det = tracker; @@ -181,3 +170,5 @@ void ActsExamples::DD4hep::sortFCChhDetElements( det.insert(det.end(), hCal.begin(), hCal.end()); det.insert(det.end(), muon.begin(), muon.end()); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/Geant4Detector/include/ActsExamples/Geant4Detector/Geant4Detector.hpp b/Examples/Detectors/Geant4Detector/include/ActsExamples/Geant4Detector/Geant4Detector.hpp index 5a948c3f3b5..32c7a7568ea 100644 --- a/Examples/Detectors/Geant4Detector/include/ActsExamples/Geant4Detector/Geant4Detector.hpp +++ b/Examples/Detectors/Geant4Detector/include/ActsExamples/Geant4Detector/Geant4Detector.hpp @@ -31,9 +31,8 @@ class Detector; } // namespace Acts namespace ActsExamples { -class IContextDecorator; -namespace Geant4 { +class IContextDecorator; struct Geant4Detector { using DetectorElements = @@ -41,8 +40,7 @@ struct Geant4Detector { using DetectorPtr = std::shared_ptr; using Surfaces = std::vector>; - using ContextDecorators = - std::vector>; + using ContextDecorators = std::vector>; using TrackingGeometryPtr = std::shared_ptr; /// Nested configuration struct @@ -90,5 +88,4 @@ struct Geant4Detector { const Config& cfg, const Acts::Logger& logger) const; }; -} // namespace Geant4 } // namespace ActsExamples diff --git a/Examples/Detectors/Geant4Detector/src/Geant4Detector.cpp b/Examples/Detectors/Geant4Detector/src/Geant4Detector.cpp index e3b52f36cd3..67ab547db26 100644 --- a/Examples/Detectors/Geant4Detector/src/Geant4Detector.cpp +++ b/Examples/Detectors/Geant4Detector/src/Geant4Detector.cpp @@ -23,9 +23,10 @@ #include "G4Transform3D.hh" #include "G4VPhysicalVolume.hh" -auto ActsExamples::Geant4::Geant4Detector::constructDetector( - const ActsExamples::Geant4::Geant4Detector::Config& cfg, - const Acts::Logger& logger) +namespace ActsExamples { + +auto Geant4Detector::constructDetector(const Geant4Detector::Config& cfg, + const Acts::Logger& logger) -> std::tuple { if (cfg.g4World == nullptr) { throw std::invalid_argument( @@ -44,9 +45,8 @@ auto ActsExamples::Geant4::Geant4Detector::constructDetector( return std::tie(detector, decorators, elements); } -auto ActsExamples::Geant4::Geant4Detector::constructTrackingGeometry( - const ActsExamples::Geant4::Geant4Detector::Config& cfg, - const Acts::Logger& logger) +auto Geant4Detector::constructTrackingGeometry( + const Geant4Detector::Config& cfg, const Acts::Logger& logger) -> std::tuple { if (cfg.g4World == nullptr) { throw std::invalid_argument( @@ -104,10 +104,9 @@ auto ActsExamples::Geant4::Geant4Detector::constructTrackingGeometry( return std::tie(trackingGeometry, decorators, elements); } -auto ActsExamples::Geant4::Geant4Detector::convertGeant4Volumes( - const Geant4Detector::Config& cfg, const Acts::Logger& logger) const - -> std::tuple { +auto Geant4Detector::convertGeant4Volumes(const Geant4Detector::Config& cfg, + const Acts::Logger& logger) const + -> std::tuple { // Generate the surface cache Acts::Geant4DetectorSurfaceFactory::Cache g4SurfaceCache; G4Transform3D g4ToWorld; @@ -143,3 +142,5 @@ auto ActsExamples::Geant4::Geant4Detector::convertGeant4Volumes( return std::tie(surfaces, elements); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp index c5968ef4ca3..aea978be935 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/BuildGenericDetector.hpp @@ -31,11 +31,7 @@ #include "ActsExamples/GenericDetector/LayerBuilderT.hpp" #include "ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp" -#include -#include #include -#include -#include #include #include #include @@ -108,7 +104,7 @@ std::vector> modulePositionsDisc( /// return a unique vector to the tracking geometry template std::unique_ptr buildDetector( - const typename detector_element_t::ContextType& gctxIn, + const Acts::GeometryContext& gctxIn, std::vector>>& detectorStore, std::size_t level, @@ -782,7 +778,7 @@ std::unique_ptr buildDetector( Acts::getDefaultLogger("TrackerGeometryBuilder", volumeLLevel)); // get the geometry auto trackingGeometry = cylinderGeometryBuilder->trackingGeometry(gctx); - /// return the tracking geometry + // return the tracking geometry return trackingGeometry; } diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetector.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetector.hpp index c487f43d3a6..21a1f85bec6 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetector.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetector.hpp @@ -24,17 +24,12 @@ namespace ActsExamples { class IContextDecorator; } // namespace ActsExamples -namespace ActsExamples::Generic { +namespace ActsExamples { + class GenericDetectorElement; -} // namespace ActsExamples::Generic struct GenericDetector { - using DetectorElement = ActsExamples::Generic::GenericDetectorElement; - using DetectorElementPtr = std::shared_ptr; - using DetectorStore = std::vector>; - - using ContextDecorators = - std::vector>; + using ContextDecorators = std::vector>; using TrackingGeometryPtr = std::shared_ptr; struct Config { @@ -46,9 +41,12 @@ struct GenericDetector { }; /// The Store of the detector elements (lifetime: job) - DetectorStore detectorStore; + std::vector>> + detectorStore; std::pair finalize( const Config& cfg, std::shared_ptr mdecorator); }; + +} // namespace ActsExamples diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp index 97d2f7fad3e..9ac48f6cc68 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/GenericDetectorElement.hpp @@ -22,7 +22,7 @@ class DiscBounds; class ISurfaceMaterial; } // namespace Acts -namespace ActsExamples::Generic { +namespace ActsExamples { /// @class GenericDetectorElement /// @@ -101,28 +101,4 @@ class GenericDetectorElement : public Acts::DetectorElementBase { std::shared_ptr m_elementDiscBounds = nullptr; }; -inline const Acts::Transform3& -ActsExamples::Generic::GenericDetectorElement::transform( - const Acts::GeometryContext& /*gctx*/) const { - return *m_elementTransform; -} - -inline const Acts::Surface& -ActsExamples::Generic::GenericDetectorElement::surface() const { - return *m_elementSurface; -} - -inline Acts::Surface& ActsExamples::Generic::GenericDetectorElement::surface() { - return *m_elementSurface; -} - -inline double ActsExamples::Generic::GenericDetectorElement::thickness() const { - return m_elementThickness; -} - -inline ActsExamples::Generic::GenericDetectorElement::Identifier -ActsExamples::Generic::GenericDetectorElement::identifier() const { - return m_elementIdentifier; -} - -} // namespace ActsExamples::Generic +} // namespace ActsExamples diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/LayerBuilderT.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/LayerBuilderT.hpp index 642b4a63ffc..66a5c8f2f37 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/LayerBuilderT.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/LayerBuilderT.hpp @@ -15,17 +15,11 @@ #include "Acts/Geometry/ILayerBuilder.hpp" #include "Acts/Geometry/Layer.hpp" #include "Acts/Geometry/LayerCreator.hpp" -#include "Acts/Geometry/ProtoLayer.hpp" -#include "Acts/Material/HomogeneousSurfaceMaterial.hpp" -#include "Acts/Material/Material.hpp" -#include "Acts/Material/MaterialSlab.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/GenericDetector/GenericDetectorElement.hpp" #include "ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp" -#include - namespace ActsExamples::Generic { using Acts::VectorHelpers::eta; diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp index 977c11d9121..d8e1ce24fb0 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp @@ -16,11 +16,8 @@ #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" -#include "Acts/Surfaces/RadialBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include "Acts/Utilities/BinUtility.hpp" -#include "Acts/Utilities/BinnedArray.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/GenericDetector/GenericDetectorElement.hpp" diff --git a/Examples/Detectors/GenericDetector/src/BuildGenericDetector.cpp b/Examples/Detectors/GenericDetector/src/BuildGenericDetector.cpp index 5f396bbe4e8..594ff3120d9 100644 --- a/Examples/Detectors/GenericDetector/src/BuildGenericDetector.cpp +++ b/Examples/Detectors/GenericDetector/src/BuildGenericDetector.cpp @@ -11,10 +11,8 @@ #include #include -namespace ActsExamples::Generic { - /// helper method for cylinder -std::vector modulePositionsCylinder( +std::vector ActsExamples::Generic::modulePositionsCylinder( double radius, double zStagger, double moduleHalfLength, double lOverlap, const std::pair& binningSchema) { int nPhiBins = binningSchema.first; @@ -45,7 +43,8 @@ std::vector modulePositionsCylinder( } /// helper method for disc -std::vector> modulePositionsDisc( +std::vector> +ActsExamples::Generic::modulePositionsDisc( double z, double ringStagger, std::vector phiStagger, std::vector phiSubStagger, double innerRadius, double outerRadius, const std::vector& discBinning, @@ -95,10 +94,9 @@ std::vector> modulePositionsDisc( } /// Helper method for positioning -std::vector modulePositionsRing(double z, double radius, - double phiStagger, - double phiSubStagger, - int nPhiBins) { +std::vector ActsExamples::Generic::modulePositionsRing( + double z, double radius, double phiStagger, double phiSubStagger, + int nPhiBins) { // create and fill the positions std::vector rPositions; rPositions.reserve(nPhiBins); @@ -130,5 +128,3 @@ std::vector modulePositionsRing(double z, double radius, } return rPositions; } - -} // namespace ActsExamples::Generic diff --git a/Examples/Detectors/GenericDetector/src/GenericDetector.cpp b/Examples/Detectors/GenericDetector/src/GenericDetector.cpp index 6a152128edc..bf033fc1e3e 100644 --- a/Examples/Detectors/GenericDetector/src/GenericDetector.cpp +++ b/Examples/Detectors/GenericDetector/src/GenericDetector.cpp @@ -8,20 +8,20 @@ #include "ActsExamples/GenericDetector/GenericDetector.hpp" -#include "Acts/Geometry/ILayerBuilder.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "ActsExamples/GenericDetector/BuildGenericDetector.hpp" #include "ActsExamples/GenericDetector/GenericDetectorElement.hpp" -#include "ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp" + +namespace ActsExamples { auto GenericDetector::finalize( const Config& cfg, std::shared_ptr mdecorator) -> std::pair { - DetectorElement::ContextType nominalContext; + GenericDetectorElement::ContextType nominalContext; /// Return the generic detector TrackingGeometryPtr gGeometry = - ActsExamples::Generic::buildDetector( + Generic::buildDetector( nominalContext, detectorStore, cfg.buildLevel, std::move(mdecorator), cfg.buildProto, cfg.surfaceLogLevel, cfg.layerLogLevel, cfg.volumeLogLevel); @@ -30,3 +30,5 @@ auto GenericDetector::finalize( return std::make_pair( std::move(gGeometry), std::move(gContextDecorators)); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/GenericDetector/src/GenericDetectorElement.cpp b/Examples/Detectors/GenericDetector/src/GenericDetectorElement.cpp index def22d443d3..c1448a67599 100644 --- a/Examples/Detectors/GenericDetector/src/GenericDetectorElement.cpp +++ b/Examples/Detectors/GenericDetector/src/GenericDetectorElement.cpp @@ -13,7 +13,9 @@ #include -ActsExamples::Generic::GenericDetectorElement::GenericDetectorElement( +namespace ActsExamples { + +GenericDetectorElement::GenericDetectorElement( const Identifier identifier, std::shared_ptr transform, std::shared_ptr pBounds, double thickness, @@ -29,7 +31,7 @@ ActsExamples::Generic::GenericDetectorElement::GenericDetectorElement( m_elementSurface->assignSurfaceMaterial(std::move(material)); } -ActsExamples::Generic::GenericDetectorElement::GenericDetectorElement( +GenericDetectorElement::GenericDetectorElement( const Identifier identifier, std::shared_ptr transform, std::shared_ptr dBounds, double thickness, @@ -44,3 +46,26 @@ ActsExamples::Generic::GenericDetectorElement::GenericDetectorElement( m_elementDiscBounds(std::move(dBounds)) { m_elementSurface->assignSurfaceMaterial(std::move(material)); } + +const Acts::Transform3& GenericDetectorElement::transform( + const Acts::GeometryContext& /*gctx*/) const { + return *m_elementTransform; +} + +const Acts::Surface& GenericDetectorElement::surface() const { + return *m_elementSurface; +} + +Acts::Surface& GenericDetectorElement::surface() { + return *m_elementSurface; +} + +double GenericDetectorElement::thickness() const { + return m_elementThickness; +} + +GenericDetectorElement::Identifier GenericDetectorElement::identifier() const { + return m_elementIdentifier; +} + +} // namespace ActsExamples diff --git a/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp b/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp index 61a827ca29d..c0860bd31bf 100644 --- a/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp +++ b/Examples/Detectors/ITkModuleSplitting/include/ActsExamples/ITkModuleSplitting/ITkModuleSplitting.hpp @@ -17,7 +17,6 @@ #include #include #include -#include namespace ActsExamples::ITk { diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapRootIo.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapRootIo.hpp index b5a523c2c0e..3f05cad4cc7 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapRootIo.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapRootIo.hpp @@ -57,8 +57,7 @@ detail::InterpolatedMagneticField2 makeMagneticFieldMapRzFromRoot( std::array nBinsRZ)>& localToGlobalBin, const std::string& fieldMapFile, const std::string& treeName, - Acts::ActsScalar lengthUnit, Acts::ActsScalar BFieldUnit, - bool firstQuadrant = false); + double lengthUnit, double BFieldUnit, bool firstQuadrant = false); /// Method to setup the FieldMap /// @param localToGlobalBin Function mapping the local bins of x,y,z to the @@ -105,7 +104,6 @@ detail::InterpolatedMagneticField3 makeMagneticFieldMapXyzFromRoot( std::array nBinsXYZ)>& localToGlobalBin, const std::string& fieldMapFile, const std::string& treeName, - Acts::ActsScalar lengthUnit, Acts::ActsScalar BFieldUnit, - bool firstOctant = false); + double lengthUnit, double BFieldUnit, bool firstOctant = false); } // namespace ActsExamples diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapTextIo.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapTextIo.hpp index ed191226705..f7ba1f2848a 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapTextIo.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/FieldMapTextIo.hpp @@ -58,8 +58,8 @@ detail::InterpolatedMagneticField2 makeMagneticFieldMapRzFromText( const std::function binsRZ, std::array nBinsRZ)>& localToGlobalBin, - const std::string& fieldMapFile, Acts::ActsScalar lengthUnit, - Acts::ActsScalar BFieldUnit, bool firstQuadrant = false); + const std::string& fieldMapFile, double lengthUnit, double BFieldUnit, + bool firstQuadrant = false); /// Method to setup the FieldMapper /// @param localToGlobalBin Function mapping the local bins of x,y,z to the @@ -107,7 +107,7 @@ detail::InterpolatedMagneticField3 makeMagneticFieldMapXyzFromText( const std::function binsXYZ, std::array nBinsXYZ)>& localToGlobalBin, - const std::string& fieldMapFile, Acts::ActsScalar lengthUnit, - Acts::ActsScalar BFieldUnit, bool firstOctant = false); + const std::string& fieldMapFile, double lengthUnit, double BFieldUnit, + bool firstOctant = false); } // namespace ActsExamples diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp index 5def5740fa4..aa799319e29 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp @@ -16,14 +16,14 @@ namespace ActsExamples { /// The ScalableBField-specific magnetic field context. struct ScalableBFieldContext { - Acts::ActsScalar scalor = 1.; + double scalor = 1.; }; /// A constant magnetic field that is scaled depending on the event context. class ScalableBField final : public Acts::MagneticFieldProvider { public: struct Cache { - Acts::ActsScalar scalor = 1.; + double scalor = 1.; /// @brief constructor with context explicit Cache(const Acts::MagneticFieldContext& mctx) { @@ -41,8 +41,7 @@ class ScalableBField final : public Acts::MagneticFieldProvider { /// @param [in] Bx magnetic field component in global x-direction /// @param [in] By magnetic field component in global y-direction /// @param [in] Bz magnetic field component in global z-direction - ScalableBField(Acts::ActsScalar Bx = 0, Acts::ActsScalar By = 0, - Acts::ActsScalar Bz = 0) + ScalableBField(double Bx = 0, double By = 0, double Bz = 0) : m_BField(Bx, By, Bz) {} /// @brief retrieve magnetic field value diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBFieldService.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBFieldService.hpp index a228eccfe55..f39e7a6cf86 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBFieldService.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBFieldService.hpp @@ -26,7 +26,7 @@ class ScalableBFieldService : public IContextDecorator { public: struct Config { /// Scaling factor. Unit value means the magnetic field is left unchanged. - Acts::ActsScalar scalor = 1.25; + double scalor = 1.25; }; /// Construct the magnetic field service. diff --git a/Examples/Detectors/MagneticField/src/FieldMapRootIo.cpp b/Examples/Detectors/MagneticField/src/FieldMapRootIo.cpp index 48e2e634d65..50aac0d0fae 100644 --- a/Examples/Detectors/MagneticField/src/FieldMapRootIo.cpp +++ b/Examples/Detectors/MagneticField/src/FieldMapRootIo.cpp @@ -23,8 +23,7 @@ ActsExamples::makeMagneticFieldMapRzFromRoot( std::array nBinsRZ)>& localToGlobalBin, const std::string& fieldMapFile, const std::string& treeName, - Acts::ActsScalar lengthUnit, Acts::ActsScalar BFieldUnit, - bool firstQuadrant) { + double lengthUnit, double BFieldUnit, bool firstQuadrant) { /// [1] Read in field map file // Grid position points in r and z std::vector rPos; @@ -73,8 +72,7 @@ ActsExamples::makeMagneticFieldMapXyzFromRoot( std::array nBinsXYZ)>& localToGlobalBin, const std::string& fieldMapFile, const std::string& treeName, - Acts::ActsScalar lengthUnit, Acts::ActsScalar BFieldUnit, - bool firstOctant) { + double lengthUnit, double BFieldUnit, bool firstOctant) { /// [1] Read in field map file // Grid position points in x, y and z std::vector xPos; diff --git a/Examples/Detectors/MagneticField/src/FieldMapTextIo.cpp b/Examples/Detectors/MagneticField/src/FieldMapTextIo.cpp index d298ec046b2..4512355ba73 100644 --- a/Examples/Detectors/MagneticField/src/FieldMapTextIo.cpp +++ b/Examples/Detectors/MagneticField/src/FieldMapTextIo.cpp @@ -22,8 +22,8 @@ ActsExamples::makeMagneticFieldMapRzFromText( const std::function binsRZ, std::array nBinsRZ)>& localToGlobalBin, - const std::string& fieldMapFile, Acts::ActsScalar lengthUnit, - Acts::ActsScalar BFieldUnit, bool firstQuadrant) { + const std::string& fieldMapFile, double lengthUnit, double BFieldUnit, + bool firstQuadrant) { /// [1] Read in field map file // Grid position points in r and z std::vector rPos; @@ -65,8 +65,8 @@ ActsExamples::makeMagneticFieldMapXyzFromText( const std::function binsXYZ, std::array nBinsXYZ)>& localToGlobalBin, - const std::string& fieldMapFile, Acts::ActsScalar lengthUnit, - Acts::ActsScalar BFieldUnit, bool firstOctant) { + const std::string& fieldMapFile, double lengthUnit, double BFieldUnit, + bool firstOctant) { /// [1] Read in field map file // Grid position points in x, y and z std::vector xPos; diff --git a/Examples/Detectors/MagneticField/src/ScalableBFieldService.cpp b/Examples/Detectors/MagneticField/src/ScalableBFieldService.cpp index 0d1cb1bfa6a..2501ae42536 100644 --- a/Examples/Detectors/MagneticField/src/ScalableBFieldService.cpp +++ b/Examples/Detectors/MagneticField/src/ScalableBFieldService.cpp @@ -8,7 +8,6 @@ #include "ActsExamples/MagneticField/ScalableBFieldService.hpp" -#include "Acts/MagneticField/MagneticFieldContext.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/MagneticField/ScalableBField.hpp" @@ -19,18 +18,21 @@ namespace { const std::string s_name = "ScalableBFieldService"; } -ActsExamples::ScalableBFieldService::ScalableBFieldService( - const Config& cfg, Acts::Logging::Level lvl) +namespace ActsExamples { + +ScalableBFieldService::ScalableBFieldService(const Config& cfg, + Acts::Logging::Level lvl) : m_cfg(cfg), m_logger(Acts::getDefaultLogger(s_name, lvl)) {} -const std::string& ActsExamples::ScalableBFieldService::name() const { +const std::string& ScalableBFieldService::name() const { return s_name; } -ActsExamples::ProcessCode ActsExamples::ScalableBFieldService::decorate( - AlgorithmContext& ctx) { +ProcessCode ScalableBFieldService::decorate(AlgorithmContext& ctx) { ScalableBFieldContext magCtx; magCtx.scalor = std::pow(m_cfg.scalor, ctx.eventNumber); ctx.magFieldContext = std::make_any(magCtx); return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp index f6431c5ddbe..585aef06756 100644 --- a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp +++ b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp @@ -24,7 +24,6 @@ #include "Acts/Surfaces/StrawSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Visualization/GeometryView3D.hpp" #include "Acts/Visualization/ObjVisualization3D.hpp" @@ -40,20 +39,21 @@ #include #include #include -#include #include #include -ActsExamples::MockupSectorBuilder::MockupSectorBuilder( - const ActsExamples::MockupSectorBuilder::Config& config) { +namespace ActsExamples { + +MockupSectorBuilder::MockupSectorBuilder( + const MockupSectorBuilder::Config& config) { mCfg = config; - ActsExamples::GdmlDetectorConstruction geo_gdml(mCfg.gdmlPath); + GdmlDetectorConstruction geo_gdml(mCfg.gdmlPath); g4World = geo_gdml.Construct(); } std::shared_ptr -ActsExamples::MockupSectorBuilder::buildChamber( - const ActsExamples::MockupSectorBuilder::ChamberConfig& chamberConfig) { +MockupSectorBuilder::buildChamber( + const MockupSectorBuilder::ChamberConfig& chamberConfig) { if (g4World == nullptr) { throw std::invalid_argument("MockupSector: No g4World initialized"); } @@ -61,7 +61,7 @@ ActsExamples::MockupSectorBuilder::buildChamber( const Acts::GeometryContext gctx; // Geant4Detector Config creator with the g4world from the gdml file - auto g4WorldConfig = ActsExamples::Geant4::Geant4Detector::Config(); + auto g4WorldConfig = Geant4Detector::Config(); g4WorldConfig.name = "Chamber"; g4WorldConfig.g4World = g4World; @@ -78,7 +78,7 @@ ActsExamples::MockupSectorBuilder::buildChamber( g4SurfaceOptions.passiveSurfaceSelector = g4Passive; g4WorldConfig.g4SurfaceOptions = g4SurfaceOptions; - auto g4detector = ActsExamples::Geant4::Geant4Detector(); + auto g4detector = Geant4Detector(); auto [detector, surfaces, detectorElements] = g4detector.constructDetector(g4WorldConfig, Acts::getDummyLogger()); @@ -127,14 +127,12 @@ ActsExamples::MockupSectorBuilder::buildChamber( Acts::Vector3 maxValues = {min_max[0].second, min_max[1].second, min_max[2].second}; - Acts::ActsScalar hx = + double hx = strawSurfaces.front()->bounds().values()[1] + mCfg.toleranceOverlap; - Acts::ActsScalar hy = - 0.5 * ((maxValues.y() + radius) - (minValues.y() - radius)) + - mCfg.toleranceOverlap; - Acts::ActsScalar hz = - 0.5 * ((maxValues.z() + radius) - (minValues.z() - radius)) + - mCfg.toleranceOverlap; + double hy = 0.5 * ((maxValues.y() + radius) - (minValues.y() - radius)) + + mCfg.toleranceOverlap; + double hz = 0.5 * ((maxValues.z() + radius) - (minValues.z() - radius)) + + mCfg.toleranceOverlap; auto detectorVolumeBounds = std::make_shared(hx, hy, hz); @@ -157,7 +155,7 @@ ActsExamples::MockupSectorBuilder::buildChamber( } std::shared_ptr -ActsExamples::MockupSectorBuilder::buildSector( +MockupSectorBuilder::buildSector( std::vector> detVolumes) { if (mCfg.NumberOfSectors > maxNumberOfSectors) { @@ -189,10 +187,9 @@ ActsExamples::MockupSectorBuilder::buildSector( // calculate the phi angles of the vectors auto phiA = Acts::VectorHelpers::phi(pointA); auto phiB = Acts::VectorHelpers::phi(pointB); - Acts::ActsScalar sectorAngle = std::numbers::pi_v; + double sectorAngle = std::numbers::pi; - Acts::ActsScalar halfPhi = - std::numbers::pi_v / mCfg.NumberOfSectors; + double halfPhi = std::numbers::pi / mCfg.NumberOfSectors; if (mCfg.NumberOfSectors == 1) { halfPhi = (phiB - phiA) / 2; @@ -316,7 +313,7 @@ ActsExamples::MockupSectorBuilder::buildSector( return detectorVolume; } -void ActsExamples::MockupSectorBuilder::drawSector( +void MockupSectorBuilder::drawSector( const std::shared_ptr& detectorVolumeSector, const std::string& nameObjFile) { @@ -330,3 +327,5 @@ void ActsExamples::MockupSectorBuilder::drawSector( objSector.write(nameObjFile); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/JsonTGeoDetectorConfig.hpp b/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/JsonTGeoDetectorConfig.hpp index eb038572fcf..c1b006f6593 100644 --- a/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/JsonTGeoDetectorConfig.hpp +++ b/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/JsonTGeoDetectorConfig.hpp @@ -58,15 +58,13 @@ namespace ActsExamples { namespace Options { /// Read config for options interval -void from_json(const nlohmann::json& j, - ActsExamples::Options::Interval& interval) { +void from_json(const nlohmann::json& j, Interval& interval) { interval.lower = j.at("lower"); interval.upper = j.at("upper"); } /// Write config for options interval -void to_json(nlohmann::json& j, - const ActsExamples::Options::Interval& interval) { +void to_json(nlohmann::json& j, const Interval& interval) { // no direct conversion from std::optional to json j = nlohmann::json{{"lower", interval.lower.value_or(0)}, {"upper", interval.upper.value_or(0)}}; @@ -74,8 +72,7 @@ void to_json(nlohmann::json& j, } // namespace Options -void from_json(const nlohmann::json& j, - ActsExamples::TGeoITkModuleSplitter::Config& msc) { +void from_json(const nlohmann::json& j, TGeoITkModuleSplitter::Config& msc) { msc.barrelMap = j["geo-tgeo-barrel-map"].get>(); msc.discMap = @@ -83,8 +80,7 @@ void from_json(const nlohmann::json& j, .get>>>(); } -void to_json(nlohmann::json& j, - const ActsExamples::TGeoITkModuleSplitter::Config& msc) { +void to_json(nlohmann::json& j, const TGeoITkModuleSplitter::Config& msc) { j["geo-tgeo-barrel-map"] = msc.barrelMap; j["geo-tgeo-disc-map"] = msc.discMap; } @@ -92,7 +88,7 @@ void to_json(nlohmann::json& j, /// Read layer configuration triplets template void from_json(const nlohmann::json& j, - ActsExamples::TGeoDetector::Config::LayerTriplet& ltr) { + TGeoDetector::Config::LayerTriplet& ltr) { ltr.negative = j.at("negative").get(); ltr.central = j.at("central").get(); ltr.positive = j.at("positive").get(); @@ -101,15 +97,14 @@ void from_json(const nlohmann::json& j, /// Write layer configuration triplets template void to_json(nlohmann::json& j, - const ActsExamples::TGeoDetector::Config::LayerTriplet& ltr) { + const TGeoDetector::Config::LayerTriplet& ltr) { j = nlohmann::json{{"negative", ltr.negative}, {"central", ltr.central}, {"positive", ltr.positive}}; } /// Read volume struct -void from_json(const nlohmann::json& j, - ActsExamples::TGeoDetector::Config::Volume& vol) { +void from_json(const nlohmann::json& j, TGeoDetector::Config::Volume& vol) { // subdetector selection vol.name = j.at("geo-tgeo-volume-name"); @@ -145,8 +140,7 @@ void from_json(const nlohmann::json& j, if (j.count("geo-tgeo-itk-module-split") != 0) { vol.itkModuleSplit = j.at("geo-tgeo-itk-module-split"); if (vol.itkModuleSplit) { - ActsExamples::TGeoITkModuleSplitter::Config itkConfig = - j.at("Splitters").at("ITk"); + TGeoITkModuleSplitter::Config itkConfig = j.at("Splitters").at("ITk"); vol.barrelMap = itkConfig.barrelMap; vol.discMap = itkConfig.discMap; } @@ -185,7 +179,7 @@ void to_json(nlohmann::json& j, const TGeoDetector::Config::Volume& vol) { j["Splitters"]["CylinderDisk"] = cdConfig; if (vol.itkModuleSplit) { - ActsExamples::TGeoITkModuleSplitter::Config itkConfig; + TGeoITkModuleSplitter::Config itkConfig; itkConfig.barrelMap = vol.barrelMap; itkConfig.discMap = vol.discMap; j["Splitters"]["ITk"] = itkConfig; diff --git a/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp b/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp index 0fae0df1c5a..41134fdfa54 100644 --- a/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp +++ b/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp @@ -29,17 +29,14 @@ class IMaterialDecorator; } // namespace Acts namespace ActsExamples { -class IContextDecorator; -} // namespace ActsExamples -namespace ActsExamples { +class IContextDecorator; struct TGeoDetector { using DetectorElementPtr = std::shared_ptr; using DetectorStore = std::vector; - using ContextDecorators = - std::vector>; + using ContextDecorators = std::vector>; using TrackingGeometryPtr = std::shared_ptr; /// The Store of the detector elements (lifetime: job) diff --git a/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp b/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp index aeed881eb1e..0ece428a438 100644 --- a/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp +++ b/Examples/Detectors/TGeoDetector/src/TGeoDetector.cpp @@ -30,10 +30,7 @@ #include #include -#include #include -#include -#include #include #include #include @@ -135,12 +132,12 @@ std::vector makeLayerBuilderConfigs( cdsConfig, logger.clone("TGeoCylinderDiscSplitter", config.layerLogLevel)); } else if (volume.itkModuleSplit) { - ActsExamples::TGeoITkModuleSplitter::Config itkConfig; + TGeoITkModuleSplitter::Config itkConfig; itkConfig.barrelMap = volume.barrelMap; itkConfig.discMap = volume.discMap; itkConfig.splitPatterns = volume.splitPatterns; layerBuilderConfig.detectorElementSplitter = - std::make_shared( + std::make_shared( itkConfig, logger.clone("TGeoITkModuleSplitter", config.layerLogLevel)); } diff --git a/Examples/Detectors/TGeoDetector/src/TGeoITkModuleSplitter.cpp b/Examples/Detectors/TGeoDetector/src/TGeoITkModuleSplitter.cpp index 42bbbd9c882..2ad248f2e13 100644 --- a/Examples/Detectors/TGeoDetector/src/TGeoITkModuleSplitter.cpp +++ b/Examples/Detectors/TGeoDetector/src/TGeoITkModuleSplitter.cpp @@ -21,14 +21,16 @@ #include #include -ActsExamples::TGeoITkModuleSplitter::TGeoITkModuleSplitter( - const ActsExamples::TGeoITkModuleSplitter::Config& cfg, +namespace ActsExamples { + +TGeoITkModuleSplitter::TGeoITkModuleSplitter( + const TGeoITkModuleSplitter::Config& cfg, std::unique_ptr logger) : m_cfg(cfg), m_logger(std::move(logger)) { initSplitCategories(); } -void ActsExamples::TGeoITkModuleSplitter::initSplitCategories() { +void TGeoITkModuleSplitter::initSplitCategories() { m_splitCategories.reserve(m_cfg.splitPatterns.size()); for (const std::pair& pattern_split_category : m_cfg.splitPatterns) { @@ -50,7 +52,7 @@ void ActsExamples::TGeoITkModuleSplitter::initSplitCategories() { /// If applicable, returns a split detector element inline std::vector> -ActsExamples::TGeoITkModuleSplitter::split( +TGeoITkModuleSplitter::split( const Acts::GeometryContext& gctx, std::shared_ptr detElement) const { // Is the current node covered by this splitter? @@ -66,10 +68,10 @@ ActsExamples::TGeoITkModuleSplitter::split( " node " + sensorName + " using split ranges of category " + std::get<1>(split_category)); if (!std::get<2>(split_category)) { - return ActsExamples::TGeoITkModuleSplitter::splitBarrelModule( + return TGeoITkModuleSplitter::splitBarrelModule( gctx, detElement, m_cfg.barrelMap.at(std::get<1>(split_category))); } else { - return ActsExamples::TGeoITkModuleSplitter::splitDiscModule( + return TGeoITkModuleSplitter::splitDiscModule( gctx, detElement, m_cfg.discMap.at(std::get<1>(split_category))); } } @@ -83,7 +85,7 @@ ActsExamples::TGeoITkModuleSplitter::split( /// If applicable, returns a split detector element inline std::vector> -ActsExamples::TGeoITkModuleSplitter::splitBarrelModule( +TGeoITkModuleSplitter::splitBarrelModule( const Acts::GeometryContext& gctx, const std::shared_ptr& detElement, unsigned int nSegments) const { @@ -101,11 +103,10 @@ ActsExamples::TGeoITkModuleSplitter::splitBarrelModule( /// If applicable, returns a split detector element inline std::vector> -ActsExamples::TGeoITkModuleSplitter::splitDiscModule( +TGeoITkModuleSplitter::splitDiscModule( const Acts::GeometryContext& gctx, const std::shared_ptr& detElement, - const std::vector& - splitRanges) const { + const std::vector& splitRanges) const { auto name = detElement->tgeoNode().GetName(); auto factory = [&](const auto& trafo, const auto& bounds) { @@ -117,3 +118,5 @@ ActsExamples::TGeoITkModuleSplitter::splitDiscModule( return ITk::splitDiscModule(gctx, detElement, splitRanges, factory, name, logger()); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp index 9e3b5977a6a..6e3b4e31cdf 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp @@ -9,9 +9,7 @@ #pragma once #include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Utilities/BinUtility.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp" #include #include @@ -21,7 +19,7 @@ namespace Acts { class TrackingGeometry; } // namespace Acts -namespace ActsExamples::Telescope { +namespace ActsExamples { /// The telescope detector surface type enum class TelescopeSurfaceType { @@ -45,13 +43,14 @@ enum class TelescopeSurfaceType { /// @param surfaceType is the detector surface type /// @param binValue indicates which axis the detector surface normals are /// parallel to -std::unique_ptr buildDetector( - const typename TelescopeDetectorElement::ContextType& gctx, - std::vector>& detectorStore, +std::unique_ptr buildTelescopeDetector( + const Acts::GeometryContext& gctx, + std::vector>& + detectorStore, const std::vector& positions, const std::vector& stereoAngles, const std::array& offsets, const std::array& bounds, double thickness, TelescopeSurfaceType surfaceType, Acts::BinningValue binValue = Acts::BinningValue::binZ); -} // namespace ActsExamples::Telescope +} // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp index 31095f42636..76b81984fb0 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp @@ -9,37 +9,24 @@ #pragma once #include "Acts/Definitions/Units.hpp" -#include "Acts/Utilities/Logger.hpp" -#include "ActsExamples/Utilities/Options.hpp" +#include "Acts/Geometry/DetectorElementBase.hpp" #include #include #include #include -using namespace Acts::UnitLiterals; - namespace Acts { class TrackingGeometry; class IMaterialDecorator; } // namespace Acts namespace ActsExamples { -class IContextDecorator; -} // namespace ActsExamples - -namespace ActsExamples::Telescope { -class TelescopeDetectorElement; -class TelescopeG4DetectorConstruction; +class IContextDecorator; struct TelescopeDetector { - using DetectorElement = ActsExamples::Telescope::TelescopeDetectorElement; - using DetectorElementPtr = std::shared_ptr; - using DetectorStore = std::vector; - - using ContextDecorators = - std::vector>; + using ContextDecorators = std::vector>; using TrackingGeometryPtr = std::shared_ptr; struct Config { @@ -47,18 +34,18 @@ struct TelescopeDetector { std::vector stereos{{0, 0, 0, 0, 0, 0}}; std::array offsets{{0, 0}}; std::array bounds{{25, 100}}; - double thickness{80_um}; + double thickness{80 * Acts::UnitConstants::um}; int surfaceType{0}; int binValue{2}; }; Config config; /// The store of the detector elements (lifetime: job) - DetectorStore detectorStore; + std::vector> detectorStore; std::pair finalize( const Config& cfg, const std::shared_ptr& mdecorator); }; -} // namespace ActsExamples::Telescope +} // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp index 5a5d276cf9e..f3fa5a4b8bd 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp @@ -24,7 +24,7 @@ class DiscBounds; class ISurfaceMaterial; } // namespace Acts -namespace ActsExamples::Telescope { +namespace ActsExamples { /// @class TelescopeDetectorElement /// @@ -159,4 +159,4 @@ TelescopeDetectorElement::alignedTransforms() const { return m_alignedTransforms; } -} // namespace ActsExamples::Telescope +} // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp index 7e01a9499bd..d436d577235 100644 --- a/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp @@ -12,6 +12,7 @@ #include "Acts/Definitions/Units.hpp" #include "Acts/Geometry/CuboidVolumeBounds.hpp" #include "Acts/Geometry/CylinderVolumeBounds.hpp" +#include "Acts/Geometry/DetectorElementBase.hpp" #include "Acts/Geometry/DiscLayer.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ILayerArrayCreator.hpp" @@ -28,22 +29,21 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" #include "Acts/Utilities/Logger.hpp" +#include "ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp" #include #include #include std::unique_ptr -ActsExamples::Telescope::buildDetector( - const typename ActsExamples::Telescope::TelescopeDetectorElement:: - ContextType& gctx, - std::vector< - std::shared_ptr>& +ActsExamples::buildTelescopeDetector( + const Acts::GeometryContext& gctx, + std::vector>& detectorStore, const std::vector& positions, const std::vector& stereoAngles, const std::array& offsets, const std::array& bounds, - double thickness, ActsExamples::Telescope::TelescopeSurfaceType surfaceType, + double thickness, TelescopeSurfaceType surfaceType, Acts::BinningValue binValue) { using namespace Acts::UnitLiterals; diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp index 7a5e262067a..bbf1aff4106 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp @@ -8,6 +8,7 @@ #include "ActsExamples/TelescopeDetector/TelescopeDetector.hpp" +#include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Utilities/BinningType.hpp" #include "ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp" @@ -16,10 +17,12 @@ #include #include -auto ActsExamples::Telescope::TelescopeDetector::finalize( +namespace ActsExamples { + +auto TelescopeDetector::finalize( const Config& cfg, const std::shared_ptr& /*mdecorator*/) -> std::pair { - DetectorElement::ContextType nominalContext; + TelescopeDetectorElement::ContextType nominalContext; if (cfg.surfaceType > 1) { throw std::invalid_argument( @@ -48,15 +51,18 @@ auto ActsExamples::Telescope::TelescopeDetector::finalize( std::vector stereos = cfg.stereos; std::ranges::sort(positions); - /// Return the telescope detector - TrackingGeometryPtr gGeometry = ActsExamples::Telescope::buildDetector( - nominalContext, detectorStore, positions, stereos, cfg.offsets, - cfg.bounds, cfg.thickness, - static_cast( - cfg.surfaceType), - static_cast(cfg.binValue)); + Acts::GeometryContext geometryContext(nominalContext); + + // Return the telescope detector + TrackingGeometryPtr gGeometry = + buildTelescopeDetector(geometryContext, detectorStore, positions, stereos, + cfg.offsets, cfg.bounds, cfg.thickness, + static_cast(cfg.surfaceType), + static_cast(cfg.binValue)); ContextDecorators gContextDecorators = {}; // return the pair of geometry and empty decorators return std::make_pair( std::move(gGeometry), std::move(gContextDecorators)); } + +} // namespace ActsExamples diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeDetectorElement.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeDetectorElement.cpp index 22421064ef1..25fdca6c852 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeDetectorElement.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeDetectorElement.cpp @@ -11,7 +11,9 @@ #include "Acts/Surfaces/DiscSurface.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" -ActsExamples::Telescope::TelescopeDetectorElement::TelescopeDetectorElement( +namespace ActsExamples { + +TelescopeDetectorElement::TelescopeDetectorElement( std::shared_ptr transform, std::shared_ptr pBounds, double thickness, std::shared_ptr material) @@ -27,7 +29,7 @@ ActsExamples::Telescope::TelescopeDetectorElement::TelescopeDetectorElement( mutableSurface->assignSurfaceMaterial(std::move(material)); } -ActsExamples::Telescope::TelescopeDetectorElement::TelescopeDetectorElement( +TelescopeDetectorElement::TelescopeDetectorElement( std::shared_ptr transform, std::shared_ptr dBounds, double thickness, std::shared_ptr material) @@ -40,3 +42,5 @@ ActsExamples::Telescope::TelescopeDetectorElement::TelescopeDetectorElement( m_elementDiscBounds(std::move(dBounds)) { m_elementSurface->assignSurfaceMaterial(std::move(material)); } + +} // namespace ActsExamples diff --git a/Examples/Framework/ML/src/NeuralCalibrator.cpp b/Examples/Framework/ML/src/NeuralCalibrator.cpp index 67c6e76db57..83e4d11354e 100644 --- a/Examples/Framework/ML/src/NeuralCalibrator.cpp +++ b/Examples/Framework/ML/src/NeuralCalibrator.cpp @@ -189,9 +189,7 @@ void ActsExamples::NeuralCalibrator::calibrate( calibratedCovariance(boundLoc0, boundLoc0) = output[iVar0]; calibratedCovariance(boundLoc1, boundLoc1) = output[iVar0 + 1]; - trackState.allocateCalibrated(kMeasurementSize); - trackState.calibrated() = calibratedParameters; - trackState.calibratedCovariance() = calibratedCovariance; + trackState.allocateCalibrated(calibratedParameters, calibratedCovariance); trackState.setSubspaceIndices(fixedMeasurement.subspaceIndices()); }); } diff --git a/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp b/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp index ab232628341..174dc05ef40 100644 --- a/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp @@ -10,25 +10,16 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/EventData/MeasurementHelpers.hpp" #include "Acts/EventData/SubspaceHelpers.hpp" #include "Acts/EventData/Types.hpp" -#include "Acts/EventData/detail/ParameterTraits.hpp" -#include "Acts/EventData/detail/PrintParameters.hpp" #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Utilities/Iterator.hpp" #include "ActsExamples/EventData/GeometryContainers.hpp" #include "ActsExamples/EventData/IndexSourceLink.hpp" #include "ActsExamples/EventData/MeasurementConcept.hpp" -#include -#include -#include #include -#include -#include #include -#include #include #include @@ -138,6 +129,11 @@ class MeasurementContainer { return getMeasurement(addMeasurement(Size, geometryId)); } + template + VariableProxy copyMeasurement(const OtherDerived& other); + template + FixedProxy copyMeasurement(const OtherDerived& other); + template VariableProxy emplaceMeasurement(std::uint8_t size, Acts::GeometryIdentifier geometryId, @@ -494,6 +490,22 @@ class VariableMeasurementProxy } }; +template +MeasurementContainer::VariableProxy MeasurementContainer::copyMeasurement( + const OtherDerived& other) { + VariableProxy meas = makeMeasurement(other.size(), other.geometryId()); + meas.copyFrom(other); + return meas; +} + +template +MeasurementContainer::FixedProxy MeasurementContainer::copyMeasurement( + const OtherDerived& other) { + FixedProxy meas = makeMeasurement(other.geometryId()); + meas.copyFrom(other); + return meas; +} + template MeasurementContainer::VariableProxy MeasurementContainer::emplaceMeasurement( std::uint8_t size, Acts::GeometryIdentifier geometryId, Args&&... args) { diff --git a/Examples/Framework/include/ActsExamples/EventData/MeasurementConcept.hpp b/Examples/Framework/include/ActsExamples/EventData/MeasurementConcept.hpp index 14627a78c53..9394b1bf992 100644 --- a/Examples/Framework/include/ActsExamples/EventData/MeasurementConcept.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/MeasurementConcept.hpp @@ -8,7 +8,6 @@ #pragma once -#include "Acts/EventData/SourceLink.hpp" #include "Acts/Geometry/GeometryIdentifier.hpp" #include @@ -23,4 +22,5 @@ concept MeasurementConcept = requires(const T& m) { { m.parameters() }; { m.covariance() }; }; + } // namespace ActsExamples diff --git a/Examples/Framework/src/EventData/MeasurementCalibration.cpp b/Examples/Framework/src/EventData/MeasurementCalibration.cpp index b4764844770..190d37153bb 100644 --- a/Examples/Framework/src/EventData/MeasurementCalibration.cpp +++ b/Examples/Framework/src/EventData/MeasurementCalibration.cpp @@ -41,10 +41,8 @@ void ActsExamples::PassThroughCalibrator::calibrate( static_cast>( measurement); - trackState.allocateCalibrated(kMeasurementSize); - trackState.calibrated() = fixedMeasurement.parameters(); - trackState.calibratedCovariance() = - fixedMeasurement.covariance(); + trackState.allocateCalibrated(fixedMeasurement.parameters().eval(), + fixedMeasurement.covariance().eval()); trackState.setSubspaceIndices(fixedMeasurement.subspaceIndices()); }); } diff --git a/Examples/Framework/src/EventData/ScalingCalibrator.cpp b/Examples/Framework/src/EventData/ScalingCalibrator.cpp index ae5c1eca4fe..2a956902513 100644 --- a/Examples/Framework/src/EventData/ScalingCalibrator.cpp +++ b/Examples/Framework/src/EventData/ScalingCalibrator.cpp @@ -178,9 +178,7 @@ void ActsExamples::ScalingCalibrator::calibrate( calibratedCovariance(boundLoc0, boundLoc0) *= ct.x_scale; calibratedCovariance(boundLoc1, boundLoc1) *= ct.y_scale; - trackState.allocateCalibrated(kMeasurementSize); - trackState.calibrated() = calibratedParameters; - trackState.calibratedCovariance() = calibratedCovariance; + trackState.allocateCalibrated(calibratedParameters, calibratedCovariance); trackState.setSubspaceIndices(fixedMeasurement.subspaceIndices()); }); } diff --git a/Examples/Io/Csv/src/CsvTrackingGeometryWriter.cpp b/Examples/Io/Csv/src/CsvTrackingGeometryWriter.cpp index 1257be23ff6..e40c679a055 100644 --- a/Examples/Io/Csv/src/CsvTrackingGeometryWriter.cpp +++ b/Examples/Io/Csv/src/CsvTrackingGeometryWriter.cpp @@ -128,12 +128,12 @@ void writeSurface(SurfaceWriter& sfWriter, const Acts::Surface& surface, /// @param transform the layer transform /// @param representingBoundValues [in,out] the bound values /// @param last is the last layer -void writeCylinderLayerVolume( - LayerVolumeWriter& lvWriter, const Acts::Layer& lv, - const Acts::Transform3& transform, - std::vector& representingBoundValues, - std::vector& volumeBoundValues, - std::vector& lastBoundValues, bool last) { +void writeCylinderLayerVolume(LayerVolumeWriter& lvWriter, + const Acts::Layer& lv, + const Acts::Transform3& transform, + std::vector& representingBoundValues, + std::vector& volumeBoundValues, + std::vector& lastBoundValues, bool last) { // The layer volume to be written LayerVolumeData lvDims; lvDims.geometry_id = lv.geometryId().value(); @@ -229,9 +229,8 @@ void writeVolume(SurfaceWriter& sfWriter, SurfaceGridWriter& sfGridWriter, const auto& vTransform = volume.transform(); // Get the values of the volume boundaries - std::vector volumeBoundValues = - volume.volumeBounds().values(); - std::vector lastBoundValues; + std::vector volumeBoundValues = volume.volumeBounds().values(); + std::vector lastBoundValues; if (volume.volumeBounds().type() == Acts::VolumeBounds::eCylinder) { auto vTranslation = vTransform.translation(); @@ -285,7 +284,7 @@ void writeVolume(SurfaceWriter& sfWriter, SurfaceGridWriter& sfGridWriter, // Write the layer volume, exclude single layer volumes (written above) if (rVolume != nullptr && writeLayerVolume && layers.size() > 3) { // Get the values of the representing volume - std::vector representingBoundValues = + std::vector representingBoundValues = rVolume->volumeBounds().values(); if (rVolume->volumeBounds().type() == Acts::VolumeBounds::eCylinder) { bool last = (layerIdx + 2 == diff --git a/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepReader.hpp b/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepReader.hpp index 204f88ad83a..07c4e771857 100644 --- a/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepReader.hpp +++ b/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepReader.hpp @@ -25,9 +25,7 @@ namespace ActsExamples { -namespace DD4hep { struct DD4hepDetector; -} /// Read particles from EDM4hep. /// @@ -55,7 +53,7 @@ class EDM4hepReader final : public IReader { std::string graphvizOutput = ""; /// DD4hep detector for cellID resolution. - std::shared_ptr dd4hepDetector; + std::shared_ptr dd4hepDetector; /// Tracking geometry for cellID resolution. std::shared_ptr trackingGeometry; diff --git a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp index 3d5008863a3..4561bc61db0 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp @@ -9,7 +9,6 @@ #include "ActsExamples/Io/EDM4hep/EDM4hepReader.hpp" #include "Acts/Definitions/Units.hpp" -#include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp" #include "ActsExamples/DD4hepDetector/DD4hepDetector.hpp" #include "ActsExamples/EventData/SimHit.hpp" @@ -371,8 +370,8 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { for (auto it = hitsByParticle.begin(), end = hitsByParticle.end(); it != end; it = hitsByParticle.upper_bound(it->first)) { - std::cout << "Particle " << it->first << " has " - << hitsByParticle.count(it->first) << " hits" << std::endl; + ACTS_DEBUG("Particle " << it->first << " has " + << hitsByParticle.count(it->first) << " hits"); std::vector hitIndices; hitIndices.reserve(hitsByParticle.count(it->first)); diff --git a/Examples/Io/Json/src/JsonDigitizationConfig.cpp b/Examples/Io/Json/src/JsonDigitizationConfig.cpp index 489c86087bf..8e3b3abe2cc 100644 --- a/Examples/Io/Json/src/JsonDigitizationConfig.cpp +++ b/Examples/Io/Json/src/JsonDigitizationConfig.cpp @@ -87,12 +87,12 @@ void from_json( if (sType == "Gauss") { f = Digitization::Gauss(j["stddev"]); } else if (sType == "GaussTrunc") { - Acts::ActsScalar sigma = j["stddev"]; - std::pair range = j["range"]; + double sigma = j["stddev"]; + std::pair range = j["range"]; f = Digitization::GaussTrunc(sigma, range); } else if (sType == "GaussClipped") { - Acts::ActsScalar sigma = j["stddev"]; - std::pair range = j["range"]; + double sigma = j["stddev"]; + std::pair range = j["range"]; f = Digitization::GaussClipped(sigma, range); } else if (sType == "Uniform") { Acts::BinningData bd; @@ -159,7 +159,7 @@ void ActsExamples::from_json(const nlohmann::json& j, for (const auto& jvar : jvariances) { auto idx = static_cast(jvar["index"].get()); - auto vars = jvar["rms"].get>(); + auto vars = jvar["rms"].get>(); gdc.varianceMap[idx] = vars; } } diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryWriter.hpp index 5c9a71d6c94..9f23300be06 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryWriter.hpp @@ -49,9 +49,9 @@ class RootTrackSummaryWriter final : public WriterT { struct Config { /// Input (fitted) tracks collection std::string inputTracks; - /// Input particles collection. + /// Input particles collection (optional). std::string inputParticles; - /// Input track-particle matching. + /// Input track-particle matching (optional). std::string inputTrackParticleMatching; /// Output filename. std::string filePath = "tracksummary.root"; diff --git a/Examples/Io/Root/src/RootMaterialTrackReader.cpp b/Examples/Io/Root/src/RootMaterialTrackReader.cpp index b7e5e0ef4f2..dc8a48e137e 100644 --- a/Examples/Io/Root/src/RootMaterialTrackReader.cpp +++ b/Examples/Io/Root/src/RootMaterialTrackReader.cpp @@ -83,9 +83,6 @@ RootMaterialTrackReader::RootMaterialTrackReader(const Config& config, ACTS_DEBUG("The full chain has " << nentries << " entries for " << m_events << " events this corresponds to a batch size of: " << m_batchSize); - std::cout << "The full chain has " << nentries << " entries for " << m_events - << " events this corresponds to a batch size of: " << m_batchSize - << std::endl; // Sort the entry numbers of the events { diff --git a/Examples/Io/Root/src/RootTrackStatesWriter.cpp b/Examples/Io/Root/src/RootTrackStatesWriter.cpp index edf396384de..f90fa96ab0e 100644 --- a/Examples/Io/Root/src/RootTrackStatesWriter.cpp +++ b/Examples/Io/Root/src/RootTrackStatesWriter.cpp @@ -12,28 +12,22 @@ #include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/EventData/MultiTrajectory.hpp" -#include "Acts/EventData/MultiTrajectoryHelpers.hpp" -#include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/TransformationHelpers.hpp" #include "Acts/EventData/VectorMultiTrajectory.hpp" -#include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/MultiIndex.hpp" +#include "Acts/Utilities/TrackHelpers.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include "ActsExamples/EventData/AverageSimHits.hpp" #include "ActsExamples/EventData/IndexSourceLink.hpp" #include "ActsExamples/EventData/Track.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Utilities/Range.hpp" -#include "ActsExamples/Validation/TrackClassification.hpp" #include "ActsFatras/EventData/Barcode.hpp" -#include "ActsFatras/EventData/Particle.hpp" #include -#include #include #include -#include #include #include #include @@ -487,21 +481,7 @@ ProcessCode RootTrackStatesWriter::writeT(const AlgorithmContext& ctx, } if (ipar == eUnbiased && state.hasSmoothed() && state.hasProjector() && state.hasCalibrated()) { - // calculate the unbiased track parameters (i.e. fitted track - // parameters with this measurement removed) using Eq.(12a)-Eq.(12c) - // of NIMA 262, 444 (1987) - auto m = state.effectiveCalibrated(); - auto H = state.effectiveProjector(); - auto V = state.effectiveCalibratedCovariance(); - auto K = - (state.smoothedCovariance() * H.transpose() * - (H * state.smoothedCovariance() * H.transpose() - V).inverse()) - .eval(); - auto unbiasedParamsVec = - state.smoothed() + K * (m - H * state.smoothed()); - auto unbiasedParamsCov = - state.smoothedCovariance() - K * H * state.smoothedCovariance(); - return std::make_pair(unbiasedParamsVec, unbiasedParamsCov); + return Acts::calculateUnbiasedParametersCovariance(state); } return std::nullopt; }; diff --git a/Examples/Io/Root/src/RootTrackSummaryWriter.cpp b/Examples/Io/Root/src/RootTrackSummaryWriter.cpp index ad23b4e6195..de6753ce3bf 100644 --- a/Examples/Io/Root/src/RootTrackSummaryWriter.cpp +++ b/Examples/Io/Root/src/RootTrackSummaryWriter.cpp @@ -53,12 +53,6 @@ RootTrackSummaryWriter::RootTrackSummaryWriter( : WriterT(config.inputTracks, "RootTrackSummaryWriter", level), m_cfg(config) { // tracks collection name is already checked by base ctor - if (m_cfg.inputParticles.empty()) { - throw std::invalid_argument("Missing particles input collection"); - } - if (m_cfg.inputTrackParticleMatching.empty()) { - throw std::invalid_argument("Missing input track particles matching"); - } if (m_cfg.filePath.empty()) { throw std::invalid_argument("Missing output filename"); } @@ -66,8 +60,9 @@ RootTrackSummaryWriter::RootTrackSummaryWriter( throw std::invalid_argument("Missing tree name"); } - m_inputParticles.initialize(m_cfg.inputParticles); - m_inputTrackParticleMatching.initialize(m_cfg.inputTrackParticleMatching); + m_inputParticles.maybeInitialize(m_cfg.inputParticles); + m_inputTrackParticleMatching.maybeInitialize( + m_cfg.inputTrackParticleMatching); // Setup ROOT I/O auto path = m_cfg.filePath; @@ -220,9 +215,16 @@ ProcessCode RootTrackSummaryWriter::finalize() { ProcessCode RootTrackSummaryWriter::writeT(const AlgorithmContext& ctx, const ConstTrackContainer& tracks) { - // Read additional input collections - const auto& particles = m_inputParticles(ctx); - const auto& trackParticleMatching = m_inputTrackParticleMatching(ctx); + // In case we do not have truth info, we bind to a empty collection + const static SimParticleContainer emptyParticles; + const static TrackParticleMatching emptyTrackParticleMatching; + + const auto& particles = + m_inputParticles.isInitialized() ? m_inputParticles(ctx) : emptyParticles; + const auto& trackParticleMatching = + m_inputTrackParticleMatching.isInitialized() + ? m_inputTrackParticleMatching(ctx) + : emptyTrackParticleMatching; // For each particle within a track, how many hits did it contribute std::vector particleHitCounts; @@ -244,6 +246,7 @@ ProcessCode RootTrackSummaryWriter::writeT(const AlgorithmContext& ctx, m_nSharedHits.push_back(track.nSharedHits()); m_chi2Sum.push_back(track.chi2()); m_NDF.push_back(track.nDoF()); + { std::vector measurementChi2; std::vector measurementVolume; @@ -266,8 +269,6 @@ ProcessCode RootTrackSummaryWriter::writeT(const AlgorithmContext& ctx, measurementLayer.push_back(layer); } } - // IDs are stored as double (as the vector of vector of int is not known - // to ROOT) m_measurementChi2.push_back(std::move(measurementChi2)); m_measurementVolume.push_back(std::move(measurementVolume)); m_measurementLayer.push_back(std::move(measurementLayer)); diff --git a/Examples/Io/Root/src/VertexNTupleWriter.cpp b/Examples/Io/Root/src/VertexNTupleWriter.cpp index 07c71f115c1..6304af1cb8d 100644 --- a/Examples/Io/Root/src/VertexNTupleWriter.cpp +++ b/Examples/Io/Root/src/VertexNTupleWriter.cpp @@ -345,24 +345,24 @@ ProcessCode VertexNTupleWriter::writeT( }; // Helper function for computing the pull - auto pull = - [this](const Acts::ActsScalar& diff, const Acts::ActsScalar& variance, - const std::string& variableStr, const bool& afterFit = true) { - if (variance <= 0) { - std::string tempStr; - if (afterFit) { - tempStr = "after"; - } else { - tempStr = "before"; - } - ACTS_WARNING("Nonpositive variance " - << tempStr << " vertex fit: Var(" << variableStr - << ") = " << variance << " <= 0."); - return std::numeric_limits::quiet_NaN(); - } - double std = std::sqrt(variance); - return diff / std; - }; + auto pull = [this](const double& diff, const double& variance, + const std::string& variableStr, + const bool& afterFit = true) { + if (variance <= 0) { + std::string tempStr; + if (afterFit) { + tempStr = "after"; + } else { + tempStr = "before"; + } + ACTS_WARNING("Nonpositive variance " << tempStr << " vertex fit: Var(" + << variableStr << ") = " << variance + << " <= 0."); + return std::numeric_limits::quiet_NaN(); + } + double std = std::sqrt(variance); + return diff / std; + }; auto calculateTruthPrimaryVertexDensity = [this, truthVertices](const Acts::Vertex& vtx) { @@ -571,14 +571,14 @@ ProcessCode VertexNTupleWriter::writeT( m_recoZ.push_back(vtx.fullPosition()[Acts::CoordinateIndices::eZ]); m_recoT.push_back(vtx.fullPosition()[Acts::CoordinateIndices::eTime]); - Acts::ActsScalar varX = vtx.fullCovariance()(Acts::CoordinateIndices::eX, - Acts::CoordinateIndices::eX); - Acts::ActsScalar varY = vtx.fullCovariance()(Acts::CoordinateIndices::eY, - Acts::CoordinateIndices::eY); - Acts::ActsScalar varZ = vtx.fullCovariance()(Acts::CoordinateIndices::eZ, - Acts::CoordinateIndices::eZ); - Acts::ActsScalar varTime = vtx.fullCovariance()( - Acts::CoordinateIndices::eTime, Acts::CoordinateIndices::eTime); + double varX = vtx.fullCovariance()(Acts::CoordinateIndices::eX, + Acts::CoordinateIndices::eX); + double varY = vtx.fullCovariance()(Acts::CoordinateIndices::eY, + Acts::CoordinateIndices::eY); + double varZ = vtx.fullCovariance()(Acts::CoordinateIndices::eZ, + Acts::CoordinateIndices::eZ); + double varTime = vtx.fullCovariance()(Acts::CoordinateIndices::eTime, + Acts::CoordinateIndices::eTime); m_covXX.push_back(varX); m_covYY.push_back(varY); diff --git a/Examples/Io/Root/src/detail/NuclearInteractionParametrisation.cpp b/Examples/Io/Root/src/detail/NuclearInteractionParametrisation.cpp index eb1bbe838e8..244c30ca039 100644 --- a/Examples/Io/Root/src/detail/NuclearInteractionParametrisation.cpp +++ b/Examples/Io/Root/src/detail/NuclearInteractionParametrisation.cpp @@ -58,8 +58,8 @@ float gaussianValue(TH1F const* histo, const float mom) { float invariantMass(const Acts::Vector4& fourVector1, const Acts::Vector4& fourVector2) { Acts::Vector4 sum = fourVector1 + fourVector2; - const Acts::ActsScalar energy = sum[Acts::eEnergy]; - Acts::ActsScalar momentum = sum.template segment<3>(Acts::eMom0).norm(); + const double energy = sum[Acts::eEnergy]; + double momentum = sum.template segment<3>(Acts::eMom0).norm(); return std::sqrt(energy * energy - momentum * momentum); } diff --git a/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgPointWriter.hpp b/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgPointWriter.hpp index 3ad6527a882..8695fe2e7f1 100644 --- a/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgPointWriter.hpp +++ b/Examples/Io/Svg/include/ActsExamples/Io/Svg/SvgPointWriter.hpp @@ -82,7 +82,7 @@ class SvgPointWriter final : public WriterT> { std::string outputDir; ///< where to place output files std::size_t outputPrecision = 6; ///< floating point precision - Acts::ActsScalar spSize = 10.; //!< size of the space point to be drawn + double spSize = 10.; //!< size of the space point to be drawn Acts::Svg::Style spStyle = s_pointStyle; //!< The style of the space point to be drawn @@ -91,11 +91,11 @@ class SvgPointWriter final : public WriterT> { Acts::Svg::Style infoBoxStyle = s_infoStyle; // The style of the info box bool projectionXY = true; ///< xy projection - std::array zRangeXY = { - std::numeric_limits::lowest(), - std::numeric_limits::max()}; ///< View range in z of - ///< the XY view - bool projectionZR = true; ///< zr projection + std::array zRangeXY = { + std::numeric_limits::lowest(), + std::numeric_limits::max()}; ///< View range in z of + ///< the XY view + bool projectionZR = true; ///< zr projection std::shared_ptr trackingGeometry = nullptr; ///< The tracking geometry, a set pointer will cause the diff --git a/Examples/Python/src/DD4hepComponent.cpp b/Examples/Python/src/DD4hepComponent.cpp index f4ad0277aea..e38a33cf82c 100644 --- a/Examples/Python/src/DD4hepComponent.cpp +++ b/Examples/Python/src/DD4hepComponent.cpp @@ -16,32 +16,25 @@ #include "ActsExamples/DD4hepDetector/DD4hepDetector.hpp" #include "ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp" #include "ActsExamples/Framework/IContextDecorator.hpp" -#include "ActsExamples/Framework/ProcessCode.hpp" -#include #include #include -#include #include #include -namespace Acts { -class IMaterialDecorator; -} // namespace Acts - namespace py = pybind11; using namespace ActsExamples; using namespace Acts::Python; PYBIND11_MODULE(ActsPythonBindingsDD4hep, m) { { - using Config = DD4hep::DD4hepGeometryService::Config; - auto s = py::class_>( + using Config = DD4hepGeometryService::Config; + auto s = py::class_>( m, "DD4hepGeometryService") .def(py::init()) - .def("drop", &DD4hep::DD4hepGeometryService::drop); + .def("drop", &DD4hepGeometryService::drop); auto c = py::class_(s, "Config").def(py::init<>()); ACTS_PYTHON_STRUCT_BEGIN(c, Config); @@ -155,20 +148,20 @@ PYBIND11_MODULE(ActsPythonBindingsDD4hep, m) { } { - py::class_>( + py::class_>( m, "DD4hepDetector") .def(py::init<>()) - .def(py::init>()) + .def(py::init>()) .def("finalize", - py::overload_cast>( - &DD4hep::DD4hepDetector::finalize)) + &DD4hepDetector::finalize)) .def("finalize", py::overload_cast< const Acts::GeometryContext&, const Acts::Experimental::DD4hepDetectorStructure::Options&>( - &DD4hep::DD4hepDetector::finalize)) - .def("drop", &DD4hep::DD4hepDetector::drop) - .def_property_readonly("field", &DD4hep::DD4hepDetector::field); + &DD4hepDetector::finalize)) + .def("drop", &DD4hepDetector::drop) + .def_property_readonly("field", &DD4hepDetector::field); } } diff --git a/Examples/Python/src/Detector.cpp b/Examples/Python/src/Detector.cpp index 6b9ef68f927..833364301a7 100644 --- a/Examples/Python/src/Detector.cpp +++ b/Examples/Python/src/Detector.cpp @@ -10,7 +10,6 @@ #include "Acts/Material/IMaterialDecorator.hpp" #include "Acts/Plugins/Python/Utilities.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Logger.hpp" #include "ActsExamples/ContextualDetector/AlignedDetector.hpp" #include "ActsExamples/Framework/IContextDecorator.hpp" #include "ActsExamples/GenericDetector/GenericDetector.hpp" @@ -18,12 +17,9 @@ #include "ActsExamples/TelescopeDetector/TelescopeDetector.hpp" #include "ActsExamples/Utilities/Options.hpp" -#include -#include #include #include #include -#include #include #include @@ -34,6 +30,7 @@ namespace py = pybind11; using namespace ActsExamples; namespace Acts::Python { + void addDetector(Context& ctx) { auto [m, mex] = ctx.get("main", "examples"); { @@ -44,16 +41,17 @@ void addDetector(Context& ctx) { } { - using Config = GenericDetector::Config; + using Detector = GenericDetector; + using Config = Detector::Config; - auto gd = py::class_>( - mex, "GenericDetector") - .def(py::init<>()) - .def("finalize", - py::overload_cast< - const Config&, - std::shared_ptr>( - &GenericDetector::finalize)); + auto gd = + py::class_>(mex, "GenericDetector") + .def(py::init<>()) + .def("finalize", + py::overload_cast< + const Config&, + std::shared_ptr>( + &Detector::finalize)); py::class_(gd, "Config") .def(py::init<>()) @@ -65,18 +63,18 @@ void addDetector(Context& ctx) { } { - using TelescopeDetector = Telescope::TelescopeDetector; - using Config = TelescopeDetector::Config; + using Detector = TelescopeDetector; + using Config = Detector::Config; auto td = - py::class_>( - mex, "TelescopeDetector") + py::class_>(mex, + "TelescopeDetector") .def(py::init<>()) .def("finalize", py::overload_cast< const Config&, const std::shared_ptr&>( - &TelescopeDetector::finalize)); + &Detector::finalize)); py::class_(td, "Config") .def(py::init<>()) @@ -90,17 +88,17 @@ void addDetector(Context& ctx) { } { - using AlignedDetector = Contextual::AlignedDetector; - using Config = AlignedDetector::Config; - - auto d = py::class_>( - mex, "AlignedDetector") - .def(py::init<>()) - .def("finalize", - py::overload_cast< - const Config&, - std::shared_ptr>( - &AlignedDetector::finalize)); + using Detector = AlignedDetector; + using Config = Detector::Config; + + auto d = + py::class_>(mex, "AlignedDetector") + .def(py::init<>()) + .def("finalize", + py::overload_cast< + const Config&, + std::shared_ptr>( + &Detector::finalize)); auto c = py::class_(d, "Config") .def(py::init<>()); @@ -124,16 +122,17 @@ void addDetector(Context& ctx) { } { - using Config = TGeoDetector::Config; - - auto d = py::class_>( - mex, "TGeoDetector") - .def(py::init<>()) - .def("finalize", - py::overload_cast< - const Config&, - std::shared_ptr>( - &TGeoDetector::finalize)); + using Detector = TGeoDetector; + using Config = Detector::Config; + + auto d = + py::class_>(mex, "TGeoDetector") + .def(py::init<>()) + .def("finalize", + py::overload_cast< + const Config&, + std::shared_ptr>( + &Detector::finalize)); py::class_(mex, "Interval") .def(py::init<>()) diff --git a/Examples/Python/src/ExaTrkXTrackFinding.cpp b/Examples/Python/src/ExaTrkXTrackFinding.cpp index 3778e8576f5..c7a30b51d2e 100644 --- a/Examples/Python/src/ExaTrkXTrackFinding.cpp +++ b/Examples/Python/src/ExaTrkXTrackFinding.cpp @@ -30,6 +30,7 @@ namespace py = pybind11; using namespace ActsExamples; using namespace Acts; +using namespace py::literals; namespace Acts::Python { @@ -67,7 +68,7 @@ void addExaTrkXTrackFinding(Context &ctx) { auto c = py::class_(alg, "Config").def(py::init<>()); ACTS_PYTHON_STRUCT_BEGIN(c, Config); ACTS_PYTHON_MEMBER(modelPath); - ACTS_PYTHON_MEMBER(numFeatures); + ACTS_PYTHON_MEMBER(selectedFeatures); ACTS_PYTHON_MEMBER(embeddingDim); ACTS_PYTHON_MEMBER(rVal); ACTS_PYTHON_MEMBER(knnVal); @@ -91,11 +92,12 @@ void addExaTrkXTrackFinding(Context &ctx) { auto c = py::class_(alg, "Config").def(py::init<>()); ACTS_PYTHON_STRUCT_BEGIN(c, Config); ACTS_PYTHON_MEMBER(modelPath); - ACTS_PYTHON_MEMBER(numFeatures); + ACTS_PYTHON_MEMBER(selectedFeatures); ACTS_PYTHON_MEMBER(cut); ACTS_PYTHON_MEMBER(nChunks); ACTS_PYTHON_MEMBER(undirected); ACTS_PYTHON_MEMBER(deviceID); + ACTS_PYTHON_MEMBER(useEdgeFeatures); ACTS_PYTHON_STRUCT_END(); } { @@ -174,36 +176,61 @@ void addExaTrkXTrackFinding(Context &ctx) { inputMeasurementSimHitsMap, inputMeasurementParticlesMap, outputGraph, targetMinPT, targetMinSize, uniqueModules); - py::enum_(mex, "NodeFeature") - .value("R", TrackFindingAlgorithmExaTrkX::NodeFeature::eR) - .value("Phi", TrackFindingAlgorithmExaTrkX::NodeFeature::ePhi) - .value("Z", TrackFindingAlgorithmExaTrkX::NodeFeature::eZ) - .value("X", TrackFindingAlgorithmExaTrkX::NodeFeature::eX) - .value("Y", TrackFindingAlgorithmExaTrkX::NodeFeature::eY) - .value("Eta", TrackFindingAlgorithmExaTrkX::NodeFeature::eEta) - .value("ClusterX", TrackFindingAlgorithmExaTrkX::NodeFeature::eClusterX) - .value("ClusterY", TrackFindingAlgorithmExaTrkX::NodeFeature::eClusterY) - .value("CellCount", TrackFindingAlgorithmExaTrkX::NodeFeature::eCellCount) - .value("CellSum", TrackFindingAlgorithmExaTrkX::NodeFeature::eCellSum) - .value("Cluster1R", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster1R) - .value("Cluster2R", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster2R) - .value("Cluster1Phi", - TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster1Phi) - .value("Cluster2Phi", - TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster2Phi) - .value("Cluster1Z", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster1Z) - .value("Cluster2Z", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster2Z) - .value("Cluster1Eta", - TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster1Eta) - .value("Cluster2Eta", - TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster2Eta); - - ACTS_PYTHON_DECLARE_ALGORITHM(ActsExamples::TrackFindingAlgorithmExaTrkX, mex, - "TrackFindingAlgorithmExaTrkX", - inputSpacePoints, inputClusters, - inputTruthGraph, outputProtoTracks, outputGraph, - graphConstructor, edgeClassifiers, trackBuilder, - nodeFeatures, featureScales, filterShortTracks); + { + auto nodeFeatureEnum = + py::enum_(mex, "NodeFeature") + .value("R", TrackFindingAlgorithmExaTrkX::NodeFeature::eR) + .value("Phi", TrackFindingAlgorithmExaTrkX::NodeFeature::ePhi) + .value("Z", TrackFindingAlgorithmExaTrkX::NodeFeature::eZ) + .value("X", TrackFindingAlgorithmExaTrkX::NodeFeature::eX) + .value("Y", TrackFindingAlgorithmExaTrkX::NodeFeature::eY) + .value("Eta", TrackFindingAlgorithmExaTrkX::NodeFeature::eEta) + .value("ClusterX", + TrackFindingAlgorithmExaTrkX::NodeFeature::eClusterLoc0) + .value("ClusterY", + TrackFindingAlgorithmExaTrkX::NodeFeature::eClusterLoc1) + .value("CellCount", + TrackFindingAlgorithmExaTrkX::NodeFeature::eCellCount) + .value("ChargeSum", + TrackFindingAlgorithmExaTrkX::NodeFeature::eChargeSum); + + // clang-format off +#define ADD_FEATURE_ENUMS(n) \ + nodeFeatureEnum \ + .value("Cluster" #n "X", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster##n##X) \ + .value("Cluster" #n "Y", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster##n##Y) \ + .value("Cluster" #n "Z", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster##n##Z) \ + .value("Cluster" #n "R", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster##n##R) \ + .value("Cluster" #n "Phi", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster##n##Phi) \ + .value("Cluster" #n "Eta", TrackFindingAlgorithmExaTrkX::NodeFeature::eCluster##n##Eta) \ + .value("CellCount" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eCellCount##n) \ + .value("ChargeSum" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eChargeSum##n) \ + .value("LocEta" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLocEta##n) \ + .value("LocPhi" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLocPhi##n) \ + .value("LocDir0" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLocDir0##n) \ + .value("LocDir1" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLocDir1##n) \ + .value("LocDir2" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLocDir2##n) \ + .value("LengthDir0" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLengthDir0##n) \ + .value("LengthDir1" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLengthDir1##n) \ + .value("LengthDir2" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eLengthDir2##n) \ + .value("GlobEta" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eGlobEta##n) \ + .value("GlobPhi" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eGlobPhi##n) \ + .value("EtaAngle" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::eEtaAngle##n) \ + .value("PhiAngle" #n, TrackFindingAlgorithmExaTrkX::NodeFeature::ePhiAngle##n) + // clang-format on + + ADD_FEATURE_ENUMS(1); + ADD_FEATURE_ENUMS(2); + +#undef ADD_FEATURE_ENUMS + } + + ACTS_PYTHON_DECLARE_ALGORITHM( + ActsExamples::TrackFindingAlgorithmExaTrkX, mex, + "TrackFindingAlgorithmExaTrkX", inputSpacePoints, inputClusters, + inputTruthGraph, outputProtoTracks, outputGraph, graphConstructor, + edgeClassifiers, trackBuilder, nodeFeatures, featureScales, + minMeasurementsPerTrack, geometryIdMap); { auto cls = @@ -239,7 +266,8 @@ void addExaTrkXTrackFinding(Context &ctx) { py::arg("graphConstructor"), py::arg("edgeClassifiers"), py::arg("trackBuilder"), py::arg("level")) .def("run", &ExaTrkXPipeline::run, py::arg("features"), - py::arg("spacepoints"), py::arg("hook") = Acts::ExaTrkXHook{}, + py::arg("moduleIds"), py::arg("spacepoints"), + py::arg("hook") = Acts::ExaTrkXHook{}, py::arg("timing") = nullptr); } diff --git a/Examples/Python/src/Geant4Component.cpp b/Examples/Python/src/Geant4Component.cpp index abba9cefe98..53984168740 100644 --- a/Examples/Python/src/Geant4Component.cpp +++ b/Examples/Python/src/Geant4Component.cpp @@ -42,17 +42,6 @@ #include #include -class G4UserSteppingAction; -class G4VUserPhysicsList; -namespace Acts { -class MagneticFieldProvider; -class TrackingGeometry; -class Volume; -} // namespace Acts -namespace ActsExamples { -class RandomNumbers; -} // namespace ActsExamples - namespace py = pybind11; using namespace pybind11::literals; @@ -250,12 +239,11 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { } { - py::class_< - Telescope::TelescopeG4DetectorConstructionFactory, - Geant4::DetectorConstructionFactory, - std::shared_ptr>( + py::class_>( mod, "TelescopeG4DetectorConstructionFactory") - .def(py::init>>(), py::arg("cfg"), py::arg("regionCreators") = @@ -289,31 +277,29 @@ PYBIND11_MODULE(ActsPythonBindingsGeant4, mod) { std::shared_ptr>( mod, "Geant4DetectorElement"); - using Geant4Detector = Geant4::Geant4Detector; + using Detector = Geant4Detector; + using Config = Detector::Config; auto g = - py::class_>( - mod, "Geant4Detector") + py::class_>(mod, "Geant4Detector") .def(py::init<>()) .def( "constructDetector", - [](Geant4Detector& self, const Geant4Detector::Config& cfg, - Logging::Level logLevel) { + [](Detector& self, const Config& cfg, Logging::Level logLevel) { auto logger = getDefaultLogger("Geant4Detector", logLevel); return self.constructDetector(cfg, *logger); }, py::arg("cfg"), py::arg("logLevel") = Logging::INFO) .def( "constructTrackingGeometry", - [](Geant4Detector& self, const Geant4Detector::Config& cfg, - Logging::Level logLevel) { + [](Detector& self, const Config& cfg, Logging::Level logLevel) { auto logger = getDefaultLogger("Geant4Detector", logLevel); return self.constructTrackingGeometry(cfg, *logger); }, py::arg("cfg"), py::arg("logLevel") = Logging::INFO); - auto c = py::class_(g, "Config").def(py::init<>()); - ACTS_PYTHON_STRUCT_BEGIN(c, Geant4Detector::Config); + auto c = py::class_(g, "Config").def(py::init<>()); + ACTS_PYTHON_STRUCT_BEGIN(c, Config); ACTS_PYTHON_MEMBER(name); ACTS_PYTHON_MEMBER(g4World); ACTS_PYTHON_MEMBER(g4SurfaceOptions); diff --git a/Examples/Python/src/Geant4DD4hepComponent.cpp b/Examples/Python/src/Geant4DD4hepComponent.cpp index f8dec7d35d1..409bca273d1 100644 --- a/Examples/Python/src/Geant4DD4hepComponent.cpp +++ b/Examples/Python/src/Geant4DD4hepComponent.cpp @@ -14,8 +14,6 @@ #include #include -class G4VUserDetectorConstruction; - namespace py = pybind11; using namespace ActsExamples; @@ -28,7 +26,7 @@ PYBIND11_MODULE(ActsPythonBindingsDDG4, m) { Geant4::DetectorConstructionFactory, std::shared_ptr>( m, "DDG4DetectorConstructionFactory") - .def(py::init, + .def(py::init, std::vector>>(), py::arg("detector"), py::arg("regionCreators") = diff --git a/Examples/Python/src/Geometry.cpp b/Examples/Python/src/Geometry.cpp index ee98bac3fb5..d69b35a86ba 100644 --- a/Examples/Python/src/Geometry.cpp +++ b/Examples/Python/src/Geometry.cpp @@ -199,8 +199,8 @@ void addGeometry(Context& ctx) { py::class_, Acts::VolumeBounds>(m, "CylinderVolumeBounds") - .def(py::init(), + .def(py::init(), "rmin"_a, "rmax"_a, "halfz"_a, "halfphi"_a = std::numbers::pi, "avgphi"_a = 0., "bevelMinZ"_a = 0., "bevelMaxZ"_a = 0.); @@ -282,7 +282,7 @@ void addGeometry(Context& ctx) { py::arg("envelope") = ExtentEnvelope::Zero()) .def("range", [](const Acts::Extent& self, - Acts::BinningValue bval) -> std::array { + Acts::BinningValue bval) -> std::array { return {self.min(bval), self.max(bval)}; }) .def("__str__", &Extent::toString); @@ -382,11 +382,10 @@ void addExperimentalGeometry(Context& ctx) { // Be able to construct a proto binning py::class_(m, "ProtoBinning") .def(py::init&, std::size_t>(), + const std::vector&, std::size_t>(), "bValue"_a, "bType"_a, "e"_a, "exp"_a = 0u) - .def(py::init(), + .def(py::init(), "bValue"_a, "bType"_a, "minE"_a, "maxE"_a, "nbins"_a, "exp"_a = 0u) .def(py::init(), @@ -436,13 +435,13 @@ void addExperimentalGeometry(Context& ctx) { } { - using RangeXDDim1 = Acts::RangeXD<1u, Acts::ActsScalar>; + using RangeXDDim1 = Acts::RangeXD<1u, double>; using KdtSurfacesDim1Bin100 = Acts::Experimental::KdtSurfaces<1u, 100u>; using KdtSurfacesProviderDim1Bin100 = Acts::Experimental::KdtSurfacesProvider<1u, 100u>; py::class_(m, "RangeXDDim1") - .def(py::init([](const std::array& irange) { + .def(py::init([](const std::array& irange) { RangeXDDim1 range; range[0].shrink(irange[0], irange[1]); return range; @@ -464,14 +463,14 @@ void addExperimentalGeometry(Context& ctx) { } { - using RangeXDDim2 = Acts::RangeXD<2u, Acts::ActsScalar>; + using RangeXDDim2 = Acts::RangeXD<2u, double>; using KdtSurfacesDim2Bin100 = Acts::Experimental::KdtSurfaces<2u, 100u>; using KdtSurfacesProviderDim2Bin100 = Acts::Experimental::KdtSurfacesProvider<2u, 100u>; py::class_(m, "RangeXDDim2") - .def(py::init([](const std::array& range0, - const std::array& range1) { + .def(py::init([](const std::array& range0, + const std::array& range1) { RangeXDDim2 range; range[0].shrink(range0[0], range0[1]); range[1].shrink(range1[0], range1[1]); diff --git a/Examples/Python/src/Json.cpp b/Examples/Python/src/Json.cpp index 12baaa9f6d3..cbf9bfb6581 100644 --- a/Examples/Python/src/Json.cpp +++ b/Examples/Python/src/Json.cpp @@ -153,7 +153,7 @@ void addJson(Context& ctx) { .def(py::init<>()) .def(py::init, - std::pair>(), + std::pair>(), py::arg("refLayers"), py::arg("bins")); ACTS_PYTHON_STRUCT_BEGIN(c, Config); diff --git a/Examples/Python/src/TruthTracking.cpp b/Examples/Python/src/TruthTracking.cpp index 3f0d8a0915a..1502ce23d40 100644 --- a/Examples/Python/src/TruthTracking.cpp +++ b/Examples/Python/src/TruthTracking.cpp @@ -8,6 +8,7 @@ #include "Acts/Plugins/Python/Utilities.hpp" #include "Acts/Utilities/Logger.hpp" +#include "ActsExamples/TruthTracking/HitSelector.hpp" #include "ActsExamples/TruthTracking/ParticleSelector.hpp" #include "ActsExamples/TruthTracking/ParticleSmearing.hpp" #include "ActsExamples/TruthTracking/TrackModifier.hpp" @@ -16,7 +17,6 @@ #include "ActsExamples/TruthTracking/TruthSeedingAlgorithm.hpp" #include "ActsExamples/TruthTracking/TruthTrackFinder.hpp" #include "ActsExamples/TruthTracking/TruthVertexFinder.hpp" -#include "ActsExamples/Utilities/HitSelector.hpp" #include @@ -85,6 +85,8 @@ void addTruthTracking(Context& ctx) { ACTS_PYTHON_MEMBER(removeNeutral); ACTS_PYTHON_MEMBER(removeSecondaries); ACTS_PYTHON_MEMBER(excludeAbsPdgs); + ACTS_PYTHON_MEMBER(minPrimaryVertexId); + ACTS_PYTHON_MEMBER(maxPrimaryVertexId); ACTS_PYTHON_STRUCT_END(); pythonRangeProperty(c, "rho", &Config::rhoMin, &Config::rhoMax); @@ -97,6 +99,8 @@ void addTruthTracking(Context& ctx) { pythonRangeProperty(c, "pt", &Config::ptMin, &Config::ptMax); pythonRangeProperty(c, "measurements", &Config::measurementsMin, &Config::measurementsMax); + pythonRangeProperty(c, "primaryVertexId", &Config::minPrimaryVertexId, + &Config::maxPrimaryVertexId); } { @@ -154,7 +158,10 @@ void addTruthTracking(Context& ctx) { outputParticles, outputSeeds, outputProtoTracks, deltaRMin, deltaRMax); ACTS_PYTHON_DECLARE_ALGORITHM(ActsExamples::HitSelector, mex, "HitSelector", - inputHits, outputHits, maxTime); + inputHits, inputParticlesSelected, outputHits, + minX, maxX, minY, maxY, minZ, maxZ, minR, maxR, + minTime, maxTime, minEnergyLoss, maxEnergyLoss, + minPrimaryVertexId, maxPrimaryVertexId); ACTS_PYTHON_DECLARE_ALGORITHM( ActsExamples::TrackTruthMatcher, mex, "TrackTruthMatcher", inputTracks, diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 666cb676c39..ab5e04706bb 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -33,21 +33,21 @@ test_digitization_example_input[smeared]__particles.root: 669d0304eb8bcf244aa627 test_digitization_example_input[smeared]__measurements.root: 243c2f69b7b0db9dbeaa7494d4ea0f3dd1691dc90f16e10df6c0491ff4dc7d62 test_digitization_example_input[geometric]__particles.root: 669d0304eb8bcf244aa627809a117944e5e3b994fdfcfb8710f2b9a8f9a62d3b test_digitization_example_input[geometric]__measurements.root: 63ec81635979058fb8976f94455bf490cf92b7b142c4a05cc39de6225f5de2fb -test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: ec6487dfca5f944cfacfef903eb4b9a97f8f6a668d07f77d0c3ec45c68054824 -test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: 84085bcc63562cfb1b4c70d2665bf06938ac559bb40c2b01c076e1d8b5c7b43b +test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: f0b4c6018d0b2641024b88f6ac717f16a2ca486007c2e9bf166c85dc5e161739 +test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: e5187591a0902d7214dd211adf459e2ec43b200b43c7ebdb90e5af50ee828f91 test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e -test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 8e15cceeef4b115708596702988925b7506d39e0531dc5534636ec411a9b4ca2 -test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 8e0116c656e1cc67446d54a5205c4a3e2f4c1fc90fa551bb608c881877dfa0ab +test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 1d3198e1926cf2c568d1c854c3ec7d638ed296163ac3cd1ff68273ab21a12657 +test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 0b0266b28e20efab834b74e816ed9c658527496f6ef55ca8c073133aae0825b1 test_ckf_tracks_example[generic-truth_estimated]__performance_seeding.root: 1facb05c066221f6361b61f015cdf0918e94d9f3fce2269ec7b6a4dffeb2bc7e -test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 82a6744980553e6274df78eea15f0dec22676b1c04e14afc3828bff9bbf5e1b1 -test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 06d6ae1d05cb611b19df3c59531997c9b0108f5ef6027d76c4827bd2d9edb921 -test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: 53a96c225ed78bd7da1491ae3ff4173f0e6c8bffe27e3eab1ab7adfe55426080 +test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: d043c7d28772954fa2c1e4b320384c26589586bc4cdd95e0506fab59a37135d7 +test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: f063e4ab1f7f55106fa8b61bac627ca4739f04434ee35c77db603910a6e1a747 +test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: d5388653cf5613e765e6ce1e5afe94d94ff5182d7734e75251bc415f0192f444 test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 2a98d8ec8fae97e18f4661580b71885f558d7222f94bca5edfbf5cdb595021f7 test_ckf_tracks_example[odd-full_seeding]__performance_seeding_trees.root: 43c58577aafe07645e5660c4f43904efadf91d8cda45c5c04c248bbe0f59814f -test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 7ec5f4b24fa69bfc9d812a6f224d74d36df2d0a42aef791ae0116f309d6f1433 +test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 6ed8f0db3f3e7f1b71b6d9da7371597d4fb5f95b3d2f2ab18be43d1763ce41c1 test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 1eaae038ced2cc5c757480ca42eab60cdaff14d812c34a807a841267d6bfa110 test_ckf_tracks_example[odd-truth_estimated]__performance_seeding.root: 1a36b7017e59f1c08602ef3c2cb0483c51df248f112e3780c66594110719c575 -test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 35a65e15a6f479f628a96f56ee78e1ac371d71a686ee0c974944d681499fe6bd +test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: a519202b1233d8e7aac3c9038ee6e16b5d3cdfe2027212d6900e00ee0fcec21d test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 3e257de624674fa9a19dcc72598c78c29a52633821acaa56dc2aa39a1395f1b5 test_vertex_fitting_reading[Truth-False-100]__performance_vertexing.root: 76ef6084d758dfdfc0151ddec2170e12d73394424e3dac4ffe46f0f339ec8293 test_vertex_fitting_reading[Iterative-False-100]__performance_vertexing.root: 60372210c830a04f95ceb78c6c68a9b0de217746ff59e8e73053750c837b57eb diff --git a/Examples/Python/tests/test_writer.py b/Examples/Python/tests/test_writer.py index 4c9e220f899..ac64fa4048f 100644 --- a/Examples/Python/tests/test_writer.py +++ b/Examples/Python/tests/test_writer.py @@ -197,6 +197,43 @@ def test_root_simhits_writer(tmp_path, fatras, conf_const, assert_root_hash): assert_root_hash(out.name, out) +@pytest.mark.root +def test_root_tracksummary_writer(tmp_path, fatras, conf_const): + detector, trackingGeometry, decorators = GenericDetector.create() + field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T)) + s = Sequencer(numThreads=1, events=10) + + from truth_tracking_kalman import runTruthTrackingKalman + + # This also runs the RootTrackSummaryWriter with truth information + runTruthTrackingKalman( + trackingGeometry, + field, + digiConfigFile=Path( + str( + Path(__file__).parent.parent.parent.parent + / "Examples/Algorithms/Digitization/share/default-smearing-config-generic.json" + ) + ), + outputDir=tmp_path, + s=s, + ) + + # Run the RootTrackSummaryWriter without the truth information + s.addWriter( + conf_const( + RootTrackSummaryWriter, + level=acts.logging.INFO, + inputTracks="tracks", + filePath=str(tmp_path / "track_summary_kf_no_truth.root"), + ) + ) + + s.run() + assert (tmp_path / "tracksummary_kf.root").exists() + assert (tmp_path / "track_summary_kf_no_truth.root").exists() + + @pytest.mark.csv def test_csv_meas_writer(tmp_path, fatras, trk_geo, conf_const): s = Sequencer(numThreads=1, events=10) diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/EventDataSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/EventDataSvgConverter.hpp index c05539d6dd4..ddcf1654eb1 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/EventDataSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/EventDataSvgConverter.hpp @@ -23,8 +23,8 @@ namespace Acts::Svg::EventDataConverter { /// @param idx the running index /// /// @return a vector of svg objects -actsvg::svg::object pointXY(const Vector3& pos, ActsScalar size, - const Style& style, unsigned int idx = 0); +actsvg::svg::object pointXY(const Vector3& pos, double size, const Style& style, + unsigned int idx = 0); /// Write/create a 3D point in ZR view /// @@ -34,8 +34,8 @@ actsvg::svg::object pointXY(const Vector3& pos, ActsScalar size, /// @param indx the running index /// /// @return a vector of svg objects -actsvg::svg::object pointZR(const Vector3& pos, ActsScalar size, - const Style& style, unsigned int idx = 0); +actsvg::svg::object pointZR(const Vector3& pos, double size, const Style& style, + unsigned int idx = 0); /// Write/create a 3D point in a given view /// @@ -46,8 +46,8 @@ actsvg::svg::object pointZR(const Vector3& pos, ActsScalar size, /// /// @return a vector of svg objects template -actsvg::svg::object point(const Vector3& pos, ActsScalar size, - const Style& style, unsigned int idx) { +actsvg::svg::object point(const Vector3& pos, double size, const Style& style, + unsigned int idx) { view_type view; std::vector ps = {pos}; auto ppos = view(ps)[0]; diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp index 909fc44a356..c81698de5c2 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/GridSvgConverter.hpp @@ -31,7 +31,7 @@ using ProtoGrid = actsvg::proto::grid; namespace GridConverter { // An optional range and binning value -using AxisBound = std::tuple, BinningValue>; +using AxisBound = std::tuple, BinningValue>; /// Nested Options struct struct Options { @@ -65,8 +65,8 @@ ProtoGrid convert(const grid_type& grid, // The edge values - these need to follow the ACTSVG convention, // so there could be swapping when necessary - std::vector edges0; - std::vector edges1; + std::vector edges0; + std::vector edges1; // 1D case (more to be filled in later) if constexpr (grid_type::DIM == 1u) { diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp index 788ac36aca5..b90803b07a5 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp @@ -115,7 +115,7 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, if constexpr (index_grid::grid_type::DIM == 1u) { if (indexGrid.casts[0u] == BinningValue::binPhi) { auto estRangeR = constrain.range(BinningValue::binR); - std::array rRange = {estRangeR.min(), estRangeR.max()}; + std::array rRange = {estRangeR.min(), estRangeR.max()}; gridOptions.optionalBound = {rRange, BinningValue::binR}; } } @@ -139,7 +139,7 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, // Register the bin naming std::string binInfo = std::string("- bin : [") + std::to_string(ib0) + std::string("]"); - ActsScalar binCenter = 0.5 * (binEdges[ib0] + binEdges[ib0 - 1u]); + double binCenter = 0.5 * (binEdges[ib0] + binEdges[ib0 - 1u]); binInfo += "\n - center : (" + std::to_string(binCenter) + ")"; pGrid._bin_ids.push_back(binInfo); } @@ -158,8 +158,8 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, std::string binInfo = std::string("- bin : [") + std::to_string(ib0) + std::string(", ") + std::to_string(ib1) + std::string("]"); - ActsScalar binCenter0 = 0.5 * (binEdges0[ib0] + binEdges0[ib0 - 1u]); - ActsScalar binCenter1 = 0.5 * (binEdges1[ib1] + binEdges1[ib1 - 1u]); + double binCenter0 = 0.5 * (binEdges0[ib0] + binEdges0[ib0 - 1u]); + double binCenter1 = 0.5 * (binEdges1[ib1] + binEdges1[ib1 - 1u]); binInfo += "\n - center : (" + std::to_string(binCenter0) + ", " + std::to_string(binCenter1) + ")"; pGrid._bin_ids.push_back(binInfo); diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/LayerSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/LayerSvgConverter.hpp index 079f5ae7aec..c5cf43675dd 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/LayerSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/LayerSvgConverter.hpp @@ -24,13 +24,10 @@ namespace Svg { using ProtoVolume = actsvg::proto::volume>; -static std::array noLimitZ = { - std::numeric_limits::lowest(), - std::numeric_limits::max()}; +static std::array noLimitZ = {std::numeric_limits::lowest(), + std::numeric_limits::max()}; -static std::array noLimitPhi = { - -std::numbers::pi_v, - std::numbers::pi_v}; +static std::array noLimitPhi = {-std::numbers::pi, std::numbers::pi}; namespace LayerConverter { @@ -49,16 +46,16 @@ struct Options { /// The style of the surface objects GeometryHierarchyMap