Skip to content

Conversation

@kciesla93
Copy link
Contributor

This PR fixes duplicate layers in HoughCell object:

  • Keep both m_layer and m_hits as vectors, but make some changes how they are handled:
    • For m_hits, instead of calling resize when nearing the capacity of the vectors, simply call reserve.
    • For m_layers there is no need for such treatment, as number of layers should be small. To avoid making it into a std::set, add extra check to make sure that duplicates are not inserted.
    • Drop member variables tracking number of elements. Rely on std::vector::end() instead (for member functions returning std::span).
  • Added test.
  • Remove unused headers.

--- END COMMIT MESSAGE ---

Tagging @goblirsc and @junggjo9 since this code is used by muons (also in Athena), but since this was unnoticed, I guess it was not used for anything critical.

@github-actions github-actions bot added Component - Core Affects the Core module Seeding labels Jan 19, 2026
Comment on lines +128 to +129
/// a batch to resize the vector of the hits
static constexpr std::size_t m_assignBatch{20};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see advantage of enforcing the assignment at compile time.

std::span<const identifier_t, std::dynamic_extent>
Acts::HoughTransformUtils::HoughCell<identifier_t>::getHits() const {
std::span<const identifier_t, std::dynamic_extent> hits(m_hits.begin(),
m_iHit);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to reuse the same hough cell without reallocating the memory

Comment on lines +98 to +99
m_hits.clear();
m_layers.clear();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index manipulation was developed because we saw it performed better. @dimitra97

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed

Comment on lines +86 to +90
// Check for duplicates
if (std::find(m_layers.begin(), m_layers.end(), layer) == m_layers.end()) {
m_layers.push_back(layer);
m_nLayers += weight;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I foree here already a big CPU bottleneck. Why not checking that the last layer numer corresponds to the current one. Same logic as for the hit filling?

for (uint8_t layer = 1; layer <= nLayers; ++layer) {
// Add hits equal to the layer number
for (uint8_t hit = 0; hit < layer; ++hit) {
plane.fillBin(0, 0, nHits++, layer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you loop layer by layer. There's'no need to loop through the entire vector of [0-8] if you're filling layer 9. Just check whether the last layer number is different. If people are jumping between the layers, they must do the duplicate removal themselves in the peak finder!

@github-actions github-actions bot added this to the next milestone Jan 19, 2026
@github-actions
Copy link
Contributor

📊: Physics performance monitoring for b9aaca5

Full contents

physmon summary

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Core Affects the Core module Seeding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants