-
Notifications
You must be signed in to change notification settings - Fork 100
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
feat: convert several DDRec constructors to use const Detector&
#1148
Merged
Conversation
This file contains 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
andresailer
reviewed
Jul 26, 2023
wdconinc
force-pushed
the
ddrec-const-detector
branch
from
July 26, 2023 18:17
2958ffe
to
1ae088d
Compare
7 tasks
github-merge-queue bot
pushed a commit
to eic/EICrecon
that referenced
this pull request
Oct 5, 2023
… const pointers (#1045) ### Briefly, what does this PR introduce? While looking into #1032, #1035, #1036 I started realizing two things: - cell ID position converters are created by algorithms from geometry instead of doing this once in the service, - there is no const protection in the detector pointers passed to algorithms (i.e. an algorithm could change geometry), - there is no protection against null pointers being passed from geometry. The first two points are related since the interface for creating a cell ID position converter requires a non-const detector (see also AIDASoft/DD4hep#1148). This PR centralizes the creation of cell ID position converters, clarifies ownership through unique_ptrs, and makes sure no null pointers are passed to the algorithms. In places where the constructor gets the const not_null pointer, we can also impose this in the class on the relevant member variable. ### What kind of change does this PR introduce? - [x] Bug fix (issue: avoid creation of cell ID position converters in algorithms) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [x] Changes have been communicated to collaborators: - @simonge reordered MatrixTransferStatic init arguments - @c-dilks @chchatte92 this also affects RichGeo_service etc. ### Does this PR introduce breaking changes? What changes might users need to make to their code? Yes, now requires GSL (which has always been in eic-shell and is a requirement). ### Does this PR change default behavior? No. --------- Co-authored-by: Christopher Dilks <c-dilks@users.noreply.github.com> Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
@wdconinc Wouter, can we merge this PR ? |
Ah, yeah, I didn't realize this was marked as draft still. |
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.
This started as an attempt to use a
CellIDPositionConverter
in a class that only has access to aconst Detector&
, but then turned in to figuring out a few other constructors where we can add const-ness.The main hurdle is addressed in 4c26c03, where the former approach was returning the map entry
m_detectorTypes[type]
whenevertype
is not a valid key, creating a new entry in the process. This doesn't work when const.I changed this to adding an empty key entry when
m_detectorTypes
is first filled,m_detectorTypes[""] = {}
, and this one can be returned whentype
is not a valid key, without violating const-ness.Potential implications
If a sensitive detector doesn't specify a type, then
type()
returns""
too,There doesn't seem to be any guards (that I could find) against someone defining a sensitive detector with an empty string as type. Feedback welcome. I'm filing this as draft first.
BEGINRELEASENOTES
const Detector&
instead ofDetector&
ENDRELEASENOTES