Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
cvarni authored and cvarni committed Oct 5, 2024
1 parent 3708349 commit 8befdef
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 56 deletions.
41 changes: 22 additions & 19 deletions Core/include/Acts/EventData/Seed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,40 @@

namespace Acts {

enum class OwningPolicy : bool {Owner, Viewer};

template <typename external_spacepoint_t, std::size_t N = 3ul, OwningPolicy owningPolicy = OwningPolicy::Viewer>
enum class OwningPolicy : bool { Owner, Viewer };

template <typename external_spacepoint_t, std::size_t N = 3ul,
OwningPolicy owningPolicy = OwningPolicy::Viewer>
requires(N >= 3)
class Seed {
public:
static constexpr std::size_t DIM = N;
static constexpr OwningPolicy owning_policy = owningPolicy;
using value_type = typename std::conditional<owningPolicy == OwningPolicy::Viewer,
const external_spacepoint_t*,
const external_spacepoint_t>::type;
using value_type =
typename std::conditional<owningPolicy == OwningPolicy::Viewer,
const external_spacepoint_t*,
const external_spacepoint_t>::type;
using element_type = external_spacepoint_t;

Seed() = delete;

// lvalues
template <typename ... args_t>
requires(sizeof...(args_t) == N)
// lvalues
template <typename... args_t>
requires(sizeof...(args_t) == N)
Seed(const args_t&... points)
requires(owningPolicy == OwningPolicy::Viewer);
// rvalues
template <typename ... args_t>
requires(sizeof...(args_t) == N)

// rvalues
template <typename... args_t>
requires(sizeof...(args_t) == N)
Seed(const args_t&&... points)
requires(owningPolicy == OwningPolicy::Viewer) = delete;

// any value
template <typename ... args_t>
requires(sizeof...(args_t) == N)
Seed(args_t&& ... points)
requires(owningPolicy == OwningPolicy::Viewer)
= delete;

// any value
template <typename... args_t>
requires(sizeof...(args_t) == N)
Seed(args_t&&... points)
requires(owningPolicy == OwningPolicy::Owner);

void setVertexZ(float vertex);
Expand Down
61 changes: 34 additions & 27 deletions Core/include/Acts/EventData/Seed.ipp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// -*- C++ -*-
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
Expand All @@ -9,51 +8,59 @@

namespace Acts {

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

template <typename external_spacepoint_t, std::size_t N, OwningPolicy owningPolicy>

template <typename external_spacepoint_t, std::size_t N,
OwningPolicy owningPolicy>
requires(N >= 3)
template <typename ... args_t>
requires(sizeof...(args_t) == N)
Seed<external_spacepoint_t, N, owningPolicy>::Seed(args_t&& ... points)
requires(owningPolicy == OwningPolicy::Owner)
: m_spacepoints({std::forward<args_t>(points)...})
{}
template <typename external_spacepoint_t, std::size_t N, OwningPolicy owningPolicy>
template <typename... args_t>
requires(sizeof...(args_t) == N)
Seed<external_spacepoint_t, N, owningPolicy>::Seed(args_t&&... points)
requires(owningPolicy == OwningPolicy::Owner)
: m_spacepoints({std::forward<args_t>(points)...}) {}

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

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

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

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

template <typename external_spacepoint_t, std::size_t N, OwningPolicy owningPolicy>
template <typename external_spacepoint_t, std::size_t N,
OwningPolicy owningPolicy>
requires(N >= 3)
float Seed<external_spacepoint_t, N, owningPolicy>::seedQuality() const {
float Seed<external_spacepoint_t, N, owningPolicy>::seedQuality() const {
return m_seedQuality;
}

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/EventData/SpacePointContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class SpacePointContainer {
ProxyType at(const std::size_t n);
ProxyType at(const std::size_t n) const;
const ValueType& sp(const std::size_t n) const;

private:
void initialize();

Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/EventData/SpacePointContainer.ipp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// -*- C++ -*-
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
Expand Down
10 changes: 4 additions & 6 deletions Core/include/Acts/Seeding/SeedFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ void SeedFinder<external_spacepoint_t, grid_t, platform_t>::createSeedsForGroup(
}

// Get the middle space point candidates
const std::vector<external_spacepoint_t>& middleSPs =
grid.at(middleSPsIdx);
const std::vector<external_spacepoint_t>& middleSPs = grid.at(middleSPsIdx);
// Return if somehow there are no middle sp candidates
if (middleSPs.empty()) {
return;
Expand Down Expand Up @@ -182,10 +181,9 @@ void SeedFinder<external_spacepoint_t, grid_t, platform_t>::createSeedsForGroup(

// Iterate over middle-bottom dublets
getCompatibleDoublets<Acts::SpacePointCandidateType::eBottom>(
options, grid, state.spacePointMutableData, state.bottomNeighbours,
spM, state.linCircleBottom, state.compatBottomSP,
m_config.deltaRMinBottomSP, m_config.deltaRMaxBottomSP, uIP, uIP2,
cosPhiM, sinPhiM);
options, grid, state.spacePointMutableData, state.bottomNeighbours, spM,
state.linCircleBottom, state.compatBottomSP, m_config.deltaRMinBottomSP,
m_config.deltaRMaxBottomSP, uIP, uIP2, cosPhiM, sinPhiM);

// no bottom SP found -> try next spM
if (state.compatBottomSP.empty()) {
Expand Down
6 changes: 4 additions & 2 deletions Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,10 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithm::execute(

/// variable middle SP radial region of interest
const Acts::Range1D<float> rMiddleSPRange(
std::floor(minRange/2)*2 + m_cfg.seedFinderConfig.deltaRMiddleMinSPRange,
std::floor(maxRange/2)*2 - m_cfg.seedFinderConfig.deltaRMiddleMaxSPRange);
std::floor(minRange / 2) * 2 +
m_cfg.seedFinderConfig.deltaRMiddleMinSPRange,
std::floor(maxRange / 2) * 2 -
m_cfg.seedFinderConfig.deltaRMiddleMaxSPRange);

// run the seeding
static thread_local std::vector<seed_type> seeds;
Expand Down

0 comments on commit 8befdef

Please sign in to comment.