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!: Updates to GBTS for Athena Implementation #3882

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

Conversation

Rosie-Hasan
Copy link
Contributor

@Rosie-Hasan Rosie-Hasan commented Nov 20, 2024

Changes to GBTS seeding in Core and Examples needed to implement in Athena and make it work with any space point type.

--- END COMMIT MESSAGE ---
I have changed the space point class so I believe it will be breaking to Athena infrastructure (draft merge request of patch in canary)
And added infrastructure to use cluster width information, but this is disabled in the examples case
Also removed some unneeded parameters

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced GbtsSP struct with additional parameters for improved spatial information.
    • Streamlined access to space point properties in the SeedFinderGbts and GbtsTrackingFilter classes.
    • Introduced multiple new configuration classes for seed finding algorithms.
  • Bug Fixes

    • Corrected handling of Gbts_id assignment in geometry mapping.
  • Documentation

    • Updated parameter names for consistency across functions and classes.
  • Chores

    • Removed unnecessary dependencies and parameters to simplify configuration interfaces.
    • Removed seed filtering configurations from various components.

Copy link

coderabbitai bot commented Nov 20, 2024

Warning

Rate limit exceeded

@Rosie-Hasan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 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 83c742c and 831f82b.

📒 Files selected for processing (1)
  • Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (3 hunks)

Walkthrough

Significant modifications made, yes. The GbtsSP struct updated, new parameters added to its constructor, hmmm. Member variables enhanced, calculations refined. The addSpacePoint method now uses actual cluster width, yes. Changes in GbtsTrackingFilter, access patterns simplified, clearer code, it is. Seed finding configurations streamlined, unnecessary parameters removed, yes. Overall, a refinement of existing structures and functionalities, this is.

Changes

File Path Change Summary
Core/include/Acts/Seeding/GbtsDataStorage.hpp Updated GbtsSP constructor to include bool isPixel and float ClusterWidth. Added member variables m_phi, m_r, and m_ClusterWidth. Modified addSpacePoint method to use actual cluster width.
Core/include/Acts/Seeding/GbtsTrackingFilter.hpp Simplified access to r() method in GbtsEdgeState. Updated update method to reflect new access patterns.
Core/include/Acts/Seeding/SeedFinderGbts.ipp Simplified access to r and phi in runGbts_TrackFinder and createSeeds methods. Removed SeedFilter.hpp include.
Core/include/Acts/Seeding/SeedFinderGbtsConfig.hpp Removed seedFilter and maxSeedsPerSpM members. Renamed connector_input_file to ConnectorInputFile.
Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/GbtsSeedingAlgorithm.hpp Removed Acts::SeedFilterConfig seedFilterConfig from Config struct.
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp Removed SeedFilter.hpp include. Updated constructor and logging in execute method. Modified MakeGbtsSpacePoints method to include new parameters.
Examples/Python/python/acts/examples/reconstruction.py Renamed connector_inputConfigFile to ConnectorInputConfigFile. Removed seedFilterConfigArg from addGbtsSeeding.
Examples/Python/src/TrackFinding.cpp Renamed connector_input_file to ConnectorInputFile in SeedFinderGbtsConfig. Removed maxSeedsPerSpM. Added multiple configuration classes.
Examples/Scripts/Python/full_chain_itk_Gbts.py Renamed connector_inputConfigFile in addSeeding function call to ConnectorInputConfigFile.

Suggested labels

automerge

Suggested reviewers

  • andiwand
  • paulgessinger

In the code, changes abound,
New parameters, clarity found.
With Yoda's wisdom, we refine,
Structures and functions, all align.
A journey of growth, we embrace,
In the galaxy of code, we find our place! 🌌✨


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?

