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!: Updating the cuts in ScoreBased Solver to eta based cuts. #4054

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

Ragansu
Copy link
Contributor

@Ragansu Ragansu commented Jan 28, 2025

Introduced eta-based cuts in ACTS Standalone.

  • All detector level cuts are now eta based
  • The cuts can be a single number or an array with the size of the eta bins
  • Updated Tests, Examples, python scripts, Json plugins for the same.

--- END COMMIT MESSAGE ---

To bring the ScoreBased solver closer to that of ATHENA, I have introduced eta-based cuts in ACTS Standalone. Previously eta-based cuts required in ATHENA were done using optional cuts. With this PR, all detector-level cuts are now eta-based and the cuts can be a single number or an array with the size of the eta bins. A new config file is required for this change and hence I updated Tests, Examples, python scripts, Json plugins

Thanks @Corentin-Allaire and @CarloVarni

Summary by CodeRabbit

  • New Features

    • Introduced a new configuration parameter minUnshared for track ambiguity resolution.
    • Added eta-based configuration options for track selection.
    • Enhanced track scoring methods with more flexible criteria.
  • Refactor

    • Removed fixed momentum and angular constraints for track selection.
    • Simplified ambiguity resolution configuration.
    • Replaced global track parameters with more granular eta-based thresholds.
  • Improvements

    • Improved track selection logic with a more nuanced scoring mechanism.
    • Added more flexible detector configuration options.

Copy link

coderabbitai bot commented Jan 28, 2025

Warning

Rate limit exceeded

@Ragansu has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between babb823 and 0c77316.

📒 Files selected for processing (1)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3 hunks)
## Walkthrough

Significant modifications made to the `ScoreBasedAmbiguityResolution` class across multiple files, they are. The focus on enhancing configuration and scoring mechanisms for track resolution, it is. Key transformations include removal of specific momentum and angular parameters, introduction of a new `minUnshared` parameter, and implementation of more granular eta-based configuration options for track scoring, they do.

## Changes

| File | Change Summary |
|------|----------------|
| `Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp` | Restructured `DetectorConfig` and `Config` structs; added eta-based configuration vectors. |
| `Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp` | Simplified scoring methods; removed pT, phi, eta checks. |
| `Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp` | Added method `etaBasedCuts` for eta-based scoring. |
| `Examples/Algorithms/AmbiguityResolution/...` | Removed angular and momentum parameters; added `minUnshared`. |
| `Examples/Python/...` | Updated configuration for ambiguity resolution; simplified parameter set. |
| `Examples/Scripts/Python/...` | Modified ambiguity resolution configuration across multiple scripts. |
| `Plugins/Json/src/AmbiguityConfigJsonConverter.cpp` | Updated `from_json` function to reflect new detector configuration parameters. |
| `Tests/UnitTests/Core/AmbiguityResolution/ScoreBasedAmbiguityResolutionTest.cpp` | Adjusted test configuration by adding `minUnshared` and removing old parameters. |

## Sequence Diagram

