Skip to content
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

Update position_from_cell calculation #605

Merged
merged 9 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ TRACCC_HOST_DEVICE
inline vector2 position_from_cell(const cell& cell, const cell_module& mod) {

// Retrieve the specific values based on module idx
return {mod.pixel.min_center_x + cell.channel0 * mod.pixel.pitch_x,
mod.pixel.min_center_y + cell.channel1 * mod.pixel.pitch_y};
return {mod.pixel.min_corner_x +
(scalar{0.5} + cell.channel0) * mod.pixel.pitch_x,
mod.pixel.min_corner_y +
(scalar{0.5} + cell.channel1) * mod.pixel.pitch_y};
}

TRACCC_HOST_DEVICE inline void calc_cluster_properties(
Expand Down
4 changes: 2 additions & 2 deletions core/include/traccc/geometry/pixel_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace traccc {
/// No checking on out of bounds done
struct pixel_data {

scalar min_center_x = 0.f;
scalar min_center_y = 0.f;
scalar min_corner_x = 0.f;
scalar min_corner_y = 0.f;
scalar pitch_x = 1.f;
scalar pitch_y = 1.f;
char dimension = 2;
Expand Down
4 changes: 2 additions & 2 deletions io/src/csv/read_cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ traccc::cell_module get_module(const std::uint64_t geometry_id,
// Set the value on the module description.
const auto& binning_data = geo_it->segmentation.binningData();
assert(binning_data.size() > 0);
result.pixel.min_center_x = binning_data[0].min;
result.pixel.min_corner_x = binning_data[0].min;
result.pixel.pitch_x = binning_data[0].step;
if (binning_data.size() > 1) {
result.pixel.min_center_y = binning_data[1].min;
result.pixel.min_corner_y = binning_data[1].min;
result.pixel.pitch_y = binning_data[1].step;
}
result.pixel.dimension = geo_it->dimensions;
Expand Down
4 changes: 2 additions & 2 deletions tests/common/tests/cca_test.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -98,7 +98,7 @@ class ConnectedComponentAnalysisTests
traccc::cell_module_collection_types::host &modules = data.modules;

for (std::size_t i = 0; i < modules.size(); i++) {
modules.at(i).pixel = traccc::pixel_data{0, 0, 1, 1};
modules.at(i).pixel = {-0.5f, -0.5f, 1.f, 1.f};
}

std::map<traccc::geometry_id, vecmem::vector<traccc::measurement>>
Expand Down
Loading