❤️ Share
🪧 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. (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 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 Component - Core Affects the Core module Component - Examples Affects the Examples module Seeding Track Finding labels Nov 20, 2024
Copy link

github-actions bot commented Nov 20, 2024

📊: Physics performance monitoring for 831f82b

Full contents

physmon summary

@paulgessinger paulgessinger changed the title feat: Updates to GBTS for Athena Implementation (Breaking Change) feat!: Updates to GBTS for Athena Implementation Nov 21, 2024
@AJPfleger AJPfleger added this to the v39.0.0 milestone Nov 30, 2024
@Rosie-Hasan Rosie-Hasan marked this pull request as ready for review December 12, 2024 10:21
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

🧹 Outside diff range and nitpick comments (7)
Core/include/Acts/Seeding/GbtsDataStorage.hpp (1)

Line range hint 223-230: Simplify determination of isPixel, you can.

Consider streamlining the assignment of isPixel.

Refactored code:

-          bool isPixel = false;
-          if (sourceLink.size() == 1) {  // pixels have 1 SL
-            isPixel = true;
-          } else {
-            isPixel = false;
-          }
+          bool isPixel = (sourceLink.size() == 1);  // pixels have 1 SL
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (1)

223-230: Simplify isPixel determination, you should.

Streamlining the code improves readability.

Simplify as follows:

-          bool isPixel = false;
-          if (sourceLink.size() == 1) {  // pixels have 1 SL
-            isPixel = true;
-          } else {
-            isPixel = false;
-          }
+          bool isPixel = (sourceLink.size() == 1);  // pixels have 1 SL
Core/include/Acts/Seeding/SeedFinderGbtsConfig.hpp (1)

46-46: Hmmmm, good the naming change is. Documentation, we must add.

The renaming to PascalCase convention, consistent with other changes in the codebase it is. Yet, a comment explaining the purpose of this configuration file, helpful it would be.

Add a documentation comment like this:

+  // Path to the connector configuration file that defines the layer connections
   std::string ConnectorInputFile;  // input file for connector object
Core/include/Acts/Seeding/SeedFinderGbts.ipp (1)

168-172: Hmmmm, simplified access patterns, good they are. Yet optimize further, we can.

The direct access to space point properties through m_spGbts, cleaner code it creates. However, for performance in critical calculations, consider caching frequently accessed values:

-              float r1 = n1->m_spGbts.r();
-              float x1 = n1->m_spGbts.SP->x();
-              float y1 = n1->m_spGbts.SP->y();
-              float z1 = n1->m_spGbts.SP->z();
-              float phi1 = n1->m_spGbts.phi();
+              const auto& sp = n1->m_spGbts;
+              const float r1 = sp.r();
+              const float x1 = sp.SP->x();
+              const float y1 = sp.SP->y();
+              const float z1 = sp.SP->z();
+              const float phi1 = sp.phi();

Also applies to: 201-201, 547-547

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

281-281: Parameter naming convention updated, yes.

Renamed parameter follows Python naming conventions better it does not. PascalCase for parameters unusual in Python it is. Consider snake_case instead.

-    ConnectorInputConfigFile: Optional[Union[Path, str]] = None,
+    connector_input_config_file: Optional[Union[Path, str]] = None,

437-437: Consistent parameter renaming applied, but naming convention concerns persist.

Changed for consistency with parameter definition it was, but same naming convention issue exists.

-                ConnectorInputConfigFile,
+                connector_input_config_file,

1094-1107: Cluster width feature disabled by default, hmm.

New infrastructure for cluster width added it was, but disabled by default it remains. Matches PR objectives this does, which mention feature is currently disabled in examples.

Two observations I have:

  1. Parameter naming inconsistency:
-    ConnectorInputFileStr = str(ConnectorInputConfigFile)
+    connector_input_file_str = str(connector_input_config_file)
  1. Documentation for new parameter m_useClusterWidth missing it is.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 595f2e6 and 8347b8a.

📒 Files selected for processing (9)
  • Core/include/Acts/Seeding/GbtsDataStorage.hpp (4 hunks)
  • Core/include/Acts/Seeding/GbtsTrackingFilter.hpp (3 hunks)
  • Core/include/Acts/Seeding/SeedFinderGbts.ipp (3 hunks)
  • Core/include/Acts/Seeding/SeedFinderGbtsConfig.hpp (1 hunks)
  • Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/GbtsSeedingAlgorithm.hpp (0 hunks)
  • Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (3 hunks)
  • Examples/Python/python/acts/examples/reconstruction.py (3 hunks)
  • Examples/Python/src/TrackFinding.cpp (2 hunks)
  • Examples/Scripts/Python/full_chain_itk_Gbts.py (1 hunks)
💤 Files with no reviewable changes (1)
  • Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/GbtsSeedingAlgorithm.hpp
🔇 Additional comments (16)
Core/include/Acts/Seeding/GbtsDataStorage.hpp (8)

32-35: New member variables added, helpful they are.

Adding m_isPixel, m_phi, m_r, and m_ClusterWidth enhances data encapsulation within GbtsSP.


36-44: Constructor updated appropriately, it is.

The constructor initializes new members and computes m_phi and m_r correctly.


49-50: Getter methods provided, good practice this is.

Implementing accessors for r() and ClusterWidth() ensures proper data encapsulation.


160-160: Ensure consistency of sp.r(), you must.

Verify that sp.r() aligns with m_r, to maintain data consistency.


173-173: Cluster width retrieval, appropriate it is.

Using sp.ClusterWidth() to obtain the cluster width is correct.


184-184: Cluster width check, necessary it is.

Validating cluster_width > 0.2 maintains data integrity.


Line range hint 232-233: Placeholder for ClusterWidth, mindful you must be.

Setting ClusterWidth to zero may impact calculations. Update when actual values available, you should.


Line range hint 235-236: Constructor call updated correctly, it is.

Including new parameters in gbtsSpacePoints.emplace_back properly done.

Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (4)

70-70: Input file stream initialized, acceptable it is.

input_ifstream correctly opens ConnectorInputFile from configuration.


89-97: Debug logging enhanced, clarity improved.

Logging of Gbts space points provides valuable information for debugging.


232-233: ClusterWidth set to zero, verify implications you must.

Ensure that a zero ClusterWidth does not adversely affect computations.


235-236: Constructor call updated, parameters included properly.

gbtsSpacePoints.emplace_back now correctly includes isPixel and ClusterWidth.

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

206-206: Parameter name updated, consistency maintained.

Renaming connector_input_file to ConnectorInputFile aligns with naming conventions.

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

98-98: Parameter name updated, consistency improved it is.

Changed connector_inputConfigFile to ConnectorInputConfigFile, reflecting updates in configuration naming.

Core/include/Acts/Seeding/GbtsTrackingFilter.hpp (1)

55-56: Simplified access to space point properties, I sense. Wise decision, this is.

Direct access to r() through m_spGbts instead of m_spGbts.SP, cleaner and more maintainable the code becomes. Consistent with changes throughout the codebase, this pattern is.

Verify the consistency of this pattern, we must:

Also applies to: 70-70, 279-279

✅ Verification successful

Let me search for these patterns in different ways to verify the consistency, hmm. The Force will guide us to the truth about these access patterns, it will.


Consistent the changes are, throughout the codebase they flow

Through the Force, seen I have that both patterns coexist:

  • Direct access through m_spGbts.r() for radius
  • Legacy access through m_spGbts.SP->x(), m_spGbts.SP->y(), m_spGbts.SP->z()

A transition in progress this appears to be, where radius access simplified is, while other properties through SP pointer still flow. Natural this evolution is, as step by step the code transforms.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining old-style access patterns
rg -A 2 'm_spGbts\.SP->[r|phi]\(\)'

Length of output: 37


Script:

#!/bin/bash
# Search for any occurrences of m_spGbts to understand the access pattern
rg -A 2 'm_spGbts'

# Also search for specific radius access patterns
rg -A 2 '->r\(\)'

# And search for phi access patterns
rg -A 2 '->phi\(\)'

Length of output: 6863

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

1094-1107: Verify the impact of disabled cluster width feature.

Understand the effects of disabled cluster width feature we must.

✅ Verification successful

Safe to disable cluster width feature, it is

Investigated the Force surrounding cluster width, I have. Clear evidence found in the codebase:

  • Optional feature it is, defaulting to false in SeedFinderGbtsConfig.hpp
  • Used only in space point addition, impact minimal it has
  • No critical dependencies or tests broken by disabling, found there were not

Proceed with m_useClusterWidth=False, you may. No disturbance in the Force, this change will cause.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for cluster width usage in the codebase
echo "Searching for cluster width usage..."
rg -l "useClusterWidth|m_useClusterWidth"

# Search for related configuration settings
echo "Searching for related configuration..."
rg "cluster.*width.*config" -A 3

Length of output: 482


Script:

#!/bin/bash
# Search for the implementation details of cluster width usage
echo "Searching in SeedFinderGbts.ipp..."
rg -A 10 "m_useClusterWidth" "Core/include/Acts/Seeding/SeedFinderGbts.ipp"

echo "Searching in SeedFinderGbtsConfig.hpp..."
rg -A 5 "m_useClusterWidth" "Core/include/Acts/Seeding/SeedFinderGbtsConfig.hpp"

# Check if there are any tests related to cluster width
echo "Searching for tests..."
rg -A 5 "useClusterWidth.*test" 

# Check Python bindings for cluster width
echo "Checking Python bindings..."
rg -A 5 "useClusterWidth" "Examples/Python/src/TrackFinding.cpp"

Length of output: 1233

@AJPfleger AJPfleger requested a review from noemina December 17, 2024 16:13
Changing isSCT->isStrip
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/Seeding/GbtsDataStorage.hpp (2)

32-50: Approve the changes to GbtsSP struct, but suggest documentation, hmm.

Wise changes these are, using atan2 instead of atan. More robust handling of quadrants, it provides. But documentation, it lacks. Help future padawans understand the purpose of these members, we must.

Add documentation for the new members, you should:

+ /// @brief Indicates if the space point is from a pixel detector
  bool m_isPixel;
+ /// @brief Azimuthal angle in the global coordinate system
  float m_phi;
+ /// @brief Radial distance from the origin in the global coordinate system
  float m_r;
+ /// @brief Width of the cluster in the detector
  float m_ClusterWidth;

Line range hint 173-177: Extract magic numbers as named constants, we must.

Magic numbers in the code, clarity they lack. Constants with meaningful names, better understanding they bring.

Extract these as named constants at class or namespace level:

+ // Cluster width constants for barrel layers
+ static constexpr float MIN_TAU_SCALE = 6.7f;
+ static constexpr float MIN_CLUSTER_WIDTH_OFFSET = 0.2f;
+ static constexpr float MAX_TAU_BASE = 1.6f;
+ static constexpr float MAX_TAU_FACTOR = 0.15f;
+ static constexpr float MAX_TAU_SCALE = 6.1f;

  if (useClusterWidth) {
    float cluster_width = sp.ClusterWidth();
-   min_tau = 6.7 * (cluster_width - 0.2);
-   max_tau = 1.6 + 0.15 / (cluster_width + 0.2) + 6.1 * (cluster_width - 0.2);
+   min_tau = MIN_TAU_SCALE * (cluster_width - MIN_CLUSTER_WIDTH_OFFSET);
+   max_tau = MAX_TAU_BASE + MAX_TAU_FACTOR / (cluster_width + MIN_CLUSTER_WIDTH_OFFSET) +
+             MAX_TAU_SCALE * (cluster_width - MIN_CLUSTER_WIDTH_OFFSET);

Also applies to: 184-187

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8347b8a and 0bff8e8.

📒 Files selected for processing (2)
  • Core/include/Acts/Seeding/GbtsDataStorage.hpp (4 hunks)
  • Core/include/Acts/Seeding/SeedFinderGbts.ipp (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Core/include/Acts/Seeding/SeedFinderGbts.ipp
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: fpe_masks
  • GitHub Check: missing_includes
  • GitHub Check: linux_ubuntu_extra (ubuntu2204_clang, 20)
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20)
  • GitHub Check: macos
  • GitHub Check: linux_ubuntu
  • GitHub Check: build_debug
🔇 Additional comments (1)
Core/include/Acts/Seeding/GbtsDataStorage.hpp (1)

47-47: Consider renaming isStrip method, a better name we seek.

From past wisdom shared by timadye, less ATLAS-specific name we should use, as only in LRT mode this is used.

Suggestion from code rabbit
Comment suggested by code rabbit
Fixing format of comment
removing duplicate definition
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)
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (2)

70-70: Safer file path handling, implement you must.

Check file existence before opening, and std::filesystem use, you should. Prevent undefined behavior when file exists not, this will.

-      m_cfg.seedFinderConfig.ConnectorInputFile.c_str(), std::ifstream::in);
+      std::filesystem::path(m_cfg.seedFinderConfig.ConnectorInputFile), std::ifstream::in);
+      if (!input_ifstream.is_open()) {
+          throw std::runtime_error("Failed to open connector input file");
+      }

