LFHCAL: reuse slice volume templates across readout sections#1112
Open
wdconinc wants to merge 2 commits into
Open
LFHCAL: reuse slice volume templates across readout sections#1112wdconinc wants to merge 2 commits into
wdconinc wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the LFHCAL DD4hep geometry construction by reusing slice volume templates across readout sections, reducing the number of unique TGeoVolumes created while preserving per-placement PhysVolID tagging for readout identification.
Changes:
- Reworked 8M/4M module slice construction to pre-build and reuse absorber/filler/scintillator templates instead of creating per-layer volumes.
- Updated scintillator plate helpers (8M/4M) to remove layer/readout parameters and to use fixed foil volume names.
- Moved
layerz/rlayerzID assignment for scintillator to the placed-instance level (module slice placement) rather than per-tower placement.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
All 7 readout sections share identical slice geometry (Polystyrene + Kapton + Steel235 with the same thicknesses). Previously, layer_num was reset to 0 at each readout section boundary, causing createEightM/ FourMModule to create separate TGeoVolume objects for every layer index in every section (1704 unique volumes total). Pre-build one template per slice type (absorber, filler, scintillator) and place it for every layer, setting layerz and rlayerz physVolIDs on each placement. This reduces the unique TGeoVolume count by ~97% (1704 → 57), lowering memory footprint and geometry lookup cost in reconstruction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
caf3d86 to
7145a01
Compare
Add runtime consistency checks in createEightMModule and createFourMModule: store the first-occurrence slice parameters (thickness, material, region, limits, vis) for each template type and throw std::runtime_error if a later slice of the same partID differs. This ensures future XML changes that introduce non-uniform slice geometry fail loudly rather than silently using wrong geometry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
No diffs in https://eic.github.io/epic/pr/1112/capybara/sim_dis_18x275_minQ2=1000_epic_craterlake/index.html (or any of the rec outputs). |
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
The LFHCAL XML defines 7 readout sections (
readoutlayer=0..6), all with identical slice geometry (Polystyrene + Kapton + Steel235 with the same thicknesses). Previously,layer_numwas reset to 0 at each readout section boundary insidecreateDetector, causingcreateEightMModule/createFourMModuleto create separateTGeoVolumeobjects for every layer index in every section — producing 1704 unique volumes when ~57 suffice.Fix
Pre-build one template per slice type (absorber, filler, scintillator assembly) from the first occurrence of each
slice_partID. For all subsequent layers, place the same template. The per-layerlayerzandrlayerzphysVolIDs are set on each placement node (consistent with how DD4hep's VolumeManager collects IDs along the full path).The
createScintillatorPlateEightM/createScintillatorPlateFourMhelper signatures no longer receivelayerID/roLayer; foil volume names are now fixed strings instead of layer-indexed.Impact
Measured locally using
npdet_to_dotandcheckGeometry:checkGeometryonepic_lfhcal_only.xml)The primary benefit is reduced unique volume count — fewer
G4LogicalVolumeobjects during Geant4 initialization, a smallerVolumeManagertree in EICRecon, and lower memory footprint at startup.