Skip to content

Commit

Permalink
Merge branch 'main' into fix/another-final
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzburger authored Dec 3, 2024
2 parents b28c6f3 + 797c3c3 commit dcce190
Show file tree
Hide file tree
Showing 34 changed files with 195 additions and 313 deletions.
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
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
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
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
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
47 changes: 45 additions & 2 deletions Core/include/Acts/Utilities/Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <iostream>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <type_traits>
#include <vector>

Expand Down Expand Up @@ -221,4 +219,49 @@ struct overloaded : Ts... {
template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

namespace detail {

/// Computes the minimum, maximum, and bin count for a given vector of values.
///
/// This function processes a vector of doubles to compute:
/// - The minimum value (@c xMin)
/// - The maximum value (@c xMax), adjusted to include an additional bin
/// - The bin count (@c xBinCount) based on the number of unique values
///
/// The computation is performed as follows:
/// 1. Sorts the input vector using @c std::ranges::sort to prepare for uniqueness.
/// 2. Determines the number of unique values using @c std::unique and calculates the bin count.
/// 3. Calculates the minimum and maximum using @c std::ranges::minmax.
/// 4. Adjusts the maximum to include an additional bin by adding the bin step
/// size.
///
/// @param xPos A reference to a vector of doubles.
/// @return A tuple containing:
/// - The minimum value (double)
/// - The adjusted maximum value (double)
/// - The bin count (std::size_t)
///
/// @note The vector xPos will be modified during the call.
inline auto getMinMaxAndBinCount(std::vector<double>& xPos) {
// sort the values for unique()
std::ranges::sort(xPos);

// get the number of bins over unique values
auto it = std::unique(xPos.begin(), xPos.end());
const std::size_t xBinCount = std::distance(xPos.begin(), it);

// get the minimum and maximum
auto [xMin, xMax] = std::ranges::minmax(xPos);

// calculate maxima (add one last bin, because bin value always corresponds to
// left boundary)
const double stepX = (xMax - xMin) / static_cast<double>(xBinCount - 1);
xMax += stepX;

// Return all values as a tuple
return std::make_tuple(xMin, xMax, xBinCount);
}

} // namespace detail

} // namespace Acts
Loading

0 comments on commit dcce190

Please sign in to comment.