From 972be5225bad00aa59c06ecd0ac9cb593bc04c92 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 22 Dec 2023 10:34:09 -0600 Subject: [PATCH] fix: forward compatibility with Acts-v31 (#1188) ### Briefly, what does this PR introduce? ~~Thanks to C++20 we can now do templated lambdas which don't require syntactic validity of all code paths. That makes forward/backward compatibility across Acts versions easier with constexpr lambdas.~~ Ifdefs on defined Acts major versions allow us to bypass code blocks that are not compilable or parsable under different versions of Acts. Ref: https://github.com/acts-project/acts/pull/2649 ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] New feature (issue: Acts v31 compatibility) - [ ] Documentation update - [ ] Other: __ ### 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. --------- Co-authored-by: Dmitry Kalinkin --- cmake/jana_plugin.cmake | 6 ++++++ src/algorithms/tracking/IterativeVertexFinder.cc | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/jana_plugin.cmake b/cmake/jana_plugin.cmake index c9fcf98b4a..5e0baa0a34 100644 --- a/cmake/jana_plugin.cmake +++ b/cmake/jana_plugin.cmake @@ -248,6 +248,12 @@ macro(plugin_add_acts _name) ActsPluginDD4hep ${ActsCore_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}ActsExamplesFramework${CMAKE_SHARED_LIBRARY_SUFFIX} ) + if(${_name}_WITH_LIBRARY) + target_compile_definitions(${PLUGIN_NAME}_library PRIVATE "Acts_VERSION_MAJOR=${Acts_VERSION_MAJOR}") + endif() + if(${_name}_WITH_PLUGIN) + target_compile_definitions(${PLUGIN_NAME}_plugin PRIVATE "Acts_VERSION_MAJOR=${Acts_VERSION_MAJOR}") + endif() endmacro() diff --git a/src/algorithms/tracking/IterativeVertexFinder.cc b/src/algorithms/tracking/IterativeVertexFinder.cc index ff1c89625b..8ec8876642 100644 --- a/src/algorithms/tracking/IterativeVertexFinder.cc +++ b/src/algorithms/tracking/IterativeVertexFinder.cc @@ -86,11 +86,15 @@ std::unique_ptr eicrecon::IterativeVertexFinder::prod VertexSeeder::Config seederCfg(ipEst); VertexSeeder seeder(seederCfg); // Set up the actual vertex finder - VertexFinder::Config finderCfg(vertexFitter, std::move(linearizer), - std::move(seeder), ipEst); + VertexFinder::Config finderCfg(std::move(vertexFitter), std::move(linearizer), + std::move(seeder), std::move(ipEst)); finderCfg.maxVertices = m_cfg.m_maxVertices; finderCfg.reassignTracksAfterFirstFit = m_cfg.m_reassignTracksAfterFirstFit; + #if Acts_VERSION_MAJOR >= 31 + VertexFinder finder(std::move(finderCfg)); + #else VertexFinder finder(finderCfg); + #endif VertexFinder::State state(*m_BField, m_fieldctx); VertexFinderOptions finderOpts(m_geoctx, m_fieldctx);