-
Notifications
You must be signed in to change notification settings - Fork 256
refactor: Move logic into TrackerHitLocal #5234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kodiakhq
merged 15 commits into
acts-project:main
from
paulgessinger:refactor/trackerhitlocal-api
Mar 21, 2026
Merged
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bfc7dd1
refactor: Move logic into TrackerHitLocal
paulgessinger 39c76e4
fix tests, inline trivial methods again
paulgessinger 7dbd485
column major for covariance
paulgessinger d6acd86
lint
paulgessinger 794a202
more lint
paulgessinger 50fd1d9
redirect
paulgessinger 53ae9e9
remove members in favor of interface
paulgessinger c57673f
format
paulgessinger f53cc35
drop nullptr checks, redundant setters
paulgessinger 71e7d74
use int32, remove casting
paulgessinger 3a2bfe8
lint
paulgessinger 31173dd
centralize c2y extensions flag
paulgessinger 5175ac4
drop links
paulgessinger fae1216
Merge branch 'main' into refactor/trackerhitlocal-api
AJPfleger 63c0fc6
Merge branch 'main' into refactor/trackerhitlocal-api
andiwand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
Plugins/EDM4hep/include/ActsPodioEdm/detail/SubspaceIndexHelpers.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| // 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 <cstddef> | ||
| #include <cstdint> | ||
| #include <span> | ||
| #include <stdexcept> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| namespace ActsPodioEdm::detail { | ||
|
|
||
| /// Encoded index type for local measurement subspace coordinates. | ||
| using SubspaceIndex = std::uint8_t; | ||
| /// Largest allowed local subspace index value. | ||
| constexpr std::uint8_t kMaxSubspaceIndex = 6u; | ||
| /// Maximum number of coordinates in an encoded local subspace. | ||
| constexpr std::size_t kMaxSubspaceSize = 6u; | ||
|
paulgessinger marked this conversation as resolved.
|
||
|
|
||
| /// Encode a list of bound parameter indices into a 32-bit integer. | ||
| /// | ||
| /// This function bit-packs up to `kMaxSubspaceSize` parameter indices into a | ||
| /// single 32-bit unsigned integer for storage in EDM4hep format. | ||
| /// | ||
| /// Bit layout: | ||
| /// - Bits 0-3: Number of indices (size) | ||
| /// - Bits 4-7: First index | ||
| /// - Bits 8-11: Second index | ||
| /// - Bits 12-15: Third index | ||
| /// - (and so on, up to `kMaxSubspaceSize` indices total) | ||
| /// | ||
| /// @param indices Span of parameter indices to encode (max | ||
| /// `kMaxSubspaceSize` elements) | ||
| /// @return Packed 32-bit unsigned integer containing all indices | ||
| inline std::uint32_t encodeIndices(std::span<const std::uint8_t> indices) { | ||
|
paulgessinger marked this conversation as resolved.
Outdated
|
||
| if (indices.size() > kMaxSubspaceSize) { | ||
| throw std::runtime_error("Number of indices exceeds maximum of " + | ||
| std::to_string(kMaxSubspaceSize) + " for EDM4hep"); | ||
| } | ||
|
|
||
| std::uint32_t result = 0; | ||
| std::uint8_t shift = 0; | ||
| result |= (indices.size() << 0); | ||
| shift += 4; | ||
|
|
||
| for (std::uint8_t index : indices) { | ||
| if (index > kMaxSubspaceIndex) { | ||
| throw std::runtime_error("Index out of range: maximum allowed is " + | ||
| std::to_string(kMaxSubspaceIndex)); | ||
| } | ||
| result |= (static_cast<std::uint32_t>(index) << shift); | ||
| shift += 4; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| /// Decode a 32-bit integer back into a list of bound parameter indices. | ||
| /// | ||
| /// This function unpacks a bit-packed integer (created by encodeIndices) back | ||
| /// into the original list of parameter indices. See encodeIndices for the bit | ||
| /// layout specification. | ||
| /// | ||
| /// @param type Packed 32-bit unsigned integer containing encoded indices | ||
| /// @return Vector of decoded parameter indices (each in | ||
| /// `[0, kMaxSubspaceIndex]`) | ||
| inline std::vector<SubspaceIndex> decodeIndices(std::uint32_t type) { | ||
| std::vector<SubspaceIndex> result; | ||
| std::uint8_t size = type & 0xF; | ||
| if (size > kMaxSubspaceSize) { | ||
| throw std::runtime_error("Number of indices exceeds maximum of " + | ||
| std::to_string(kMaxSubspaceSize) + " for EDM4hep"); | ||
| } | ||
| result.resize(size); | ||
| for (std::size_t i = 0; i < result.size(); ++i) { | ||
| result[i] = (type >> ((i + 1) * 4)) & 0xF; | ||
| if (result[i] > kMaxSubspaceIndex) { | ||
| throw std::runtime_error("Index out of range: maximum allowed is " + | ||
| std::to_string(kMaxSubspaceIndex)); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| } // namespace ActsPodioEdm::detail | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.