Line range hint 79-85: Magic numbers in layer identification, replace we must.

Constants or enums for layer identification ranges use, you should. More maintainable and less error-prone, the code will be.

+enum class LayerType {
+    BARREL_MIN = 79,
+    BARREL_MAX = 85,
+    POSITIVE_MIN = 89,
+    POSITIVE_MAX = 99
+};

-if (79 < Gbts_id && Gbts_id < 85) {  // 80s, barrel
+if (static_cast<int>(LayerType::BARREL_MIN) < Gbts_id && 
+    Gbts_id < static_cast<int>(LayerType::BARREL_MAX)) {

Also applies to: 89-99

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0bff8e8 and 05e3af2.

📒 Files selected for processing (2)
  • Core/include/Acts/Seeding/SeedFinderGbtsConfig.hpp (1 hunks)
  • Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Core/include/Acts/Seeding/SeedFinderGbtsConfig.hpp
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: merge-sentinel
  • GitHub Check: unused_files
  • GitHub Check: linux_ubuntu_extra (ubuntu2204_clang, 20)
  • GitHub Check: missing_includes
  • GitHub Check: macos
  • GitHub Check: linux_ubuntu_extra (ubuntu2204, 20)
  • GitHub Check: build_debug
  • GitHub Check: linux_ubuntu
  • GitHub Check: docs
🔇 Additional comments (1)
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (1)

223-231: Handle cluster width properly, we must.

Hardcoded cluster width of 0, concerning it is. Document impact of this limitation and plan for future implementation, we should.

Run this verification to check cluster width usage:

Copy link
Contributor

@noemina noemina left a comment

Choose a reason for hiding this comment

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

There are only a few changes in this PR, and I’ve left a few comments for consideration.

That said, I’ve noticed that this version of the code could benefit from aligning more closely with the requirements for deployment in ACTS. Specifically, the code could benefit from additional testing and documentation. This is also reflected in the SonarCloud analysis: https://sonarcloud.io/component_measures?id=acts-project_acts.

While these points aren’t within the scope of this PR, they might be worth addressing in future updates to the code. It could be a good opportunity to incorporate some of these improvements as part of our planned updates.

Core/include/Acts/Seeding/GbtsDataStorage.hpp Outdated Show resolved Hide resolved
Comment on lines 46 to +47
bool isPixel() const { return m_isPixel; }
bool isSCT() const { return !m_isPixel; }
bool isStrip() const { return !m_isPixel; }
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks a lot detector dependent. Not for now, but probably we need to define a strategy to generalise this code.

Comment on lines 676 to 677
// In normal (non LRT) mode penalise SSS by 1000, PSS (if enabled) and
// PPS by 10000
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can neglect the LRT case for the moment. Also, I do not think we build PSS and/or PPS at all, so we can probably remove those cases?

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 05e3af2 and ae8cd35.

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

30-36: Document the member variables, young padawan must.

Missing documentation for member variables, I see. Clarity in code, essential it is.

Add documentation for:

  • m_isPixel: Purpose of pixel/strip differentiation
  • m_phi: Units and coordinate system
  • m_r: Units and what it represents
  • m_ClusterWidth: Units and significance

37-45: Precalculate phi and r in constructor, wise choice it is.

Good practice to compute m_phi and m_r once in constructor, it is. Memory-computation tradeoff, balanced well it has been.


47-51: Detector-specific code, concerning this is.

Too coupled to specific detector technology (pixel/strip), this implementation is. More generic approach, consider we must.

Run this command to assess impact:

@@ -152,7 +158,7 @@ class GbtsDataStorage {
return -1;
}

int binIndex = pL->getEtaBin(sp.SP->z(), sp.SP->r());
int binIndex = pL->getEtaBin(sp.SP->z(), sp.r());
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Error codes, document we must. Return values, explain we should.

Return values (-1, -2, -3), their meaning unclear it is. Documentation for error conditions, add you must.

Add enum for error codes:

+  enum class SpacePointError {
+    Success = 0,
+    InvalidLayer = -1,
+    InvalidEtaBin = -2,
+    InvalidClusterWidth = -3
+  };

Also applies to: 185-189

Comment on lines +174 to 177
float cluster_width = sp.ClusterWidth();
min_tau = 6.7 * (cluster_width - 0.2);
max_tau =
1.6 + 0.15 / (cluster_width + 0.2) + 6.1 * (cluster_width - 0.2);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Magic numbers in tau calculations, explain you must.

Constants 6.7, 0.2, 1.6, 0.15, and 6.1, mysterious they are. Document their significance and origin, you should.

Extract as named constants with documentation:

+  // Tau calculation constants for barrel layers
+  static constexpr float MIN_TAU_FACTOR = 6.7f;
+  static constexpr float CLUSTER_WIDTH_OFFSET = 0.2f;
+  static constexpr float MAX_TAU_BASE = 1.6f;
+  static constexpr float MAX_TAU_FACTOR1 = 0.15f;
+  static constexpr float MAX_TAU_FACTOR2 = 6.1f;

Committable suggestion skipped: line range outside the PR's diff.

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/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (1)

230-231: Document the temporary limitation, you must.

Add comment explaining why cluster width is not available in examples and when it will be implemented, you should.

-      float ClusterWidth =
-          0;  // false input as this is not available in examples
+      float ClusterWidth = 0;  
+      // TODO: Cluster width information will be available when Athena 
+      // implementation is complete. Currently initialized to 0 as placeholder.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ae8cd35 and b5a1ded.

📒 Files selected for processing (1)
  • Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: macos
  • GitHub Check: unused_files
  • GitHub Check: missing_includes
  • GitHub Check: docs
🔇 Additional comments (2)
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (2)

89-101: Safe access patterns implemented, they are. Approve this change, I do.

Previous wisdom shared, heeded it was. Source links and geometry ID checks added, preventing crashes they do.


226-234: Incomplete implementation of cluster width, I sense.

Initialize cluster width to zero, you do, but use it, you do not. A disturbance in the Force, this creates.

Run this command to verify cluster width usage across the codebase:

Additionally, verify pixel detection logic:

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 Component - Examples Affects the Examples module Seeding Track Finding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants