Skip to content

Commit

Permalink
Merge branch 'main' into whitepaper-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Nov 6, 2023
2 parents d7a34a5 + ed1919b commit 4d8d35b
Show file tree
Hide file tree
Showing 275 changed files with 1,469 additions and 1,435 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GreedyAmbiguityResolution {
std::uint32_t maximumIterations = 1000;

/// Minimum number of measurement to form a track.
size_t nMeasurementsMin = 7;
std::size_t nMeasurementsMin = 7;
};

struct State {
Expand Down
9 changes: 5 additions & 4 deletions Core/include/Acts/Clusterization/Clusterization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct Connect1D {
};

// Default connection type based on GridDim
template <typename Cell, size_t GridDim = 2>
template <typename Cell, std::size_t GridDim = 2>
struct DefaultConnect {
static_assert(GridDim != 1 && GridDim != 2,
"Only grid dimensions of 1 or 2 are supported");
Expand All @@ -67,7 +67,7 @@ struct DefaultConnect<Cell, 1> : public Connect1D<Cell> {};
///
/// @param [in] cells the cell collection to be labeled
/// @param [in] connect the connection type (see DefaultConnect)
template <typename CellCollection, size_t GridDim = 2,
template <typename CellCollection, std::size_t GridDim = 2,
typename Connect =
DefaultConnect<typename CellCollection::value_type, GridDim>>
void labelClusters(CellCollection& cells, Connect connect = Connect());
Expand All @@ -80,13 +80,14 @@ void labelClusters(CellCollection& cells, Connect connect = Connect());
/// void clusterAddCell(Cluster&, const Cell&)
///
/// @return nothing
template <typename CellCollection, typename ClusterCollection, size_t GridDim>
template <typename CellCollection, typename ClusterCollection,
std::size_t GridDim>
ClusterCollection mergeClusters(CellCollection& /*cells*/);

/// @brief createClusters
/// Convenience function which runs both labelClusters and createClusters.
template <typename CellCollection, typename ClusterCollection,
size_t GridDim = 2,
std::size_t GridDim = 2,
typename Connect =
DefaultConnect<typename CellCollection::value_type, GridDim>>
ClusterCollection createClusters(CellCollection& cells,
Expand Down
47 changes: 24 additions & 23 deletions Core/include/Acts/Clusterization/Clusterization.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Acts::Ccl::internal {

// Machinery for validating generic Cell/Cluster types at compile-time

template <typename, size_t, typename T = void>
template <typename, std::size_t, typename T = void>
struct cellTypeHasRequiredFunctions : std::false_type {};

template <typename T>
Expand All @@ -42,14 +42,14 @@ struct clusterTypeHasRequiredFunctions<
std::void_t<decltype(clusterAddCell(std::declval<T>(), std::declval<U>()))>>
: std::true_type {};

template <size_t GridDim>
template <std::size_t GridDim>
constexpr void staticCheckGridDim() {
static_assert(
GridDim == 1 || GridDim == 2,
"mergeClusters is only defined for grid dimensions of 1 or 2. ");
}

template <typename T, size_t GridDim>
template <typename T, std::size_t GridDim>
constexpr void staticCheckCellType() {
constexpr bool hasFns = cellTypeHasRequiredFunctions<T, GridDim>();
static_assert(hasFns,
Expand All @@ -67,7 +67,7 @@ constexpr void staticCheckClusterType() {
"'void clusterAddCell(Cluster&, const Cell&)'");
}

template <typename Cell, size_t GridDim>
template <typename Cell, std::size_t GridDim>
struct Compare {
static_assert(GridDim != 1 && GridDim != 2,
"Only grid dimensions of 1 or 2 are supported");
Expand Down Expand Up @@ -101,7 +101,7 @@ struct Compare<Cell, 1> {
// wrapping, but it's way slower
class DisjointSets {
public:
explicit DisjointSets(size_t initial_size = 128)
explicit DisjointSets(std::size_t initial_size = 128)
: m_size(initial_size),
m_rank(m_size),
m_parent(m_size),
Expand All @@ -114,31 +114,32 @@ class DisjointSets {
m_size *= 2;
m_rank.resize(m_size);
m_parent.resize(m_size);
m_ds = boost::disjoint_sets<size_t*, size_t*>(&m_rank[0], &m_parent[0]);
m_ds = boost::disjoint_sets<std::size_t*, std::size_t*>(&m_rank[0],
&m_parent[0]);
}
m_ds.make_set(m_globalId);
return static_cast<Label>(m_globalId++);
}

void unionSet(size_t x, size_t y) { m_ds.union_set(x, y); }
Label findSet(size_t x) { return static_cast<Label>(m_ds.find_set(x)); }
void unionSet(std::size_t x, std::size_t y) { m_ds.union_set(x, y); }
Label findSet(std::size_t x) { return static_cast<Label>(m_ds.find_set(x)); }

private:
size_t m_globalId = 1;
size_t m_size;
std::vector<size_t> m_rank;
std::vector<size_t> m_parent;
boost::disjoint_sets<size_t*, size_t*> m_ds;
std::size_t m_globalId = 1;
std::size_t m_size;
std::vector<std::size_t> m_rank;
std::vector<std::size_t> m_parent;
boost::disjoint_sets<std::size_t*, std::size_t*> m_ds;
};

template <size_t BufSize>
template <std::size_t BufSize>
struct ConnectionsBase {
size_t nconn{0};
std::size_t nconn{0};
std::array<Label, BufSize> buf;
ConnectionsBase() { std::fill(buf.begin(), buf.end(), NO_LABEL); }
};

template <size_t GridDim>
template <std::size_t GridDim>
class Connections {};

// On 1-D grid, cells have 1 backward neighbor
Expand All @@ -154,7 +155,7 @@ struct Connections<2> : public ConnectionsBase<4> {
};

// Cell collection logic
template <typename Cell, typename Connect, size_t GridDim>
template <typename Cell, typename Connect, std::size_t GridDim>
Connections<GridDim> getConnections(typename std::vector<Cell>::iterator it,
std::vector<Cell>& set, Connect connect) {
Connections<GridDim> seen;
Expand Down Expand Up @@ -242,15 +243,15 @@ ConnectResult Connect1D<Cell>::operator()(const Cell& ref,
return deltaCol == 1 ? ConnectResult::eConn : ConnectResult::eNoConnStop;
}

template <size_t GridDim>
template <std::size_t GridDim>
void recordEquivalences(const internal::Connections<GridDim> seen,
internal::DisjointSets& ds) {
// Sanity check: first element should always have
// label if nconn > 0
if (seen.nconn > 0 && seen.buf[0] == NO_LABEL) {
throw std::logic_error("seen.nconn > 0 but seen.buf[0] == NO_LABEL");
}
for (size_t i = 1; i < seen.nconn; i++) {
for (std::size_t i = 1; i < seen.nconn; i++) {
// Sanity check: since connection lookup is always backward
// while iteration is forward, all connected cells found here
// should have a label
Expand All @@ -264,7 +265,7 @@ void recordEquivalences(const internal::Connections<GridDim> seen,
}
}

template <typename CellCollection, size_t GridDim, typename Connect>
template <typename CellCollection, std::size_t GridDim, typename Connect>
void labelClusters(CellCollection& cells, Connect connect) {
using Cell = typename CellCollection::value_type;
internal::staticCheckCellType<Cell, GridDim>();
Expand Down Expand Up @@ -296,7 +297,7 @@ void labelClusters(CellCollection& cells, Connect connect) {
}

template <typename CellCollection, typename ClusterCollection,
size_t GridDim = 2>
std::size_t GridDim = 2>
ClusterCollection mergeClusters(CellCollection& cells) {
using Cell = typename CellCollection::value_type;
using Cluster = typename ClusterCollection::value_type;
Expand All @@ -315,8 +316,8 @@ ClusterCollection mergeClusters(CellCollection& cells) {
return internal::mergeClustersImpl<CellCollection, ClusterCollection>(cells);
}

template <typename CellCollection, typename ClusterCollection, size_t GridDim,
typename Connect>
template <typename CellCollection, typename ClusterCollection,
std::size_t GridDim, typename Connect>
ClusterCollection createClusters(CellCollection& cells, Connect connect) {
using Cell = typename CellCollection::value_type;
using Cluster = typename ClusterCollection::value_type;
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/Definitions/TrackParametrization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ namespace Acts {
// Ensure bound track parameters definition is valid.
static_assert(std::is_enum_v<BoundIndices>,
"'BoundIndices' must be an enum type");
static_assert(std::is_convertible_v<BoundIndices, size_t>,
"'BoundIndices' must be convertible to size_t");
static_assert(std::is_convertible_v<BoundIndices, std::size_t>,
"'BoundIndices' must be convertible to std::size_t");
// Only the order can be user-defined
static_assert(BoundIndices::eBoundSize == 6u,
"Bound track parameters must have six components");

// Ensure free track parameters definition is valid.
static_assert(std::is_enum_v<FreeIndices>,
"'FreeIndices' must be an enum type");
static_assert(std::is_convertible_v<FreeIndices, size_t>,
"'FreeIndices' must be convertible to size_t");
static_assert(std::is_convertible_v<FreeIndices, std::size_t>,
"'FreeIndices' must be convertible to std::size_t");
// Only the order can be user-defined
static_assert(FreeIndices::eFreeSize == 8u,
"Free track parameters must have eight components");
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Detector/Detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Detector : public std::enable_shared_from_this<Detector> {
DetectorVolumeUpdator m_detectorVolumeUpdator;

/// Name/index map to find volumes by name and detect duplicates
std::unordered_map<std::string, size_t> m_volumeNameIndex;
std::unordered_map<std::string, std::size_t> m_volumeNameIndex;

/// Geometry Id hierarchy map of all sensitive surfaces
GeometryHierarchyMap<const Surface*> m_sensitiveHierarchyMap;
Expand Down
13 changes: 7 additions & 6 deletions Core/include/Acts/Detector/DetectorVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class DetectorVolume : public std::enable_shared_from_this<DetectorVolume> {
/// @param nseg is the number of segments to approximate
///
/// @return an Extent object
Extent extent(const GeometryContext& gctx, size_t nseg = 1) const;
Extent extent(const GeometryContext& gctx, std::size_t nseg = 1) const;

/// Initialize/update the navigation status in this environment
///
Expand Down Expand Up @@ -361,7 +361,8 @@ class DetectorVolume : public std::enable_shared_from_this<DetectorVolume> {
/// @param nseg is the number of segments to approximate
///
/// @return a boolean indicating if the objects are properly contained
bool checkContainment(const GeometryContext& gctx, size_t nseg = 1) const;
bool checkContainment(const GeometryContext& gctx,
std::size_t nseg = 1) const;

/// build the bounding box
///
Expand Down Expand Up @@ -469,7 +470,7 @@ struct AllSurfacesExtractor {
inline static const std::vector<const Surface*> extract(
[[maybe_unused]] const GeometryContext& gctx,
const NavigationState& nState,
[[maybe_unused]] const std::vector<size_t>& indices = {}) {
[[maybe_unused]] const std::vector<std::size_t>& indices = {}) {
if (nState.currentVolume == nullptr) {
throw std::runtime_error(
"AllSurfacesExtractor: no detector volume given.");
Expand All @@ -491,7 +492,7 @@ struct IndexedSurfacesExtractor {
/// @return a vector of raw Surface pointers
inline static const std::vector<const Surface*> extract(
[[maybe_unused]] const GeometryContext& gctx,
const NavigationState& nState, const std::vector<size_t>& indices) {
const NavigationState& nState, const std::vector<std::size_t>& indices) {
if (nState.currentVolume == nullptr) {
throw std::runtime_error(
"IndexedSurfacesExtractor: no detector volume given.");
Expand Down Expand Up @@ -519,7 +520,7 @@ struct AllSubVolumesExtractor {
inline static const std::vector<const DetectorVolume*> extract(
[[maybe_unused]] const GeometryContext& gctx,
const NavigationState& nState,
[[maybe_unused]] const std::vector<size_t>& indices = {}) {
[[maybe_unused]] const std::vector<std::size_t>& indices = {}) {
if (nState.currentVolume == nullptr) {
throw std::runtime_error(
"AllSubVolumesExtractor: no detector volume given.");
Expand All @@ -539,7 +540,7 @@ struct IndexedSubVolumesExtractor {
/// @return a vector of raw DetectorVolume pointers
inline static const std::vector<const DetectorVolume*> extract(
[[maybe_unused]] const GeometryContext& gctx,
const NavigationState& nState, const std::vector<size_t>& indices) {
const NavigationState& nState, const std::vector<std::size_t>& indices) {
if (nState.currentVolume == nullptr) {
throw std::runtime_error(
"AllSubVolumesExtractor: no detector volume given.");
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Detector/KdtSurfacesProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Experimental {
/// It also deals with the conversion from global query to
/// KDTree lookup positions
///
template <size_t kDIM = 2u, size_t bSize = 100u,
template <std::size_t kDIM = 2u, std::size_t bSize = 100u,
typename reference_generator =
detail::PolyhedronReferenceGenerator<1u, false>>
class KdtSurfaces {
Expand Down Expand Up @@ -161,7 +161,7 @@ class KdtSurfaces {
///
/// This allows to create small region based callable structs at
/// configuration level that are then connected to an InternalStructureBuilder
template <size_t kDIM = 2u, size_t bSize = 100u,
template <std::size_t kDIM = 2u, std::size_t bSize = 100u,
typename reference_generator =
detail::PolyhedronReferenceGenerator<1u, false>>
class KdtSurfacesProvider : public ISurfacesProvider {
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Detector/detail/ReferenceGenerators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct BinningValueReferenceGenerator {
///
/// The grid filling then completes the empty bins in between and
/// expands if necessary.
template <size_t nSEGS = 1u, bool aBARY = true>
template <std::size_t nSEGS = 1u, bool aBARY = true>
struct PolyhedronReferenceGenerator {
/// Helper to access the Center point of for filling the grid
///
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Detector/detail/SupportHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ std::vector<std::shared_ptr<Surface>> discSupport(
///
/// @note this modifies the layerSurfaces and toAllIndices
void addSupport(std::vector<std::shared_ptr<Surface>>& layerSurfaces,
std::vector<size_t>& assignToAll, const Extent& layerExtent,
std::vector<std::size_t>& assignToAll,
const Extent& layerExtent,
Surface::SurfaceType layerRepresentation,
const std::array<ActsScalar, 5u>& layerSupportValues,
std::optional<Transform3> layerTransform = std::nullopt,
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Digitization/CartesianSegmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CartesianSegmentation : public Segmentation {
/// @param numCellsX is the number of cells in X
/// @param numCellsY is the number of cells in Y
CartesianSegmentation(const std::shared_ptr<const PlanarBounds>& mBounds,
size_t numCellsX, size_t numCellsY = 1);
std::size_t numCellsX, std::size_t numCellsY = 1);

/// @todo constructor from BinUtilities for more complex readouts
///
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Digitization/DigitizationCell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace Acts {
/// @brief pair of ints for definition of a cell
struct DigitizationCell final {
// identification and data
size_t channel0 = 0;
size_t channel1 = 1;
std::size_t channel0 = 0;
std::size_t channel1 = 1;
float data = 0.;

// construct them
DigitizationCell(size_t ch0, size_t ch1, float d = 0.)
DigitizationCell(std::size_t ch0, std::size_t ch1, float d = 0.)
: channel0(ch0), channel1(ch1), data(d) {}

/// To merge cells in case they are at the same position
Expand Down
12 changes: 6 additions & 6 deletions Core/include/Acts/EventData/Measurement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ namespace Acts {
/// on). Both variants add additional complications. Since the geometry object
/// is not required anyway (as discussed above), not storing it removes all
/// these complications altogether.
template <typename indices_t, size_t kSize>
template <typename indices_t, std::size_t kSize>
class Measurement {
static constexpr size_t kFullSize = detail::kParametersSize<indices_t>;
static constexpr std::size_t kFullSize = detail::kParametersSize<indices_t>;

using Subspace = detail::FixedSizeSubspace<kFullSize, kSize>;

Expand Down Expand Up @@ -98,7 +98,7 @@ class Measurement {
const SourceLink& sourceLink() const { return m_source; }

/// Number of measured parameters.
static constexpr size_t size() { return kSize; }
static constexpr std::size_t size() { return kSize; }

/// Check if a specific parameter is part of this measurement.
bool contains(indices_t i) const { return m_subspace.contains(i); }
Expand All @@ -107,7 +107,7 @@ class Measurement {
constexpr std::array<indices_t, kSize> indices() const {
std::array<uint8_t, kSize> subInds = m_subspace.indices();
std::array<indices_t, kSize> inds{};
for (size_t i = 0; i < kSize; i++) {
for (std::size_t i = 0; i < kSize; i++) {
inds[i] = static_cast<indices_t>(subInds[i]);
}
return inds;
Expand Down Expand Up @@ -211,10 +211,10 @@ namespace detail {
// -> VariantMeasurementGenerator<..., 1, 2, 3, 4>
// -> VariantMeasurementGenerator<..., 0, 1, 2, 3, 4>
//
template <typename indices_t, size_t kN, size_t... kSizes>
template <typename indices_t, std::size_t kN, std::size_t... kSizes>
struct VariantMeasurementGenerator
: VariantMeasurementGenerator<indices_t, kN - 1u, kN, kSizes...> {};
template <typename indices_t, size_t... kSizes>
template <typename indices_t, std::size_t... kSizes>
struct VariantMeasurementGenerator<indices_t, 0u, kSizes...> {
using Type = std::variant<Measurement<indices_t, kSizes>...>;
};
Expand Down
Loading

0 comments on commit 4d8d35b

Please sign in to comment.