-
Notifications
You must be signed in to change notification settings - Fork 45
Add optical SD check and output in post boundary step #2077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lebuller
wants to merge
14
commits into
celeritas-project:develop
Choose a base branch
from
lebuller:lbu/optical_sd_params
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fb45cf7
Reformat SDParams class to take a inp::Detectors struct instead of a …
4c51da0
Alters SDParams to take CoreGeoParams instead of GeoParamsInterface a…
5f398a6
store loaded model detectors in problem setup for core params
9e4f09c
Adds SDParams to the global core params, as well as to the core param…
943e210
configures detectors from model input in build_core in global test base
41dab25
fix missing const in core param detector accessor and pass dereferenc…
2c414e2
adds SD params to optical params input in problem setup
7f4495a
WIP: Adds accessor for sensitive detector view
6ba0444
Merge branch 'develop' into lbu/optical_sd_params
eb0775a
Remove default constructor for SDParams and instead always pass geome…
f9d8277
Adds outputting particle energy when killing in PostBoundaryExecutor
22e6bf4
Change (decrease) expected step values in optical tests to account fo…
f528303
Change invalid_label to no_label in SDParams test for default empty c…
4953dad
Merge branch 'develop' into lbu/optical_sd_params
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //------------------------------- -*- C++ -*- -------------------------------// | ||
| // Copyright Celeritas contributors: see top-level COPYRIGHT file for details | ||
| // SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
| //---------------------------------------------------------------------------// | ||
| //! \file celeritas/optical/SensitiveDetectorView.hh | ||
| //---------------------------------------------------------------------------// | ||
| #pragma once | ||
|
|
||
| #include "geocel/Types.hh" | ||
| #include "celeritas/Quantities.hh" | ||
| #include "celeritas/user/SDData.hh" | ||
|
|
||
| namespace celeritas | ||
| { | ||
| namespace optical | ||
| { | ||
|
|
||
| class SensitiveDetectorView | ||
| { | ||
| using SDParamsRef = NativeCRef<SDParamsData>; | ||
|
|
||
| public: | ||
| inline CELER_FUNCTION SensitiveDetectorView(SDParamsRef const& params); | ||
|
|
||
| inline auto CELER_FUNCTION detector_id(ImplVolumeId iv_id); | ||
|
|
||
| private: | ||
| SDParamsRef const& params_; | ||
| }; | ||
|
|
||
| CELER_FUNCTION | ||
| SensitiveDetectorView::SensitiveDetectorView(SDParamsRef const& params) | ||
| : params_(params) | ||
| { | ||
| CELER_EXPECT(params_); | ||
| } | ||
|
|
||
| CELER_FUNCTION auto SensitiveDetectorView::detector_id(ImplVolumeId iv_id) | ||
| { | ||
| return params_.detector[iv_id]; | ||
| } | ||
|
|
||
| } // namespace optical | ||
| } // namespace celeritas | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,13 +38,28 @@ struct PostBoundaryExecutor | |
| */ | ||
| CELER_FUNCTION void PostBoundaryExecutor::operator()(CoreTrackView& track) const | ||
| { | ||
| auto geo = track.geometry(); | ||
| auto det_params = track.sensitive_detectors(); | ||
| ImplVolumeId iv_id = geo.impl_volume_id(); | ||
|
|
||
| DetectorId det_id = det_params.detector_id(iv_id); | ||
| if (det_id) | ||
| { | ||
| auto energy = track.particle().energy(); | ||
| // TODO print energy when killing at SD | ||
| std::cout << "Detector hit in volume " << iv_id.get() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't have a cout in a |
||
| << " on detector " << det_id.get() << " with energy " | ||
| << energy.value() << std::endl; | ||
| track.sim().status(TrackStatus::killed); | ||
| } | ||
|
|
||
| auto traverse = track.surface_physics().traversal(); | ||
| CELER_EXPECT(traverse.is_exiting()); | ||
|
|
||
| if (traverse.in_pre_volume()) | ||
| { | ||
| // Re-entrant into the pre-volume | ||
| auto geo = track.geometry(); | ||
| // auto geo = track.geometry(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing commented line |
||
| geo.cross_boundary(); | ||
| if (CELER_UNLIKELY(geo.failed())) | ||
| { | ||
|
|
||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation throughout the file.