Skip to content

refactor(material)!: Replace TrackingGeometryMaterial pair with named fields - #6123

Merged
andiwand merged 1 commit into
acts-project:mainfrom
paulgessinger:codex/tracking-geometry-material-api
Sep 19, 2026
Merged

andiwand merged 1 commit into
acts-project:mainfrom
paulgessinger:codex/tracking-geometry-material-api

Conversation

@paulgessinger

Copy link
Copy Markdown
Member

TrackingGeometryMaterial is currently a std::pair, so callers depend on positional members and tuple decomposition. Replace it with a dedicated struct containing surfaceMaterials and volumeMaterials, and migrate the existing mapper, JSON/ROOT I/O, and tests to named member access.

This is the standalone API prerequisite for #6109. It contains no stable keys, application methods, validation changes, or material-map format changes. The two existing maps and their behavior are unchanged.

Breaking change and migration:

  • Replace .first with .surfaceMaterials and .second with .volumeMaterials.
  • Replace pair-specific operations (std::get, pair conversions, and tuple-style access) with named member access. Avoid structured bindings so later fields can be added without changing callers.
  • Existing two-map brace initialization remains valid.

Validation: built and passed MaterialMapper, MaterialMapJsonConverter, MaterialJsonDocumentation, and RootMaterialMapIo against this commit independently of #6109. JSON examples and ROOT round trips remain unchanged.

@paulgessinger paulgessinger added this to the next milestone Sep 18, 2026
@paulgessinger paulgessinger added Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins Breaking change This change breaks backwards compatibility API breaking Public API labels Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Public API surface diff

+3 added, 1 breaking.

⚠️ Breaking API changes (source-level)

Removed types / aliases / enums / variables (1)
  • aliases Acts::TrackingGeometryMaterial

➕ Added public API

New types / aliases / enums / variables / concepts (1)
  • type Acts::TrackingGeometryMaterial
New public data members (2)
  • Acts::TrackingGeometryMaterial::surfaceMaterials
  • Acts::TrackingGeometryMaterial::volumeMaterials

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

📊: Physics performance monitoring for ea9b8dc

Full contents

physmon summary

❗️: Downstream build failure

  • Key4hep (cc @acts-project/key4hep-contacts)

@andiwand
andiwand enabled auto-merge September 19, 2026 07:18
@andiwand
andiwand added this pull request to the merge queue Sep 19, 2026
Merged via the queue into acts-project:main with commit 47d1680 Sep 19, 2026
56 checks passed
madbaron pushed a commit to key4hep/k4ActsTracking that referenced this pull request Sep 19, 2026
Handle the TrackingGeometryMaterial struct introduced by acts-project/acts#6123 while retaining support for released ACTS versions that use a pair.
goblirsc pushed a commit to goblirsc/acts that referenced this pull request Sep 21, 2026
… fields (acts-project#6123)

`TrackingGeometryMaterial` is currently a `std::pair`, so callers depend
on positional members and tuple decomposition. Replace it with a
dedicated struct containing `surfaceMaterials` and `volumeMaterials`,
and migrate the existing mapper, JSON/ROOT I/O, and tests to named
member access.

This is the standalone API prerequisite for acts-project#6109. It contains no stable
keys, application methods, validation changes, or material-map format
changes. The two existing maps and their behavior are unchanged.

Breaking change and migration:
- Replace `.first` with `.surfaceMaterials` and `.second` with
`.volumeMaterials`.
- Replace pair-specific operations (`std::get`, pair conversions, and
tuple-style access) with named member access. Avoid structured bindings
so later fields can be added without changing callers.
- Existing two-map brace initialization remains valid.

Validation: built and passed MaterialMapper, MaterialMapJsonConverter,
MaterialJsonDocumentation, and RootMaterialMapIo against this commit
independently of acts-project#6109. JSON examples and ROOT round trips remain
unchanged.
stephenswat pushed a commit to stephenswat/acts that referenced this pull request Sep 23, 2026
…cts-project#6109)

Builds on the merged API-only prerequisite acts-project#6123. This PR now contains
only the stable-key implementation on current main; the
`TrackingGeometryMaterial` pair-to-struct migration is no longer part of
its diff.

Material maps currently bind assignments to geometry IDs, so rebuilding
an equivalent geometry with different IDs can attach material to the
wrong surfaces. Add optional stable string keys to the proto-material
`configureFace` overloads and carry those identities through mapping,
serialization, and loading. Existing calls without keys keep ID-based
assignment.

- Discover keys by downcasting proto materials; leave `Surface` and
`ISurfaceMaterial` unchanged.
- Validate duplicate keys and geometry IDs before accumulation,
retaining the registry in the binned accumulator state with its
implementation type in `detail`.
- Apply assignments through format-independent
`TrackingGeometryMaterial::apply` in Core. Resolve surface assignments
before updating them. Reject keyed maps on Gen1 geometry, including the
JSON decorator construction path.
- Serialize keyed assignments in a plain `KeyedSurfaces` array without a
nested version header or duplicated ID-map entries. Each entry contains
its key, diagnostic geometry ID, and material payload.
- Require a matching key for keyed targets, without numeric-ID fallback.
Allow unused keys for combined maps and subset geometries.
- Preserve original IDs and keys in merge-marker provenance. Retain the
existing public marker API.
- Expose the maps and geometry application in Python; document
configuration with compiled snippets.

Loading replaces the placeholder and consumes its key. Rebuild the
designators before applying another keyed map; retain
`TrackingGeometryMaterial` to re-export keyed assignments. ROOT writers
reject keyed assignments; JSON/CBOR preserve them.

Validation after rebasing onto main (`47d16806`): rebuilt Core,
JSON/ROOT, and Core/JSON Python bindings. TrackingGeometryMaterial,
MaterialMapper, MaterialMapJsonConverter, RootMaterialMapIo, and Portal
tests passed, along with the optional-key Python integration test. The
rebase retains main’s removal of deprecated material mappers and the
existing axis checks in `Surface::assignSurfaceMaterial`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API breaking Breaking change This change breaks backwards compatibility Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins Public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants