Skip to content

Commit

Permalink
Update position_from_cell calculation (#605)
Browse files Browse the repository at this point in the history
* bug: fixed pixel min center calculation in module

* Formatting

* Formatting

* fixed mistake

* Update pixel_data.hpp

* Update measurement_creation.ipp

* Update read_cells.cpp

* Update measurement_creation.ipp

* Made the CCA tests account for the segmentation handling change.

---------

Co-authored-by: Attila Krasznahorkay <[email protected]>
  • Loading branch information
fredevb and krasznaa authored Jun 7, 2024
1 parent 15baf6d commit ddeeade
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
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

0 comments on commit ddeeade

Please sign in to comment.