-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix: use unique_ptr for geometry in DD4hep_service, hand out not_null const pointers #1045
Conversation
5468569
to
ad97536
Compare
ad97536
to
83d2993
Compare
Do we really want to smear non-null check across our interfaces? Is it not enough to just ensure that the geometry service doesn't return null. |
It's heavy on notation, I admit, but the requirement for a not_null pointer is in this case imposed by the algorithms, not by the service. The DD4hep_service can satisfy the demand by promising to return a not_null pointer. Putting the requirement in the algorithms makes clear to anyone working in those algorithms that |
@veprbl I removed the gsl::not_null on all algorithms init calls in b9b97f4 This doesn't really add much utility on the init calls if we can't set it on the class members. I've kept it in DD4hepBfield since there we construct with the detector geometry provided as constructor argument (similar to RichGeo_services). |
The dRICH benchmarks look okay with this PR. |
Yes. That was my point, that it's probably the return values where gsl::not_null makes sense (I don't claim any deep philosophical understanding of GSL, though). |
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
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.
Diff LGTM, capybara happy
Briefly, what does this PR introduce?
While looking into #1032, #1035, #1036 I started realizing two things:
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?
Please check if this PR fulfills the following:
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.