Skip to content

feat: python based tracking geometry display#5303

Open
asalzburger wants to merge 2 commits intoacts-project:mainfrom
asalzburger:feat-python-display
Open

feat: python based tracking geometry display#5303
asalzburger wants to merge 2 commits intoacts-project:mainfrom
asalzburger:feat-python-display

Conversation

@asalzburger
Copy link
Copy Markdown
Contributor

This PR adds a utility that let you display some features of the tracking geometry, e.g. where material surface are etc. etc.

--- END COMMIT MESSAGE ---

Examples:

python3 Examples/Scripts/Python/display_tracking_geometry.py --detector odd --sub-system pixels::barrel --layer 2:4:6:8  --view xy --select sensitives --show
Screenshot 2026-03-31 at 12 16 37

Or even just inspect the detector:

python3 Examples/Scripts/Python/display_tracking_geometry.py --detector odd --detector-inspect --select sensitive

With output:

Detector inspect [odd] (surface category: sensitive)
========================================================================
pixels
  volumes : 16,17,18
  layers  : 2:4:6:8:10:12:14:16
  parts:
    - all      volumes=16,17,18     layers=2:4:6:8:10:12:14:16
    - barrel   volumes=17           layers=2:4:6:8
    - n_endcap volumes=16           layers=4:6:8:10:12:14:16
    - p_endcap volumes=18           layers=2:4:6:8:10:12:14
    - endcaps  volumes=16,18        layers=2:4:6:8:10:12:14:16

short_strips
  volumes : 23,24,25
  layers  : 2:4:6:8:10:12
  parts:
    - all      volumes=23,24,25     layers=2:4:6:8:10:12
    - barrel   volumes=24           layers=2:4:6:8
    - n_endcap volumes=23           layers=2:4:6:8:10:12
    - p_endcap volumes=25           layers=2:4:6:8:10:12
    - endcaps  volumes=23,25        layers=2:4:6:8:10:12

long_strips
  volumes : 28,29,30
  layers  : 2:4:6:8:10:12
  parts:
    - all      volumes=28,29,30     layers=2:4:6:8:10:12
    - barrel   volumes=29           layers=2:4
    - n_endcap volumes=28           layers=2:4:6:8:10:12
    - p_endcap volumes=30           layers=2:4:6:8:10:12
    - endcaps  volumes=28,30        layers=2:4:6:8:10:12

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

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

@github-actions github-actions bot added the Component - Examples Affects the Examples module label Mar 31, 2026
@github-actions github-actions bot added this to the next milestone Mar 31, 2026
@asalzburger
Copy link
Copy Markdown
Contributor Author

This might be the first step towards retiring actsvg:

Screenshot 2026-03-31 at 12 29 33

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

📊: Physics performance monitoring for e9102f3

Full contents

physmon summary

@sonarqubecloud
Copy link
Copy Markdown

@asalzburger asalzburger requested a review from benjaminhuth April 1, 2026 08:15
Copy link
Copy Markdown
Member

@benjaminhuth benjaminhuth left a comment

Choose a reason for hiding this comment

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

Some comments, but nothing major.

return split_polys, join_markers


def _dedupe_surfaces_by_geometry_id(surfaces):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe a plain python set would be a better fit here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm not sure, don't we have this in C++, and can bind the geometry identifier? Do we need a reimplementation in Python?

project_polyhedron_vertices,
surface_to_2d_patches,
)
from .tracking_surfaces import (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

More a style question, do we want to import all these functions into the acts.utilities module, or wouldn't it be clearer to have acts.utilities.projection2d.function?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm maybe this is too early, but I would find it nice to split geometry-specific and generic parts.
One could e.g. have a function/class in a non-executable script takes the subsystem-volume-id dicts and then separate the ODD / generic detector specific scripts in one or two dedicated scripts

E.g.,
Python/Utilities/display_tracking_geometry.py
Examples/Scripts/Python/display_odd.py
Examples/Scripts/Python/display_generic.py

Comment on lines +263 to +270
sensitive = collect_sensitive_surfaces(tracking_geometry)
material = collect_material_surfaces(tracking_geometry)
if category == "sensitive":
return sensitive
if category == "material":
return material
if category == "all":
return _dedupe_surfaces_by_geometry_id([*sensitive, *material])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
sensitive = collect_sensitive_surfaces(tracking_geometry)
material = collect_material_surfaces(tracking_geometry)
if category == "sensitive":
return sensitive
if category == "material":
return material
if category == "all":
return _dedupe_surfaces_by_geometry_id([*sensitive, *material])
sensitive = collect_sensitive_surfaces(tracking_geometry)
material = collect_material_surfaces(tracking_geometry)
if category == "sensitive":
return collect_sensitive_surfaces(tracking_geometry)
if category == "material":
return collect_material_surfaces(tracking_geometry)
if category == "all":
return _dedupe_surfaces_by_geometry_id([
*collect_material_surfaces(tracking_geometry),
*collect_material_surfaces(tracking_geometry)
])

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

Labels

Component - Examples Affects the Examples module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants