Skip to content

Commit

Permalink
Merge branch 'main' into remove-actsscalar
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Nov 26, 2024
2 parents 38ef2dd + a0aed8c commit e2abc00
Show file tree
Hide file tree
Showing 48 changed files with 824 additions and 388 deletions.
8 changes: 3 additions & 5 deletions Core/include/Acts/Material/BinnedSurfaceMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Utilities/BinUtility.hpp"

#include <cstddef>
#include <iosfwd>
#include <vector>

namespace Acts {

Expand Down Expand Up @@ -83,10 +81,10 @@ class BinnedSurfaceMaterial : public ISurfaceMaterial {
/// Destructor
~BinnedSurfaceMaterial() override = default;

/// Scale operator
/// Scale operation
///
/// @param scale is the scale factor for the full material
BinnedSurfaceMaterial& operator*=(double scale) final;
/// @param factor is the scale factor for the full material
BinnedSurfaceMaterial& scale(double factor) final;

/// Return the BinUtility
const BinUtility& binUtility() const;
Expand Down
8 changes: 3 additions & 5 deletions Core/include/Acts/Material/GridSurfaceMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Material/ISurfaceMaterial.hpp"
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Delegate.hpp"
#include "Acts/Utilities/GridAccessHelpers.hpp"
#include "Acts/Utilities/VectorHelpers.hpp"

#include <ostream>
#include <stdexcept>
Expand Down Expand Up @@ -197,9 +195,9 @@ class GridSurfaceMaterialT : public ISurfaceMaterial {

/// Scale operator
///
/// @param scale is the scale factor applied
ISurfaceMaterial& operator*=(double scale) final {
m_materialAccessor.scale(m_grid, scale);
/// @param factor is the scale factor applied
ISurfaceMaterial& scale(double factor) final {
m_materialAccessor.scale(m_grid, factor);
return (*this);
}

Expand Down
41 changes: 17 additions & 24 deletions Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "Acts/Material/ISurfaceMaterial.hpp"
#include "Acts/Material/MaterialSlab.hpp"

#include <cstddef>
#include <iosfwd>

namespace Acts {
Expand Down Expand Up @@ -62,13 +61,8 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial {
/// Scale operator
/// - it is effectively a thickness scaling
///
/// @param scale is the scale factor
HomogeneousSurfaceMaterial& operator*=(double scale) final;

/// Equality operator
///
/// @param hsm is the source material
bool operator==(const HomogeneousSurfaceMaterial& hsm) const;
/// @param factor is the scale factor
HomogeneousSurfaceMaterial& scale(double factor) final;

/// @copydoc ISurfaceMaterial::materialSlab(const Vector2&) const
///
Expand All @@ -94,22 +88,21 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial {

private:
/// The five different MaterialSlab
MaterialSlab m_fullMaterial = MaterialSlab();
};

inline const MaterialSlab& HomogeneousSurfaceMaterial::materialSlab(
const Vector2& /*lp*/) const {
return (m_fullMaterial);
}
MaterialSlab m_fullMaterial;

inline const MaterialSlab& HomogeneousSurfaceMaterial::materialSlab(
const Vector3& /*gp*/) const {
return (m_fullMaterial);
}

inline bool HomogeneousSurfaceMaterial::operator==(
const HomogeneousSurfaceMaterial& hsm) const {
return (m_fullMaterial == hsm.m_fullMaterial);
}
/// @brief Check if two materials are exactly equal.
///
/// This is a strict equality check, i.e. the materials must have identical
/// properties.
///
/// @param lhs is the left hand side material
/// @param rhs is the right hand side material
///
/// @return true if the materials are equal
friend constexpr bool operator==(const HomogeneousSurfaceMaterial& lhs,
const HomogeneousSurfaceMaterial& rhs) {
return lhs.m_fullMaterial == rhs.m_fullMaterial;
}
};

} // namespace Acts
31 changes: 15 additions & 16 deletions Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class HomogeneousVolumeMaterial : public IVolumeMaterial {
HomogeneousVolumeMaterial& operator=(const HomogeneousVolumeMaterial& hvm) =
default;

/// Equality operator
///
/// @param hvm is the source material
bool operator==(const HomogeneousVolumeMaterial& hvm) const;

/// Access to actual material
///
/// @param position is the request position for the material call
Expand All @@ -64,17 +59,21 @@ class HomogeneousVolumeMaterial : public IVolumeMaterial {
std::ostream& toStream(std::ostream& sl) const final;

private:
Material m_material = Material();
};

inline const Material HomogeneousVolumeMaterial::material(
const Vector3& /*position*/) const {
return (m_material);
}
Material m_material;

inline bool HomogeneousVolumeMaterial::operator==(
const HomogeneousVolumeMaterial& hvm) const {
return (m_material == hvm.m_material);
}
/// @brief Check if two materials are exactly equal.
///
/// This is a strict equality check, i.e. the materials must have identical
/// properties.
///
/// @param lhs is the left hand side material
/// @param rhs is the right hand side material
///
/// @return true if the materials are equal
friend constexpr bool operator==(const HomogeneousVolumeMaterial& lhs,
const HomogeneousVolumeMaterial& rhs) {
return lhs.m_material == rhs.m_material;
}
};

} // namespace Acts
17 changes: 8 additions & 9 deletions Core/include/Acts/Material/ISurfaceMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/Definitions/Direction.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Material/MaterialSlab.hpp"

#include <memory>
#include <sstream>
#include <vector>

namespace Acts {

Expand Down Expand Up @@ -50,10 +47,10 @@ class ISurfaceMaterial {
/// Destructor
virtual ~ISurfaceMaterial() = default;

/// Scale operator
/// Scale material
///
/// @param scale is the scale factor applied
virtual ISurfaceMaterial& operator*=(double scale) = 0;
/// @param factor is the scale factor applied
virtual ISurfaceMaterial& scale(double factor) = 0;

/// Return method for full material description of the Surface
/// - from local coordinate on the surface
Expand Down Expand Up @@ -128,9 +125,11 @@ class ISurfaceMaterial {
}

protected:
double m_splitFactor{1.}; //!< the split factor in favour of oppositePre
MappingType m_mappingType{
Acts::MappingType::Default}; //!< Use the default mapping type by default
/// the split factor in favour of oppositePre
double m_splitFactor{1.};

/// Use the default mapping type by default
MappingType m_mappingType{Acts::MappingType::Default};
};

inline double ISurfaceMaterial::factor(Direction pDir,
Expand Down
14 changes: 11 additions & 3 deletions Core/include/Acts/Material/Material.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

#pragma once

#include "Acts/Definitions/Algebra.hpp"

#include <iosfwd>
#include <limits>
#include <utility>

#include <Eigen/Dense>

namespace Acts {

Expand Down Expand Up @@ -112,6 +111,15 @@ class Material {
float m_z = 0.0f;
float m_molarRho = 0.0f;

/// @brief Check if two materials are exactly equal.
///
/// This is a strict equality check, i.e. the materials must have identical
/// properties.
///
/// @param lhs is the left hand side material
/// @param rhs is the right hand side material
///
/// @return true if the materials are equal
friend constexpr bool operator==(const Material& lhs, const Material& rhs) {
return (lhs.m_x0 == rhs.m_x0) && (lhs.m_l0 == rhs.m_l0) &&
(lhs.m_ar == rhs.m_ar) && (lhs.m_z == rhs.m_z) &&
Expand Down
9 changes: 9 additions & 0 deletions Core/include/Acts/Material/MaterialSlab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ class MaterialSlab {
float m_thicknessInX0 = 0.0f;
float m_thicknessInL0 = 0.0f;

/// @brief Check if two materials are exactly equal.
///
/// This is a strict equality check, i.e. the materials must have identical
/// properties.
///
/// @param lhs is the left hand side material
/// @param rhs is the right hand side material
///
/// @return true if the materials are equal
friend constexpr bool operator==(const MaterialSlab& lhs,
const MaterialSlab& rhs) {
// t/X0 and t/L0 are dependent variables and need not be checked
Expand Down
5 changes: 2 additions & 3 deletions Core/include/Acts/Material/ProtoSurfaceMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Utilities/BinUtility.hpp"

#include <cstddef>
#include <iosfwd>

namespace Acts {
Expand Down Expand Up @@ -67,9 +66,9 @@ class ProtoSurfaceMaterialT : public ISurfaceMaterial {
ProtoSurfaceMaterialT<BinningType>& operator=(
ProtoSurfaceMaterialT<BinningType>&& smproxy) = default;

/// Scale operator - dummy implementation
/// Scale operation - dummy implementation
///
ProtoSurfaceMaterialT<BinningType>& operator*=(double /*scale*/) final {
ProtoSurfaceMaterialT<BinningType>& scale(double /*factor*/) final {
return (*this);
}

Expand Down
11 changes: 2 additions & 9 deletions Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -36,7 +32,6 @@
#include <cstddef>
#include <functional>
#include <limits>
#include <numeric>
#include <sstream>
#include <vector>

Expand Down Expand Up @@ -398,7 +393,7 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
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());
Expand Down Expand Up @@ -581,10 +576,8 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {
} else if (counts[static_cast<std::size_t>(Status::onSurface)] > 0) {
state.stepCounterAfterFirstComponentOnSurface.reset();
return Status::onSurface;
} else if (counts[static_cast<std::size_t>(Status::unreachable)] > 0) {
return Status::unreachable;
} else {
return Status::missed;
return Status::unreachable;
}
}

Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -111,7 +112,7 @@ Result<double> MultiEigenStepperLoop<E, R>::step(
m_stepLimitAfterFirstComponentOnSurface) {
for (auto& cmp : components) {
if (cmp.status != Status::onSurface) {
cmp.status = Status::missed;
cmp.status = Status::unreachable;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/TrackFitting/detail/GsfActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions Core/include/Acts/Utilities/Intersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace Acts {

/// Status enum
enum class IntersectionStatus : int {
missed = 0,
unreachable = 0,
reachable = 1,
onSurface = 2
Expand Down Expand Up @@ -58,7 +57,7 @@ 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
Expand Down
5 changes: 2 additions & 3 deletions Core/src/Material/BinnedSurfaceMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ Acts::BinnedSurfaceMaterial::BinnedSurfaceMaterial(
m_binUtility(binUtility),
m_fullMaterial(std::move(fullProperties)) {}

Acts::BinnedSurfaceMaterial& Acts::BinnedSurfaceMaterial::operator*=(
double scale) {
Acts::BinnedSurfaceMaterial& Acts::BinnedSurfaceMaterial::scale(double factor) {
for (auto& materialVector : m_fullMaterial) {
for (auto& materialBin : materialVector) {
materialBin.scaleThickness(scale);
materialBin.scaleThickness(factor);
}
}
return (*this);
Expand Down
Loading

0 comments on commit e2abc00

Please sign in to comment.