HcalBarrel: replace tessellated tiles and end ring with primitive solids - #1108
Open
wdconinc wants to merge 3 commits into
Open
HcalBarrel: replace tessellated tiles and end ring with primitive solids#1108wdconinc wants to merge 3 commits into
wdconinc wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves HCal Barrel Geant4 navigation performance by replacing several tessellated GDML-based solids (scintillator tiles and the steel end ring) with analytically navigable primitive solids built directly in the geometry plugin.
Changes:
- Replace 16 scintillator tile tessellations with
ExtrudedPolygonsolids using hardcoded boundary vertices and z extents. - Replace the end-ring tessellation with a
Tubeannulus minus 32 cylindrical bolt-hole subtractions, and place the two rings via explicit ±z translations. - Remove
file/url/cacheattributes for tile and end-ring elements from the compact XML (material remains).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/BarrelHCalCalorimeter_geo.cpp | Builds tile and end-ring geometry from primitive solids instead of loading tessellated GDML. |
| compact/hcal/barrel_gdml.xml | Removes now-unused GDML download attributes for tiles/end ring while keeping materials. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wdconinc
force-pushed
the
hcal-primitive-solids
branch
2 times, most recently
from
May 23, 2026 16:38
54829eb to
8d18916
Compare
Contributor
wdconinc
force-pushed
the
hcal-primitive-solids
branch
from
May 26, 2026 08:46
2c00a8e to
371cc8b
Compare
wdconinc
force-pushed
the
hcal-primitive-solids
branch
from
May 26, 2026 17:23
371cc8b to
1fca8cc
Compare
Replace 16 scintillator tile tessellations (Tile01-12, CTile09-12) with G4ExtrudedSolid (ExtrudedPolygon) shapes and the barrel end ring tessellation with a G4Tubs annulus minus 32 bolt-hole G4Tubs subtractions. Tessellated solids require the generic navigator to test every facet during boundary crossing, while primitive solids use analytical intersection formulae. Replacing ~1000-vertex tiles (placed >=192 times) and the ~10000-vertex end ring with primitives is expected to give a measurable improvement in navigation speed. Tile shapes (ExtrudedPolygon): - Each tile is a flat 7 mm slab with an 8- or 9-vertex boundary polygon. - Polygon vertex coordinates were extracted from the original tessellation GDML files (stored in eic/epic-data) by tracing boundary edges on the top face. Tile01 retains its non-zero z offset (z: 1.921-8.921 mm) that was baked into the tessellation; all other tiles span +/-3.5 mm. End ring (Tube - 32 x Tube): - Annulus: inner radius 1980.15 mm, outer radius 2619.85 mm, half-length 19.304 mm. - 32 bolt holes: radius 152.4 mm, centres at R = 2293.86069 mm, evenly spaced in phi (11.25 deg pitch). - Previously placed with RotationY(180 deg) to produce the negative-z copy from a shape with z baked in; now placed at +/-3178.406 mm with no rotation (the centred Tube is already reflection-symmetric in z). The GDML file/url/cache attributes for the tiles and end ring are removed from compact/hcal/barrel_gdml.xml; material attributes are retained. The steel sector and chimney-sector tessellations are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
er_gdmlfile -> end_ring
tile{N}_gdmlfile -> tile{N}
ctile{N}_gdmlfile -> ctile{N}
These elements no longer reference GDML files; their geometry
is defined inline via <shape> and <dimensions> children.
sec_gdmlfile and csec_gdmlfile are unchanged as they still load
tessellated steel sector shapes from GDML.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DD4hep's Tube has no (name, rmin, rmax, dz) constructor. The 4-argument template is (rmin, rmax, dz, endPhi). Passing a char const* as the first argument caused the string to be evaluated as rmin, and an empty string "" triggered dd4hep::Evaluator 'blank string detected'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
wdconinc
force-pushed
the
hcal-primitive-solids
branch
from
June 6, 2026 21:15
1fca8cc to
da39251
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace 16 scintillator-tile tessellations and the barrel end-ring tessellation in the HCal Barrel geometry plugin with equivalent Geant4 primitive solids, and use daughter-volume placements for the end-ring bolt holes so that Geant4's smart voxelisation applies.
All geometry dimensions are now specified in the compact XML file (
compact/hcal/barrel_gdml.xml) rather than hardcoded in the plugin. No hardcoded data tables remain in the C++ source.Motivation
Tessellated solids force the Geant4 navigator to test every triangle facet at each boundary crossing. The tiles contain several hundred to ~1000 triangles each and are placed ≥192 times per event (12 η layers × 16 φ sectors); the end ring had 9844 vertices and 19816 triangles. Replacing them with primitives removes the facet-loop overhead entirely. For the bolt holes an additional optimisation is possible: using daughter-volume placements instead of a Boolean-subtraction chain lets Geant4's
SmartVoxelHeadervoxelise the 32 holes, giving O(log 32) boundary lookup instead of traversing a depth-32 CSG tree.Changes
Scintillator tiles →
ExtrudedPolygon(G4ExtrudedSolid)All 16 tile shapes (Tile01–Tile12, CTile09–CTile12) are flat 7 mm slabs with an 8–9 vertex boundary polygon. Each tile element in the compact XML now carries a
<shape type="Xtru">child with<twoDimVertex>and<section>sub-elements (following GDML conventions). The plugin reads and constructs anExtrudedPolygondirectly from those elements — no GDML file download is required at runtime.Tile01 retains the non-zero z offset (z: 1.9212–8.9212 mm) that was baked into the original tessellation.
End ring →
Tubemother + 32 airTubedaughtersThe end ring element in the compact XML now carries a
<dimensions>child with attributesrinner,router,zhalf,zcenter,nholes,rhole, andrhole_ctr(all in mm). The plugin reads these and constructs a steel annulus (Tube) with 32 evenly-spaced air-filled bolt-hole daughters.Rather than building a depth-32 Boolean subtraction chain — which Geant4 cannot voxelise — the holes are represented as air-filled daughter
Tubevolumes placed inside the steel annulus mother. A track inside a daughter sees air, which is geometrically equivalent to a hole. Geant4'sSmartVoxelHeaderthen voxelises the 32 daughters, reducing per-boundary work from O(32) (CSG tree) to O(log 32).The two ring copies are placed at z = ±
zcenterwith a simple translation (previouslyRotationY(180°)was used on a shape with z baked in from the tessellation).Compact XML
file/url/cacheattributes removed from tile and end-ring elements. Each tile now has a<shape type="Xtru">child; the end ring has a<dimensions>child.materialattributes are retained. The sector and chimney-sector GDML files are unchanged.Not changed
The steel barrel sector and chimney-sector tessellations (18–21 distinct Z levels, varying XY cross-sections) are left as tessellations pending benchmarking to confirm they are worth the additional implementation effort.