Skip to content
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: allow for reordered DD4hep_service geometry arguments #1035

Conversation

wdconinc
Copy link
Contributor

@wdconinc wdconinc commented Oct 2, 2023

Briefly, what does this PR introduce?

This fixes the DD4hep_service to allow querying the geometry in any order, and avoids race conditions in the detector() and cellIDPositionConverter() calls.

TODO:

What kind of change does this PR introduce?

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

No.

Does this PR change default behavior?

No.

@wdconinc
Copy link
Contributor Author

wdconinc commented Oct 2, 2023

Hopefully one of the CI jobs will fail. Then I'll merge the fix, and then hopefully CI will not fail anymore.

@wdconinc
Copy link
Contributor Author

wdconinc commented Oct 2, 2023

Hopefully one of the CI jobs will fail.

Seems like it's not going to fail since it requires on specific ordering and only calling specific algorithms.

@wdconinc wdconinc requested a review from simonge October 2, 2023 15:57
@wdconinc
Copy link
Contributor Author

wdconinc commented Oct 2, 2023

@simonge This change should fix it. I tested with

eicrecon -Ppodio:output_file=rec_dis_18x275_minQ2=1000_brycecanyon.edm4eic.root -Ppodio:output_include_collections=ForwardOffMRecParticles sim_dis_18x275_minQ2=1000_brycecanyon.edm4hep.root

and had no more failures.

@wdconinc wdconinc temporarily deployed to github-pages October 2, 2023 16:43 — with GitHub Actions Inactive
@simonge
Copy link
Contributor

simonge commented Oct 2, 2023

Thanks @wdconinc, trying to test this but today a bug loading the geometry xml has appeared.

simonge
simonge previously approved these changes Oct 3, 2023
Copy link
Contributor

@simonge simonge left a comment

Choose a reason for hiding this comment

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

Works well, thanks

@wdconinc
Copy link
Contributor Author

wdconinc commented Oct 3, 2023

Reverted the reordering that was intended to trigger the bug. Needs new approval.

@wdconinc wdconinc enabled auto-merge October 3, 2023 13:13
@wdconinc wdconinc added this pull request to the merge queue Oct 3, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 3, 2023
@wdconinc wdconinc added this pull request to the merge queue Oct 3, 2023
@wdconinc wdconinc temporarily deployed to github-pages October 3, 2023 15:28 — with GitHub Actions Inactive
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 3, 2023
@wdconinc wdconinc added this pull request to the merge queue Oct 3, 2023
Merged via the queue into main with commit 3329095 Oct 3, 2023
94 checks passed
@wdconinc wdconinc deleted the 1032-order-of-geometry-arguments-from-dd4hep_service-in-algorithm-init-matters branch October 3, 2023 16:28
github-merge-queue bot pushed a commit 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order of geometry arguments from DD4hep_service in algorithm init matters
3 participants