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

feat: component wise digital clustering #4142

Merged

Conversation

asalzburger
Copy link
Contributor

@asalzburger asalzburger commented Mar 21, 2025

This PR introduces component-wise digital clustering (as a default for digital).
It removes the problem of wrong weighting.

The PR also fixes the issue that thresholds have not been taking into account correctly for digital clustering.

Before the fix:

hist_residual_loc1_vol29_csize2

After the fix:

hist_residual_loc1_vol29_csize2

--- END COMMIT MESSAGE ---

Any further description goes here, @-mentions are ok here!

  • Use a conventional commits prefix: quick summary
    • We mostly use feat, fix, refactor, docs, chore and build types.
  • A milestone will be assigned by one of the maintainers

Summary by CodeRabbit

  • New Features
    • Updated digitization settings now support an expanded parameter range and a new detector configuration option for improved simulation outcomes.
  • Refactor
    • Enhanced processing with refined per-dimension weight and channel management.
  • Documentation
    • Improved clarity of documentation comments in the configuration struct, and updated parameters for particle generation in the digitization process.
  • Bug Fixes
    • Updated hash values for test files to ensure accuracy in the digitization examples.

Copy link

coderabbitai bot commented Mar 21, 2025

Caution

Review failed

The head commit changed during the review from e569d1d to be7241c.

Walkthrough

Modified configurations across C++ and Python examples, they have been. In GeometricConfig, documentation improved and a member variable replaced was. The digitization algorithm now uses arrays for handling weights and channel indices in two dimensions. In digitization.py, the runDigitization function received updated parameters—eta range expanded, multiplicity reduced, and a configuration file added. Changes to documentation and control flow, plainly they are.

Changes

File(s) Change Summary
Examples/.../Digitization/GeometricConfig.hpp Documentation comments updated; member variable strip removed and new componentDigital (initialized to true) added.
Examples/.../DigitizationAlgorithm.cpp Scalar variables replaced with arrays for total weight and channel indices; logic updated for charge calculation and position updates in both x and y dimensions.
Examples/.../digitization.py In runDigitization: eta range extended with uniform option, multiplicity reduced, and digiConfigFile parameter added.

Suggested labels

automerge

Suggested reviewers

  • paulgessinger

Poem

In code’s vast galaxy, change now appears,
New flags and arrays, strong are the steeds of our gears.
Documentation shines bright, clear like a twin sun’s ray,
Logic flows smoothly, guiding our path, come what may.
With the Force in our code, our journey’s begun—hmm, yes, fun!
Celebrate we must, as the code and the Force unite as one.
Mmm, a fine upgrade this is!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added this to the next milestone Mar 21, 2025
@github-actions github-actions bot added the Component - Examples Affects the Examples module label Mar 21, 2025
Copy link
Member

@paulgessinger paulgessinger left a comment

Choose a reason for hiding this comment

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

Do I understand correctly that the digital was weighting xy against each other which leads to funky positions if the pitches are not symmetric?

In any case could you elaborate a bit more on what the issue is and what the fix does?

Copy link

github-actions bot commented Mar 21, 2025

📊: Physics performance monitoring for 41c5fd5

Full contents

physmon summary

@asalzburger
Copy link
Contributor Author

asalzburger commented Mar 21, 2025

Hi @paulgessinger, here's the example:

Imagine you do a simple weighted mean on the left side, as you have two pixels/strips on both the upper y, it will weight the upper position with weight 2 and the lower one with weight 1, hence it will pull you into a too high value of y. That's not a problem for analogue clustering, because the path length regulates this.

However, in digital, the weights of every hit cell is one and hence you get this problem.

As it is very clear, the second version in this case is a better estimate, hence, what I introduced is an independent weight for single x and y components, if configured to do so. For pixels this is not really a problem, as x-pitch and y-pitch are pretty similar, but for strips this is a nasty bias.

Screenshot 2025-03-21 at 18 06 50

In the adapted version, blue is ignored, actually. But there are situations when it is only ignored in one direction.

(Took me embarrassingly long to understand that)

@asalzburger
Copy link
Contributor Author

Need to fix issues and make CI failures still.

@paulgessinger
Copy link
Member

Thanks @asalzburger! That clears it up.

@asalzburger
Copy link
Contributor Author

ExatrkX python tests are failing ... but I have no idea why?

@paulgessinger
Copy link
Member

@asalzburger Indeed very strange. Could be a transient error, let's rerun.

paulgessinger
paulgessinger previously approved these changes Mar 25, 2025
@asalzburger
Copy link
Contributor Author

Thanks @asalzburger! That clears it up.

Restarted, let's see - it was pretty consistent on this PR though.

@paulgessinger
Copy link
Member

Yeah, it reappaered. I don't see it on other PRs at this time though. @benjaminhuth could the change in the clustering trigger a SEGFAULT in pytorch?

Test if this fixes ExaTrk.X
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Examples/Scripts/Python/digitization.py (1)

44-44: Reduced multiplicity from 2 to 1, I observe.

Fewer particles generated will be. For testing component-wise digital clustering, simpler input preferable it is. But documentation of this change, missing it is.

Add comment explaining multiplicity reduction reason, helpful it would be:

-    multiplicity=1,
+    multiplicity=1,  # Reduced to simplify component-wise digital clustering testing
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07f04eb and 26e0b59.

📒 Files selected for processing (1)
  • Examples/Scripts/Python/digitization.py (2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
Examples/Scripts/Python/digitization.py (1)
Examples/Python/tests/test_examples.py (1)
  • field (39-40)
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: CI Bridge / build_exatrkx
  • GitHub Check: CI Bridge / build_exatrkx_cpu
  • GitHub Check: CI Bridge / build_gnn_tensorrt
  • GitHub Check: merge-sentinel
  • GitHub Check: CI Bridge / clang_tidy
  • GitHub Check: linux_ubuntu
  • GitHub Check: macos
  • GitHub Check: linux_ubuntu_extra (ubuntu2404_clang19, 20, clang++-19)
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, g++)
  • GitHub Check: unused_files
  • GitHub Check: missing_includes
  • GitHub Check: build_debug
🔇 Additional comments (2)
Examples/Scripts/Python/digitization.py (2)

41-41: Uniform eta distribution, added you have. Wise, this change is.

To reach endcaps with sufficient statistics, uniform distribution necessary it is. Match your PR objectives, this change does.


94-96: Updated function call with digiConfigFile parameter, you have.

Necessary this change is, to match new function signature. Consistent with parameter added in function definition, hmm, yes.

@asalzburger
Copy link
Contributor Author

@paulgessinger - the issue with CI is resolved, can you reapprove ?

@kodiakhq kodiakhq bot merged commit f1ebf4c into acts-project:main Mar 27, 2025
47 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants