Skip to content

Commit 24d8f3f

Browse files
authored
Merge pull request #1165 from m-brettell/cluster_diameter_calculation
Bugfix and change to the cluster_diameter calculation
1 parent d07fabc commit 24d8f3f

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

core/include/traccc/clusterization/clustering_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct clustering_config {
8888
* See the enum definition for more details.
8989
*/
9090
clustering_diameter_strategy diameter_strategy =
91-
clustering_diameter_strategy::MAXIMUM;
91+
clustering_diameter_strategy::CHANNEL1;
9292

9393
/**
9494
* @brief The maximum number of cells per partition.

core/include/traccc/clusterization/details/measurement_creation.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ inline scalar signal_cell_modelling(
2626
///
2727
/// @param cell The cell to get the position of
2828
/// @param det_descr The (silicon) detector description
29-
/// @return The local position of the cell
29+
/// @return The local position of the cell (upper bound) and optionality the
30+
/// lower bound
3031
///
3132
template <typename T>
3233
TRACCC_HOST_DEVICE inline vector2 position_from_cell(
3334
const edm::silicon_cell<T>& cell,
34-
const silicon_detector_description::const_device& det_descr);
35+
const silicon_detector_description::const_device& det_descr,
36+
vector2* cell_lower_position = nullptr);
3537

3638
/// Function used for calculating the properties of the cluster during
3739
/// measurement creation

core/include/traccc/clusterization/impl/measurement_creation.ipp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,25 @@ inline scalar signal_cell_modelling(
2020
template <typename T>
2121
TRACCC_HOST_DEVICE inline vector2 position_from_cell(
2222
const edm::silicon_cell<T>& cell,
23-
const silicon_detector_description::const_device& det_descr) {
23+
const silicon_detector_description::const_device& det_descr,
24+
vector2* cell_lower_position) {
2425

2526
// The detector description for the module that the cell is on.
2627
const auto module_dd = det_descr.at(cell.module_index());
2728
// Calculate / construct the local cell position.
28-
return {module_dd.reference_x() +
29-
(scalar{0.5f} + static_cast<scalar>(cell.channel0())) *
30-
module_dd.pitch_x(),
31-
module_dd.reference_y() +
32-
(scalar{0.5f} + static_cast<scalar>(cell.channel1())) *
33-
module_dd.pitch_y()};
29+
vector2 upper_position = {
30+
module_dd.reference_x() +
31+
(scalar{0.5f} + static_cast<scalar>(cell.channel0())) *
32+
module_dd.pitch_x(),
33+
module_dd.reference_y() +
34+
(scalar{0.5f} + static_cast<scalar>(cell.channel1())) *
35+
module_dd.pitch_y()};
36+
37+
if (cell_lower_position) {
38+
*cell_lower_position = {upper_position[0] - module_dd.pitch_x(),
39+
upper_position[1] - module_dd.pitch_y()};
40+
}
41+
return upper_position;
3442
}
3543

3644
template <typename T>

device/common/include/traccc/clusterization/device/impl/aggregate_cluster.ipp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ inline void aggregate_cluster(
5757
point2 mean{0.f, 0.f}, var{0.f, 0.f}, offset{0.f, 0.f};
5858

5959
scalar min_channel0 = std::numeric_limits<scalar>::max();
60-
scalar max_channel0 = std::numeric_limits<scalar>::min();
60+
scalar max_channel0 = std::numeric_limits<scalar>::lowest();
6161
scalar min_channel1 = std::numeric_limits<scalar>::max();
62-
scalar max_channel1 = std::numeric_limits<scalar>::min();
62+
scalar max_channel1 = std::numeric_limits<scalar>::lowest();
6363

6464
const unsigned int module_idx = cells.module_index().at(cid + start);
6565
const auto module_descr = det_descr.at(module_idx);
@@ -101,12 +101,14 @@ inline void aggregate_cluster(
101101
totalWeight += weight;
102102
scalar weight_factor = weight / totalWeight;
103103

104-
point2 cell_position =
105-
traccc::details::position_from_cell(cell, det_descr);
104+
point2 cell_lower_position = {0, 0};
105+
point2 cell_position = traccc::details::position_from_cell(
106+
cell, det_descr, &cell_lower_position);
106107

107-
min_channel0 = std::min(min_channel0, cell_position[0]);
108+
// calculated from the most-extreme cell edges
109+
min_channel0 = std::min(min_channel0, cell_lower_position[0]);
108110
max_channel0 = std::max(max_channel0, cell_position[0]);
109-
min_channel1 = std::min(min_channel1, cell_position[1]);
111+
min_channel1 = std::min(min_channel1, cell_lower_position[1]);
110112
max_channel1 = std::max(max_channel1, cell_position[1]);
111113

112114
if (!first_processed) {

0 commit comments

Comments
 (0)