Skip to content

Commit

Permalink
revert conflicting files
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Nov 25, 2024
1 parent b14e0bd commit cfaf41e
Show file tree
Hide file tree
Showing 20 changed files with 269 additions and 325 deletions.
19 changes: 9 additions & 10 deletions Core/include/Acts/EventData/GenericBoundTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ namespace Acts {
template <class particle_hypothesis_t>
class GenericBoundTrackParameters {
public:
using Scalar = double;
using ParametersVector = BoundVector;
using CovarianceMatrix = BoundSquareMatrix;
using ParticleHypothesis = particle_hypothesis_t;
Expand Down Expand Up @@ -92,7 +91,7 @@ class GenericBoundTrackParameters {
/// successfully be converted to on-surface parameters.
static Result<GenericBoundTrackParameters> create(
std::shared_ptr<const Surface> surface, const GeometryContext& geoCtx,
const Vector4& pos4, const Vector3& dir, Scalar qOverP,
const Vector4& pos4, const Vector3& dir, double qOverP,
std::optional<CovarianceMatrix> cov,
ParticleHypothesis particleHypothesis,
double tolerance = s_onSurfaceTolerance) {
Expand Down Expand Up @@ -168,7 +167,7 @@ class GenericBoundTrackParameters {
///
/// @tparam kIndex Track parameter index
template <BoundIndices kIndex>
Scalar get() const {
double get() const {
return m_params[kIndex];
}

Expand Down Expand Up @@ -203,14 +202,14 @@ class GenericBoundTrackParameters {
return m_surface->localToGlobal(geoCtx, localPosition(), direction());
}
/// Time coordinate.
Scalar time() const { return m_params[eBoundTime]; }
double time() const { return m_params[eBoundTime]; }

/// Phi direction.
Scalar phi() const { return m_params[eBoundPhi]; }
double phi() const { return m_params[eBoundPhi]; }
/// Theta direction.
Scalar theta() const { return m_params[eBoundTheta]; }
double theta() const { return m_params[eBoundTheta]; }
/// Charge over momentum.
Scalar qOverP() const { return m_params[eBoundQOverP]; }
double qOverP() const { return m_params[eBoundQOverP]; }

/// Unit direction three-vector, i.e. the normalized momentum
/// three-vector.
Expand All @@ -219,18 +218,18 @@ class GenericBoundTrackParameters {
m_params[eBoundTheta]);
}
/// Absolute momentum.
Scalar absoluteMomentum() const {
double absoluteMomentum() const {
return m_particleHypothesis.extractMomentum(m_params[eBoundQOverP]);
}
/// Transverse momentum.
Scalar transverseMomentum() const {
double transverseMomentum() const {
return std::sin(m_params[eBoundTheta]) * absoluteMomentum();
}
/// Momentum three-vector.
Vector3 momentum() const { return absoluteMomentum() * direction(); }

/// Particle electric charge.
Scalar charge() const {
double charge() const {
return m_particleHypothesis.extractCharge(get<eBoundQOverP>());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class GenericCurvilinearTrackParameters
using Base = GenericBoundTrackParameters<particle_hypothesis_t>;

public:
using Scalar = double;
using ParametersVector = BoundVector;
using CovarianceMatrix = BoundSquareMatrix;
using ParticleHypothesis = particle_hypothesis_t;
Expand All @@ -43,7 +42,7 @@ class GenericCurvilinearTrackParameters
/// @param cov Curvilinear bound parameters covariance matrix
/// @param particleHypothesis Particle hypothesis
GenericCurvilinearTrackParameters(const Vector4& pos4, const Vector3& dir,
Scalar qOverP,
double qOverP,
std::optional<CovarianceMatrix> cov,
ParticleHypothesis particleHypothesis)
: Base(CurvilinearSurface(pos4.segment<3>(ePos0), dir).surface(),
Expand All @@ -58,8 +57,8 @@ class GenericCurvilinearTrackParameters
/// @param qOverP Charge over momentum
/// @param cov Curvilinear bound parameters covariance matrix
/// @param particleHypothesis Particle hypothesis
GenericCurvilinearTrackParameters(const Vector4& pos4, Scalar phi,
Scalar theta, Scalar qOverP,
GenericCurvilinearTrackParameters(const Vector4& pos4, double phi,
double theta, double qOverP,
std::optional<CovarianceMatrix> cov,
ParticleHypothesis particleHypothesis)
: Base(CurvilinearSurface(pos4.segment<3>(ePos0),
Expand Down
27 changes: 13 additions & 14 deletions Core/include/Acts/EventData/GenericFreeTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace Acts {
template <class particle_hypothesis_t>
class GenericFreeTrackParameters {
public:
using Scalar = double;
using ParametersVector = FreeVector;
using CovarianceMatrix = FreeSquareMatrix;
using ParticleHypothesis = particle_hypothesis_t;
Expand Down Expand Up @@ -66,7 +65,7 @@ class GenericFreeTrackParameters {
/// @param cov Free parameters covariance matrix
/// @param particleHypothesis Particle hypothesis
GenericFreeTrackParameters(const Vector4& pos4, const Vector3& dir,
Scalar qOverP, std::optional<CovarianceMatrix> cov,
double qOverP, std::optional<CovarianceMatrix> cov,
ParticleHypothesis particleHypothesis)
: m_params(FreeVector::Zero()),
m_cov(std::move(cov)),
Expand All @@ -91,8 +90,8 @@ class GenericFreeTrackParameters {
/// @param qOverP Charge over momentum
/// @param cov Free parameters covariance matrix
/// @param particleHypothesis Particle hypothesis
GenericFreeTrackParameters(const Vector4& pos4, Scalar phi, Scalar theta,
Scalar qOverP, std::optional<CovarianceMatrix> cov,
GenericFreeTrackParameters(const Vector4& pos4, double phi, double theta,
double qOverP, std::optional<CovarianceMatrix> cov,
ParticleHypothesis particleHypothesis)
: m_params(FreeVector::Zero()),
m_cov(std::move(cov)),
Expand Down Expand Up @@ -146,7 +145,7 @@ class GenericFreeTrackParameters {
///
/// @tparam kIndex Track parameter index
template <FreeIndices kIndex>
Scalar get() const {
double get() const {
return m_params[kIndex];
}

Expand All @@ -162,41 +161,41 @@ class GenericFreeTrackParameters {
/// Spatial position three-vector.
Vector3 position() const { return m_params.segment<3>(eFreePos0); }
/// Time coordinate.
Scalar time() const { return m_params[eFreeTime]; }
double time() const { return m_params[eFreeTime]; }

/// Phi direction.
Scalar phi() const { return VectorHelpers::phi(direction()); }
double phi() const { return VectorHelpers::phi(direction()); }
/// Theta direction.
Scalar theta() const { return VectorHelpers::theta(direction()); }
double theta() const { return VectorHelpers::theta(direction()); }
/// Charge over momentum.
Scalar qOverP() const { return m_params[eFreeQOverP]; }
double qOverP() const { return m_params[eFreeQOverP]; }

/// Unit direction three-vector, i.e. the normalized momentum three-vector.
Vector3 direction() const {
return m_params.segment<3>(eFreeDir0).normalized();
}
/// Absolute momentum.
Scalar absoluteMomentum() const {
double absoluteMomentum() const {
return m_particleHypothesis.extractMomentum(m_params[eFreeQOverP]);
}
/// Transverse momentum.
Scalar transverseMomentum() const {
double transverseMomentum() const {
// direction vector w/ arbitrary normalization can be parametrized as
// [f*sin(theta)*cos(phi), f*sin(theta)*sin(phi), f*cos(theta)]
// w/ f,sin(theta) positive, the transverse magnitude is then
// sqrt(f^2*sin^2(theta)) = f*sin(theta)
Scalar transverseMagnitude2 =
double transverseMagnitude2 =
square(m_params[eFreeDir0]) + square(m_params[eFreeDir1]);
// absolute magnitude is f by construction
Scalar magnitude2 = transverseMagnitude2 + square(m_params[eFreeDir2]);
double magnitude2 = transverseMagnitude2 + square(m_params[eFreeDir2]);
// such that we can extract sin(theta) = f*sin(theta) / f
return std::sqrt(transverseMagnitude2 / magnitude2) * absoluteMomentum();
}
/// Momentum three-vector.
Vector3 momentum() const { return absoluteMomentum() * direction(); }

/// Particle electric charge.
Scalar charge() const {
double charge() const {
return m_particleHypothesis.extractCharge(get<eFreeQOverP>());
}

Expand Down
22 changes: 8 additions & 14 deletions Core/include/Acts/EventData/TrackStateProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@ template <std::size_t Size, bool ReadOnlyMaps = true>
struct FixedSizeTypes {
constexpr static auto Flags = Eigen::ColMajor | Eigen::AutoAlign;

using Scalar = double;

// single items
using Coefficients = Eigen::Matrix<Scalar, Size, 1, Flags>;
using Covariance = Eigen::Matrix<Scalar, Size, Size, Flags>;
using Coefficients = Eigen::Matrix<double, Size, 1, Flags>;
using Covariance = Eigen::Matrix<double, Size, Size, Flags>;
using CoefficientsMap = Eigen::Map<ConstIf<Coefficients, ReadOnlyMaps>>;
using CovarianceMap = Eigen::Map<ConstIf<Covariance, ReadOnlyMaps>>;

using DynamicCoefficients = Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Flags>;
using DynamicCoefficients = Eigen::Matrix<double, Eigen::Dynamic, 1, Flags>;
using DynamicCovariance =
Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Flags>;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Flags>;
using DynamicCoefficientsMap =
Eigen::Map<ConstIf<DynamicCoefficients, ReadOnlyMaps>>;
using DynamicCovarianceMap =
Expand All @@ -105,11 +103,9 @@ template <bool ReadOnlyMaps = true>
struct DynamicSizeTypes {
constexpr static auto Flags = Eigen::ColMajor | Eigen::AutoAlign;

using Scalar = double;

using Coefficients = Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Flags>;
using Coefficients = Eigen::Matrix<double, Eigen::Dynamic, 1, Flags>;
using Covariance =
Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Flags>;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Flags>;
using CoefficientsMap = Eigen::Map<ConstIf<Coefficients, ReadOnlyMaps>>;
using CovarianceMap = Eigen::Map<ConstIf<Covariance, ReadOnlyMaps>>;
};
Expand All @@ -119,8 +115,6 @@ struct DynamicSizeTypes {
// This is public
template <std::size_t M, bool ReadOnly = true>
struct TrackStateTraits {
using Scalar = double;

using Parameters =
typename detail_lt::FixedSizeTypes<eBoundSize, ReadOnly>::CoefficientsMap;
using Covariance =
Expand All @@ -135,8 +129,8 @@ struct TrackStateTraits {
typename detail_lt::DynamicSizeTypes<ReadOnly>::CovarianceMap;

constexpr static auto ProjectorFlags = Eigen::RowMajor | Eigen::AutoAlign;
using Projector = Eigen::Matrix<Scalar, M, eBoundSize, ProjectorFlags>;
using EffectiveProjector = Eigen::Matrix<Scalar, Eigen::Dynamic, eBoundSize,
using Projector = Eigen::Matrix<double, M, eBoundSize, ProjectorFlags>;
using EffectiveProjector = Eigen::Matrix<double, Eigen::Dynamic, eBoundSize,
ProjectorFlags, M, eBoundSize>;
};

Expand Down
36 changes: 17 additions & 19 deletions Core/include/Acts/Propagator/ConstrainedStep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ namespace Acts {
/// The hierarchy is:
/// - Overstepping resolution / backpropagation
/// - Convergence
/// - Step into the void with `std::numeric_limits<Scalar>::max()`
/// - Step into the void with `std::numeric_limits<double>::max()`
class ConstrainedStep {
public:
using Scalar = double;

/// the types of constraints
/// from actor - this would be a typical navigation step
/// from aborter - this would be a target condition
Expand All @@ -53,47 +51,47 @@ class ConstrainedStep {

constexpr ConstrainedStep() = default;

/// constructor from Scalar
/// constructor
/// @param value is the user given initial value
constexpr explicit ConstrainedStep(Scalar value) { setUser(value); }
constexpr explicit ConstrainedStep(double value) { setUser(value); }

/// set accuracy by one Scalar
/// set accuracy
///
/// this will set only the accuracy, as this is the most
/// exposed to the Propagator
///
/// @param value is the new accuracy value
constexpr void setAccuracy(Scalar value) {
constexpr void setAccuracy(double value) {
assert(value > 0 && "ConstrainedStep accuracy must be > 0.");
// set the accuracy value
m_accuracy = value;
}

/// set user by one Scalar
/// set user
///
/// @param value is the new user value
constexpr void setUser(Scalar value) {
constexpr void setUser(double value) {
// TODO enable assert; see https://github.com/acts-project/acts/issues/2543
// assert(value != 0 && "ConstrainedStep user must be != 0.");
// set the user value
m_values[user] = value;
}

/// returns the min step size
constexpr Scalar value() const {
Scalar min = *std::min_element(m_values.begin(), m_values.end());
constexpr double value() const {
double min = *std::min_element(m_values.begin(), m_values.end());
// accuracy is always positive and therefore handled separately
Scalar result = std::min(std::abs(min), m_accuracy);
double result = std::min(std::abs(min), m_accuracy);
return std::signbit(min) ? -result : result;
}

/// Access a specific value
///
/// @param type is the requested parameter type
constexpr Scalar value(Type type) const { return m_values[type]; }
constexpr double value(Type type) const { return m_values[type]; }

/// Access the accuracy value
constexpr Scalar accuracy() const { return m_accuracy; }
constexpr double accuracy() const { return m_accuracy; }

/// release a certain constraint value
///
Expand All @@ -111,7 +109,7 @@ class ConstrainedStep {
/// @param value is the new value to be updated
/// @param type is the constraint type
/// @param releaseStep Allow step size to increase again
constexpr void update(Scalar value, Type type, bool releaseStep = false) {
constexpr void update(double value, Type type, bool releaseStep = false) {
if (releaseStep) {
release(type);
}
Expand All @@ -127,7 +125,7 @@ class ConstrainedStep {

std::ostream& toStream(std::ostream& os) const {
// Helper method to avoid unreadable screen output
auto streamValue = [&](Scalar val) {
auto streamValue = [&](double val) {
os << std::setw(5);
if (std::abs(val) == kNotSet) {
os << (val > 0 ? "+∞" : "-∞");
Expand Down Expand Up @@ -156,12 +154,12 @@ class ConstrainedStep {
}

private:
static constexpr auto kNotSet = std::numeric_limits<Scalar>::max();
static constexpr auto kNotSet = std::numeric_limits<double>::max();

/// the step size tuple
std::array<Scalar, 3> m_values = {kNotSet, kNotSet, kNotSet};
std::array<double, 3> m_values = {kNotSet, kNotSet, kNotSet};
/// the accuracy value - this can vary up and down given a good step estimator
Scalar m_accuracy = kNotSet;
double m_accuracy = kNotSet;
};

inline std::ostream& operator<<(std::ostream& os, const ConstrainedStep& step) {
Expand Down
14 changes: 5 additions & 9 deletions Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@

namespace Acts {

/// @brief Default evaluater of the k_i's and elements of the transport matrix
/// @brief Default evaluator of the k_i's and elements of the transport matrix
/// D of the RKN4 stepping. This is a pure implementation by textbook.
struct EigenStepperDefaultExtension {
using Scalar = double;
/// @brief Vector3 replacement for the custom scalar type
using ThisVector3 = Eigen::Matrix<Scalar, 3, 1>;

/// @brief Evaluater of the k_i's of the RKN4. For the case of i = 0 this
/// @brief Evaluator of the k_i's of the RKN4. For the case of i = 0 this
/// step sets up qop, too.
///
/// @tparam i Index of the k_i, i = [0, 3]
Expand All @@ -43,9 +39,9 @@ struct EigenStepperDefaultExtension {
template <int i, typename propagator_state_t, typename stepper_t,
typename navigator_t>
bool k(const propagator_state_t& state, const stepper_t& stepper,
const navigator_t& /*navigator*/, ThisVector3& knew,
const Vector3& bField, std::array<Scalar, 4>& kQoP,
const double h = 0., const ThisVector3& kprev = ThisVector3::Zero())
const navigator_t& /*navigator*/, Vector3& knew, const Vector3& bField,
std::array<double, 4>& kQoP, const double h = 0.,
const Vector3& kprev = Vector3::Zero())
requires(i >= 0 && i <= 3)
{
auto qop = stepper.qOverP(state.stepping);
Expand Down
Loading

0 comments on commit cfaf41e

Please sign in to comment.