Skip to content

BarrelHCAL: group tiles into 32 phi-sector sub-assemblies#1122

Draft
wdconinc wants to merge 1 commit into
mainfrom
barrel_hcal_sectors
Draft

BarrelHCAL: group tiles into 32 phi-sector sub-assemblies#1122
wdconinc wants to merge 1 commit into
mainfrom
barrel_hcal_sectors

Conversation

@wdconinc

Copy link
Copy Markdown
Contributor

Motivation

The BarrelHCAL detector is currently built as a single flat Assembly with 7,714 daughters (29 normal + 3 chimney steel structures, 2 end rings, and 7,680 scintillator tiles). Since Assembly volumes have no bounding box, ROOT's TGeo voxeliser must search all 7,714 children on every navigation step inside the barrel. Profiling with Perfetto traces shows this costs 119–139 µs per navigation call, roughly 100× the typical 1 µs baseline.

Approach

Replaces the flat BarrelHCAL assembly with 32 phi-sector sub-assemblies placed directly in the bounded envelope Polycone:

  • A phi_to_sector lambda maps any phi angle (radians) to a sector index [0..31] using the 11.25°/sector geometry
  • Each of the 29 normal and 3 chimney steel structures is routed to the corresponding sector
  • Each scintillator tile is routed to its sector via the same phi calculation used during placement
  • End rings (which span all phi) are placed directly in envelope bypassing the sector grouping

Result: envelope has 34 daughters (32 sectors + 2 end rings). Each sector sub-assembly has ~241 daughters (1–2 steel structures + 240 tiles). TGeo can voxelise the 32 sector bounding boxes in envelope, skipping ~31/32 sub-assemblies per navigation step.

Expected navigation speedup: 7,714 flat → ~32 (envelope) + ~241 (sector) ≈ 50× reduction in navigation search work.

Validation

  • Builds cleanly with -Wall -Wextra -Werror -pedantic (clang++)
  • npsim -G -N0 geometry loads without error
  • npsim -G -N2 runs 2 events without geometry navigation errors or exceptions
  • physVolID chain changes from envelope → BarrelHCAL → tile to envelope → BarrelHCAL_sectorNN → tile; DD4hep VolumeManager walks the full chain transparently

Related

Copilot AI review requested due to automatic review settings May 30, 2026 13:12
@github-actions github-actions Bot added topic: barrel Mid-rapidity detectors topic: calorimetry topic: PID Particle identification topic: materials labels May 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR primarily optimizes detector geometry navigation by reducing large flat daughter lists through sector grouping, parameterized placements, and reusable volume templates. Its actual scope is broader than the BarrelHCAL title, also changing LFHCAL, FEMC, BIC, dRICH, and DIRC geometry/optics behavior.

Changes:

  • Groups BarrelHCAL tiles/steel into 32 phi-sector assemblies and inlines tile/end-ring geometry definitions.
  • Replaces repeated placements with reusable templates or paramVolume1D in LFHCAL, forward ECAL, Barrel ScFi, and Barrel Imaging.
  • Adds dRICH sensorbox subvolumes and DIRC bar optical-surface handling.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/BarrelHCalCalorimeter_geo.cpp Builds BarrelHCAL sector sub-assemblies, procedural end rings, and XML-defined tile solids.
compact/hcal/barrel_gdml.xml Replaces external end-ring/tile GDML references with inline compact XML shapes.
src/LFHCAL_geo.cpp Reuses absorber/filler/scintillator templates across repeated slices.
src/forwardEcal_geo.cpp Converts tower/fiber/block repeated placements to paramVolume1D.
src/DRICH_geo.cpp Adds per-sector sensorbox gas subvolumes and reparents PDU assemblies.
src/DIRC_geo.cpp Adds DIRC bar optical surface setup.
compact/optical_materials.xml Defines the DIRC bar optical surface used by DIRC_geo.cpp.
src/BarrelCalorimeterScFi_geo.cpp Groups fibers by row and places them with paramVolume1D.
src/BarrelCalorimeterImaging_geo.cpp Converts 1D module placement along stave Y to parameterized placement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/DIRC_geo.cpp Outdated
@wdconinc wdconinc marked this pull request as draft May 30, 2026 13:19
Replace the single flat Assembly BarrelHCAL (7,714 daughters) with 32
per-sector sub-assemblies placed directly in the envelope Polycone.

The flat assembly has no bounding box, so every navigation step in the
barrel must search all 7,714 children. With 32 sub-assemblies the
envelope (a bounded Polycone) can voxelise their bounding boxes and
skip ~31/32 of them per navigation call. Each sector sub-assembly
contains ~241 daughters (1-2 steel structures + 10×12×2 tiles).

Navigation cost: 119-139 µs/call → expected ~1-3 µs/call (~50× speedup).

Key mapping:
- phi_to_sector lambda: normalizes phi in [0,2π) → sector index [0..31]
- Normal steel sectors k=0..28: phi = -k*11.25°
- Chimney sectors at +11.25°, 0°, -11.25°: → sectors 1, 0, 31
- End rings placed directly in envelope (span all sectors)
- 10 tiles per phi sector (i_phi wraps correctly at sector 30 boundary)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wdconinc wdconinc force-pushed the barrel_hcal_sectors branch from 77db324 to 9adb46a Compare May 30, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: barrel Mid-rapidity detectors topic: calorimetry topic: materials topic: PID Particle identification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants