diff --git a/Alignment/include/ActsAlignment/Kernel/Alignment.ipp b/Alignment/include/ActsAlignment/Kernel/Alignment.ipp index 09170ee9ca9..a1a8e451b08 100644 --- a/Alignment/include/ActsAlignment/Kernel/Alignment.ipp +++ b/Alignment/include/ActsAlignment/Kernel/Alignment.ipp @@ -118,7 +118,8 @@ void ActsAlignment::Alignment::calculateAlignmentParameters( alignResult.measurementDim += alignState.measurementDim; sumChi2ONdf += alignState.chi2 / alignState.measurementDim; } - alignResult.averageChi2ONdf = sumChi2ONdf / alignResult.numTracks; + alignResult.averageChi2ONdf = + sumChi2ONdf / static_cast(alignResult.numTracks); // Get the inverse of chi2 second derivative matrix (we need this to // calculate the covariance of the alignment parameters) diff --git a/Core/include/Acts/Definitions/Units.hpp b/Core/include/Acts/Definitions/Units.hpp index 65d7cee775d..5a247e5eccf 100644 --- a/Core/include/Acts/Definitions/Units.hpp +++ b/Core/include/Acts/Definitions/Units.hpp @@ -202,10 +202,10 @@ constexpr double mol = 1.0; namespace UnitLiterals { // define user literal functions for the given unit constant #define ACTS_DEFINE_UNIT_LITERAL(name) \ - constexpr double operator"" _##name(long double x) { \ + inline consteval double operator"" _##name(long double x) { \ return ::Acts::UnitConstants::name * x; \ } \ - constexpr double operator"" _##name(unsigned long long x) { \ + inline consteval double operator"" _##name(unsigned long long x) { \ return ::Acts::UnitConstants::name * x; \ } ACTS_DEFINE_UNIT_LITERAL(fm) diff --git a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp index 9ce660e5856..5ce2937019e 100644 --- a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp @@ -84,7 +84,8 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// Constructor - from a fixed size array /// /// @param values The bound values - TrapezoidVolumeBounds(const std::array& values) noexcept(false) + explicit TrapezoidVolumeBounds( + const std::array& values) noexcept(false) : m_values(values) { checkConsistency(); buildSurfaceBounds(); diff --git a/Core/include/Acts/MagneticField/ConstantBField.hpp b/Core/include/Acts/MagneticField/ConstantBField.hpp index 7586cbcbace..59f1d8999e9 100644 --- a/Core/include/Acts/MagneticField/ConstantBField.hpp +++ b/Core/include/Acts/MagneticField/ConstantBField.hpp @@ -22,7 +22,7 @@ class ConstantBField final : public MagneticFieldProvider { public: struct Cache { /// @brief constructor with context - Cache(const MagneticFieldContext& /*mcfg*/) {} + explicit Cache(const MagneticFieldContext& /*mcfg*/) {} }; /// Construct constant magnetic field from field vector. diff --git a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp index d65f8113d9e..3f23d7f4d7c 100644 --- a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp +++ b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp @@ -146,7 +146,7 @@ class InterpolatedBFieldMap : public InterpolatedMagneticField { struct Cache { /// @brief Constructor with magnetic field context - Cache(const MagneticFieldContext& /*mctx*/) {} + explicit Cache(const MagneticFieldContext& /*mctx*/) {} std::optional fieldCell; bool initialized = false; @@ -175,7 +175,8 @@ class InterpolatedBFieldMap : public InterpolatedMagneticField { /// @brief default constructor /// - InterpolatedBFieldMap(Config cfg) : m_cfg{std::move(cfg)} { + /// @param cfg the configuration struct + explicit InterpolatedBFieldMap(Config cfg) : m_cfg{std::move(cfg)} { typename Grid::index_t minBin{}; minBin.fill(1); m_lowerLeft = m_cfg.grid.lowerLeftBinEdge(minBin); diff --git a/Core/include/Acts/MagneticField/NullBField.hpp b/Core/include/Acts/MagneticField/NullBField.hpp index d3c24ee59f3..e5d513a4e2e 100644 --- a/Core/include/Acts/MagneticField/NullBField.hpp +++ b/Core/include/Acts/MagneticField/NullBField.hpp @@ -19,7 +19,7 @@ class NullBField final : public MagneticFieldProvider { public: struct Cache { /// @brief constructor with context - Cache(const MagneticFieldContext& /*mcfg*/) {} + explicit Cache(const MagneticFieldContext& /*mcfg*/) {} }; /// @brief Default constructor diff --git a/Core/include/Acts/MagneticField/SolenoidBField.hpp b/Core/include/Acts/MagneticField/SolenoidBField.hpp index b2162203eec..d14d3eedeab 100644 --- a/Core/include/Acts/MagneticField/SolenoidBField.hpp +++ b/Core/include/Acts/MagneticField/SolenoidBField.hpp @@ -71,7 +71,7 @@ class SolenoidBField final : public MagneticFieldProvider { public: struct Cache { /// @brief Constructor with magnetic field context - Cache(const MagneticFieldContext& /*mctx*/) {} + explicit Cache(const MagneticFieldContext& /*mctx*/) {} }; /// Config struct for the SolenoidBfield. @@ -91,7 +91,7 @@ class SolenoidBField final : public MagneticFieldProvider { /// @brief the constructor with a shared pointer /// @note since it is a shared field, we enforce it to be const /// @tparam bField is the shared BField to be stored - SolenoidBField(Config config); + explicit SolenoidBField(Config config); /// @brief Retrieve magnetic field value in local (r,z) coordinates /// diff --git a/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp b/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp index 7107410bfec..12c233a37e2 100644 --- a/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp @@ -37,7 +37,7 @@ class AccumulatedSurfaceMaterial { /// Default Constructor - for homogeneous material /// /// @param splitFactor is the pre/post splitting directive - AccumulatedSurfaceMaterial(double splitFactor = 0.); + explicit AccumulatedSurfaceMaterial(double splitFactor = 0.); /// Explicit constructor with only full MaterialSlab, /// for one-dimensional binning. diff --git a/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp b/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp index 2034387e764..ddb2a0fabc2 100644 --- a/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp +++ b/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp @@ -25,7 +25,7 @@ class HomogeneousVolumeMaterial : public IVolumeMaterial { /// Explicit constructor /// /// @param material is the material held by this - HomogeneousVolumeMaterial(const Material& material); + explicit HomogeneousVolumeMaterial(const Material& material); /// Copy Constructor /// diff --git a/Core/include/Acts/Material/ISurfaceMaterial.hpp b/Core/include/Acts/Material/ISurfaceMaterial.hpp index cad6832441a..c587a3c4260 100644 --- a/Core/include/Acts/Material/ISurfaceMaterial.hpp +++ b/Core/include/Acts/Material/ISurfaceMaterial.hpp @@ -35,7 +35,7 @@ class ISurfaceMaterial { /// Constructor /// /// @param splitFactor is the splitting ratio between pre/post update - ISurfaceMaterial(double splitFactor) : m_splitFactor(splitFactor) {} + explicit ISurfaceMaterial(double splitFactor) : m_splitFactor(splitFactor) {} /// Constructor /// diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 942c20dc764..1e8cdefbcb8 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -70,7 +70,8 @@ class AnnulusBounds : public DiscBounds { /// Constructor - from parameters array /// /// @param values The parameter array - AnnulusBounds(const std::array& values) noexcept(false); + explicit AnnulusBounds(const std::array& values) noexcept( + false); AnnulusBounds(const AnnulusBounds& source) = default; diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index d0d684016a8..343746aa496 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -75,7 +75,7 @@ class ConeBounds : public SurfaceBounds { /// Constructor - from parameters array /// /// @param values The parameter array - ConeBounds(const std::array& values) noexcept(false); + explicit ConeBounds(const std::array& values) noexcept(false); ~ConeBounds() override = default; diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index e802056e7fd..3446c6784f9 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -88,17 +88,18 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// This will throw if the vector size does not match `num_vertices`. /// This will throw if the vertices do not form a convex polygon. /// @param vertices The list of vertices. - ConvexPolygonBounds(const std::vector& vertices) noexcept(false); + explicit ConvexPolygonBounds(const std::vector& vertices) noexcept( + false); /// Constructor from a fixed size array of vertices. /// This will throw if the vertices do not form a convex polygon. /// @param vertices The vertices - ConvexPolygonBounds(const vertex_array& vertices) noexcept(false); + explicit ConvexPolygonBounds(const vertex_array& vertices) noexcept(false); /// Constructor from a fixed size array of parameters /// This will throw if the vertices do not form a convex polygon. /// @param values The values to build up the vertices - ConvexPolygonBounds(const value_array& values) noexcept(false); + explicit ConvexPolygonBounds(const value_array& values) noexcept(false); ~ConvexPolygonBounds() override = default; diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index d144c8b995b..3f4d87a40ad 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -81,7 +81,8 @@ class CylinderBounds : public SurfaceBounds { /// Constructor - from fixed size array /// /// @param values The parameter values - CylinderBounds(const std::array& values) noexcept(false) + explicit CylinderBounds(const std::array& values) noexcept( + false) : m_values(values), m_closed(std::abs(values[eHalfPhiSector] - std::numbers::pi) < s_epsilon) { diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index 7497bd22309..a46467cc5e3 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -63,7 +63,8 @@ class DiamondBounds : public PlanarBounds { /// Constructor - from fixed size array /// /// @param values The parameter values - DiamondBounds(const std::array& values) noexcept(false) + explicit DiamondBounds(const std::array& values) noexcept( + false) : m_values(values), m_boundingBox( Vector2{-(*std::max_element(values.begin(), values.begin() + 2)), diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index 32c63c2aef6..855c4a0aab5 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -59,7 +59,8 @@ class DiscTrapezoidBounds : public DiscBounds { /// Constructor - from fixed size array /// /// @param values The parameter values - DiscTrapezoidBounds(const std::array& values) noexcept(false) + explicit DiscTrapezoidBounds( + const std::array& values) noexcept(false) : m_values(values) { checkConsistency(); } diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index ea90e3d2a88..dcdc529c011 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -68,7 +68,8 @@ class EllipseBounds : public PlanarBounds { /// Constructor - from fixed size array /// /// @param values The parameter values - EllipseBounds(const std::array& values) noexcept(false) + explicit EllipseBounds(const std::array& values) noexcept( + false) : m_values(values), m_boundingBox(values[eInnerRy], values[eOuterRy]) { checkConsistency(); } diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index e3169d8a845..006dcc796d7 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -39,7 +39,7 @@ class LineBounds : public SurfaceBounds { /// Constructor - from fixed size array /// /// @param values The parameter values - LineBounds(const std::array& values) noexcept(false) + explicit LineBounds(const std::array& values) noexcept(false) : m_values(values) { checkConsistency(); } diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index ef3e8996572..c47ae5904c8 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -57,7 +57,7 @@ class RadialBounds : public DiscBounds { /// Constructor from array values /// /// @param values The bound values - RadialBounds(const std::array& values) noexcept(false) + explicit RadialBounds(const std::array& values) noexcept(false) : m_values(values) { checkConsistency(); } diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index aba1743fa74..957140b1bac 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -50,15 +50,6 @@ class RectangleBounds : public PlanarBounds { checkConsistency(); } - /// Constructor - from fixed size array - generic - /// - /// @param values The parameter values - RectangleBounds(const std::array& values) noexcept(false) - : m_min({values[eMinX], values[eMinY]}), - m_max({values[eMaxX], values[eMaxY]}) { - checkConsistency(); - } - /// Constructor - from min/max - generic /// /// @param min The left bottom corner @@ -68,6 +59,16 @@ class RectangleBounds : public PlanarBounds { checkConsistency(); } + /// Constructor - from fixed size array - generic + /// + /// @param values The parameter values + explicit RectangleBounds(const std::array& values) noexcept( + false) + : m_min({values[eMinX], values[eMinY]}), + m_max({values[eMaxX], values[eMaxY]}) { + checkConsistency(); + } + ~RectangleBounds() override = default; BoundsType type() const final; diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index 94a571268d5..71a1e6ee060 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -356,12 +356,13 @@ class SurfaceArray { struct SingleElementLookup : ISurfaceGridLookup { /// @brief Default constructor. /// @param element the one and only element. - SingleElementLookup(SurfaceVector::value_type element) + explicit SingleElementLookup(SurfaceVector::value_type element) : m_element({element}) {} /// @brief Default constructor. /// @param elements the surfaces that are provided through a single lookup - SingleElementLookup(const SurfaceVector& elements) : m_element(elements) {} + explicit SingleElementLookup(const SurfaceVector& elements) + : m_element(elements) {} /// @brief Lookup, always returns @c element /// @return reference to vector containing only @c element @@ -442,7 +443,7 @@ class SurfaceArray { /// @brief Constructor with a single surface /// @param srf The one and only surface - SurfaceArray(std::shared_ptr srf); + explicit SurfaceArray(std::shared_ptr srf); /// @brief Get all surfaces in bin given by position. /// @param position the lookup position diff --git a/Core/include/Acts/Utilities/Axis.hpp b/Core/include/Acts/Utilities/Axis.hpp index 758a8c2ec3c..8eec68716c9 100644 --- a/Core/include/Acts/Utilities/Axis.hpp +++ b/Core/include/Acts/Utilities/Axis.hpp @@ -43,7 +43,8 @@ class NeighborHoodIndices { iterator() = default; // Specialized constructor for end() iterator - iterator(std::size_t current) : m_current(current), m_wrapped(true) {} + explicit iterator(std::size_t current) + : m_current(current), m_wrapped(true) {} iterator(std::size_t begin1, std::size_t end1, std::size_t begin2) : m_current(begin1), diff --git a/Core/include/Acts/Utilities/Grid.hpp b/Core/include/Acts/Utilities/Grid.hpp index 317fb3b123e..c2bb3b3e9bc 100644 --- a/Core/include/Acts/Utilities/Grid.hpp +++ b/Core/include/Acts/Utilities/Grid.hpp @@ -98,38 +98,39 @@ class Grid final : public IGrid { /// grid object. /// /// @param axes - Grid(const std::tuple& axes) : m_axes(axes) { + explicit Grid(const std::tuple& axes) : m_axes(axes) { m_values.resize(size()); } /// @brief Move constructor from axis tuple /// @param axes - Grid(std::tuple&& axes) : m_axes(std::move(axes)) { + explicit Grid(std::tuple&& axes) : m_axes(std::move(axes)) { m_values.resize(size()); } /// @brief constructor from parameters pack of axes /// @param axes - Grid(Axes&&... axes) : m_axes(std::forward_as_tuple(axes...)) { + explicit Grid(Axes&&... axes) : m_axes(std::forward_as_tuple(axes...)) { m_values.resize(size()); } /// @brief constructor from parameters pack of axes /// @param axes - Grid(const Axes&... axes) : m_axes(std::tuple(axes...)) { + explicit Grid(const Axes&... axes) : m_axes(std::tuple(axes...)) { m_values.resize(size()); } /// @brief constructor from parameters pack of axes and type tag /// @param axes - Grid(TypeTag /*tag*/, Axes&&... axes) + explicit Grid(TypeTag /*tag*/, Axes&&... axes) : m_axes(std::forward_as_tuple(axes...)) { m_values.resize(size()); } /// @brief constructor from parameters pack of axes and type tag /// @param axes - Grid(TypeTag /*tag*/, const Axes&... axes) : m_axes(std::tuple(axes...)) { + explicit Grid(TypeTag /*tag*/, const Axes&... axes) + : m_axes(std::tuple(axes...)) { m_values.resize(size()); } diff --git a/Core/include/Acts/Utilities/KDTree.hpp b/Core/include/Acts/Utilities/KDTree.hpp index dc8f9f9b844..e448ff50657 100644 --- a/Core/include/Acts/Utilities/KDTree.hpp +++ b/Core/include/Acts/Utilities/KDTree.hpp @@ -75,7 +75,7 @@ class KDTree { /// /// @param d The vector of position-value pairs to construct the k-d tree /// from. - KDTree(vector_t &&d) : m_elems(d) { + explicit KDTree(vector_t &&d) : m_elems(d) { // To start out, we need to check whether we need to construct a leaf node // or an internal node. We create a leaf only if we have at most as many // elements as the number of elements that can fit into a leaf node. diff --git a/Core/include/Acts/Utilities/RangeXD.hpp b/Core/include/Acts/Utilities/RangeXD.hpp index 19f82245460..3024b230b5f 100644 --- a/Core/include/Acts/Utilities/RangeXD.hpp +++ b/Core/include/Acts/Utilities/RangeXD.hpp @@ -67,7 +67,7 @@ class RangeXD { /// @brief Construct a range from a pair of minimum and maximum values /// @note Only available for one-dimensional ranges /// @param p The pair of minimum and maximum values - RangeXD(const std::pair& p) + explicit RangeXD(const std::pair& p) requires(Dims == 1) : m_minima({p.first}), m_maxima({p.second}) {} diff --git a/Examples/Algorithms/Fatras/src/FatrasSimulation.cpp b/Examples/Algorithms/Fatras/src/FatrasSimulation.cpp index f9e627f482a..f70826437f0 100644 --- a/Examples/Algorithms/Fatras/src/FatrasSimulation.cpp +++ b/Examples/Algorithms/Fatras/src/FatrasSimulation.cpp @@ -222,7 +222,7 @@ ActsExamples::ProcessCode ActsExamples::FatrasSimulation::execute( std::vector particlesInput; particlesInput.reserve(inputParticles.size()); for (const auto &p : inputParticles) { - particlesInput.push_back(p.initial()); + particlesInput.push_back(p.initialState()); } // prepare output containers @@ -302,7 +302,7 @@ ActsExamples::ProcessCode ActsExamples::FatrasSimulation::execute( if (auto it = particlesFinal.find(particleInitial.particleId()); it != particlesFinal.end()) { - particleSimulated.final() = *it; + particleSimulated.finalState() = *it; } else { ACTS_ERROR("particle " << particleInitial.particleId() << " has no final state"); diff --git a/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp b/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp index 886646a3655..401a821a6cd 100644 --- a/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp +++ b/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp @@ -95,7 +95,7 @@ void ParticleTrackingAction::PostUserTrackingAction(const G4Track* aTrack) { return; } SimParticle particle = *particleIt; - particle.final() = convert(*aTrack, barcode); + particle.finalState() = convert(*aTrack, barcode); auto [it, success] = eventStore().particlesSimulated.insert(particle); diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp b/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp index 9d5c1b873d3..2c13621c898 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp @@ -85,8 +85,8 @@ ProcessCode EventGenerator::read(const AlgorithmContext& ctx) { ACTS_VERBOSE(" - particle at " << pos4.transpose()); // `withParticleId` returns a copy because it changes the identity particle = particle.withParticleId(pid); - particle.initial().setPosition4(pos4); - particle.final().setPosition4(pos4); + particle.initialState().setPosition4(pos4); + particle.finalState().setPosition4(pos4); }; for (auto& vertexParticle : newParticles) { updateParticleInPlace(vertexParticle); diff --git a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp index 6cc00f77430..cc2105477da 100644 --- a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp +++ b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp @@ -76,7 +76,7 @@ void setPassedMaterial(const HepMC3::ConstGenVertexPtr& vertex, const int id, currentVertex = currentParticle->production_vertex(); } // Assign the passed material to the particle - particle.final().setMaterialPassed(x0, l0); + particle.finalState().setMaterialPassed(x0, l0); } /// @brief This function collects outgoing particles from a vertex while keeping diff --git a/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp b/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp index e88e8e9db38..3ab1c4ef0d3 100644 --- a/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp @@ -162,11 +162,11 @@ template inline auto selectModule(const GeometryIdMultiset& container, Acts::GeometryIdentifier::Value volume, Acts::GeometryIdentifier::Value layer, - Acts::GeometryIdentifier::Value module) { + Acts::GeometryIdentifier::Value imodule) { return selectModule( container, Acts::GeometryIdentifier().setVolume(volume).setLayer(layer).setSensitive( - module)); + imodule)); } /// Select all elements for the lowest non-zero identifier component. diff --git a/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp b/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp index 2bf9dcc8cbc..de23dd47b32 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SimParticle.hpp @@ -56,11 +56,16 @@ class SimParticle final { } } - const SimParticleState& initial() const { return m_initial; } - const SimParticleState& final() const { return m_final; } + /// Const reference access to the initial particle state + const SimParticleState& initialState() const { return m_initial; } + /// Const reference access to the final particle state + const SimParticleState& finalState() const { return m_final; } - SimParticleState& initial() { return m_initial; } - SimParticleState& final() { return m_final; } + /// Non-const reference access to the initial particle state + SimParticleState& initialState() { return m_initial; } + + /// Non-const reference access to the final particle state + SimParticleState& finalState() { return m_final; } /// Construct a new particle with a new identifier but same kinematics. /// @@ -68,100 +73,108 @@ class SimParticle final { /// is used to identify the whole particle. Setting it on an existing /// particle is usually a mistake. SimParticle withParticleId(SimBarcode particleId) const { - return SimParticle(initial().withParticleId(particleId), - final().withParticleId(particleId)); + return SimParticle(initialState().withParticleId(particleId), + finalState().withParticleId(particleId)); } /// Set the process type that generated this particle. SimParticle& setProcess(ActsFatras::ProcessType proc) { - initial().setProcess(proc); - final().setProcess(proc); + initialState().setProcess(proc); + finalState().setProcess(proc); return *this; } /// Set the pdg. SimParticle& setPdg(Acts::PdgParticle pdg) { - initial().setPdg(pdg); - final().setPdg(pdg); + initialState().setPdg(pdg); + finalState().setPdg(pdg); return *this; } /// Set the charge. SimParticle& setCharge(double charge) { - initial().setCharge(charge); - final().setCharge(charge); + initialState().setCharge(charge); + finalState().setCharge(charge); return *this; } /// Set the mass. SimParticle& setMass(double mass) { - initial().setMass(mass); - final().setMass(mass); + initialState().setMass(mass); + finalState().setMass(mass); return *this; } /// Set the particle ID. SimParticle& setParticleId(SimBarcode barcode) { - initial().setParticleId(barcode); - final().setParticleId(barcode); + initialState().setParticleId(barcode); + finalState().setParticleId(barcode); return *this; } /// Particle identifier within an event. - SimBarcode particleId() const { return initial().particleId(); } + SimBarcode particleId() const { return initialState().particleId(); } /// Which type of process generated this particle. - ActsFatras::ProcessType process() const { return initial().process(); } + ActsFatras::ProcessType process() const { return initialState().process(); } /// PDG particle number that identifies the type. - Acts::PdgParticle pdg() const { return initial().pdg(); } + Acts::PdgParticle pdg() const { return initialState().pdg(); } /// Absolute PDG particle number that identifies the type. - Acts::PdgParticle absolutePdg() const { return initial().absolutePdg(); } + Acts::PdgParticle absolutePdg() const { return initialState().absolutePdg(); } /// Particle charge. - double charge() const { return initial().charge(); } + double charge() const { return initialState().charge(); } /// Particle absolute charge. - double absoluteCharge() const { return initial().absoluteCharge(); } + double absoluteCharge() const { return initialState().absoluteCharge(); } /// Particle mass. - double mass() const { return initial().mass(); } + double mass() const { return initialState().mass(); } /// Check if this is a secondary particle. - bool isSecondary() const { return initial().isSecondary(); } + bool isSecondary() const { return initialState().isSecondary(); } /// Particle hypothesis. - Acts::ParticleHypothesis hypothesis() const { return initial().hypothesis(); } + Acts::ParticleHypothesis hypothesis() const { + return initialState().hypothesis(); + } /// Particl qOverP. - double qOverP() const { return initial().qOverP(); } + double qOverP() const { return initialState().qOverP(); } /// Space-time position four-vector. - const Acts::Vector4& fourPosition() const { return initial().fourPosition(); } + const Acts::Vector4& fourPosition() const { + return initialState().fourPosition(); + } /// Three-position, i.e. spatial coordinates without the time. - auto position() const { return initial().position(); } + auto position() const { return initialState().position(); } /// Time coordinate. - double time() const { return initial().time(); } + double time() const { return initialState().time(); } /// Energy-momentum four-vector. - Acts::Vector4 fourMomentum() const { return initial().fourMomentum(); } + Acts::Vector4 fourMomentum() const { return initialState().fourMomentum(); } /// Unit three-direction, i.e. the normalized momentum three-vector. - const Acts::Vector3& direction() const { return initial().direction(); } + const Acts::Vector3& direction() const { return initialState().direction(); } /// Polar angle. - double theta() const { return initial().theta(); } + double theta() const { return initialState().theta(); } /// Azimuthal angle. - double phi() const { return initial().phi(); } + double phi() const { return initialState().phi(); } /// Absolute momentum in the x-y plane. - double transverseMomentum() const { return initial().transverseMomentum(); } + double transverseMomentum() const { + return initialState().transverseMomentum(); + } /// Absolute momentum. - double absoluteMomentum() const { return initial().absoluteMomentum(); } + double absoluteMomentum() const { return initialState().absoluteMomentum(); } /// Absolute momentum. - Acts::Vector3 momentum() const { return initial().momentum(); } + Acts::Vector3 momentum() const { return initialState().momentum(); } /// Total energy, i.e. norm of the four-momentum. - double energy() const { return initial().energy(); } + double energy() const { return initialState().energy(); } /// Energy loss over the particles lifetime or simulation time. - double energyLoss() const { return initial().energy() - final().energy(); } + double energyLoss() const { + return initialState().energy() - finalState().energy(); + } /// Accumulated path within material measured in radiation lengths. - double pathInX0() const { return final().pathInX0(); } + double pathInX0() const { return finalState().pathInX0(); } /// Accumulated path within material measured in interaction lengths. - double pathInL0() const { return final().pathInL0(); } + double pathInL0() const { return finalState().pathInL0(); } /// Number of hits. - std::uint32_t numberOfHits() const { return final().numberOfHits(); } + std::uint32_t numberOfHits() const { return finalState().numberOfHits(); } /// Particle outcome. - ActsFatras::ParticleOutcome outcome() const { return final().outcome(); } + ActsFatras::ParticleOutcome outcome() const { return finalState().outcome(); } private: SimParticleState m_initial; diff --git a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp index 0b82a20181b..3c8727a2e80 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp @@ -267,7 +267,7 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { } } - particleSimulated.final().setPosition4( + particleSimulated.finalState().setPosition4( inParticle.getEndpoint()[0] * Acts::UnitConstants::mm, inParticle.getEndpoint()[1] * Acts::UnitConstants::mm, inParticle.getEndpoint()[2] * Acts::UnitConstants::mm, time); @@ -275,15 +275,15 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { Acts::Vector3 momentumFinal = {inParticle.getMomentumAtEndpoint()[0], inParticle.getMomentumAtEndpoint()[1], inParticle.getMomentumAtEndpoint()[2]}; - particleSimulated.final().setDirection(momentumFinal.normalized()); - particleSimulated.final().setAbsoluteMomentum(momentumFinal.norm()); + particleSimulated.finalState().setDirection(momentumFinal.normalized()); + particleSimulated.finalState().setAbsoluteMomentum(momentumFinal.norm()); ACTS_VERBOSE("- Updated particle initial -> final, position: " << particleInitial.fourPosition().transpose() << " -> " - << particleSimulated.final().fourPosition().transpose()); + << particleSimulated.finalState().fourPosition().transpose()); ACTS_VERBOSE(" momentum: " << particleInitial.fourMomentum().transpose() << " -> " - << particleSimulated.final().fourMomentum().transpose()); + << particleSimulated.finalState().fourMomentum().transpose()); particlesSimulated.insert(particleSimulated); } diff --git a/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp b/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp index adb433891d9..5471b6b63db 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp @@ -35,17 +35,17 @@ SimParticle EDM4hepUtil::readParticle(const edm4hep::MCParticle& from, // TODO do we have that in EDM4hep? // particle.setProcess(static_cast(data.process)); - to.initial().setPosition4(from.getVertex()[0] * Acts::UnitConstants::mm, - from.getVertex()[1] * Acts::UnitConstants::mm, - from.getVertex()[2] * Acts::UnitConstants::mm, - from.getTime() * Acts::UnitConstants::ns); + to.initialState().setPosition4(from.getVertex()[0] * Acts::UnitConstants::mm, + from.getVertex()[1] * Acts::UnitConstants::mm, + from.getVertex()[2] * Acts::UnitConstants::mm, + from.getTime() * Acts::UnitConstants::ns); // Only used for direction; normalization/units do not matter Acts::Vector3 momentum = {from.getMomentum()[0], from.getMomentum()[1], from.getMomentum()[2]}; - to.initial().setDirection(momentum.normalized()); + to.initialState().setDirection(momentum.normalized()); - to.initial().setAbsoluteMomentum(momentum.norm() * 1_GeV); + to.initialState().setAbsoluteMomentum(momentum.norm() * 1_GeV); return to; } @@ -62,9 +62,9 @@ void EDM4hepUtil::writeParticle(const SimParticle& from, static_cast(from.fourMomentum().y()), static_cast(from.fourMomentum().z())}); to.setMomentumAtEndpoint( - {static_cast(from.final().fourMomentum().x()), - static_cast(from.final().fourMomentum().y()), - static_cast(from.final().fourMomentum().z())}); + {static_cast(from.finalState().fourMomentum().x()), + static_cast(from.finalState().fourMomentum().y()), + static_cast(from.finalState().fourMomentum().z())}); } ActsFatras::Hit EDM4hepUtil::readSimHit( diff --git a/Examples/Io/Root/src/RootAthenaDumpReader.cpp b/Examples/Io/Root/src/RootAthenaDumpReader.cpp index 421affa36ba..9a9325d43e1 100644 --- a/Examples/Io/Root/src/RootAthenaDumpReader.cpp +++ b/Examples/Io/Root/src/RootAthenaDumpReader.cpp @@ -672,7 +672,7 @@ RootAthenaDumpReader::reprocessParticles( } auto newParticle = particle.withParticleId(fatrasBarcode); - newParticle.final().setNumberOfHits(std::distance(begin, end)); + newParticle.finalState().setNumberOfHits(std::distance(begin, end)); newParticles.push_back(newParticle); for (auto it = begin; it != end; ++it) { diff --git a/Examples/Io/Root/src/RootParticleReader.cpp b/Examples/Io/Root/src/RootParticleReader.cpp index 0eafeaa666b..410970a07bd 100644 --- a/Examples/Io/Root/src/RootParticleReader.cpp +++ b/Examples/Io/Root/src/RootParticleReader.cpp @@ -157,7 +157,7 @@ ProcessCode RootParticleReader::read(const AlgorithmContext& context) { p.setMass((*m_m).at(i) * Acts::UnitConstants::GeV); p.setParticleId((*m_particleId).at(i)); - SimParticleState& initialState = p.initial(); + SimParticleState& initialState = p.initialState(); initialState.setPosition4((*m_vx).at(i) * Acts::UnitConstants::mm, (*m_vy).at(i) * Acts::UnitConstants::mm, @@ -167,7 +167,7 @@ ProcessCode RootParticleReader::read(const AlgorithmContext& context) { initialState.setDirection((*m_px).at(i), (*m_py).at(i), (*m_pz).at(i)); initialState.setAbsoluteMomentum((*m_p).at(i) * Acts::UnitConstants::GeV); - SimParticleState& finalState = p.final(); + SimParticleState& finalState = p.finalState(); // TODO eloss cannot be read since we need the final momentum finalState.setMaterialPassed((*m_pathInX0).at(i) * Acts::UnitConstants::mm, diff --git a/Examples/Io/Root/src/SeedingPerformanceWriter.cpp b/Examples/Io/Root/src/SeedingPerformanceWriter.cpp index e37f115093d..75898818ed3 100644 --- a/Examples/Io/Root/src/SeedingPerformanceWriter.cpp +++ b/Examples/Io/Root/src/SeedingPerformanceWriter.cpp @@ -175,9 +175,9 @@ ActsExamples::ProcessCode ActsExamples::SeedingPerformanceWriter::writeT( minDeltaR = distance; } } - m_effPlotTool.fill(m_effPlotCache, particle.initial(), minDeltaR, + m_effPlotTool.fill(m_effPlotCache, particle.initialState(), minDeltaR, isMatched); - m_duplicationPlotTool.fill(m_duplicationPlotCache, particle.initial(), + m_duplicationPlotTool.fill(m_duplicationPlotCache, particle.initialState(), nMatchedSeedsForParticle - 1); } ACTS_DEBUG("Number of seeds: " << nSeeds); diff --git a/Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp b/Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp index 0265aa3ea8b..dd5c671b02f 100644 --- a/Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp +++ b/Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp @@ -260,14 +260,14 @@ ProcessCode TrackFinderPerformanceWriter::writeT( } // Fill efficiency plots - m_effPlotTool.fill(m_effPlotCache, particle.initial(), minDeltaR, + m_effPlotTool.fill(m_effPlotCache, particle.initialState(), minDeltaR, isReconstructed); // Fill number of duplicated tracks for this particle - m_duplicationPlotTool.fill(m_duplicationPlotCache, particle.initial(), + m_duplicationPlotTool.fill(m_duplicationPlotCache, particle.initialState(), nMatchedTracks - 1); // Fill number of reconstructed/truth-matched/fake tracks for this particle - m_fakeRatePlotTool.fill(m_fakeRatePlotCache, particle.initial(), + m_fakeRatePlotTool.fill(m_fakeRatePlotCache, particle.initialState(), nMatchedTracks, nFakeTracks); m_nTotalParticles += 1; diff --git a/Examples/Io/Root/src/TrackFitterPerformanceWriter.cpp b/Examples/Io/Root/src/TrackFitterPerformanceWriter.cpp index 6a183cef4dd..f6c98028939 100644 --- a/Examples/Io/Root/src/TrackFitterPerformanceWriter.cpp +++ b/Examples/Io/Root/src/TrackFitterPerformanceWriter.cpp @@ -148,7 +148,7 @@ ActsExamples::ProcessCode ActsExamples::TrackFitterPerformanceWriter::writeT( // Record this majority particle ID of this trajectory reconParticleIds.push_back(ip->particleId()); // Fill the residual plots - m_resPlotTool.fill(m_resPlotCache, ctx.geoContext, ip->initial(), + m_resPlotTool.fill(m_resPlotCache, ctx.geoContext, ip->initialState(), fittedParameters); // Fill the trajectory summary info m_trackSummaryPlotTool.fill(m_trackSummaryPlotCache, fittedParameters, @@ -182,7 +182,7 @@ ActsExamples::ProcessCode ActsExamples::TrackFitterPerformanceWriter::writeT( minDeltaR = distance; } } - m_effPlotTool.fill(m_effPlotCache, particle.initial(), minDeltaR, + m_effPlotTool.fill(m_effPlotCache, particle.initialState(), minDeltaR, isReconstructed); } diff --git a/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp index 6b6712c230b..93ed797fed2 100644 --- a/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(ConvexPolygonBoundsConvexity) { // wrong number of vertices BOOST_CHECK_THROW(poly<3> trip{vertices}, AssertionFailureException); } - { poly<4> quad = {vertices}; } + { poly<4> quad(vertices); } // this one is self intersecting vertices = {{0, 0}, {1, 0}, {0.5, 1}, {0.9, 1.2}}; @@ -50,13 +50,13 @@ BOOST_AUTO_TEST_CASE(ConvexPolygonBoundsConvexity) { // this one is not vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}}; - { poly<4> quad = {vertices}; } + { poly<4> quad(vertices); } vertices = {{0, 0}, {1, 0}, {0.8, 0.5}, {1, 1}, {0, 1}}; { BOOST_CHECK_THROW(poly<5> pent(vertices), std::logic_error); } vertices = {{0, 0}, {1, 0}, {1.1, 0.5}, {1, 1}, {0, 1}}; - { poly<5> pent{vertices}; } + { poly<5> pent(vertices); } } BOOST_AUTO_TEST_CASE(ConvexPolygonBoundsConstruction) {