Skip to content

Integrate detector hits with larsoft#2278

Open
sethrj wants to merge 46 commits intoceleritas-project:developfrom
sethrj:larsoft-detector-hit
Open

Integrate detector hits with larsoft#2278
sethrj wants to merge 46 commits intoceleritas-project:developfrom
sethrj:larsoft-detector-hit

Conversation

@sethrj
Copy link
Member

@sethrj sethrj commented Feb 23, 2026

This sets up detectors and a hit callback for LArSoft integration, and successfully records realistic BackTrackerRecord (BTR) results from the standalone test. It is not yet tested as part of a postprocessing art workflow (due to missing optical data in the DUNE inputs) and is known not to work as part of a full sim→ionandscint→fullsim workflow due to the use of an extant Geant4 physics setup for the EM stage.

  • Add a GeantSetup option to define detectors by name that get picked up during GeantGeo construction; for LArSoft this is set to {"PhotonDetector"} and propagated through the OpticalStandaloneInput
  • Add primary to detector hit
  • Share volume params through optical core params (@amandalund )
  • Implement find_volume_instance_at for vecgeom (@amandalund )
  • Map a detector coordinate vector to volume ID + channel during LarStandaloneRunner construction
  • Construct and call back to OBTRHelper in LarStandaloneRunner, and convert back to OBTR at end of event
  • Save and output the actual LArSoft version we built against
  • Add test code

I ran the test successfully against v10_14_01 and v10_20_01 (which both, I think, have the same data objects).

@sethrj sethrj added the app Application front ends label Feb 23, 2026
@github-actions
Copy link

github-actions bot commented Feb 23, 2026

Test summary

 5 950 files   9 578 suites   21m 16s ⏱️
 2 211 tests  2 170 ✅  41 💤 0 ❌
32 884 runs  32 745 ✅ 139 💤 0 ❌

Results for commit 886a3cd.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 73.68421% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.23%. Comparing base (d4ab396) to head (886a3cd).

Files with missing lines Patch % Lines
src/celeritas/ext/GeantSetup.cc 31.25% 10 Missing and 1 partial ⚠️
.../celeritas/ext/detail/GeantSurfacePhysicsLoader.cc 20.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2278      +/-   ##
===========================================
- Coverage    87.24%   87.23%   -0.02%     
===========================================
  Files         1357     1357              
  Lines        43246    43292      +46     
  Branches     13189    13212      +23     
===========================================
+ Hits         37731    37766      +35     
- Misses        4307     4315       +8     
- Partials      1208     1211       +3     
Files with missing lines Coverage Δ
src/celeritas/ext/GeantSetup.hh 100.00% <ø> (ø)
.../celeritas/ext/detail/GeantSurfacePhysicsHelper.hh 68.00% <ø> (+1.33%) ⬆️
src/celeritas/g4/DetectorConstruction.cc 100.00% <100.00%> (ø)
src/celeritas/inp/StandaloneInput.hh 50.00% <ø> (ø)
src/celeritas/optical/CoreParams.cc 91.66% <100.00%> (+0.11%) ⬆️
src/celeritas/optical/CoreParams.hh 94.73% <ø> (ø)
src/celeritas/optical/DetectorData.hh 100.00% <100.00%> (ø)
src/celeritas/optical/action/DetectorAction.hh 100.00% <ø> (ø)
...eleritas/optical/action/detail/DetectorExecutor.hh 90.47% <100.00%> (+0.47%) ⬆️
src/celeritas/optical/gen/GeneratorData.hh 96.42% <100.00%> (ø)
... and 8 more

... and 4 files with indirect coverage changes

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

@sethrj sethrj force-pushed the larsoft-detector-hit branch from 156b4ca to 21dc62c Compare March 2, 2026 13:22
@sethrj sethrj force-pushed the larsoft-detector-hit branch from 3cc3221 to 9774646 Compare March 3, 2026 00:16
@sethrj sethrj marked this pull request as ready for review March 3, 2026 00:16
@sethrj
Copy link
Member Author

sethrj commented Mar 7, 2026

@stognini Could you review? Thanks!

Copy link
Member

@stognini stognini left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks!

There are 2 issues I am investigating that we'll fix on a future PR:

  • SimEnergyDeposits outside LAr (and thus crashing the execution)
  • The PDSimAna module (from my branch, which I'll open a PR soon), generates reasonable OpDetBacktrackerRecord plots from PDFastSim but our PDFullSimCeler OBTRs are empty, even though we are transporting photons.

@sethrj
Copy link
Member Author

sethrj commented Mar 10, 2026

@stognini Actually I want to get the dune cryostat geometry working and producing hits before I merge this, so it'll be just another minute.

@sethrj sethrj force-pushed the larsoft-detector-hit branch from 17785a4 to 0fbf69a Compare March 10, 2026 17:05
@sethrj sethrj requested a review from pcanal as a code owner March 11, 2026 15:59
@sethrj sethrj requested a review from hhollenb March 11, 2026 15:59
{
return type != GeneratorType::size_ && num_photons > 0
&& step_length > 0 && material && continuous_edep_fraction >= 0
&& step_length > 0 && continuous_edep_fraction >= 0
Copy link
Member Author

Choose a reason for hiding this comment

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

@amandalund I remembered after I 'fixed' this that we'd previously discussed the pros and cons here: I think the benefits of "ensuring" that the provided data is enough to send to Celeritas outweighs the disadvantage of having an extra check that the input material is valid. (And that would require a check anyway against the range of valid material IDs, which this simple bool cannot do.)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's fine (but we should add a check in the GeneratorExecutor that the material is valid).

// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file larceler/Convert.hh
//! \todo Update with #2223
Copy link
Member Author

Choose a reason for hiding this comment

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

I will delete this now that it's merged in.

*/
void LarStandaloneRunner::hit(SpanCelerHits hits)
{
CELER_LOG(debug) << "Processing " << hits.size() << " hits";
Copy link
Member Author

Choose a reason for hiding this comment

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

Should probably make CELER_LOG_LOCAL? We also don't yet have a plan for managing thread-local state with global celeritas setup.

Comment on lines +250 to +252
Real3 larpos{convert_to_larsoft<LarsoftLen>(h.position[0]),
convert_to_larsoft<LarsoftLen>(h.position[1]),
convert_to_larsoft<LarsoftLen>(h.position[2])};
Copy link
Member Author

Choose a reason for hiding this comment

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

Use quantity_to_array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application front ends enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate with LArSim via standalone plug-in

4 participants