```mermaid
sequenceDiagram
    participant Tracks
    participant AmbiguityResolver
    participant DetectorConfig
    
    Tracks->>AmbiguityResolver: Submit tracks
    AmbiguityResolver->>DetectorConfig: Request eta-based cuts
    DetectorConfig-->>AmbiguityResolver: Return cut parameters
    AmbiguityResolver->>AmbiguityResolver: Calculate track scores
    AmbiguityResolver->>Tracks: Return resolved tracks

Possibly related PRs

Suggested Labels

automerge, Seeding

Suggested Reviewers

  • Corentin-Allaire

Poem

🌌 In the depths of cosmic space,
Tracks find their rightful place.
With minUnshared, clarity shines,
Ambiguity fades, as truth aligns.
Eta bins guide the way,
Resolution blooms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QMSVLNMBLgw5jAKcEuDMRMzMZ6GTGZbOlnSzCwqM/WYjNQBoA1wCkvEGhnxBSzpwFsKmdLP0B0zZZzWWQAnOlmhA0M8s22bUA3noZGABYaWfbPLmvT0MqrtDIpKtm54MZmszGdODtnZzFJKM6nT/MYBSzfZpgPQHiD0Bez5wKM6cCjNQWFhz5yM0IFLMTn2zQgds2OajM7mJzCw1s9WcfOlmMAZAUs6RbIB3n4g7Zy4NDKSCzmSzyF1cwwEvNRn3zW544KcHiB5niS05ls/+dOCnAKSFFgc+2Ywv9nMLnZy4IxZgBJnoZ7Z4c7uYosLCYzuZv8/EA/N5nzgcl0sxuarNMAMziFhgMyHODSXoAWFy8+2bmExmyAUZy4AuZIuXANzpZ84KcCEALDmQZAIQOcDICuXLzAl4s/EEuBtAnYKFtQEICjPtnoZzZqM5rPOCZmez8Uc4JBeMuXmuzgVuC0xDjNkBzgMZ5cyuZgB+wfTfpgM1hCDMMAoMases0AA= -->

<!-- internal state end -->
<!-- tips_start -->

---

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):

- 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](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. ([Beta](https://docs.coderabbit.ai/early-access#beta))
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@github-actions github-actions bot added Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins Ambiguity Resolution labels Jan 28, 2025
@github-actions github-actions bot added this to the next milestone Jan 28, 2025
@Ragansu Ragansu changed the title Feat eta based cuts !feat: Updating the cuts in ScoreBased Solver to eta based cuts. Jan 28, 2025
@Ragansu Ragansu changed the title !feat: Updating the cuts in ScoreBased Solver to eta based cuts. feat!: Updating the cuts in ScoreBased Solver to eta based cuts. Jan 28, 2025
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: 3

🧹 Nitpick comments (8)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (2)

116-117: New parameter for minimum unshared hits, added it is.
Clear documentation highlight, you should. Value of 5 might not suit all detectors, test you must.


227-230: Helper function to retrieve cuts per eta bin, neat it is.
Yet defensive checks for invalid bin index, implement you might.

Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (1)

234-238: Abundant debug logs, user-friendly they are.
In production, overhead consider you must.

Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp (1)

30-59: Optimize etaBasedCuts implementation, we should.

Improvements needed, I sense:

  1. Early return when no cuts applied, there should be
  2. Binary search for eta bin finding, more efficient it would be
  3. Redundant boolean operations, eliminated they must be
 bool Acts::ScoreBasedAmbiguityResolution::etaBasedCuts(
     const DetectorConfig& detector, const TrackFeatures& trackFeatures,
     const double& eta) const {
   std::vector<double> etaBins = detector.etaBins;
-  int etaBin = 0;
-  bool cutApplied = false;
+  auto it = std::upper_bound(etaBins.begin(), etaBins.end(), eta);
+  if (it == etaBins.begin() || it == etaBins.end()) {
+    return false;  // eta out of range
+  }
+  size_t etaBin = std::distance(etaBins.begin(), it) - 1;

-  for (std::size_t i = 0; i < etaBins.size() - 1; ++i) {
-    if (eta >= etaBins[i] && eta < etaBins[i + 1]) {
-      etaBin = i;
-      break;
-    }
-  }

-  cutApplied = (trackFeatures.nHits < getValueAtEta(detector.minHitsPerEta,
-                                                    etaBins.size(), etaBin)) ||
-               cutApplied;
-
-  cutApplied = (trackFeatures.nHoles > getValueAtEta(detector.maxHolesPerEta,
-                                                     etaBins.size(), etaBin)) ||
-               cutApplied;
-
-  cutApplied =
-      (trackFeatures.nOutliers >
-       getValueAtEta(detector.maxOutliersPerEta, etaBins.size(), etaBin)) ||
-      cutApplied;
-
-  return cutApplied;
+  return (trackFeatures.nHits < getValueAtEta(detector.minHitsPerEta,
+                                             etaBins.size(), etaBin)) ||
+         (trackFeatures.nHoles > getValueAtEta(detector.maxHolesPerEta,
+                                              etaBins.size(), etaBin)) ||
+         (trackFeatures.nOutliers >
+          getValueAtEta(detector.maxOutliersPerEta, etaBins.size(), etaBin));
Examples/Algorithms/AmbiguityResolution/include/ActsExamples/AmbiguityResolution/ScoreBasedAmbiguityResolutionAlgorithm.hpp (1)

57-58: Document the minUnshared parameter, you must.

Add documentation explaining the purpose and impact of minUnshared parameter, essential it is.

     // minimum number of unshared hits per track
-    std::size_t minUnshared = 5;
+    /// @brief Minimum number of unshared hits required per track
+    /// @details Used to filter out tracks with too many shared hits,
+    ///          ensuring track quality and reducing ambiguity
+    std::size_t minUnshared = 5;
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

74-75: Initialize vectors before size calculation, you should.

Move vector initialization after size validation, cleaner code it makes.

-    detectorConfig.factorHits = {};
     detectorConfig.maxHits = goodHits.size() - 1;
+    detectorConfig.factorHits.reserve(goodHits.size());

-    detectorConfig.factorHoles = {};
     detectorConfig.maxHoles = goodHoles.size() - 1;
+    detectorConfig.factorHoles.reserve(goodHoles.size());

Also applies to: 84-85

Examples/Scripts/Python/full_chain_test.py (1)

730-730: Complete the changes with documentation, we should.

Properly configured the test chain is, matching other implementations it does. Yet, document the new parameter's purpose and impact, we should.

Add this comment above the configuration:

+        # Configure ambiguity resolution with minUnshared=3 for eta-based track selection
         addScoreBasedAmbiguityResolution(
Examples/Python/python/acts/examples/reconstruction.py (1)

219-223: Approve changes to ScoreBasedAmbiguityResolutionConfig, but documentation needs, hmm!

Good addition of minUnshared parameter, I see. But document its purpose and usage, we must. Help future Padawans understand the ways of eta-based cuts, this will.

Add docstring to explain the parameter:

 ScoreBasedAmbiguityResolutionConfig = namedtuple(
     "ScoreBasedAmbiguityResolutionConfig",
     [
         "minScore",
         "minScoreSharedTracks",
         "maxShared",
+        # Minimum number of unshared measurements required for track selection.
+        # Can be specified as a single value or as an array corresponding to eta bins.
         "minUnshared",
         "maxSharedTracksPerMeasurement",
         "useAmbiguityFunction",
     ],
     defaults=[None] * 6,
 )
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 679bade and 89615b4.

📒 Files selected for processing (12)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (5 hunks)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (11 hunks)
  • Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp (1 hunks)
  • Examples/Algorithms/AmbiguityResolution/include/ActsExamples/AmbiguityResolution/ScoreBasedAmbiguityResolutionAlgorithm.hpp (1 hunks)
  • Examples/Algorithms/AmbiguityResolution/src/ScoreBasedAmbiguityResolutionAlgorithm.cpp (1 hunks)
  • Examples/Python/python/acts/examples/reconstruction.py (2 hunks)
  • Examples/Python/src/AmbiguityResolution.cpp (1 hunks)
  • Examples/Scripts/Python/full_chain_odd.py (1 hunks)
  • Examples/Scripts/Python/full_chain_odd_LRT.py (1 hunks)
  • Examples/Scripts/Python/full_chain_test.py (1 hunks)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2 hunks)
  • Tests/UnitTests/Core/AmbiguityResolution/ScoreBasedAmbiguityResolutionTest.cpp (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: missing_includes
  • GitHub Check: docs
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, clang++)
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, g++)
  • GitHub Check: macos
  • GitHub Check: linux_ubuntu
  • GitHub Check: build_debug
🔇 Additional comments (22)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (3)

41-41: No genuine change in functionality, I sense.
Marked line 41 is, but truly unchanged it appears.


54-61: Eta-based vectors, more granular configuration they allow.
Handle mismatched sizes carefully, you must. Potential out-of-range issues, watchful be.


187-190: Method for eta-based cuts, helpful it can be.
Edge cases for extreme eta or improper bin coverage, verify you should.

Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (14)

110-110: Comment clarifies purpose, small overhead it has.
Substantial gain in readability, offers it does.


118-122: Verbose logging, valuable in debugging it is.
Yet mindful be of performance in large-scale runs.


124-125: Score zeroing upon cut failure, straightforward it is.
Logic consistent with the design, yes.


140-140: Section to commence scoring, well-indicated it is.
Better readability fosters, this does.


226-226: Detector cuts repeated in advanced scoring, I see.
Alignment with prior logic, good it remains.


240-241: Eta-based cuts mirror the simpleScore path, consistent it is.
Harmonious approach for both scoring methods, yes.


256-257: Ambiguity scoring, pT-based advantage it confers.
Sense it makes for higher momentum priority.


274-274: Hit multiplier logic, interesting approach it is.
Safeguards for large nHits or negative, the code suggests. Fine it seems.


308-308: Track index increment, normal step this is.
No further remarks I have.


390-391: Eta retrieved once, reusing best practice it is.
Computational overhead, lowered you have.


395-407: Eta bin determination, loop-based approach.
Should out-of-range conditions occur, fallback logic implement, you should.


422-422: Threshold check for good tracks, straightforward it is.
Concise clarity in naming, you maintain.


537-538: Shared hit acceptance, depends on minScoreSharedTracks and config.
Balanced logic, yes. Works for repeated hits, it does.


550-550: Enforcement of minUnshared hits, consistent with earlier config.
Consider site-specific adjustments, you might.

Examples/Python/src/AmbiguityResolution.cpp (1)

36-37: Parameter signature aligned, I see.
Farewell to angular constraints, yes. minUnshared included, a worthy addition this is.

Examples/Algorithms/AmbiguityResolution/src/ScoreBasedAmbiguityResolutionAlgorithm.cpp (1)

47-47: Correct, the transformation of minUnshared is.

Clean and straightforward, the implementation is.

Examples/Scripts/Python/full_chain_odd.py (1)

417-420: Consistent configuration changes, these are.

Match the test implementation, these changes do. Proper value for minUnshared parameter, set it does. Removed momentum and angular parameters, as intended they are.

Examples/Scripts/Python/full_chain_odd_LRT.py (1)

420-420: Maintain consistency across chains, this change does.

Mirror the configuration in other files, it does. Proper implementation of eta-based cuts strategy, this is.

Examples/Python/python/acts/examples/reconstruction.py (1)

1920-1922: Strong with the Force, these changes are!

Correctly integrated the minUnshared parameter is. Proper flow from configuration to algorithm implementation, I sense.

Copy link

github-actions bot commented Jan 28, 2025

📊: Physics performance monitoring for 0c77316

Full contents

physmon summary

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 (3)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

54-78: Repetitive code in eta-based vectors initialization, I observe.

A helper function to reduce duplication, we should create.

Apply this refactor, you should:

+   template<typename T>
+   void initializeEtaVector(std::vector<T>& target,
+                           const std::vector<T>& source,
+                           const std::string& name) {
+     target = {};
+     for (auto value : source) {
+       target.push_back(value);
+     }
+   }

-   const std::vector<std::size_t>& minHitsPerEta = value["minHitsPerEta"];
-   detectorConfig.minHitsPerEta = {};
-   for (auto minHit : minHitsPerEta) {
-     detectorConfig.minHitsPerEta.push_back(minHit);
-   }
+   initializeEtaVector(detectorConfig.minHitsPerEta,
+                      value["minHitsPerEta"].get<std::vector<std::size_t>>(),
+                      "minHitsPerEta");

-   const std::vector<std::size_t>& maxHolesPerEta = value["maxHolesPerEta"];
-   detectorConfig.maxHolesPerEta = {};
-   for (auto maxHole : maxHolesPerEta) {
-     detectorConfig.maxHolesPerEta.push_back(maxHole);
-   }
+   initializeEtaVector(detectorConfig.maxHolesPerEta,
+                      value["maxHolesPerEta"].get<std::vector<std::size_t>>(),
+                      "maxHolesPerEta");

-   const std::vector<std::size_t>& maxOutliersPerEta = value["maxOutliersPerEta"];
-   detectorConfig.maxOutliersPerEta = {};
-   for (auto maxOutlier : maxOutliersPerEta) {
-     detectorConfig.maxOutliersPerEta.push_back(maxOutlier);
-   }
+   initializeEtaVector(detectorConfig.maxOutliersPerEta,
+                      value["maxOutliersPerEta"].get<std::vector<std::size_t>>(),
+                      "maxOutliersPerEta");

-   const std::vector<std::size_t>& maxSharedHitsPerEta = value["maxSharedHitsPerEta"];
-   detectorConfig.maxSharedHitsPerEta = {};
-   for (auto maxSharedHit : maxSharedHitsPerEta) {
-     detectorConfig.maxSharedHitsPerEta.push_back(maxSharedHit);
-   }
+   initializeEtaVector(detectorConfig.maxSharedHitsPerEta,
+                      value["maxSharedHitsPerEta"].get<std::vector<std::size_t>>(),
+                      "maxSharedHitsPerEta");
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (2)

194-202: Documentation enhancement for etaBasedCuts method, suggest I do.

More details about return value and parameter constraints, helpful would be.

Add these details to the documentation, you should:

   /// Rejects Tracks based on eta dependent cuts.
   ///
   /// @param track is the input track
   /// @param trackFeatures is the trackFeatures object for a specific detector
   /// @param eta is the eta of the track
+  /// @param detector is the detector configuration containing eta-based cuts
+  /// @pre eta must fall within the range defined by detector.etaBins
   /// @return true if the track is rejected, false otherwise
+  /// @throws std::out_of_range if eta is outside the configured range

240-248: Documentation enhancement for getValueAtEta method, suggest I do.

Parameter constraints and error conditions, documented they should be.

Add these details to the documentation, you should:

   /// Get the value at a specific eta bin.
   ///
   /// @param cuts is the input vector of cuts
   /// @param etaBinSize is the size of the eta bin
   /// @param binIndex is the index of the bin
+  /// @pre cuts vector must not be empty
+  /// @pre binIndex must be less than etaBinSize
   /// @return the value of cut at the specific eta bin
+  /// @throws std::out_of_range if binIndex >= etaBinSize
+  /// @throws std::invalid_argument if cuts vector is empty
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 89615b4 and ee0a36a.

📒 Files selected for processing (3)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (5 hunks)
  • Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp (1 hunks)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: merge-sentinel
🔇 Additional comments (3)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2)

84-85: Correct initialization of factor vectors and max values, I see.

Well structured and consistent with the pattern, this code is.

Also applies to: 94-95


38-52: ⚠️ Potential issue

Incomplete validation of eta bins configuration, I sense.

Additional validation checks, we must add:

  1. After initialization, empty vectors check we should
  2. Size consistency between eta bins and other eta-based vectors, verify we must

Apply this diff, you should:

    const std::vector<double>& etaBins = value["etaBins"];

    // Validate eta bins
-   if (!etaBins.empty()) {
+   if (etaBins.empty()) {
+     throw std::invalid_argument("Empty eta bins configuration");
+   }
+
    // Verify monotonically increasing eta bins
    if (!std::is_sorted(etaBins.begin(), etaBins.end())) {
      throw std::invalid_argument(
          "Eta bins must be monotonically increasing");
    }

    detectorConfig.etaBins = {};
    for (auto etaBin : etaBins) {
      detectorConfig.etaBins.push_back(etaBin);
    }
+
+   // Verify size consistency with other eta-based vectors
+   if (minHitsPerEta.size() != etaBins.size() - 1 ||
+       maxHolesPerEta.size() != etaBins.size() - 1 ||
+       maxOutliersPerEta.size() != etaBins.size() - 1 ||
+       maxSharedHitsPerEta.size() != etaBins.size() - 1) {
+     throw std::invalid_argument(
+         "Inconsistent sizes in eta-based configuration vectors");
+   }
-   }

Likely invalid or redundant comment.

Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (1)

54-68: Well documented and properly initialized eta-based configuration, this is.

Clear purpose and sensible defaults, these vectors have.

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: 1

🧹 Nitpick comments (3)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (3)

194-203: Implementation of eta-based cuts, elegant it is!

Clear purpose and parameters, this method has. But documentation, improved it could be.

Add these clarifications to the documentation, you should:

  /// Rejects Tracks based on eta dependent cuts.
  ///
+ /// Evaluates track features against thresholds defined per eta bin:
+ /// - Minimum hits requirement
+ /// - Maximum holes constraint
+ /// - Maximum outliers limit
+ /// - Maximum shared hits boundary
  ///
  /// @param detector is the detector configuration object
  /// @param trackFeatures is the trackFeatures object for a specific detector
  /// @param eta is the eta of the track
  /// @return true if the track is rejected, false otherwise

240-249: Helper method getValueAtEta, utility strong with this one is!

Static helper method, well-defined it is. But parameter names, clearer they could be.

Improve parameter names, we should:

- static std::size_t getValueAtEta(std::vector<std::size_t> cuts,
-                                  std::size_t etaBinSize,
-                                  std::size_t binIndex);
+ static std::size_t getValueAtEta(std::vector<std::size_t> thresholds,
+                                  std::size_t nEtaBins,
+                                  std::size_t currentBinIndex);

41-41: Documentation update needed, it is!

Step 5 in algorithm description, outdated it has become. Eta-based cuts, mentioned they should be.

- /// 5) Remove tracks that are not good enough based on cuts Contains method for
- /// data preparations
+ /// 5) Remove tracks that do not meet eta-dependent quality criteria for hits,
+ /// holes, outliers, and shared hits. Contains methods for data preparation
+ /// and track selection.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ee0a36a and 541f3f7.

📒 Files selected for processing (1)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (5 hunks)
🔇 Additional comments (1)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (1)

123-124: Wise addition of minUnshared parameter, it is!

Track quality control through unshared hits, essential it is. Default value of 5, reasonable starting point it seems.

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: 1

🧹 Nitpick comments (2)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2)

14-20: Simplify the initializeEtaVector function, we should.

Unnecessary complexity in vector initialization, I sense. Direct assignment or std::copy, more efficient it would be.

-void initializeEtaVector(std::vector<std::size_t>& target,
-                      const std::vector<std::size_t>& source) {
-  target = {};
-  for (auto value : source) {
-    target.push_back(value);
-  }
-}
+void initializeEtaVector(std::vector<std::size_t>& target,
+                      const std::vector<std::size_t>& source) {
+  target = source;
+}

79-80: Remove unnecessary vector initialization, we should.

Empty initialization redundant it is. By default, empty the vectors will be.

-    detectorConfig.factorHits = {};
     detectorConfig.maxHits = goodHits.size() - 1;

-    detectorConfig.factorHoles = {};
     detectorConfig.maxHoles = goodHoles.size() - 1;

Also applies to: 89-90

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 541f3f7 and 3cf3136.

📒 Files selected for processing (1)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3 hunks)
🧰 Additional context used
📓 Learnings (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:40:33.697Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing. The eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) can have either size 1 (single value for all bins) or size equal to etaBins.size() - 1 (per-bin values).
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:35:12.939Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing and the size of eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) must be equal to etaBins.size() - 1.
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: merge-sentinel
  • GitHub Check: build_debug
  • GitHub Check: unused_files
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, clang++)
  • GitHub Check: missing_includes
  • GitHub Check: macos
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, g++)
  • GitHub Check: linux_ubuntu
  • GitHub Check: docs
🔇 Additional comments (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

61-73: Correct initialization of eta-based cut vectors, this is.

Wise decision to defer size validation to runtime, it is. Size of 1 or etaBins.size() - 1, these vectors may have.

Plugins/Json/src/AmbiguityConfigJsonConverter.cpp Outdated Show resolved Hide resolved
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: 2

🧹 Nitpick comments (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

14-20: Simplify the vector initialization, we should.

Unnecessary complexity in vector initialization, I sense. Direct assignment or std::copy, more elegant it would be.

-void initializeEtaVector(std::vector<std::size_t>& target,
-                         const std::vector<std::size_t>& source) {
-  target = {};
-  for (auto value : source) {
-    target.push_back(value);
-  }
-}
+void initializeEtaVector(std::vector<std::size_t>& target,
+                        const std::vector<std::size_t>& source) {
+  target = source;
+}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3cf3136 and b75d2b2.

📒 Files selected for processing (1)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3 hunks)
🧰 Additional context used
📓 Learnings (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:40:33.697Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing. The eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) can have either size 1 (single value for all bins) or size equal to etaBins.size() - 1 (per-bin values).
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:35:12.939Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing and the size of eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) must be equal to etaBins.size() - 1.
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:47-59
Timestamp: 2025-01-29T11:54:30.076Z
Learning: In Acts::ScoreBasedAmbiguityResolution::DetectorConfig, empty eta bins in JSON configuration are acceptable as the struct has default values of {-5, 5} for etaBins.
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: unused_files
  • GitHub Check: missing_includes
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, clang++)
  • GitHub Check: macos
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20, g++)
  • GitHub Check: linux_ubuntu
  • GitHub Check: build_debug
🔇 Additional comments (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

47-59: Wise validation of eta bins, this is.

Correctly implemented, the validation is:

  • Empty eta bins, allowed they are (default values {-5, 5} they have)
  • Monotonically increasing order, enforced it is

Plugins/Json/src/AmbiguityConfigJsonConverter.cpp Outdated Show resolved Hide resolved
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: 2

🧹 Nitpick comments (2)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

14-28: Improve error handling in initializeEtaVector function, hmm.

Missing validation of input parameters and integer division in error message could lead to issues, it could.

 void initializeEtaVector(std::vector<std::size_t>& target,
                          const std::vector<std::size_t>& source,
                          int etaBinSize) {
+  if (etaBinSize <= 1) {
+    throw std::invalid_argument("etaBinSize must be greater than 1");
+  }
   if (source.size() == etaBinSize - 1) {
     target = source;  // Directly copy if sizes match
   } else if (source.size() == 1) {
     target.resize(etaBinSize - 1);  // Resize target to the required size
     std::fill(target.begin(), target.end(),
               source[0]);  // Fill with the single value from source
   } else {
-    throw std::invalid_argument("Invalid cuts size. Expected 1 or " +
-                                std::to_string(etaBinSize - 1) + ", got " +
-                                std::to_string(source.size()));
+    throw std::invalid_argument(
+        fmt::format("Invalid cuts size. Expected 1 or {}, got {}",
+                   etaBinSize - 1, source.size()));
   }
 }
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (1)

396-404: Extract eta bin lookup logic to helper function, you should.

Duplicate eta bin lookup logic, I see. In solveAmbiguity and etaBasedCuts, similar code exists. Extract to helper function, we must.

+  int getEtaBin(const std::vector<double>& etaBins, double eta) {
+    for (std::size_t i = 0; i < etaBins.size() - 1; ++i) {
+      if (eta >= etaBins[i] && eta < etaBins[i + 1]) {
+        return i;
+      }
+    }
+    return -1;  // Invalid bin
+  }

Use helper function in both places:

-      std::vector<double> etaBins = detector.etaBins;
-      int etaBin = 0;
-
-      for (std::size_t i = 0; i < detector.etaBins.size() - 1; ++i) {
-        if (eta >= etaBins[i] && eta < detector.etaBins[i + 1]) {
-          etaBin = i;
-          break;
-        }
-      }
+      int etaBin = getEtaBin(detector.etaBins, eta);
+      if (etaBin < 0) {
+        continue;  // Skip if eta is out of range
+      }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b75d2b2 and ed37831.

📒 Files selected for processing (4)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (4 hunks)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (10 hunks)
  • Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp (1 hunks)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3 hunks)
🧰 Additional context used
📓 Learnings (3)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:40:33.697Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing. The eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) can have either size 1 (single value for all bins) or size equal to etaBins.size() - 1 (per-bin values).
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:35:12.939Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing and the size of eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) must be equal to etaBins.size() - 1.
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:47-59
Timestamp: 2025-01-29T11:54:30.076Z
Learning: In Acts::ScoreBasedAmbiguityResolution::DetectorConfig, empty eta bins in JSON configuration are acceptable as the struct has default values of {-5, 5} for etaBins.
Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp (1)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp:54-68
Timestamp: 2025-01-29T12:15:02.454Z
Learning: In Acts::ScoreBasedAmbiguityResolution::DetectorConfig, the default eta bin configuration [-5,5] is intentionally set as a single bin to disable eta-based functionality by default. The per-eta vectors (minHitsPerEta, maxHolesPerEta, etc.) can have either size=1 (single value for all bins) or size=etaBins.size()-1 (value per bin).
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (1)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp:54-68
Timestamp: 2025-01-29T12:15:02.454Z
Learning: In Acts::ScoreBasedAmbiguityResolution::DetectorConfig, the default eta bin configuration [-5,5] is intentionally set as a single bin to disable eta-based functionality by default. The per-eta vectors (minHitsPerEta, maxHolesPerEta, etc.) can have either size=1 (single value for all bins) or size=etaBins.size()-1 (value per bin).
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: merge-sentinel
  • GitHub Check: macos
🔇 Additional comments (1)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp (1)

54-68: Wise default configuration, it is!

Default eta bins {-5, 5} with single bin configuration, elegant solution for disabling eta-based functionality by default, it is. Well documented and implemented, the configuration is.

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: 1

🧹 Nitpick comments (2)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2)

14-28: Parameter types, improve we must.

Inconsistent parameter types, I see. Using int for etaBinSize when std::size_t for vectors we use.

Apply this change, you should:

 void initializeEtaVector(std::vector<std::size_t>& target,
                          const std::vector<std::size_t>& source,
-                         int etaBinSize) {
+                         std::size_t etaBinSize) {

53-67: Simplify vector assignment, we can.

Unnecessary loop for vector copying, I see. Direct assignment, more efficient it would be.

Apply this change, you should:

-      detectorConfig.etaBins = {};
-      for (auto etaBin : etaBins) {
-        detectorConfig.etaBins.push_back(etaBin);
-      }
+      detectorConfig.etaBins = etaBins;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ed37831 and b432c54.

📒 Files selected for processing (1)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3 hunks)
🧰 Additional context used
📓 Learnings (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (4)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:40:33.697Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing. The eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) can have either size 1 (single value for all bins) or size equal to etaBins.size() - 1 (per-bin values).
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp:11-24
Timestamp: 2025-01-29T17:44:41.269Z
Learning: In Acts::ScoreBasedAmbiguityResolution, eta and etaBins validation is handled at configuration time in AmbiguityConfigJsonConverter.cpp, which validates that etaBins are non-empty and monotonically increasing. Therefore, additional validation in etaBasedCuts() method is not needed.
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:35:12.939Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing and the size of eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) must be equal to etaBins.size() - 1.
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:47-59
Timestamp: 2025-01-29T11:54:30.076Z
Learning: In Acts::ScoreBasedAmbiguityResolution::DetectorConfig, empty eta bins in JSON configuration are acceptable as the struct has default values of {-5, 5} for etaBins.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: merge-sentinel
🔇 Additional comments (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (1)

69-85: Well implemented, the eta-based cuts initialization is!

Consistent initialization of cut vectors using initializeEtaVector, I see. Proper error handling and size validation, you have included.

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 (2)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (2)

488-499: Defensive programming, strong with this one is.

Proper error handling for volume mapping, you have implemented. But improve error message formatting, we could.

-        ACTS_ERROR("Volume " << ivolume << "not found in the volume map");
+        ACTS_ERROR("Volume " << ivolume << " not found in the volume map");

Line range hint 545-549: Simplified return logic, recommend I do.

More concise and clear, the return statement could be.

-  if (newMeasurementsPerTrack.size() < m_cfg.minUnshared) {
-    return false;
-  } else {
-    return true;
-  }
+  return newMeasurementsPerTrack.size() >= m_cfg.minUnshared;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b432c54 and 2a37211.

📒 Files selected for processing (1)
  • Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (10 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: merge-sentinel
🔇 Additional comments (4)
Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp (4)

118-122: Improved logging verbosity, I see!

More detailed debug information for track features, you have added. Help in debugging and monitoring track quality, this will.


124-125: Refactored to eta-based cuts, the code has been.

Moved from individual parameter checks to a unified eta-based approach, you have. More maintainable and aligned with particle physics conventions, this makes the code.


532-533: Potential race condition in shared hits handling, I sense.

When multiple tracks processed in parallel are, race condition in shared hits counting may occur. Thread safety considerations, you should add.

Consider adding synchronization mechanisms if parallel track processing is implemented.


396-400: Verify eta binning implementation, we must.

Critical for correct track selection, proper eta binning is. Ensure correct bin assignment when eta equals bin boundary value, we should.

✅ Verification successful

Correct and safe, the eta binning implementation is.

Proper handling of boundaries, I sense. When eta equals bin edge, correct bin it finds. Out-of-range values, safely rejected they are. Validation of monotonic ordering, the JSON converter ensures. Trust in this implementation, we can.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for test cases that verify eta binning edge cases
rg -A 10 "etaBins.*test" 

Length of output: 26


Script:

#!/bin/bash
# Search for ambiguity resolution test files
fd "Ambiguity.*test" --type f

# Search for eta binning related code
rg -g "!*.git" "etaBins" -A 5

# Look for detector class definition
ast-grep --pattern 'class $_ {
  $$$
  etaBins
  $$$
}'

Length of output: 12511

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 (2)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2)

14-28: Document the function's purpose and improve error message clarity, we must.

Clear documentation, essential it is. And error message, more descriptive it should be.

+/**
+ * Initialize eta-based vector with either per-bin values or a single value for all bins.
+ * @param target Vector to be initialized
+ * @param source Source vector containing either one value or per-bin values
+ * @param etaBinSize Size of eta bins plus one
+ * @throws std::invalid_argument if source vector size is invalid
+ */
 void initializeEtaVector(std::vector<std::size_t>& target,
                          const std::vector<std::size_t>& source,
                          std::size_t etaBinSize) {
   if (source.size() == etaBinSize - 1) {
     target = source;  // Directly copy if sizes match
   } else if (source.size() == 1) {
     target.resize(etaBinSize - 1);  // Resize target to the required size
     std::fill(target.begin(), target.end(),
               source[0]);  // Fill with the single value from source
   } else {
     throw std::invalid_argument("Invalid cuts size. Expected 1 or " +
-                                std::to_string(etaBinSize - 1) + ", got " +
-                                std::to_string(source.size()));
+                                std::to_string(etaBinSize - 1) + 
+                                " (number of eta bin boundaries), got " +
+                                std::to_string(source.size()) +
+                                ". Use size 1 for single value or size " +
+                                std::to_string(etaBinSize - 1) +
+                                " for per-bin values.");
   }
 }

53-67: Simplify eta bins assignment, we should.

More concise, the code can be. Direct assignment, sufficient it is.

     const std::vector<double>& etaBins = value["etaBins"];

     // Validate eta bins
     if (!etaBins.empty()) {
       // Verify monotonically increasing eta bins
       if (!std::is_sorted(etaBins.begin(), etaBins.end())) {
         throw std::invalid_argument(
             "Eta bins must be monotonically increasing");
       }
-      detectorConfig.etaBins = {};
-      for (auto etaBin : etaBins) {
-        detectorConfig.etaBins.push_back(etaBin);
-      }
+      detectorConfig.etaBins = etaBins;  // Direct vector assignment
     }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2a37211 and babb823.

📒 Files selected for processing (1)
  • Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (3 hunks)
🧰 Additional context used
📓 Learnings (1)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (4)
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:40:33.697Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing. The eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) can have either size 1 (single value for all bins) or size equal to etaBins.size() - 1 (per-bin values).
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Core/src/AmbiguityResolution/ScoreBasedAmbiguityResolution.cpp:11-24
Timestamp: 2025-01-29T17:44:41.269Z
Learning: In Acts::ScoreBasedAmbiguityResolution, eta and etaBins validation is handled at configuration time in AmbiguityConfigJsonConverter.cpp, which validates that etaBins are non-empty and monotonically increasing. Therefore, additional validation in etaBasedCuts() method is not needed.
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:0-0
Timestamp: 2025-01-29T10:35:12.939Z
Learning: In the ACTS framework's ambiguity resolution configuration, eta bins must be monotonically increasing and the size of eta-based cut vectors (minHitsPerEta, maxHolesPerEta, maxOutliersPerEta, maxSharedHitsPerEta) must be equal to etaBins.size() - 1.
Learnt from: Ragansu
PR: acts-project/acts#4054
File: Plugins/Json/src/AmbiguityConfigJsonConverter.cpp:47-59
Timestamp: 2025-01-29T11:54:30.076Z
Learning: In Acts::ScoreBasedAmbiguityResolution::DetectorConfig, empty eta bins in JSON configuration are acceptable as the struct has default values of {-5, 5} for etaBins.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: merge-sentinel
🔇 Additional comments (2)
Plugins/Json/src/AmbiguityConfigJsonConverter.cpp (2)

69-86: Well structured, the eta-based cuts initialization is.

Proper initialization of all eta-based cuts, I see. Consistent use of initializeEtaVector, there is.


91-92: Guard against invalid factor calculations, we must.

Division by zero, dangerous it is. Negative values, meaningless ratios they create.

Also applies to: 101-102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ambiguity Resolution Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant