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: adding G4 stepping #3812

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

Conversation

asalzburger
Copy link
Contributor

@asalzburger asalzburger commented Nov 4, 2024

This adds the possibility to use Geant4 as a propagation reference without the need of the SimHitConversion algorithm

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced configurability in Geant4Simulation for tracking particle interactions with new parameters for recording hits and propagation summaries.
    • Added support for step logging in SensitiveSteppingAction to control logging behavior during simulations.
    • Introduced new member variables in various classes to improve tracking and output capabilities related to particle propagation.
  • Bug Fixes

    • Improved error handling for missing physical volumes and inconsistencies in physics lists.
  • Refactor

    • Streamlined methods in SensitiveSteppingAction for better clarity and maintainability.
    • Removed the SimHitToSummaryConversion algorithm to focus on core propagation functionalities.
  • Documentation

    • Updated Python bindings to reflect changes in configuration options for simulation and mapping capabilities.

@github-actions github-actions bot added the Component - Examples Affects the Examples module label Nov 4, 2024
@asalzburger asalzburger added this to the next milestone Nov 4, 2024
Copy link

github-actions bot commented Nov 4, 2024

📊: Physics performance monitoring for 0dc8a57

Full contents

physmon summary

Copy link

coderabbitai bot commented Nov 4, 2024

Walkthrough

The changes in this pull request introduce several enhancements to the Geant4 simulation framework within the ACTS library. Key modifications include the addition of new member variables for tracking propagation summaries and step logging, updates to configuration structures, and enhancements to the handling of simulation data. The SimHitToSummaryConversion class and its associated files have been removed, indicating a shift in focus away from that functionality. Overall, the changes improve the configurability and data management capabilities of the simulation components.

Changes

File Change Summary
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp Added member variable std::unordered_map<G4int, PropagationSummary> propagationRecords; in EventStore struct.
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp Added new members in Config: std::string outputPropagationSummaries, bool recordHitsOfCharged, bool recordHitsOfPrimaries, bool recordPropagationSummaries; added WriteDataHandle<PropagationSummaries> m_outputPropagationSummaries.
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp Added member variable bool stepLogging = false; in Config struct.
Examples/Algorithms/Geant4/src/Geant4Simulation.cpp Updated configuration handling for SensitiveSteppingAction; added logic for outputting propagation summaries.
Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp Updated hitFromStep function to accept G4Step*; added kinematicsOfStep function.
Examples/Algorithms/Propagation/CMakeLists.txt Removed src/SimHitToSummaryConversion.cpp from add_library.
Examples/Algorithms/Propagation/include/ActsExamples/Propagation/SimHitToSummaryConversion.hpp Removed class SimHitToSummaryConversion and its associated methods and variables.
Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp Removed implementation of SimHitToSummaryConversion class and its methods.
Examples/Python/python/acts/examples/simulation.py Updated addGeant4 function parameters to include new tracking options for particle interactions.
Examples/Python/src/Geant4Component.cpp Added new members in Geant4SimulationBase::Config: outputPropagationSummaries, recordHitsOfCharged, recordHitsOfPrimaries; overloaded create method.
Examples/Python/src/Propagation.cpp Removed references to SimHitToSummaryConversion algorithm and its header file.

Poem

In the fields of code we play,
New records of steps come our way.
With logs to track each little hop,
The simulation never stops! 🐇✨
Propagation tales now brightly bloom,
In the Geant4 garden, there's always room!


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 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.

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

🧹 Outside diff range and nitpick comments (6)
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp (1)

44-46: LGTM! Consider adding documentation for the new parameter.

The addition of the stepLogging parameter is well-placed and follows the existing configuration pattern. However, it would be helpful to add a brief documentation comment explaining:

  • The purpose of step logging
  • What information gets logged when enabled
  • Where the logs are output

Add documentation like this:

    bool secondary = true;

+   /// Controls whether to log detailed information about each simulation step.
+   /// When enabled, [describe what gets logged and where]
    bool stepLogging = false;
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp (1)

128-130: LGTM: Configuration options are well-structured.

The new configuration options are logically organized and have appropriate default values.

Consider adding documentation comments for these new options to clarify their purpose and impact:

+    /// Name of the output collection for propagation records.
+    /// Only used when recordPropagationSummaries is true.
     std::string outputPropagationSummaries = "propagation_summaries";

+    /// Whether to record hits for charged particles
     bool recordHitsOfCharged = true;

+    /// Whether to record hits for primary particles
     bool recordHitsOfPrimaries = true;

+    /// Whether to record propagation summaries for debugging
     bool recordPropagationSummaries = false;

Also applies to: 145-146, 149-150, 154-155

Examples/Algorithms/Geant4/src/Geant4Simulation.cpp (1)

338-347: Consider minor improvements to propagation summary handling

The implementation of propagation summary output is well-structured and efficient. Consider these minor improvements:

  1. Add a brief comment explaining the purpose and structure of PropagationSummaries
  2. Make the trackId const in the range-based for loop since it's not modified:
-    for (auto& [trackId, summary] : eventStore().propagationRecords) {
+    for (const auto& [trackId, summary] : eventStore().propagationRecords) {
Examples/Python/src/Geant4Component.cpp (1)

218-222: Document performance implications of hit recording options.

The new granular hit recording options (recordHitsOfCharged, recordHitsOfNeutrals, recordHitsOfPrimaries, recordHitsOfSecondaries) provide excellent control but may impact simulation performance when enabled. Consider:

  1. Adding documentation about the performance implications of enabling each option
  2. Providing recommended configurations for common use cases
Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp (2)

61-61: Ensure consistent unit conversion definitions

Consider moving the unit conversion constants (convertLength, convertEnergy, convertTime) to a shared location if they are used in multiple places within the codebase to promote consistency and maintainability.


128-129: Redundant retrieval of step points

Since kinematicsOfStep retrieves preStepPoint and postStepPoint, consider using it here to avoid redundant code and enhance consistency.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1e2a44b and e7cc02c.

📒 Files selected for processing (11)
  • Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp (2 hunks)
  • Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp (4 hunks)
  • Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp (1 hunks)
  • Examples/Algorithms/Geant4/src/Geant4Simulation.cpp (3 hunks)
  • Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp (11 hunks)
  • Examples/Algorithms/Propagation/CMakeLists.txt (1 hunks)
  • Examples/Algorithms/Propagation/include/ActsExamples/Propagation/SimHitToSummaryConversion.hpp (0 hunks)
  • Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp (0 hunks)
  • Examples/Python/python/acts/examples/simulation.py (1 hunks)
  • Examples/Python/src/Geant4Component.cpp (1 hunks)
  • Examples/Python/src/Propagation.cpp (0 hunks)
💤 Files with no reviewable changes (3)
  • Examples/Algorithms/Propagation/include/ActsExamples/Propagation/SimHitToSummaryConversion.hpp
  • Examples/Algorithms/Propagation/src/SimHitToSummaryConversion.cpp
  • Examples/Python/src/Propagation.cpp
🔇 Additional comments (19)
Examples/Algorithms/Propagation/CMakeLists.txt (1)

1-1: LGTM! Verify downstream dependencies.

The removal of SimHitToSummaryConversion.cpp from the library sources aligns with the PR objective of eliminating the SimHitConversion algorithm.

Let's verify if there are any downstream dependencies that might be affected:

✅ Verification successful

Changes to ActsExamplesPropagation library are safe to proceed

The comprehensive search across the codebase shows no references to SimHitToSummaryConversion, indicating that:

  • No other CMake targets depend on this component
  • No source files include or use this functionality
  • The class definition has been completely removed

This confirms that removing SimHitToSummaryConversion.cpp from the library sources is safe and won't impact any downstream dependencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential downstream dependencies on the removed SimHitToSummaryConversion functionality

# Search for any references to SimHitToSummaryConversion in CMake files
echo "Checking CMake files for dependencies..."
rg -l "SimHitToSummaryConversion" --type cmake

# Search for any C++ includes of the removed header
echo "Checking source files for includes..."
rg -l "#include.*SimHitToSummaryConversion" --type cpp --type hpp

Length of output: 318


Script:

#!/bin/bash
# Let's try a more comprehensive search without file type restrictions
# and broaden the search patterns

echo "Searching for any mentions of SimHitToSummaryConversion..."
rg -l "SimHitToSummaryConversion"

echo -e "\nSearching for any mentions of SimHit.*Conversion..."
rg -l "SimHit.*Conversion"

# Let's also check if there are any remaining references to this class pattern
echo -e "\nSearching for class definition or usage..."
ast-grep --pattern 'class SimHitToSummaryConversion'

Length of output: 464

Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SensitiveSteppingAction.hpp (1)

44-46: Verify integration with propagation summary recording.

Since this change is part of a larger feature to use Geant4 as a propagation reference, let's verify the relationship between stepLogging and the propagation summary functionality mentioned in the AI summary.

✅ Verification successful

Based on the shell script results, I can now generate the final response since I have enough information about how stepLogging integrates with propagation summaries:

stepLogging is correctly integrated with propagation summary recording

The code shows proper integration between stepLogging and propagation summaries:

  • stepLogging is controlled by recordPropagationSummaries in Geant4Simulation.cpp
  • When enabled, it properly initializes propagation summaries for each track and records step information
  • The data flows correctly through the EventStore and gets written via RootPropagationSummaryWriter
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how stepLogging is used with propagation summaries

# Look for files that use stepLogging
rg "stepLogging" -l

# Check for propagation summary related code
rg "PropagationSummary|recordPropagationSummaries" -A 5

# Look for the implementation file
fd "SensitiveSteppingAction.cpp"

Length of output: 22215

Examples/Algorithms/Geant4/include/ActsExamples/Geant4/EventStore.hpp (2)

12-12: LGTM: Include statement for PropagationSummary is well-placed.

The addition of PropagationSummary.hpp aligns with the PR's objective of using Geant4 as a propagation reference and follows the existing include organization pattern.


56-58: LGTM: Well-structured addition of propagation records.

The new propagationRecords member is:

  • Appropriately typed as an unordered_map for efficient track ID lookups
  • Well-documented with its purpose
  • Logically placed with other tracking-related members
  • Consistent with the PR's goal of using Geant4 as a propagation reference

Let's verify the PropagationSummary type definition and usage:

✅ Verification successful

LGTM: PropagationSummary is well-defined and properly integrated

The verification confirms:

  • PropagationSummary is properly defined in Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp
  • It's consistently used across the codebase, including Geant4 integration, propagation algorithms, and IO operations
  • No legacy SimHitConversion references were found
  • The new member's type and usage aligns with the existing propagation infrastructure
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify PropagationSummary definition and its usage in related files
echo "Checking PropagationSummary definition and usage..."
rg -t hpp -t cpp "PropagationSummary" --no-heading

# Check if there are any remaining references to SimHitConversion
echo "Verifying removal of SimHitConversion..."
rg -t hpp -t cpp "SimHitConversion" --no-heading

Length of output: 359


Script:

#!/bin/bash
# Let's try without file type filters since they weren't recognized
echo "Checking PropagationSummary definition and usage..."
rg "struct.*PropagationSummary|class.*PropagationSummary" -A 5

echo "Checking all PropagationSummary references..."
rg "PropagationSummary"

echo "Checking for any SimHitConversion references..."
rg "SimHitConversion"

Length of output: 6661

Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp (3)

13-13: LGTM: Include addition is appropriate.

The PropagationSummary header inclusion is properly placed and necessary for the new propagation summary functionality.


189-190: LGTM: Data handle addition follows established patterns.

The new WriteDataHandle for PropagationSummaries is properly implemented and consistent with the class's data handling approach.


13-13: Verify integration with related components.

The changes look good overall, but let's verify the integration with related components.

Also applies to: 128-130, 145-146, 149-150, 154-155, 189-190

✅ Verification successful

Integration verified successfully

The PropagationSummary integration is properly implemented across the codebase:

  • PropagationSummary is well-defined in Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp
  • Implementation in Geant4Simulation correctly handles the configuration and data writing
  • Python bindings are properly updated with the new configuration options
  • Multiple components are properly using PropagationSummary, including writers, propagators, and algorithms
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent usage of the new configuration options and data handle

# Test 1: Check if PropagationSummary is properly defined
echo "Checking PropagationSummary definition..."
rg -l "class PropagationSummary" "Examples/EventData"

# Test 2: Check for corresponding changes in implementation file
echo "Checking implementation file..."
rg -l "m_outputPropagationSummaries" "Examples/Algorithms/Geant4/src"

# Test 3: Check for Python binding updates
echo "Checking Python bindings..."
rg "outputPropagationSummaries|recordPropagationSummaries" "Examples/Python"

Length of output: 817


Script:

#!/bin/bash
# Let's verify the PropagationSummary definition in the correct location
echo "Checking PropagationSummary definition..."
fd PropagationSummary.hpp

# Check implementation details
echo -e "\nChecking implementation and usage..."
rg -A 2 "m_outputPropagationSummaries" Examples/Algorithms/Geant4/src/Geant4Simulation.cpp

# Check if there are any other related components using PropagationSummary
echo -e "\nChecking related usages..."
rg -l "PropagationSummary" --type cpp --type hpp

Length of output: 671


Script:

#!/bin/bash
# Check the content of PropagationSummary.hpp
echo "Checking PropagationSummary definition content..."
cat Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp

# Check for related usages with correct file extensions
echo -e "\nChecking related usages..."
rg -l "PropagationSummary" -g "*.cpp" -g "*.hpp"

# Check if the implementation properly handles the configuration
echo -e "\nChecking configuration handling..."
rg -A 5 "cfg.outputPropagationSummaries" Examples/Algorithms/Geant4/src/Geant4Simulation.cpp

Length of output: 3078

Examples/Algorithms/Geant4/src/Geant4Simulation.cpp (2)

236-240: LGTM: Configuration changes enhance flexibility

The new configuration options provide fine-grained control over hit recording behavior, aligning well with the PR's objective of adding G4 stepping capabilities. The configuration is well-structured and follows good naming practices.


304-307: LGTM: Proper initialization of propagation summary output

The output handle initialization is correctly guarded by the configuration flag and follows the established pattern in the codebase.

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

211-211: Clarify the relationship between propagation summary configuration options.

There appears to be potential redundancy between outputPropagationSummaries and recordPropagationSummaries. Please clarify:

  • Is one for controlling recording and the other for output?
  • Are both needed or can they be consolidated?

Also applies to: 223-223

Examples/Python/python/acts/examples/simulation.py (2)

732-736: LGTM: Well-structured parameter additions for hit recording control.

The new parameters provide granular control over hit recording for different particle types with sensible defaults:

  • recordHitsOfCharged: Controls hit recording for charged particles
  • recordHitsOfNeutrals: Controls hit recording for neutral particles
  • recordHitsOfPrimaries: Controls hit recording for primary particles
  • recordPropagationSummaries: Controls propagation summary recording

732-736: LGTM: Configuration changes properly integrate with Geant4Simulation.

The new hit recording parameters are correctly passed to the Geant4Simulation constructor, maintaining a clean and logical configuration structure.

Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp (7)

14-14: Approved inclusion of necessary header for stepping logger

The addition of #include "Acts/Propagator/detail/SteppingLogger.hpp" ensures that the stepping logger functionalities are available, which is necessary for the step logging features introduced.


23-23: Approved inclusion of <array> header

The inclusion of the <array> header is appropriate as it is required for the use of std::array in the new functions.


58-86: Well-structured function for kinematic data extraction

The new kinematicsOfStep function cleanly encapsulates the extraction and unit conversion of kinematic data from G4Step, improving code readability and reusability.


88-96: Simplified hitFromStep function with improved parameter handling

Updating hitFromStep to accept a G4Step* streamlines the function and leverages the new kinematicsOfStep function, enhancing code clarity and reducing redundancy.


99-109: Addition of stepFromG4Step function enhances code modularity

The new stepFromG4Step function provides a clean abstraction for converting a G4Step into an Acts::detail::Step, improving code organization and facilitating step logging.


242-256: Efficient logging of propagation steps

The use of stepFromG4Step within the step logging logic enhances the clarity and efficiency of the code, ensuring that step data is accurately recorded.


300-300: Ensure consistent usage of hit index

In lines 300, 313, and 341, hitFromStep is called with different index values. In line 300, the index is set to eventStore().particleHitCount.at(particleId) - 1, while in lines 313 and 341, the index is -1. Verify that using -1 as the index does not cause issues in downstream processing, such as hit identification or serialization.

Run the following script to check the usage of the index parameter in ActsFatras::Hit and any assumptions about its value:

Also applies to: 313-313, 341-341

✅ Verification successful

Let me gather more information about the hitFromStep function and its usage to better understand the index parameter handling.


Based on the code analysis, I can now generate the final response:

Using -1 as hit index is intentional and safe

The hit index parameter in hitFromStep is used differently in these scenarios:

  • When storing final hits (eventStore().hits), it uses particleHitCount - 1 to maintain sequential indexing
  • When creating temporary hits for buffering (hitBuffer), it uses -1 as these are intermediate hits that will be combined into a final hit

The codebase shows no validation or assumptions about hit indices being non-negative. The index is primarily used for bookkeeping in the event store and doesn't affect hit identification or serialization, which rely on geometry and particle IDs instead.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search the codebase for uses of `ActsFatras::Hit` constructor and check how the `index` parameter is utilized.

# Find all instances where `ActsFatras::Hit` is constructed
rg -A 5 'ActsFatras::Hit\s*\('

# Search for code that uses the `index` value of hits
rg -A 3 'hit.index\('

# Look for any assertions or conditions that `index` >= 0
rg 'index\s*<\s*0|index\s*>=\s*0'

Length of output: 3025


Script:

#!/bin/bash
# Search for the hitFromStep function implementation and its usages
ast-grep --pattern 'hitFromStep($$$)'

# Search for any validation or checks related to hit indices
rg -A 5 'particleHitCount|hitFromStep'

# Look for any hit processing or validation code
rg -A 5 'class.*Hit|struct.*Hit'

Length of output: 40211

asalzburger and others added 2 commits November 5, 2024 13:33
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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

📥 Commits

Reviewing files that changed from the base of the PR and between e7cc02c and 531a7b2.

📒 Files selected for processing (1)
  • Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp (11 hunks)
🔇 Additional comments (3)
Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp (3)

58-86: LGTM! Well-structured kinematics extraction.

The function effectively extracts and converts kinematic information from G4Step, with proper unit handling and clear organization of pre/post step data.


88-97: LGTM! Clean refactoring of hit creation.

The function has been effectively simplified by using G4Step directly and leveraging the new kinematicsOfStep function, while maintaining the same functionality.


Line range hint 300-341: LGTM! Consistent application of refactored hit creation.

The changes effectively integrate the refactored hitFromStep function while maintaining the existing hit buffer logic and functionality.

@asalzburger
Copy link
Contributor Author

Screenshot 2024-11-05 at 15 25 09

A bit of follow-up: as one can see the mid-point implementation creates steps exactly at hypothetical cylinders, independent from the Runge-Kutta-Stepping

@andiwand
Copy link
Contributor

andiwand commented Nov 5, 2024

I thought the pre and post step is pretty much what we have before and after the step? I imagine the next pre step will be the previous post step.

In ACTS I think we don't store the previous position (pre step) and always work with the current position (post step).

I wonder how pre and post step would look like in this picture. I imagine that the post step position would also be on surface?

After thinking about it I beliefe what G4 calls post step is what we store in the stepping logger as it runs after the stepper. The distance is then simply the path length of this last step which we can approximate with the distance between pre and post step in G4 or they might have some path length quantity we can use.

@asalzburger
Copy link
Contributor Author

I thought the pre and post step is pretty much what we have before and after the step? I imagine the next pre step will be the previous post step.

In ACTS I think we don't store the previous position (pre step) and always work with the current position (post step).

I wonder how pre and post step would look like in this picture. I imagine that the post step position would also be on surface?

After thinking about it I beliefe what G4 calls post step is what we store in the stepping logger as it runs after the stepper. The distance is then simply the path length of this last step which we can approximate with the distance between pre and post step in G4 or they might have some path length quantity we can use.

Yes, post-step would be more appropriate comparing to our Acts::detail::Step (btw, I will lift this from detail in a future PR). The issue is that we do surface based geometry, while Geant4 does volume based, i.e for silicon we would like to the average positions of all steps in on volume ... I will need another buffer for this though.

@andiwand
Copy link
Contributor

andiwand commented Nov 5, 2024

I also thought about the detail in Acts::detail::Step. I think even the step logger should not be in detail. Having them coupled in a file seems not to bad while Acts::Step seems a bit too general purpose. Maybe Acts::PostStepInfo?

Right the mapping from volume based to surface based is where we will ultimately clash with G4. I wonder if we can push these necessary conversion to the very end of the processing? Keeping the stepping info decoupled from any kind of geo/navigation info but later relate them if necessary. But I don't know yet what the use case is.

Copy link

sonarcloud bot commented Nov 7, 2024

Copy link
Contributor

kodiakhq bot commented Nov 12, 2024

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@asalzburger
Copy link
Contributor Author

I also thought about the detail in Acts::detail::Step. I think even the step logger should not be in detail. Having them coupled in a file seems not to bad while Acts::Step seems a bit too general purpose. Maybe Acts::PostStepInfo?

Right the mapping from volume based to surface based is where we will ultimately clash with G4. I wonder if we can push these necessary conversion to the very end of the processing? Keeping the stepping info decoupled from any kind of geo/navigation info but later relate them if necessary. But I don't know yet what the use case is.

I will make a PR for that, let me resolve the conflicts first here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coderabbit Component - Examples Affects the Examples module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants