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

DDCore: move create_segmentation to header file so it can be used outside of DD4hep #817

Merged
merged 3 commits into from
Apr 27, 2021

Conversation

andresailer
Copy link
Member

@andresailer andresailer commented Apr 26, 2021

@MarkusFrankATcernch as far as I can tell this is needed to be able to do

#include "DD4hep/detail/SegmentationsInterna.h"
//....
DECLARE_SEGMENTATION(GridDRcalo, create_segmentation<dd4hep::DDSegmentation::GridDRcalo>)

for #815
So that the segmentation_constructor is created and part of the components file?

BEGINRELEASENOTES

  • Move create_segmentation to DDCore/include/DD4hep/detail/SegmentationsInterna.h to allow segmentation creation in other libraries
  • Removed REGISTER_SEGMENTATION macro and DDSegmentation::SegmentationFactory class because they are obsolete. Use DECLARE_SEGMENTATION to create a plugin entry for segmentations.

ENDRELEASENOTES

@MarkusFrankATcernch
Copy link
Contributor

DECLARE_SEGMENTATION creates the factory entry in the library.
The 'list_components' opens the library during make, reads all these entries
and writes the names into the components file.
If you do not have this entry, the factory mechanism is broken.

@andresailer
Copy link
Member Author

Thanks for the confirmation!

@petricm
Copy link

petricm commented Apr 26, 2021

If users are calling detail/SegmentationsInterna.h and this is necessary to create a segmentation then this header should not be in detail.

@andresailer
Copy link
Member Author

Yeah, I kind of agree :)
I will try re-arranging so that the necessary pieces get pulled in via Segmentation.h or something like this?

@andresailer
Copy link
Member Author

I re-arranged and removed some things in DDSegmentation that wasn't needed as far as I could tell.

I ran into some weird namespace issue, so I added DD4hep/Factories.h to all the Segmentation and replaced the REGISTER_SEGMENTATION macro with DECLARE_SEGMENTATION.
Removed some stuff for the obsolete REGISTER_SEGMENTATION
Removed the file with the now obsolete DECLARE_SEGMENTATION stuff

@andresailer
Copy link
Member Author

Moving the DECLARE_SEGMENTATION to the individual segmentations leads these calls to be part of DDCore, which means any plugin linking against DDCore has these in their components file. Will bring back the ReadoutSegmentations.cpp file in plugin and leave the DECLARE_SEGMENTATION calls commented for people creating their own segmentations, in which case they probably create their own plugin in any case and it should be OK.

@vvolkl
Copy link
Contributor

vvolkl commented May 11, 2021

@andresailer so user code should also just replace REGISTER_SEGMENTATION with DECLARE_SEGMENTATION? Could you add a note to the Release Notes?

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

Successfully merging this pull request may close these issues.

geoDisplay error: Segmentation: FAILED to create segmentation: GridDRcalo
4 participants