Skip to content

Commit

Permalink
Merge branch 'main' into feature/update-athena-dump-reader-noemi
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 10, 2024
2 parents b36a6d9 + 2045800 commit 44134e6
Show file tree
Hide file tree
Showing 51 changed files with 615 additions and 176 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,10 @@ repos:
language: system
entry: docs/parse_cmake_options.py --write docs/getting_started.md
files: ^CMakeLists.txt$

- repo: local
hooks:
- id: leftover_conflict_markers
name: Leftover conflict markers
language: system
entry: git diff --staged --check
Binary file modified CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 5 additions & 4 deletions Core/include/Acts/EventData/GenericFreeTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/TrackParametersConcept.hpp"
#include "Acts/EventData/detail/PrintParameters.hpp"
#include "Acts/Utilities/MathHelpers.hpp"
#include "Acts/Utilities/UnitVectors.hpp"

#include <cassert>
Expand Down Expand Up @@ -154,12 +155,12 @@ class GenericFreeTrackParameters {
// [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 transverseMagnitude =
std::hypot(m_params[eFreeDir0], m_params[eFreeDir1]);
Scalar transverseMagnitude2 =
square(m_params[eFreeDir0]) + square(m_params[eFreeDir1]);
// absolute magnitude is f by construction
Scalar magnitude = std::hypot(transverseMagnitude, m_params[eFreeDir2]);
Scalar magnitude2 = transverseMagnitude2 + square(m_params[eFreeDir2]);
// such that we can extract sin(theta) = f*sin(theta) / f
return (transverseMagnitude / magnitude) * absoluteMomentum();
return std::sqrt(transverseMagnitude2 / magnitude2) * absoluteMomentum();
}
/// Momentum three-vector.
Vector3 momentum() const { return absoluteMomentum() * direction(); }
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/EventData/Seed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Acts {

template <typename external_spacepoint_t, std::size_t N = 3ul>
requires(N >= 3)
requires(N >= 3ul)
class Seed {
public:
using value_type = external_spacepoint_t;
Expand Down
12 changes: 6 additions & 6 deletions Core/include/Acts/EventData/Seed.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@
namespace Acts {

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
template <typename... args_t>
requires(sizeof...(args_t) == N) &&
(std::same_as<external_spacepoint_t, args_t> && ...)
Seed<external_spacepoint_t, N>::Seed(const args_t&... points)
: m_spacepoints({&points...}) {}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
void Seed<external_spacepoint_t, N>::setVertexZ(float vertex) {
m_vertexZ = vertex;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
void Seed<external_spacepoint_t, N>::setQuality(float seedQuality) {
m_seedQuality = seedQuality;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
const std::array<const external_spacepoint_t*, N>&
Seed<external_spacepoint_t, N>::sp() const {
return m_spacepoints;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
float Seed<external_spacepoint_t, N>::z() const {
return m_vertexZ;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
float Seed<external_spacepoint_t, N>::seedQuality() const {
return m_seedQuality;
}
Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/EventData/SourceLink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <cassert>
#include <concepts>
#include <iostream>
#include <type_traits>
#include <utility>

Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/EventData/TrackStateProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,9 @@ class TrackStateProxy {
jacobian() = other.jacobian();
}

// NOTE: we should not check hasCalibrated on this, since it
// may be not yet allocated
if (ACTS_CHECK_BIT(mask, PM::Calibrated) &&
has<hashString("calibrated")>() &&
other.template has<hashString("calibrated")>()) {
allocateCalibrated(other.calibratedSize());

Expand Down
21 changes: 11 additions & 10 deletions Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Propagator/EigenStepperDefaultExtension.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Utilities/MathHelpers.hpp"

namespace Acts {

Expand Down Expand Up @@ -108,7 +109,7 @@ struct EigenStepperDenseExtension {
// Evaluate k for the time propagation
Lambdappi[0] = -qop[0] * qop[0] * qop[0] * g * energy[0] / (q * q);
//~ tKi[0] = std::hypot(1, mass / initialMomentum);
tKi[0] = std::hypot(1, mass * qop[0]);
tKi[0] = fastHypot(1, mass * qop[0]);
kQoP[0] = Lambdappi[0];
} else {
// Update parameters and check for momentum condition
Expand All @@ -122,7 +123,7 @@ struct EigenStepperDenseExtension {
// Evaluate k_i for the time propagation
auto qopNew = qop[0] + h * Lambdappi[i - 1];
Lambdappi[i] = -qopNew * qopNew * qopNew * g * energy[i] / (q * q);
tKi[i] = std::hypot(1, mass * qopNew);
tKi[i] = fastHypot(1, mass * qopNew);
kQoP[i] = Lambdappi[i];
}
return true;
Expand Down Expand Up @@ -167,14 +168,14 @@ struct EigenStepperDenseExtension {
}

// Add derivative dlambda/ds = Lambda''
state.stepping.derivative(7) = -std::hypot(mass, newMomentum) * g /
state.stepping.derivative(7) = -fastHypot(mass, newMomentum) * g /
(newMomentum * newMomentum * newMomentum);

// Update momentum
state.stepping.pars[eFreeQOverP] =
stepper.charge(state.stepping) / newMomentum;
// Add derivative dt/ds = 1/(beta * c) = sqrt(m^2 * p^{-2} + c^{-2})
state.stepping.derivative(3) = std::hypot(1, mass / newMomentum);
state.stepping.derivative(3) = fastHypot(1, mass / newMomentum);
// Update time
state.stepping.pars[eFreeTime] +=
(h / 6.) * (tKi[0] + 2. * (tKi[1] + tKi[2]) + tKi[3]);
Expand Down Expand Up @@ -332,25 +333,25 @@ struct EigenStepperDenseExtension {
//~ (3. * g + qop[0] * dgdqop(energy[0], .mass,
//~ absPdg, meanEnergyLoss));

double dtp1dl = qop[0] * mass * mass / std::hypot(1, qop[0] * mass);
double dtp1dl = qop[0] * mass * mass / fastHypot(1, qop[0] * mass);
double qopNew = qop[0] + half_h * Lambdappi[0];

//~ double dtpp2dl = -mass * mass * qopNew *
//~ qopNew *
//~ (3. * g * (1. + half_h * jdL[0]) +
//~ qopNew * dgdqop(energy[1], mass, absPdgCode, meanEnergyLoss));

double dtp2dl = qopNew * mass * mass / std::hypot(1, qopNew * mass);
double dtp2dl = qopNew * mass * mass / fastHypot(1, qopNew * mass);
qopNew = qop[0] + half_h * Lambdappi[1];

//~ double dtpp3dl = -mass * mass * qopNew *
//~ qopNew *
//~ (3. * g * (1. + half_h * jdL[1]) +
//~ qopNew * dgdqop(energy[2], mass, absPdg, meanEnergyLoss));

double dtp3dl = qopNew * mass * mass / std::hypot(1, qopNew * mass);
double dtp3dl = qopNew * mass * mass / fastHypot(1, qopNew * mass);
qopNew = qop[0] + half_h * Lambdappi[2];
double dtp4dl = qopNew * mass * mass / std::hypot(1, qopNew * mass);
double dtp4dl = qopNew * mass * mass / fastHypot(1, qopNew * mass);

//~ D(3, 7) = h * mass * mass * qop[0] /
//~ std::hypot(1., mass * qop[0])
Expand All @@ -376,7 +377,7 @@ struct EigenStepperDenseExtension {
PdgParticle absPdg = particleHypothesis.absolutePdg();
float absQ = particleHypothesis.absoluteCharge();

energy[0] = std::hypot(initialMomentum, mass);
energy[0] = fastHypot(initialMomentum, mass);
// use unit length as thickness to compute the energy loss per unit length
MaterialSlab slab(material, 1);
// Use the same energy loss throughout the step.
Expand Down Expand Up @@ -430,7 +431,7 @@ struct EigenStepperDenseExtension {
const stepper_t& stepper, const int i) {
// Update parameters related to a changed momentum
currentMomentum = initialMomentum + h * dPds[i - 1];
energy[i] = std::hypot(currentMomentum, mass);
energy[i] = fastHypot(currentMomentum, mass);
dPds[i] = g * energy[i] / currentMomentum;
qop[i] = stepper.charge(state.stepping) / currentMomentum;
// Calculate term for later error propagation
Expand Down
7 changes: 4 additions & 3 deletions Core/include/Acts/Propagator/StraightLineStepper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Intersection.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/MathHelpers.hpp"
#include "Acts/Utilities/Result.hpp"

#include <algorithm>
Expand Down Expand Up @@ -336,8 +337,8 @@ class StraightLineStepper {
direction(prop_state.stepping);
// dt / ds
prop_state.stepping.derivative(eFreeTime) =
std::hypot(1., prop_state.stepping.particleHypothesis.mass() /
absoluteMomentum(prop_state.stepping));
fastHypot(1., prop_state.stepping.particleHypothesis.mass() /
absoluteMomentum(prop_state.stepping));
// d (dr/ds) / ds : == 0
prop_state.stepping.derivative.template segment<3>(4) =
Acts::Vector3::Zero().transpose();
Expand Down Expand Up @@ -424,7 +425,7 @@ class StraightLineStepper {
const auto m = state.stepping.particleHypothesis.mass();
const auto p = absoluteMomentum(state.stepping);
// time propagates along distance as 1/b = sqrt(1 + m²/p²)
const auto dtds = std::hypot(1., m / p);
const auto dtds = fastHypot(1., m / p);
// Update the track parameters according to the equations of motion
Vector3 dir = direction(state.stepping);
state.stepping.pars.template segment<3>(eFreePos0) += h * dir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Acts/Material/ISurfaceMaterial.hpp"
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/MathHelpers.hpp"

#include <algorithm>
#include <cmath>
Expand Down Expand Up @@ -146,7 +147,7 @@ struct PointwiseMaterialInteraction {
const auto& particleHypothesis = stepper.particleHypothesis(state.stepping);
// in forward(backward) propagation, energy decreases(increases) and
// variances increase(decrease)
const auto nextE = std::hypot(mass, momentum) - Eloss * navDir;
const auto nextE = fastHypot(mass, momentum) - Eloss * navDir;
// put particle at rest if energy loss is too large
nextP = (mass < nextE) ? std::sqrt(nextE * nextE - mass * mass) : 0;
// minimum momentum below which we will not push particles via material
Expand Down
10 changes: 4 additions & 6 deletions Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@

#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/Definitions/Units.hpp"
#include "Acts/EventData/Seed.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/MathHelpers.hpp"

#include <array>
#include <cmath>
#include <iostream>
#include <iterator>
#include <optional>
#include <vector>

namespace Acts {
/// @todo:
Expand Down Expand Up @@ -242,12 +241,11 @@ std::optional<BoundVector> estimateTrackParamsFromSeed(
int sign = ia > 0 ? -1 : 1;
const ActsScalar R = circleCenter.norm();
ActsScalar invTanTheta =
local2.z() /
(2.f * R * std::asin(std::hypot(local2.x(), local2.y()) / (2.f * R)));
local2.z() / (2.f * R * std::asin(local2.head<2>().norm() / (2.f * 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);
Vector3 transDirection(1., A, std::hypot(1, A) * invTanTheta);
Vector3 transDirection(1., A, fastHypot(1, A) * invTanTheta);
// Transform it back to the original frame
Vector3 direction = rotation * transDirection.normalized();

Expand Down Expand Up @@ -277,7 +275,7 @@ std::optional<BoundVector> estimateTrackParamsFromSeed(
// momentum on the transverse plane of the new frame)
ActsScalar qOverPt = sign * (UnitConstants::m) / (0.3 * bFieldInTesla * R);
// The estimated q/p in [GeV/c]^-1
params[eBoundQOverP] = qOverPt / std::hypot(1., invTanTheta);
params[eBoundQOverP] = qOverPt / fastHypot(1., invTanTheta);

if (params.hasNaN()) {
ACTS_ERROR(
Expand Down
5 changes: 3 additions & 2 deletions Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "Acts/Surfaces/detail/VerticesHelper.hpp"

#include <span>

namespace Acts::detail {

/// Check if a point is inside a box.
Expand Down Expand Up @@ -72,8 +74,7 @@ inline bool insideAlignedBox(const Vector2& lowerLeft,
/// @param jacobianOpt The Jacobian to transform the distance to Cartesian
///
/// @return True if the point is inside the polygon.
template <typename Vector2Container>
inline bool insidePolygon(const Vector2Container& vertices,
inline bool insidePolygon(std::span<const Vector2> vertices,
const BoundaryTolerance& tolerance,
const Vector2& point,
const std::optional<SquareMatrix2>& jacobianOpt) {
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Surfaces/detail/VerticesHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <algorithm>
#include <cmath>
#include <span>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -174,9 +175,8 @@ bool onHyperPlane(const std::vector<Vector3>& vertices,
ActsScalar tolerance = s_onSurfaceTolerance);

/// Calculate the closest point on the polygon.
template <typename Vector2Container>
inline Vector2 computeClosestPointOnPolygon(const Vector2& point,
const Vector2Container& vertices,
std::span<const Vector2> vertices,
const SquareMatrix2& metric) {
auto squaredNorm = [&](const Vector2& x) {
return (x.transpose() * metric * x).value();
Expand Down
13 changes: 0 additions & 13 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,30 @@
// Workaround for building on clang+libstdc++
#include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp"

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/EventData/MeasurementHelpers.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/MultiTrajectoryHelpers.hpp"
#include "Acts/EventData/ProxyAccessor.hpp"
#include "Acts/EventData/TrackContainer.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/EventData/TrackStatePropMask.hpp"
#include "Acts/EventData/Types.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Material/MaterialSlab.hpp"
#include "Acts/Propagator/ActorList.hpp"
#include "Acts/Propagator/ConstrainedStep.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/StandardAborters.hpp"
#include "Acts/Propagator/detail/LoopProtection.hpp"
#include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/TrackFinding/CombinatorialKalmanFilterError.hpp"
#include "Acts/TrackFitting/KalmanFitter.hpp"
#include "Acts/TrackFitting/detail/VoidFitterComponents.hpp"
#include "Acts/Utilities/CalibrationContext.hpp"
#include "Acts/Utilities/HashedString.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/Result.hpp"
#include "Acts/Utilities/TrackHelpers.hpp"
#include "Acts/Utilities/Zip.hpp"

#include <functional>
#include <limits>
#include <memory>
#include <ranges>
#include <string_view>
#include <type_traits>
#include <unordered_map>

namespace Acts {

Expand Down
Loading

0 comments on commit 44134e6

Please sign in to comment.