Skip to content

Commit

Permalink
Merge branch 'acts-project:main' into ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Sep 4, 2024
2 parents c422c79 + 4646759 commit b854725
Show file tree
Hide file tree
Showing 28 changed files with 724 additions and 681 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0 # To prevent shallow clone

- name: 'Download artifact'
uses: actions/github-script@v7
Expand Down
34 changes: 33 additions & 1 deletion Core/include/Acts/EventData/SubspaceHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ inline static bool checkSubspaceIndices(const Container& container,
if (subspaceSize > fullSize) {
return false;
}
if (container.size() != subspaceSize) {
if (static_cast<std::size_t>(container.size()) != subspaceSize) {
return false;
}
for (auto it = container.begin(); it != container.end();) {
Expand Down Expand Up @@ -115,6 +115,36 @@ class SubspaceHelperBase {
auto begin() const { return self().begin(); }
auto end() const { return self().end(); }

bool contains(std::uint8_t index) const {
return std::find(begin(), end(), index) != end();
}
std::size_t indexOf(std::uint8_t index) const {
auto it = std::find(begin(), end(), index);
return it != end() ? std::distance(begin(), it) : kFullSize;
}

template <typename EigenDerived>
ActsVector<kFullSize> expandVector(
const Eigen::DenseBase<EigenDerived>& vector) const {
ActsVector<kFullSize> result = ActsVector<kFullSize>::Zero();
for (auto [i, index] : enumerate(*this)) {
result(index) = vector(i);
}
return result;
}

template <typename EigenDerived>
FullSquareMatrix expandMatrix(
const Eigen::DenseBase<EigenDerived>& matrix) const {
FullSquareMatrix result = FullSquareMatrix::Zero();
for (auto [i, indexI] : enumerate(*this)) {
for (auto [j, indexJ] : enumerate(*this)) {
result(indexI, indexJ) = matrix(i, j);
}
}
return result;
}

FullSquareMatrix fullProjector() const {
FullSquareMatrix result = FullSquareMatrix::Zero();
for (auto [i, index] : enumerate(*this)) {
Expand Down Expand Up @@ -168,6 +198,7 @@ class VariableSubspaceHelper

bool empty() const { return m_indices.empty(); }
std::size_t size() const { return m_indices.size(); }
const Container& indices() const { return m_indices; }

IndexType operator[](std::size_t i) const { return m_indices[i]; }

Expand Down Expand Up @@ -215,6 +246,7 @@ class FixedSubspaceHelper

bool empty() const { return m_indices.empty(); }
std::size_t size() const { return m_indices.size(); }
const Container& indices() const { return m_indices; }

IndexType operator[](std::uint32_t i) const { return m_indices[i]; }

Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/EventData/TrackProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ class TrackProxy {
setReferenceSurface(other.referenceSurface().getSharedPtr());
parameters() = other.parameters();
covariance() = other.covariance();
} else {
setReferenceSurface(nullptr);
}

nMeasurements() = other.nMeasurements();
Expand Down
Loading

0 comments on commit b854725

Please sign in to comment.