Skip to content

Support extras (crack, topgroove, bottom_cylinder, top_cylinder) in SSD config file creation#157

Merged
theHenks merged 8 commits into
legend-exp:mainfrom
giriPHM:refresh-ssd-extras
May 21, 2026
Merged

Support extras (crack, topgroove, bottom_cylinder, top_cylinder) in SSD config file creation#157
theHenks merged 8 commits into
legend-exp:mainfrom
giriPHM:refresh-ssd-extras

Conversation

@giriPHM
Copy link
Copy Markdown
Contributor

@giriPHM giriPHM commented Mar 10, 2026

… Refactored and updated from @apearsonn's work in PR #81. Integrated logic into the modern extension structure and verified compatibility with the current metadata pipeline. I did run the tests as well. All the tests passed. There was only one warning that the test seemed to generate. I have attached the screenshot for the output from the test below.
Screenshot 2026-03-09 at 1 22 39 PM

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 90.24390% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.49%. Comparing base (d2134f7) to head (cfab173).

Files with missing lines Patch % Lines
ext/LegendDataManagementSolidStateDetectorsExt.jl 89.80% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #157      +/-   ##
==========================================
+ Coverage   47.85%   50.49%   +2.64%     
==========================================
  Files          27       27              
  Lines        2466     2533      +67     
==========================================
+ Hits         1180     1279      +99     
+ Misses       1286     1254      -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@oschulz oschulz requested a review from hervasa2 March 10, 2026 13:16
Copy link
Copy Markdown
Contributor

@hervasa2 hervasa2 left a comment

Choose a reason for hiding this comment

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

Thanks for the initiative! There are many changes that undo recent updates which have nothing to do with the additional geometry support. Please undo these and address the ignoring the Li thickness comment. My recommendation is use something with exaggerated n_thickness and plot to check like so:

sim = Simulation{T}(LegendData, meta, xtal_meta, verbose = true, HPGeEnvironment("LAr", 87u"K"), n_thickness = 5u"mm");
plot(sim.detector, st = :slice)

Could you also please include a test of each new feature, showing a snippet of the metadata and the resulting plot (using exaggerated n_thickness). Also test one detector with no "extras" to see that the old functionality still works.

Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support in the SolidStateDetectors extension for additional LEGEND SSD geometry “extras” (bottom cylinder, top groove, crack) when generating SSD configuration dictionaries from metadata, refactoring logic previously explored in PR #81 to fit the current extension/metadata pipeline.

Changes:

  • Add handling for geometry.extra.bottom_cylinder and geometry.extra.topgroove in the generated semiconductor/contact geometries.
  • Add handling for geometry.extra.crack, including forcing 3D simulation (phi to 360) and cutting the crack volume out of semiconductor and mantle contact geometry.
  • Update phi axis boundary behavior to "periodic" to support 3D cases.

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

Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
@theHenks theHenks added the enhancement New feature or request label Mar 19, 2026
@fhagemann
Copy link
Copy Markdown
Contributor

This should also be extended to include support for top_cylinder for V06649M (see #159 and https://github.com/legend-exp/legend-detectors/pull/74)

@giriPHM
Copy link
Copy Markdown
Contributor Author

giriPHM commented Mar 25, 2026

This should also be extended to include support for top_cylinder for V06649M (see #159 and legend-exp/legend-detectors#74)

Thanks for pointing that out

@giriPHM
Copy link
Copy Markdown
Contributor Author

giriPHM commented Apr 3, 2026

I have used

sim_2 = Simulation{T}(LegendData, meta, xtal_meta, verbose = true, HPGeEnvironment("LAr", 87u"K"), n_thickness = 2u"mm");
plot(sim_2.detector, st = :slice, legend=:topright, title="$det")

The top taper for V02160A and V02162B might look a bit weird, but that is just because the angle is small and the height of the taper is scaled by tangent of the angle.

@giriPHM
Copy link
Copy Markdown
Contributor Author

giriPHM commented Apr 3, 2026

Since the n+ contact geometry of V02162B (one with the top groove) looked a bit weird, I went back and made some fixes to the geometry. Now, I think it looks good. Since the top groove height is just 2.7 mm, I have used n_thickness of 1.5 mm to see things better.

@theHenks
Copy link
Copy Markdown
Contributor

theHenks commented Apr 3, 2026

@giriPHM Thank you for your work here. Are you certain that all this metadata is public? Since we are sharing this in a public repository, I recommend double-checking what can be shown and what cannot to ensure we do not release any confidential detector data.

@giriPHM
Copy link
Copy Markdown
Contributor Author

giriPHM commented Apr 3, 2026

@giriPHM Thank you for your work here. Are you certain that all this metadata is public? Since we are sharing this in a public repository, I recommend double-checking what can be shown and what cannot to ensure we do not release any confidential detector data.

That is a good point, Florian. I was posting those snippets in response to David's comment regarding the test of the features. But I will remove that information till we figure this issue out!

@giriPHM
Copy link
Copy Markdown
Contributor Author

giriPHM commented Apr 7, 2026

@Copilot. Can you suggest some tests for the added features to address the patch coverage?

@giriPHM
Copy link
Copy Markdown
Contributor Author

giriPHM commented Apr 21, 2026

Add top cylinder feature with tests; fix borehole depth parameter in active_volume.jl

  • Implemented top cylinder as a new geometry feature
  • Added corresponding tests for extra features functionality
  • Fixed bug in active_volume.jl where borehole depth was incorrectly using radius parameter

@hervasa2 hervasa2 force-pushed the refresh-ssd-extras branch from e61c82d to 36a3894 Compare April 29, 2026 13:55
@hervasa2 hervasa2 dismissed their stale review April 29, 2026 13:57

outdated

@hervasa2 hervasa2 self-requested a review April 29, 2026 13:57
@hervasa2
Copy link
Copy Markdown
Contributor

  • Refactored mantle_contact implementation to include extras and remove redundancies. The result is much more compact and maintainable.

  • Taper mantles are now handled correctly with a dedicated function.

  • Added tests for each extra. This involves creating one base detector and removing the different extras from the base volume. A point from the removed volume is tested to be in the original detector but outside of the modified volume. An additional test is added to check that the active volume of the modified volume is smaller than the base detector active volume.

  • Base:

Screenshot 2026-04-29 at 16 02 43
  • Top cylinder:
Screenshot 2026-04-29 at 14 43 03
  • Bottom cylinder:
Screenshot 2026-04-29 at 14 43 44
  • Top groove:
Screenshot 2026-04-29 at 14 47 03
  • Crack:
Screenshot 2026-04-29 at 14 47 37

@hervasa2 hervasa2 requested review from fhagemann and removed request for hervasa2 April 29, 2026 14:15
@fhagemann
Copy link
Copy Markdown
Contributor

In order to review this conceptually (without looking at every line of code): can you also attach picture for the „normal“ mantle taper case. Just to make sure that the refactoring did not break anything? :)

@hervasa2
Copy link
Copy Markdown
Contributor

hervasa2 commented Apr 30, 2026

See exaggerated "normal" mantle taper cases without extras:

  • IC
image
  • COAX
image
  • PPC
image
  • BEGe
image

Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread ext/LegendDataManagementSolidStateDetectorsExt.jl Outdated
Comment thread test/test_config_files/V00000A.yaml Outdated
Comment thread test/test_ext_ssd.jl
Copy link
Copy Markdown
Contributor

@fhagemann fhagemann left a comment

Choose a reason for hiding this comment

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

Looks good! One final comment

Comment thread src/active_volume.jl
@fhagemann fhagemann changed the title feat: add support for cracks, topgrooves, and bottom_cylinder in SSD.… Support extras (crack, topgroove, bottom_cylinder, top_cylinder) in SSD config file creation May 5, 2026
@fhagemann
Copy link
Copy Markdown
Contributor

I guess someone (@theHenks / @oschulz ) can merge this now :)

@theHenks theHenks merged commit ec72371 into legend-exp:main May 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants