Skip to content

Commit

Permalink
Merge branch 'main' into ML-to-Core
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin-Allaire authored Dec 5, 2024
2 parents 4b27aac + 3390f50 commit dbe4a81
Show file tree
Hide file tree
Showing 89 changed files with 1,237 additions and 592 deletions.
20 changes: 15 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,7 @@ linux_ubuntu_2204_clang:
# Figure out LCG platform name based on version number and OS
- >
if [ "$OS" = "alma9" ]; then
if [ "$LCG_VERSION" -ge "104" ]; then
export LCG_PLATFORM="el9"
else
export LCG_PLATFORM="centos9"
fi
export LCG_PLATFORM="el9"
else
export LCG_PLATFORM="$OS"
fi
Expand Down Expand Up @@ -431,3 +427,17 @@ lcg_105:
COMPILER:
- gcc13
- clang16

lcg_106a:
extends: .lcg_base_job

variables:
LCG_VERSION: "106a"

parallel:
matrix:
- OS: [alma9]
COMPILER:
- gcc13
- gcc14
- clang16
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ repos:
- id: leftover_conflict_markers
name: Leftover conflict markers
language: system
entry: git diff --staged --check
entry: git --no-pager diff --staged --check

- repo: local
hooks:
Expand Down
3 changes: 2 additions & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
},
{
"affiliation": "UC Berkeley",
"name": "Carlo Varni"
"name": "Carlo Varni",
"orcid": "0000-0001-6733-4310"
}
],
"access_right": "open",
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/EventData/MultiTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ class MultiTrajectory {

visit_measurement(measdim, [this, istate]<std::size_t DIM>(
std::integral_constant<std::size_t, DIM>) {
self().template allocateCalibrated_impl(
self().allocateCalibrated_impl(
istate, ActsVector<DIM>{ActsVector<DIM>::Zero()},
ActsSquareMatrix<DIM>{ActsSquareMatrix<DIM>::Zero()});
});
Expand All @@ -705,7 +705,7 @@ class MultiTrajectory {
template <std::size_t measdim, typename val_t, typename cov_t>
void allocateCalibrated(IndexType istate, const Eigen::DenseBase<val_t>& val,
const Eigen::DenseBase<cov_t>& cov) {
self().template allocateCalibrated_impl(istate, val, cov);
self().allocateCalibrated_impl(istate, val, cov);
}

void setUncalibratedSourceLink(IndexType istate, SourceLink&& sourceLink)
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ concept MutableMultiTrajectoryBackend =
{ v.template addColumn_impl<double>(col) };

{
v.template allocateCalibrated_impl(istate, ActsVector<1>{},
ActsSquareMatrix<1>{})
v.allocateCalibrated_impl(istate, ActsVector<1>{},
ActsSquareMatrix<1>{})
};
// Assuming intermediate values also work
{
v.template allocateCalibrated_impl(istate, ActsVector<eBoundSize>{},
ActsSquareMatrix<eBoundSize>{})
v.allocateCalibrated_impl(istate, ActsVector<eBoundSize>{},
ActsSquareMatrix<eBoundSize>{})
};

{ v.setUncalibratedSourceLink_impl(istate, std::move(sl)) };
Expand Down
7 changes: 1 addition & 6 deletions Core/include/Acts/EventData/TrackContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/Definitions/Units.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/MultiTrajectoryBackendConcept.hpp"
#include "Acts/EventData/TrackContainerBackendConcept.hpp"
Expand All @@ -21,11 +18,9 @@
#include "Acts/Utilities/Holders.hpp"
#include "Acts/Utilities/Iterator.hpp"
#include "Acts/Utilities/TypeTraits.hpp"
#include "Acts/Utilities/UnitVectors.hpp"

#include <any>
#include <cstddef>
#include <iterator>
#include <string>
#include <string_view>

namespace Acts {
Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/EventData/TrackProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "Acts/Utilities/UnitVectors.hpp"

#include <iterator>
#include <type_traits>

namespace Acts {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ class MultiTrajectoryTestsCommon {

auto [par, cov] = generateBoundParametersCovariance(rng, {});

ts.template allocateCalibrated(par.head<3>(), cov.topLeftCorner<3, 3>());
ts.allocateCalibrated(par.head<3>(), cov.topLeftCorner<3, 3>());

BOOST_CHECK_EQUAL(ts.calibratedSize(), 3);
BOOST_CHECK_EQUAL(ts.template calibrated<3>(), par.head<3>());
Expand All @@ -1239,17 +1239,17 @@ class MultiTrajectoryTestsCommon {
BOOST_CHECK_EQUAL(ts.template calibratedCovariance<3>(),
ActsSquareMatrix<3>::Zero());

ts.template allocateCalibrated(par2.head<3>(), cov2.topLeftCorner<3, 3>());
ts.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);
BOOST_CHECK_THROW(
ts.allocateCalibrated(par2.head<4>(), cov2.topLeftCorner<4, 4>()),
std::invalid_argument);
}
};
} // namespace Acts::detail::Test
1 change: 1 addition & 0 deletions Core/include/Acts/Geometry/Extent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <array>
#include <bitset>
#include <optional>
#include <ostream>
#include <string>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/Geometry/GeometryIdentifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <cstdint>
#include <functional>
#include <iosfwd>
#include <utility>

namespace Acts {

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Geometry/GridPortalLink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class GridPortalLink : public PortalLinkBase {
/// @tparam Axes The axis types of the grid
template <typename... Axes>
requires(sizeof...(Axes) <= 2)
class GridPortalLinkT final : public GridPortalLink {
class GridPortalLinkT : public GridPortalLink {
public:
/// The internal grid type
using GridType = Grid<const TrackingVolume*, Axes...>;
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/MagneticField/BFieldMapUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fieldMapRZ(const std::function<std::size_t(std::array<std::size_t, 2> binsRZ,
std::array<std::size_t, 2> nBinsRZ)>&
localToGlobalBin,
std::vector<double> rPos, std::vector<double> zPos,
std::vector<Acts::Vector2> bField,
const std::vector<Acts::Vector2>& bField,
double lengthUnit = UnitConstants::mm,
double BFieldUnit = UnitConstants::T, bool firstQuadrant = false);

Expand Down Expand Up @@ -137,25 +137,26 @@ fieldMapXYZ(
std::array<std::size_t, 3> nBinsXYZ)>&
localToGlobalBin,
std::vector<double> xPos, std::vector<double> yPos,
std::vector<double> zPos, std::vector<Acts::Vector3> bField,
std::vector<double> zPos, const std::vector<Acts::Vector3>& bField,
double lengthUnit = UnitConstants::mm, double BFieldUnit = UnitConstants::T,
bool firstOctant = false);

/// Function which takes an existing SolenoidBField instance and
/// creates a field mapper by sampling grid points from the analytical
/// solenoid field.
///
/// @param rlim pair of r bounds
/// @param zlim pair of z bounds
/// @param nbins pair of bin counts
/// @param rLim pair of r bounds
/// @param zLim pair of z bounds
/// @param nBins pair of bin counts
/// @param field the solenoid field instance
///
/// @return A field map instance for use in interpolation.
Acts::InterpolatedBFieldMap<
Acts::Grid<Acts::Vector2, Acts::Axis<Acts::AxisType::Equidistant>,
Acts::Axis<Acts::AxisType::Equidistant>>>
solenoidFieldMap(std::pair<double, double> rlim, std::pair<double, double> zlim,
std::pair<std::size_t, std::size_t> nbins,
solenoidFieldMap(const std::pair<double, double>& rLim,
const std::pair<double, double>& zLim,
const std::pair<std::size_t, std::size_t>& nBins,
const SolenoidBField& field);

} // namespace Acts
67 changes: 67 additions & 0 deletions Core/include/Acts/MagneticField/MultiRangeBField.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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/Definitions/Algebra.hpp"
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/MagneticField/MagneticFieldError.hpp"
#include "Acts/MagneticField/MagneticFieldProvider.hpp"
#include "Acts/Utilities/RangeXD.hpp"

namespace Acts {

/// @ingroup MagneticField
///
/// @brief Magnetic field provider modelling a magnetic field consisting of
/// several (potentially overlapping) regions of constant values.
class MultiRangeBField final : public MagneticFieldProvider {
private:
struct Cache {
explicit Cache(const MagneticFieldContext& /*unused*/);

std::optional<std::size_t> index = {};
};

using BFieldRange = std::pair<RangeXD<3, double>, Vector3>;

// The different ranges and their corresponding field vectors. Note that
// regions positioned _later_ in this vector take priority over earlier
// regions.
std::vector<BFieldRange> fieldRanges;

public:
/// @brief Construct a magnetic field from a vector of ranges.
///
/// @warning These ranges are listed in increasing order of precedence,
/// i.e. ranges further along the vector have higher priority.
explicit MultiRangeBField(const std::vector<BFieldRange>& ranges);

explicit MultiRangeBField(std::vector<BFieldRange>&& ranges);

/// @brief Construct a cache object.
MagneticFieldProvider::Cache makeCache(
const MagneticFieldContext& mctx) const override;

/// @brief Request the value of the magnetic field at a given position.
///
/// @param [in] position Global 3D position for the lookup.
/// @param [in, out] cache Cache object.
/// @returns A successful value containing a field vector if the given
/// location is contained inside any of the regions, or a failure value
/// otherwise.
Result<Vector3> getField(const Vector3& position,
MagneticFieldProvider::Cache& cache) const override;

/// @brief Get the field gradient at a given position.
///
/// @warning This is not currently implemented.
Result<Vector3> getFieldGradient(
const Vector3& position, ActsMatrix<3, 3>& /*unused*/,
MagneticFieldProvider::Cache& cache) const override;
};
} // namespace Acts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class CombinatorialKalmanFilter {

ACTS_VERBOSE("Create temp track state with mask: " << mask);
// CAREFUL! This trackstate has a previous index that is not in this
// MultiTrajectory Visiting brackwards from this track state will
// MultiTrajectory Visiting backwards from this track state will
// fail!
auto ts = bufferTrajectory.makeTrackState(mask, prevTip);

Expand Down
2 changes: 0 additions & 2 deletions Core/include/Acts/TrackFinding/MeasurementSelector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/MeasurementHelpers.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/EventData/Types.hpp"
#include "Acts/Geometry/GeometryHierarchyMap.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
Expand All @@ -21,7 +20,6 @@

#include <cassert>
#include <cstddef>
#include <iterator>
#include <limits>
#include <utility>
#include <vector>
Expand Down
5 changes: 2 additions & 3 deletions Core/include/Acts/Utilities/AlgebraHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ inline ActsMatrix<A::RowsAtCompileTime, B::ColsAtCompileTime> blockedMult(
/// Calculate the inverse of an Eigen matrix after checking if it can be
/// numerically inverted. This allows to catch potential FPEs before they occur.
/// For matrices up to 4x4, the inverse is computed directly. For larger
/// matrices, the FullPivLU is used.
/// matrices, and dynamic matrices the FullPivLU is used.
///
/// @tparam Derived Eigen derived concrete type
/// @tparam Result Eigen result type defaulted to input type
Expand All @@ -192,12 +192,11 @@ std::optional<ResultType> safeInverse(const MatrixType& m) noexcept {
constexpr int cols = MatrixType::ColsAtCompileTime;

static_assert(rows == cols);
static_assert(rows != -1);

ResultType result;
bool invertible = false;

if constexpr (rows > 4) {
if constexpr (rows > 4 || rows == -1) {
Eigen::FullPivLU<MatrixType> mFullPivLU(m);
if (mFullPivLU.isInvertible()) {
invertible = true;
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Utilities/Axis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class NeighborHoodIndices {
/// This class provides some basic functionality for calculating bin indices
/// for a given equidistant binning.
template <AxisBoundaryType bdt>
class Axis<AxisType::Equidistant, bdt> final : public IAxis {
class Axis<AxisType::Equidistant, bdt> : public IAxis {
public:
static constexpr AxisType type = AxisType::Equidistant;

Expand Down Expand Up @@ -417,7 +417,7 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis {
/// This class provides some basic functionality for calculating bin indices
/// for a given binning with variable bin sizes.
template <AxisBoundaryType bdt>
class Axis<AxisType::Variable, bdt> final : public IAxis {
class Axis<AxisType::Variable, bdt> : public IAxis {
public:
static constexpr AxisType type = AxisType::Variable;

Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/Utilities/GridAccessHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class IBoundToGridLocal {
};

template <typename global_to_grid_local_t>
class Affine3Transformed final : public IGlobalToGridLocal {
class Affine3Transformed : public IGlobalToGridLocal {
public:
using grid_local_t = typename global_to_grid_local_t::grid_local_t;

Expand Down Expand Up @@ -142,7 +142,7 @@ class Affine3Transformed final : public IGlobalToGridLocal {
/// position
/// @tparam ...Args
template <BinningValue... Args>
class GlobalSubspace final : public IGlobalToGridLocal {
class GlobalSubspace : public IGlobalToGridLocal {
public:
using grid_local_t = std::array<double, sizeof...(Args)>;

Expand Down Expand Up @@ -179,7 +179,7 @@ class GlobalSubspace final : public IGlobalToGridLocal {
// The bound to grid local transformation, if only access of a subspace
// is requested
template <std::size_t... Args>
class LocalSubspace final : public IBoundToGridLocal {
class LocalSubspace : public IBoundToGridLocal {
public:
using grid_local_t = std::array<double, sizeof...(Args)>;

Expand Down Expand Up @@ -212,7 +212,7 @@ class LocalSubspace final : public IBoundToGridLocal {
}
};

class BoundCylinderToZPhi final : public IBoundToGridLocal {
class BoundCylinderToZPhi : public IBoundToGridLocal {
public:
double radius = 1.;
double shift = 0.;
Expand Down
Loading

0 comments on commit dbe4a81

Please sign in to comment.