From 6fdfb288d3df02ddefe366647c8c92c8cd6a3229 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 15 Nov 2024 14:23:15 -0500 Subject: [PATCH 01/15] JEventSourcePODIO: support future ROOTFrameReader -> ROOTReader rename (#1671) https://github.com/AIDASoft/podio/blob/v01-01/include/podio/ROOTFrameReader.h Writer was addressed in 9f0412c4c8da1f1ca97ee0827d53e36a0e6adfe5 --- src/services/io/podio/JEventSourcePODIO.cc | 4 ++-- src/services/io/podio/JEventSourcePODIO.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/services/io/podio/JEventSourcePODIO.cc b/src/services/io/podio/JEventSourcePODIO.cc index 1d60140ff2..d7260b768d 100644 --- a/src/services/io/podio/JEventSourcePODIO.cc +++ b/src/services/io/podio/JEventSourcePODIO.cc @@ -174,7 +174,7 @@ void JEventSourcePODIO::Open() { //------------------------------------------------------------------------------ void JEventSourcePODIO::Close() { // m_reader.close(); - // TODO: ROOTFrameReader does not appear to have a close() method. + // TODO: ROOTReader does not appear to have a close() method. } @@ -196,7 +196,7 @@ void JEventSourcePODIO::GetEvent(std::shared_ptr event) { Nevents_read = 0; }else{ // m_reader.close(); - // TODO:: ROOTFrameReader does not appear to have a close() method. + // TODO:: ROOTReader does not appear to have a close() method. throw RETURN_STATUS::kNO_MORE_EVENTS; } } diff --git a/src/services/io/podio/JEventSourcePODIO.h b/src/services/io/podio/JEventSourcePODIO.h index 21dc45c999..ba7c45a94d 100644 --- a/src/services/io/podio/JEventSourcePODIO.h +++ b/src/services/io/podio/JEventSourcePODIO.h @@ -8,7 +8,12 @@ #include #include #include +#include +#if podio_VERSION >= PODIO_VERSION(0, 99, 0) +#include +#else #include +#endif #include #include #include @@ -32,7 +37,12 @@ class JEventSourcePODIO : public JEventSource { void PrintCollectionTypeTable(void); protected: +#if podio_VERSION >= PODIO_VERSION(0, 99, 0) + podio::ROOTReader m_reader; +#else podio::ROOTFrameReader m_reader; +#endif + size_t Nevents_in_file = 0; size_t Nevents_read = 0; From 0fcd81f1888fd3148b1a8e1939086d2592d2184b Mon Sep 17 00:00:00 2001 From: Barak Schmookler Date: Fri, 15 Nov 2024 13:46:01 -0600 Subject: [PATCH 02/15] Added deltaPhiMax parameter for Seed Finder (#1673) ### Briefly, what does this PR introduce? Following up on the presentation yesterday ([here](https://indico.bnl.gov/event/25559/contributions/99383/attachments/58553/100546/tracking_111424.pdf)) on seeding inefficiencies at low momentum, I found that the Acts Orthogonal seeder does a comparison between the phi values of the middle/lower and middle/upper space points. By default, this parameter is set to 0.085 Rad: https://github.com/acts-project/acts/blob/f6ed9013e76120137ae456583a04b554d88d9452/Core/include/Acts/Seeding/SeedFinderOrthogonalConfig.hpp#L79 This is checked, for example, here: https://github.com/acts-project/acts/blob/f6ed9013e76120137ae456583a04b554d88d9452/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp#L82-L86 And this check is done prior to other doublet or triplet checks on the potential seed triplet. This PR adds this deltaPhiMax parameter as an additional parameter in the seed finder. Right now, I keep the parameter at the default value in the configuration file. The parameter can be adjusted on the command line by doing this, for example: `-Ptracking:CentralTrackSeedingResults:deltaPhiMax=0.25` This will allow the parameter to be studied with single-particle and DIS events. A quick test with negative muons with total momentum of 500 MeV/c and eta = [-4,4] shows the following. With the default parameter, we see this for 10 events: ``` root [1] events->Scan("CentralTrackSeedingResults.qOverP:CentralCKFTrackParametersUnfiltered.qOverP:CentralCKFTrackParameters.qOverP") *********************************************************** * Row * Instance * CentralTr * CentralCK * CentralCK * *********************************************************** * 0 * 0 * -2.017637 * -1.997553 * -1.997553 * * 0 * 1 * -2.050001 * -1.997604 * * * 1 * 0 * * * * * 2 * 0 * -2.155712 * -2.155881 * * * 3 * 0 * * * * * 4 * 0 * * * * * 5 * 0 * -1.975466 * -1.992832 * -1.992857 * * 5 * 1 * * -1.992857 * * * 6 * 0 * * * * * 7 * 0 * * * * * 8 * 0 * * * * * 9 * 0 * -1.977929 * -1.975284 * -1.975284 * *********************************************************** ``` Seeds are formed in 4 events. If we set deltaPhiMax=0.25, we get ``` root [4] events->Scan("CentralTrackSeedingResults.qOverP:CentralCKFTrackParametersUnfiltered.qOverP:CentralCKFTrackParameters.qOverP") *********************************************************** * Row * Instance * CentralTr * CentralCK * CentralCK * *********************************************************** * 0 * 0 * -2.017637 * -1.997553 * -1.997553 * * 0 * 1 * -2.017606 * -1.997554 * * * 1 * 0 * * * * * 2 * 0 * -1.948913 * -1.945051 * * * 2 * 1 * -2.023722 * -2.024211 * * * 3 * 0 * * * * * 4 * 0 * -1.834852 * -2.038357 * -2.038357 * * 5 * 0 * -1.985146 * -1.992834 * -1.992861 * * 5 * 1 * -1.991421 * -1.992859 * * * 5 * 2 * * -1.992836 * * * 5 * 3 * * -1.992861 * * * 6 * 0 * * * * * 7 * 0 * -1.932271 * -1.938517 * * * 8 * 0 * -1.900319 * -1.974888 * * * 8 * 1 * -1.956748 * -1.954931 * * * 9 * 0 * -1.977929 * -1.975284 * -1.975284 * *********************************************************** ``` Seeds are formed in 7 events. Some of these events fail to produce tracks that survive the ambiguity solver, which needs to be studied. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [x] Tests for the changes have been added - [ ] Documentation has been added / updated - [x] Changes have been communicated to collaborators @Jeet-bhai ### 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: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/algorithms/tracking/OrthogonalTrackSeedingConfig.h | 2 ++ src/algorithms/tracking/TrackSeeding.cc | 1 + src/global/tracking/TrackSeeding_factory.h | 1 + 3 files changed, 4 insertions(+) diff --git a/src/algorithms/tracking/OrthogonalTrackSeedingConfig.h b/src/algorithms/tracking/OrthogonalTrackSeedingConfig.h index 048be3973a..5339977846 100644 --- a/src/algorithms/tracking/OrthogonalTrackSeedingConfig.h +++ b/src/algorithms/tracking/OrthogonalTrackSeedingConfig.h @@ -38,6 +38,8 @@ namespace eicrecon { float rMinMiddle = 20. * Acts::UnitConstants::mm; // Middle spacepoint must fall between these two radii float rMaxMiddle = 400. * Acts::UnitConstants::mm; + float deltaPhiMax = 0.085; // Max difference in phi between middle and either top or bottom sp + ////////////////////////////////////////////////////////////////////////// /// SEED FILTER GENERAL PARAMETERS /// The parameters below control the process of filtering out seeds before diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index c1094e78c8..3c285d631b 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -104,6 +104,7 @@ void eicrecon::TrackSeeding::configure() { m_seedFinderConfig.impactMax = m_cfg.impactMax; m_seedFinderConfig.rMinMiddle = m_cfg.rMinMiddle; m_seedFinderConfig.rMaxMiddle = m_cfg.rMaxMiddle; + m_seedFinderConfig.deltaPhiMax = m_cfg.deltaPhiMax; m_seedFinderOptions.beamPos = Acts::Vector2(m_cfg.beamPosX, m_cfg.beamPosY); m_seedFinderOptions.bFieldInZ = m_cfg.bFieldInZ; diff --git a/src/global/tracking/TrackSeeding_factory.h b/src/global/tracking/TrackSeeding_factory.h index 181e36cdba..12695bc721 100644 --- a/src/global/tracking/TrackSeeding_factory.h +++ b/src/global/tracking/TrackSeeding_factory.h @@ -50,6 +50,7 @@ class TrackSeeding_factory : ParameterRef m_impactMax {this, "impactMax", config().impactMax, "maximum impact parameter allowed for seeds for Acts::OrthogonalSeedFinder. rMin should be larger than impactMax."}; ParameterRef m_rMinMiddle {this, "rMinMiddle", config().rMinMiddle, "min radius for middle space point for Acts::OrthogonalSeedFinder"}; ParameterRef m_rMaxMiddle {this, "rMaxMiddle", config().rMaxMiddle, "max radius for middle space point for Acts::OrthogonalSeedFinder"}; + ParameterRef m_deltaPhiMax {this, "deltaPhiMax", config().deltaPhiMax, "Max phi difference between middle and top/bottom space point"}; ParameterRef m_locaError {this, "loc_a_Error", config().locaError, "Error on Loc a for Acts::OrthogonalSeedFinder"}; ParameterRef m_locbError {this, "loc_b_Error", config().locbError, "Error on Loc b for Acts::OrthogonalSeedFinder"}; ParameterRef m_phiError {this, "phi_Error", config().phiError, "Error on phi for Acts::OrthogonalSeedFinder"}; From c4f8eb8de6db47ba5372ed049131b0cf41720cb3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:15:05 -0500 Subject: [PATCH 03/15] build(deps): bump platisd/clang-tidy-pr-comments from 1.6.0 to 1.6.1 (#1674) Bumps [platisd/clang-tidy-pr-comments](https://github.com/platisd/clang-tidy-pr-comments) from 1.6.0 to 1.6.1.
Release notes

Sourced from platisd/clang-tidy-pr-comments's releases.

Release 1.6.1

  • Remove jq to avoid missing dependency issues with custom docker setups #90 (fixes #88)
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=platisd/clang-tidy-pr-comments&package-manager=github_actions&previous-version=1.6.0&new-version=1.6.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/linux-eic-shell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 97c0733535..18f8cf43dd 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -210,7 +210,7 @@ jobs: path: clang_tidy_fixes.yml if-no-files-found: ignore - name: Suggest clang-tidy fixes as PR comments - uses: platisd/clang-tidy-pr-comments@v1.6.0 + uses: platisd/clang-tidy-pr-comments@v1.6.1 if: ${{ github.event_name == 'pull_request' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} From b989c1a7ec0638d3acf48dc0f7d37dc813e3f339 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 20 Nov 2024 12:35:25 -0600 Subject: [PATCH 04/15] fix: static_cast(sqrt(...)) to avoid c++-narrowing warning/error (#1675) ### Briefly, what does this PR introduce? This PR should fix the eicrecon build error in https://eicweb.phy.anl.gov/containers/eic_container/-/jobs/4175065/raw (root-6.32.06 upgrade). ### What kind of change does this PR introduce? - [x] Bug fix (issue https://eicweb.phy.anl.gov/containers/eic_container/-/jobs/4175065/raw) - [ ] 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 - [ ] 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 --- src/algorithms/tracking/TrackProjector.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackProjector.cc b/src/algorithms/tracking/TrackProjector.cc index fbf9d8fd47..7a5815dc50 100644 --- a/src/algorithms/tracking/TrackProjector.cc +++ b/src/algorithms/tracking/TrackProjector.cc @@ -153,7 +153,7 @@ namespace eicrecon { static_cast(boundCov(Acts::eBoundPhi, Acts::eBoundQOverP)) }; const float time{static_cast(boundParams(Acts::eBoundTime))}; - const float timeError{sqrt(static_cast(boundCov(Acts::eBoundTime, Acts::eBoundTime)))}; + const float timeError{static_cast(sqrt(boundCov(Acts::eBoundTime, Acts::eBoundTime)))}; const float theta(boundParams[Acts::eBoundTheta]); const float phi(boundParams[Acts::eBoundPhi]); const decltype(edm4eic::TrackPoint::directionError) directionError{ From bfeecb733e8375cf835615e05d4b1cde47326a0c Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 20 Nov 2024 16:53:57 -0500 Subject: [PATCH 05/15] eicrecon: fail on unrecognized parameters (#1670) ### Briefly, what does this PR introduce? This changes default configuration to use jana:parameter_strictness=2. Should help users agains typos in their parameters. On older versions of JANA2 this should be no-op. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] 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 - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? Yes. Users will have to update their invocations if unused parameters are provided, or pass `-Pjana:parameter_strictness=0` argument. ### Does this PR change default behavior? Yes --- .github/workflows/linux-eic-shell.yml | 6 +++--- src/utilities/eicrecon/eicrecon_cli.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 18f8cf43dd..90b70ce7ef 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -566,7 +566,7 @@ jobs: $PWD/install/bin/eicmkplugin.py MyCustomPlugin cmake -S MyCustomPlugin -B MyCustomPlugin/build -DEICrecon_ROOT=$PWD/install -DUSER_PLUGIN_OUTPUT_DIRECTORY=$PWD/install/lib/EICrecon/plugins cmake --build MyCustomPlugin/build -j $(getconf _NPROCESSORS_ONLN) --target install - $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=MyCustomPlugin -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root -Pplugins=dump_flags,janadot -Pdump_flags:json=${{ matrix.particle }}_${{ matrix.detector_config }}_flags.json + $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=MyCustomPlugin -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root eicrecon-test-plugins: runs-on: ubuntu-latest @@ -610,7 +610,7 @@ jobs: export DETECTOR_CONFIG=${DETECTOR}_${{ matrix.detector_config }} export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH export JANA_PLUGIN_PATH=$PWD/install/lib/EICrecon/plugins${JANA_PLUGIN_PATH:+:${JANA_PLUGIN_PATH}} - $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=${{ matrix.test_plugins }} -Phistsfile=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.test_plugins }}.hists.root -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root -Pplugins=dump_flags,janadot -Pdump_flags:json=${{ matrix.particle }}_${{ matrix.detector_config }}_flags.json + $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=${{ matrix.test_plugins }} -Phistsfile=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.test_plugins }}.hists.root -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - uses: actions/upload-artifact@v4 with: name: rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.test_plugins }}.hists.root @@ -663,7 +663,7 @@ jobs: export DETECTOR_CONFIG=${DETECTOR}_${{ matrix.detector_config }} export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH export JANA_PLUGIN_PATH=$PWD/install/lib/EICrecon/plugins${JANA_PLUGIN_PATH:+:${JANA_PLUGIN_PATH}} - $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=${{ matrix.benchmark_plugins }} -Phistsfile=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.benchmark_plugins }}.hists.root -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root -Pplugins=dump_flags,janadot -Pdump_flags:json=${{ matrix.particle }}_${{ matrix.detector_config }}_flags.json + $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=${{ matrix.benchmark_plugins }} -Phistsfile=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.benchmark_plugins }}.hists.root -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - uses: actions/upload-artifact@v4 with: name: rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.benchmark_plugins }}.hists.root diff --git a/src/utilities/eicrecon/eicrecon_cli.cpp b/src/utilities/eicrecon/eicrecon_cli.cpp index 3b3720906a..eaabf77fb3 100644 --- a/src/utilities/eicrecon/eicrecon_cli.cpp +++ b/src/utilities/eicrecon/eicrecon_cli.cpp @@ -410,6 +410,9 @@ int Execute(JApplication* app, UserOptions& options) { app->GetJParameterManager()->SetParameter("jana:parameter_verbosity", 0); } } + if (not app->GetJParameterManager()->Exists("jana:parameter_strictness")) { + app->GetJParameterManager()->SetParameter("jana:parameter_strictness", 2); + } // Run JANA in normal mode try { JSignalHandler::register_handlers(app); From 6eb0941bee8620bf5b052be8ec894ae2e5aa0a47 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Fri, 22 Nov 2024 11:53:24 -0500 Subject: [PATCH 06/15] Podio event source: Use new, exception-free Emit() callback (#1624) ### Briefly, what does this PR introduce? Podio event source uses a new `Emit()` callback which doesn't use exceptions for control flow. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [x] Other: Refactoring ### 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 | 10 ++++++++ src/services/io/podio/JEventSourcePODIO.cc | 29 ++++++++++++++++------ src/services/io/podio/JEventSourcePODIO.h | 10 ++++++++ 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/cmake/jana_plugin.cmake b/cmake/jana_plugin.cmake index b2616f9167..7a10eb253c 100644 --- a/cmake/jana_plugin.cmake +++ b/cmake/jana_plugin.cmake @@ -57,6 +57,11 @@ macro(plugin_add _name) PROPERTIES PREFIX "" OUTPUT_NAME "${_name}" SUFFIX ".so") + target_compile_definitions( + ${PLUGIN_NAME}_plugin + PRIVATE "JANA_VERSION_MAJOR=${JANA_VERSION_MAJOR}" + "JANA_VERSION_MINOR=${JANA_VERSION_MINOR}" + "JANA_VERSION_PATCH=${JANA_VERSION_PATCH}") target_link_libraries(${_name}_plugin ${JANA_LIB} podio::podio podio::podioRootIO spdlog::spdlog fmt::fmt) target_link_libraries(${_name}_plugin Microsoft.GSL::GSL) @@ -82,6 +87,11 @@ macro(plugin_add _name) PROPERTIES PREFIX "lib" OUTPUT_NAME "${_name}" SUFFIX ${suffix}) + target_compile_definitions( + ${PLUGIN_NAME}_library + PRIVATE "JANA_VERSION_MAJOR=${JANA_VERSION_MAJOR}" + "JANA_VERSION_MINOR=${JANA_VERSION_MINOR}" + "JANA_VERSION_PATCH=${JANA_VERSION_PATCH}") target_include_directories( ${_name}_library diff --git a/src/services/io/podio/JEventSourcePODIO.cc b/src/services/io/podio/JEventSourcePODIO.cc index d7260b768d..faf3f4ba3b 100644 --- a/src/services/io/podio/JEventSourcePODIO.cc +++ b/src/services/io/podio/JEventSourcePODIO.cc @@ -69,6 +69,9 @@ struct InsertingVisitor { //------------------------------------------------------------------------------ JEventSourcePODIO::JEventSourcePODIO(std::string resource_name, JApplication* app) : JEventSource(resource_name, app) { SetTypeName(NAME_OF_THIS); // Provide JANA with class name +#if JANA_NEW_CALLBACK_STYLE + SetCallbackStyle(CallbackStyle::ExpertMode); // Use new, exception-free Emit() callback +#endif // Tell JANA that we want it to call the FinishEvent() method. // EnableFinishEvent(); @@ -185,7 +188,12 @@ void JEventSourcePODIO::Close() { /// /// \param event //------------------------------------------------------------------------------ -void JEventSourcePODIO::GetEvent(std::shared_ptr event) { +#if JANA_NEW_CALLBACK_STYLE +JEventSourcePODIO::Result JEventSourcePODIO::Emit(JEvent& event) { +#else +void JEventSourcePODIO::GetEvent(std::shared_ptr _event) { + auto &event = *_event; +#endif /// Calls to GetEvent are synchronized with each other, which means they can /// read and write state on the JEventSource without causing race conditions. @@ -194,10 +202,12 @@ void JEventSourcePODIO::GetEvent(std::shared_ptr event) { if( Nevents_read >= Nevents_in_file ) { if( m_run_forever ){ Nevents_read = 0; - }else{ - // m_reader.close(); - // TODO:: ROOTReader does not appear to have a close() method. + } else { +#if JANA_NEW_CALLBACK_STYLE + return Result::FailureFinished; +#else throw RETURN_STATUS::kNO_MORE_EVENTS; +#endif } } @@ -208,19 +218,22 @@ void JEventSourcePODIO::GetEvent(std::shared_ptr event) { if (event_headers.size() != 1) { throw JException("Bad event headers: Entry %d contains %d items, but 1 expected.", Nevents_read, event_headers.size()); } - event->SetEventNumber(event_headers[0].getEventNumber()); - event->SetRunNumber(event_headers[0].getRunNumber()); + event.SetEventNumber(event_headers[0].getEventNumber()); + event.SetRunNumber(event_headers[0].getRunNumber()); // Insert contents odf frame into JFactories VisitPodioCollection visit; for (const std::string& coll_name : frame->getAvailableCollections()) { const podio::CollectionBase* collection = frame->get(coll_name); - InsertingVisitor visitor(*event, coll_name); + InsertingVisitor visitor(event, coll_name); visit(visitor, *collection); } - event->Insert(frame.release()); // Transfer ownership from unique_ptr to JFactoryT + event.Insert(frame.release()); // Transfer ownership from unique_ptr to JFactoryT Nevents_read += 1; +#if JANA_NEW_CALLBACK_STYLE + return Result::Success; +#endif } //------------------------------------------------------------------------------ diff --git a/src/services/io/podio/JEventSourcePODIO.h b/src/services/io/podio/JEventSourcePODIO.h index ba7c45a94d..6c81ede7fb 100644 --- a/src/services/io/podio/JEventSourcePODIO.h +++ b/src/services/io/podio/JEventSourcePODIO.h @@ -19,6 +19,12 @@ #include #include +#if ((JANA_VERSION_MAJOR == 2) && (JANA_VERSION_MINOR >= 3)) || (JANA_VERSION_MAJOR > 2) +#define JANA_NEW_CALLBACK_STYLE 1 +#else +#define JANA_NEW_CALLBACK_STYLE 0 +#endif + class JEventSourcePODIO : public JEventSource { public: @@ -30,7 +36,11 @@ class JEventSourcePODIO : public JEventSource { void Close() override; +#if JANA_NEW_CALLBACK_STYLE + Result Emit(JEvent& event) override; +#else void GetEvent(std::shared_ptr) override; +#endif static std::string GetDescription(); From 255815bd8dcf19f71c4840877e40f9d0fe255076 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 24 Nov 2024 02:36:58 -0500 Subject: [PATCH 07/15] cmake: move find_package from plugin_add to CMakeLists.txt (#1678) This should bring us below 50 statement limit of cmake-lint. Also, no need to call find_package for every plugin. External plugins already have those looked up in cmake/EICreconConfig.cmake.in. --- CMakeLists.txt | 3 +++ cmake/jana_plugin.cmake | 19 ------------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbfa5d22b8..3983d19d5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,9 @@ find_package(EDM4EIC 5.0 REQUIRED) # spdlog find_package(spdlog REQUIRED) +# fmt +find_package(fmt 9.0.0 REQUIRED) + # Guidelines Support Library find_package(Microsoft.GSL CONFIG) diff --git a/cmake/jana_plugin.cmake b/cmake/jana_plugin.cmake index 7a10eb253c..76d9deee4a 100644 --- a/cmake/jana_plugin.cmake +++ b/cmake/jana_plugin.cmake @@ -23,25 +23,6 @@ macro(plugin_add _name) endif() endforeach() - # Include JANA by default - find_package(JANA REQUIRED) - - # TODO: NWB: This really needs to be a dependency of JANA itself. If we don't - # do this here, CMake will later refuse to accept that podio is indeed a - # dependency of JANA and aggressively reorders my target_link_list to reflect - # this misapprehension. - # https://gitlab.kitware.com/cmake/cmake/blob/v3.13.2/Source/cmComputeLinkDepends.cxx - find_package(podio REQUIRED) - - # include logging by default - find_package(spdlog REQUIRED) - - # include fmt by default - find_package(fmt 9.0.0 REQUIRED) - - # include gsl by default - find_package(Microsoft.GSL CONFIG) - # Define plugin if(${_name}_WITH_PLUGIN) add_library(${_name}_plugin SHARED ${PLUGIN_SOURCES}) From f1d839e7b9ab00c924b2d852632453d1e2f58d80 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 1 Dec 2024 10:32:14 -0500 Subject: [PATCH 08/15] CKFTracking: remove Acts tracks that failed to extrapolate, not just the trajectories (#1677) ### Briefly, what does this PR introduce? This is re-implements #1663 in such a way that downstream algorithms, such as the AmbiguitySolver, that operate on Acts EDM do not see the failed tracks. Resolves: #1672 ### What kind of change does this PR introduce? - [x] Bug fix (issue #1672) - [ ] 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 - [ ] 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 --- src/algorithms/tracking/CKFTracking.cc | 28 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/algorithms/tracking/CKFTracking.cc b/src/algorithms/tracking/CKFTracking.cc index 0f809fff0a..ba07f93561 100644 --- a/src/algorithms/tracking/CKFTracking.cc +++ b/src/algorithms/tracking/CKFTracking.cc @@ -7,6 +7,10 @@ #include #include #include +#if Acts_VERSION_MAJOR >= 32 +#include +#endif +#include #if Acts_VERSION_MAJOR < 36 #include #endif @@ -56,6 +60,7 @@ #include #include #include +#include #include #include "ActsGeometryProvider.h" @@ -260,6 +265,7 @@ namespace eicrecon { #else Acts::TrackAccessor seedNumber("seed"); #endif + std::vector failed_tracks; // Loop over seeds for (std::size_t iseed = 0; iseed < acts_init_trk_params.size(); ++iseed) { @@ -291,6 +297,7 @@ namespace eicrecon { ACTS_ERROR("Extrapolation for seed " << iseed << " and track " << track.index() << " failed with error " << extrapolationResult.error()); + failed_tracks.push_back(track.index()); continue; } #endif @@ -299,6 +306,18 @@ namespace eicrecon { } } + for (Acts::TrackIndexType track_index : std::ranges::reverse_view(failed_tracks)) { + // NOTE This does not remove track states corresponding to the + // removed tracks. Doing so would require implementing some garbage + // collection. We'll just assume no algorithm will access them + // directly. + acts_tracks.removeTrack(track_index); +#if Acts_VERSION_MAJOR < 36 + // Workaround an upstream bug in Acts::VectorTrackContainer::removeTrack_impl() + // https://github.com/acts-project/acts/commit/94cf81f3f1109210b963977e0904516b949b1154 + trackContainer->m_particleHypothesis.erase(trackContainer->m_particleHypothesis.begin() + track_index); +#endif + } // Move track states and track container to const containers // NOTE Using the non-const containers leads to references to @@ -336,15 +355,6 @@ namespace eicrecon { std::optional lastSeed; for (const auto& track : constTracks) { -#if Acts_VERSION_MAJOR >= 34 - // Some B0 tracks fail to extrapolate to the perigee surface. The - // Acts::extrapolateTrackToReferenceSurface will not set - // referenceSurface in that case, which is what we check here. - if (not track.hasReferenceSurface()) { - m_log->warn("Skipping a track not on perigee surface"); - continue; - } -#endif if (!lastSeed) { lastSeed = constSeedNumber(track); } From 0790b178f791417cf432ee53d5994bbdd1f06fc3 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 1 Dec 2024 10:40:56 -0500 Subject: [PATCH 09/15] add ONNXInference algorithm, use it to provide EcalEndcapNClusterParticleIDs (#1618) ### Briefly, what does this PR introduce? image This provides a calorimeter PID capability using ONNXruntime inference engine. The inference algorithm is generalized into a separate algorithm which inputs and outputs `edm4eic::Tensor` values introduced by https://github.com/eic/EDM4eic/pull/96. A set of weights needed to run this are provided in https://github.com/eic/epic-data/pull/22, and is generated using a script from https://github.com/eic/detector_benchmarks/pull/91. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] 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 - [ ] 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? Yes --- .../onnx/CalorimeterParticleIDPostML.cc | 86 ++++++++ .../onnx/CalorimeterParticleIDPostML.h | 44 ++++ .../onnx/CalorimeterParticleIDPreML.cc | 100 +++++++++ .../onnx/CalorimeterParticleIDPreML.h | 39 ++++ src/algorithms/onnx/InclusiveKinematicsML.cc | 2 + src/algorithms/onnx/ONNXInference.cc | 190 ++++++++++++++++++ src/algorithms/onnx/ONNXInference.h | 50 +++++ src/algorithms/onnx/ONNXInferenceConfig.h | 16 ++ src/detectors/EEMC/CMakeLists.txt | 1 + src/detectors/EEMC/EEMC.cc | 59 ++++++ .../CalorimeterParticleIDPostML_factory.h | 45 +++++ .../CalorimeterParticleIDPreML_factory.h | 43 ++++ src/factories/meta/ONNXInference_factory.h | 55 +++++ 13 files changed, 730 insertions(+) create mode 100644 src/algorithms/onnx/CalorimeterParticleIDPostML.cc create mode 100644 src/algorithms/onnx/CalorimeterParticleIDPostML.h create mode 100644 src/algorithms/onnx/CalorimeterParticleIDPreML.cc create mode 100644 src/algorithms/onnx/CalorimeterParticleIDPreML.h create mode 100644 src/algorithms/onnx/ONNXInference.cc create mode 100644 src/algorithms/onnx/ONNXInference.h create mode 100644 src/algorithms/onnx/ONNXInferenceConfig.h create mode 100644 src/factories/calorimetry/CalorimeterParticleIDPostML_factory.h create mode 100644 src/factories/calorimetry/CalorimeterParticleIDPreML_factory.h create mode 100644 src/factories/meta/ONNXInference_factory.h diff --git a/src/algorithms/onnx/CalorimeterParticleIDPostML.cc b/src/algorithms/onnx/CalorimeterParticleIDPostML.cc new file mode 100644 index 0000000000..7c2b2199ab --- /dev/null +++ b/src/algorithms/onnx/CalorimeterParticleIDPostML.cc @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Dmitry Kalinkin + +#include + +#if EDM4EIC_VERSION_MAJOR >= 8 +#include +#include +#include +#include + +#include "CalorimeterParticleIDPostML.h" + +namespace eicrecon { + + void CalorimeterParticleIDPostML::init() { + // Nothing + } + + void CalorimeterParticleIDPostML::process( + const CalorimeterParticleIDPostML::Input& input, + const CalorimeterParticleIDPostML::Output& output) const { + + const auto [in_clusters, in_assocs, prediction_tensors] = input; + auto [out_clusters, out_assocs, out_particle_ids] = output; + + if (prediction_tensors->size() != 1) { + error("Expected to find a single tensor, found {}", prediction_tensors->size()); + throw std::runtime_error(""); + } + edm4eic::Tensor prediction_tensor = (*prediction_tensors)[0]; + + if (prediction_tensor.shape_size() != 2) { + error("Expected tensor rank to be 2, but it is {}", prediction_tensor.shape_size()); + throw std::runtime_error(fmt::format("Expected tensor rank to be 2, but it is {}", prediction_tensor.shape_size())); + } + + if (prediction_tensor.getShape(0) != in_clusters->size()) { + error("Length mismatch between tensor's 0th axis and number of clusters: {} != {}", prediction_tensor.getShape(0), in_clusters->size()); + throw std::runtime_error(fmt::format("Length mismatch between tensor's 0th axis and number of clusters: {} != {}", prediction_tensor.getShape(0), in_clusters->size())); + } + + if (prediction_tensor.getShape(1) != 2) { + error("Expected 2 values per cluster in the output tensor, got {}", prediction_tensor.getShape(0)); + throw std::runtime_error(fmt::format("Expected 2 values per cluster in the output tensor, got {}", prediction_tensor.getShape(0))); + } + + if (prediction_tensor.getElementType() != 1) { // 1 - float + error("Expected a tensor of floats, but element type is {}", prediction_tensor.getElementType()); + throw std::runtime_error(fmt::format("Expected a tensor of floats, but element type is {}", prediction_tensor.getElementType())); + } + + for (size_t cluster_ix = 0; cluster_ix < in_clusters->size(); cluster_ix++) { + edm4eic::Cluster in_cluster = (*in_clusters)[cluster_ix]; + edm4eic::MutableCluster out_cluster = in_cluster.clone(); + out_clusters->push_back(out_cluster); + + float prob_pion = prediction_tensor.getFloatData(cluster_ix * prediction_tensor.getShape(1) + 0); + float prob_electron = prediction_tensor.getFloatData(cluster_ix * prediction_tensor.getShape(1) + 1); + + out_cluster.addToParticleIDs(out_particle_ids->create( + 0, // std::int32_t type + 211, // std::int32_t PDG + 0, // std::int32_t algorithmType + prob_pion // float likelihood + )); + out_cluster.addToParticleIDs(out_particle_ids->create( + 0, // std::int32_t type + 11, // std::int32_t PDG + 0, // std::int32_t algorithmType + prob_electron // float likelihood + )); + + // propagate associations + for (auto in_assoc : *in_assocs) { + if (in_assoc.getRec() == in_cluster) { + auto out_assoc = in_assoc.clone(); + out_assoc.setRec(out_cluster); + out_assocs->push_back(out_assoc); + } + } + } + } + +} // namespace eicrecon +#endif diff --git a/src/algorithms/onnx/CalorimeterParticleIDPostML.h b/src/algorithms/onnx/CalorimeterParticleIDPostML.h new file mode 100644 index 0000000000..dbc2cb93e8 --- /dev/null +++ b/src/algorithms/onnx/CalorimeterParticleIDPostML.h @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Dmitry Kalinkin + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "algorithms/interfaces/WithPodConfig.h" + +namespace eicrecon { + +using CalorimeterParticleIDPostMLAlgorithm = + algorithms::Algorithm< + algorithms::Input, + edm4eic::TensorCollection>, + algorithms::Output, + edm4hep::ParticleIDCollection> + >; + +class CalorimeterParticleIDPostML : public CalorimeterParticleIDPostMLAlgorithm, + public WithPodConfig { + +public: + CalorimeterParticleIDPostML(std::string_view name) + : CalorimeterParticleIDPostMLAlgorithm{name, + {"inputClusters", "inputClusterAssociations", "inputPredictionsTensor"}, + {"outputClusters", "outputClusterAssociations", "outputParticleIDs"}, + ""} { + } + + void init() final; + void process(const Input&, const Output&) const final; +}; + +} // namespace eicrecon diff --git a/src/algorithms/onnx/CalorimeterParticleIDPreML.cc b/src/algorithms/onnx/CalorimeterParticleIDPreML.cc new file mode 100644 index 0000000000..89d2175d7c --- /dev/null +++ b/src/algorithms/onnx/CalorimeterParticleIDPreML.cc @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Dmitry Kalinkin + +#include + +#if EDM4EIC_VERSION_MAJOR >= 8 +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CalorimeterParticleIDPreML.h" + +namespace eicrecon { + + void CalorimeterParticleIDPreML::init() { + // Nothing + } + + void CalorimeterParticleIDPreML::process( + const CalorimeterParticleIDPreML::Input& input, + const CalorimeterParticleIDPreML::Output& output) const { + + const auto [clusters, cluster_assocs] = input; + auto [feature_tensors, target_tensors] = output; + + edm4eic::MutableTensor feature_tensor = feature_tensors->create(); + feature_tensor.addToShape(clusters->size()); + feature_tensor.addToShape(11); // p, E/p, azimuthal, polar, 7 shape parameters + feature_tensor.setElementType(1); // 1 - float + + edm4eic::MutableTensor target_tensor; + if (cluster_assocs) { + target_tensor = target_tensors->create(); + target_tensor.addToShape(clusters->size()); + target_tensor.addToShape(2); // is electron, is hadron + target_tensor.setElementType(7); // 7 - int64 + } + + for (edm4eic::Cluster cluster : *clusters) { + double momentum; + { + // FIXME: use track momentum once matching to tracks becomes available + edm4eic::MCRecoClusterParticleAssociation best_assoc; + for (auto assoc : *cluster_assocs) { + if (assoc.getRec() == cluster) { + if ((not best_assoc.isAvailable()) || (assoc.getWeight() > best_assoc.getWeight())) { + best_assoc = assoc; + } + } + } + if (best_assoc.isAvailable()) { + momentum = edm4hep::utils::magnitude(best_assoc.getSim().getMomentum()); + } else { + warning("Can't find association for cluster. Skipping..."); + continue; + } + } + + feature_tensor.addToFloatData(momentum); + feature_tensor.addToFloatData(cluster.getEnergy() / momentum); + auto pos = cluster.getPosition(); + feature_tensor.addToFloatData(edm4hep::utils::anglePolar(pos)); + feature_tensor.addToFloatData(edm4hep::utils::angleAzimuthal(pos)); + for (int par_ix = 0; par_ix < cluster.shapeParameters_size(); par_ix++) { + feature_tensor.addToFloatData(cluster.getShapeParameters(par_ix)); + } + + if (cluster_assocs) { + edm4eic::MCRecoClusterParticleAssociation best_assoc; + for (auto assoc : *cluster_assocs) { + if (assoc.getRec() == cluster) { + if ((not best_assoc.isAvailable()) || (assoc.getWeight() > best_assoc.getWeight())) { + best_assoc = assoc; + } + } + } + int64_t is_electron = 0, is_pion = 0; + if (best_assoc.isAvailable()) { + is_electron = best_assoc.getSim().getPDG() == 11; + is_pion = best_assoc.getSim().getPDG() != 11; + } + target_tensor.addToInt64Data(is_pion); + target_tensor.addToInt64Data(is_electron); + } + } + + size_t expected_num_entries = feature_tensor.getShape(0) * feature_tensor.getShape(1); + if (feature_tensor.floatData_size() != expected_num_entries) { + error("Inconsistent output tensor shape and element count: {} != {}", feature_tensor.floatData_size(), expected_num_entries); + throw std::runtime_error(fmt::format("Inconsistent output tensor shape and element count: {} != {}", feature_tensor.floatData_size(), expected_num_entries)); + } + } + +} // namespace eicrecon +#endif diff --git a/src/algorithms/onnx/CalorimeterParticleIDPreML.h b/src/algorithms/onnx/CalorimeterParticleIDPreML.h new file mode 100644 index 0000000000..bc4b757eb4 --- /dev/null +++ b/src/algorithms/onnx/CalorimeterParticleIDPreML.h @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Dmitry Kalinkin + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include "algorithms/interfaces/WithPodConfig.h" + +namespace eicrecon { + +using CalorimeterParticleIDPreMLAlgorithm = + algorithms::Algorithm>, + algorithms::Output>>; + +class CalorimeterParticleIDPreML : public CalorimeterParticleIDPreMLAlgorithm, + public WithPodConfig { + +public: + CalorimeterParticleIDPreML(std::string_view name) + : CalorimeterParticleIDPreMLAlgorithm{name, + {"inputClusters"}, + {"outputFeatureTensor", "outputTargetTensor"}, + ""} { + } + + void init() final; + void process(const Input&, const Output&) const final; +}; + +} // namespace eicrecon diff --git a/src/algorithms/onnx/InclusiveKinematicsML.cc b/src/algorithms/onnx/InclusiveKinematicsML.cc index 2483d6c629..091e637eff 100644 --- a/src/algorithms/onnx/InclusiveKinematicsML.cc +++ b/src/algorithms/onnx/InclusiveKinematicsML.cc @@ -34,6 +34,8 @@ namespace eicrecon { // onnxruntime setup m_env = Ort::Env(ORT_LOGGING_LEVEL_WARNING, "inclusive-kinematics-ml"); Ort::SessionOptions session_options; + session_options.SetInterOpNumThreads(1); + session_options.SetIntraOpNumThreads(1); try { m_session = Ort::Session(m_env, m_cfg.modelPath.c_str(), session_options); diff --git a/src/algorithms/onnx/ONNXInference.cc b/src/algorithms/onnx/ONNXInference.cc new file mode 100644 index 0000000000..00665cd852 --- /dev/null +++ b/src/algorithms/onnx/ONNXInference.cc @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2022 - 2024 Wouter Deconinck, Tooba Ali, Dmitry Kalinkin + +#include + +#if EDM4EIC_VERSION_MAJOR >= 8 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ONNXInference.h" + +namespace eicrecon { + + static std::string print_shape(const std::vector& v) { + std::stringstream ss(""); + for (std::size_t i = 0; i < v.size() - 1; i++) ss << v[i] << " x "; + ss << v[v.size() - 1]; + return ss.str(); + } + + static bool check_shape_consistency(const std::vector& shape1, const std::vector& shape2) { + if (shape2.size() != shape1.size()) { + return false; + } + for (size_t ix = 0; ix < shape1.size(); ix++) { + if ((shape1[ix] != -1) && (shape2[ix] != -1) && (shape1[ix] != shape2[ix])) { + return false; + } + } + return true; + } + + template + static Ort::Value iters_to_tensor( + typename std::vector::const_iterator data_begin, + typename std::vector::const_iterator data_end, + std::vector::const_iterator shape_begin, + std::vector::const_iterator shape_end + ) { + Ort::MemoryInfo mem_info = + Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); + auto tensor = Ort::Value::CreateTensor(mem_info, const_cast(&*data_begin), data_end - data_begin, &*shape_begin, shape_end - shape_begin); + return tensor; + } + + void ONNXInference::init() { + // onnxruntime setup + m_env = Ort::Env(ORT_LOGGING_LEVEL_WARNING, name().data()); + Ort::SessionOptions session_options; + session_options.SetInterOpNumThreads(1); + session_options.SetIntraOpNumThreads(1); + try { + m_session = Ort::Session(m_env, m_cfg.modelPath.c_str(), session_options); + Ort::AllocatorWithDefaultOptions allocator; + + // print name/shape of inputs + debug("Input Node Name/Shape:"); + for (std::size_t i = 0; i < m_session.GetInputCount(); i++) { + m_input_names.emplace_back(m_session.GetInputNameAllocated(i, allocator).get()); + m_input_shapes.emplace_back(m_session.GetInputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape()); + debug("\t{} : {}", m_input_names.at(i), print_shape(m_input_shapes.at(i))); + } + + // print name/shape of outputs + debug("Output Node Name/Shape: {}", m_session.GetOutputCount()); + for (std::size_t i = 0; i < m_session.GetOutputCount(); i++) { + m_output_names.emplace_back(m_session.GetOutputNameAllocated(i, allocator).get()); + + if (m_session.GetOutputTypeInfo(i).GetONNXType() != ONNX_TYPE_TENSOR) { + m_output_shapes.emplace_back(); + debug("\t{} : not a tensor", m_output_names.at(i)); + } else { + m_output_shapes.emplace_back(m_session.GetOutputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape()); + debug("\t{} : {}", m_output_names.at(i), print_shape(m_output_shapes.at(i))); + } + } + + // convert names to char* + m_input_names_char.resize(m_input_names.size(), nullptr); + std::transform(std::begin(m_input_names), std::end(m_input_names), std::begin(m_input_names_char), + [&](const std::string& str) { return str.c_str(); }); + m_output_names_char.resize(m_output_names.size(), nullptr); + std::transform(std::begin(m_output_names), std::end(m_output_names), std::begin(m_output_names_char), + [&](const std::string& str) { return str.c_str(); }); + + } catch(const Ort::Exception& exception) { + error("ONNX error {}", exception.what()); + throw; + } + } + + void ONNXInference::process( + const ONNXInference::Input& input, + const ONNXInference::Output& output) const { + + const auto [in_tensors] = input; + auto [out_tensors] = output; + + // Require valid inputs + if (in_tensors.size() != m_input_names.size()) { + error("The ONNX model requires {} tensors, whereas {} were provided", m_input_names.size(), in_tensors.size()); + throw std::runtime_error(fmt::format("The ONNX model requires {} tensors, whereas {} were provided", m_input_names.size(), in_tensors.size())); + } + + // Prepare input tensor + std::vector input_tensor_values; + std::vector input_tensors; + + for (int ix = 0; ix < m_input_names.size(); ix++) { + edm4eic::Tensor in_tensor = in_tensors[ix]->at(0); + if (in_tensor.getElementType() == ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT) { + input_tensors.emplace_back(iters_to_tensor( + in_tensor.floatData_begin(), + in_tensor.floatData_end(), + in_tensor.shape_begin(), + in_tensor.shape_end() + )); + } else if (in_tensor.getElementType() == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64) { + input_tensors.emplace_back(iters_to_tensor( + in_tensor.int64Data_begin(), + in_tensor.int64Data_end(), + in_tensor.shape_begin(), + in_tensor.shape_end() + )); + } + + auto input_shape = input_tensors[ix].GetTensorTypeAndShapeInfo().GetShape(); + std::vector input_expected_shape = m_input_shapes[ix]; + if (!check_shape_consistency(input_shape, input_expected_shape)) { + error("Input tensor shape incorrect {} != {}", print_shape(input_shape), print_shape(input_expected_shape)); + throw std::runtime_error(fmt::format("Input tensor shape incorrect {} != {}", print_shape(input_shape), print_shape(input_expected_shape))); + } + } + + // Attempt inference + std::vector onnx_values; + try { + onnx_values = m_session.Run(Ort::RunOptions{nullptr}, m_input_names_char.data(), input_tensors.data(), + m_input_names_char.size(), m_output_names_char.data(), m_output_names_char.size()); + } catch (const Ort::Exception& exception) { + error("Error running model inference: {}", exception.what()); + throw; + } + + try { + for (size_t ix = 0; ix < onnx_values.size(); ix++) { + Ort::Value &onnx_tensor = onnx_values[ix]; + if (!onnx_tensor.IsTensor()) { + error("The output \"{}\" is not a tensor. ONNXType {} is not yet supported. Skipping...", + m_output_names_char[ix], + static_cast(onnx_tensor.GetTypeInfo().GetONNXType())); + continue; + } + auto onnx_tensor_type = onnx_tensor.GetTensorTypeAndShapeInfo(); + edm4eic::MutableTensor out_tensor = out_tensors[ix]->create(); + out_tensor.setElementType(static_cast(onnx_tensor_type.GetElementType())); + size_t num_values = 1; + for (int64_t dim_size : onnx_tensor_type.GetShape()) { + out_tensor.addToShape(dim_size); + num_values *= dim_size; + } + if (onnx_tensor_type.GetElementType() == ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT) { + auto *data = onnx_tensor.GetTensorMutableData(); + for (size_t value_ix = 0; value_ix < num_values; value_ix++) { + out_tensor.addToFloatData(data[value_ix]); + } + } else if (onnx_tensor_type.GetElementType() == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64) { + auto *data = onnx_tensor.GetTensorMutableData(); + for (size_t value_ix = 0; value_ix < num_values; value_ix++) { + out_tensor.addToInt64Data(data[value_ix]); + } + } else { + error("Unsupported ONNXTensorElementDataType {}", static_cast(onnx_tensor_type.GetElementType())); + } + } + } catch (const Ort::Exception& exception) { + error("Error running model inference: {}", exception.what()); + throw; + } + } + +} // namespace eicrecon +#endif diff --git a/src/algorithms/onnx/ONNXInference.h b/src/algorithms/onnx/ONNXInference.h new file mode 100644 index 0000000000..8cc8e91232 --- /dev/null +++ b/src/algorithms/onnx/ONNXInference.h @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2022 - 2024 Sylvester Joosten, Dmitry Romanov, Wouter Deconinck, Dmitry Kalinkin + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include "algorithms/interfaces/WithPodConfig.h" +#include "algorithms/onnx/ONNXInferenceConfig.h" + +namespace eicrecon { + +using ONNXInferenceAlgorithm = + algorithms::Algorithm>, + algorithms::Output>>; + +class ONNXInference : public ONNXInferenceAlgorithm, + public WithPodConfig { + +public: + ONNXInference(std::string_view name) + : ONNXInferenceAlgorithm{name, + {"inputTensors"}, + {"outputTensors"}, + ""} { + } + + void init() final; + void process(const Input&, const Output&) const final; + +private: + mutable Ort::Env m_env{nullptr}; + mutable Ort::Session m_session{nullptr}; + + std::vector m_input_names; + std::vector m_input_names_char; + std::vector> m_input_shapes; + + std::vector m_output_names; + std::vector m_output_names_char; + std::vector> m_output_shapes; +}; + +} // namespace eicrecon diff --git a/src/algorithms/onnx/ONNXInferenceConfig.h b/src/algorithms/onnx/ONNXInferenceConfig.h new file mode 100644 index 0000000000..a6e98204a1 --- /dev/null +++ b/src/algorithms/onnx/ONNXInferenceConfig.h @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Wouter Deconinck, Dmitry Kalinkin + +#pragma once + +#include + +namespace eicrecon { + + struct ONNXInferenceConfig { + + std::string modelPath; + + }; + +} // eicrecon diff --git a/src/detectors/EEMC/CMakeLists.txt b/src/detectors/EEMC/CMakeLists.txt index 90d48a9b0b..7478a5546c 100644 --- a/src/detectors/EEMC/CMakeLists.txt +++ b/src/detectors/EEMC/CMakeLists.txt @@ -15,6 +15,7 @@ plugin_glob_all(${PLUGIN_NAME}) # Find dependencies plugin_add_dd4hep(${PLUGIN_NAME}) plugin_add_event_model(${PLUGIN_NAME}) +plugin_add_onnxruntime(${PLUGIN_NAME}) # Add include directories (works same as target_include_directories) # plugin_include_directories(${PLUGIN_NAME} SYSTEM PUBLIC ... ) diff --git a/src/detectors/EEMC/EEMC.cc b/src/detectors/EEMC/EEMC.cc index 8908c7ac72..035b4ab3d0 100644 --- a/src/detectors/EEMC/EEMC.cc +++ b/src/detectors/EEMC/EEMC.cc @@ -15,8 +15,15 @@ #include "factories/calorimetry/CalorimeterHitDigi_factory.h" #include "factories/calorimetry/CalorimeterHitReco_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" +#if EDM4EIC_VERSION_MAJOR >= 8 +#include "factories/calorimetry/CalorimeterParticleIDPostML_factory.h" +#include "factories/calorimetry/CalorimeterParticleIDPreML_factory.h" +#endif #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" +#if EDM4EIC_VERSION_MAJOR >= 8 +#include "factories/meta/ONNXInference_factory.h" +#endif extern "C" { void InitPlugin(JApplication *app) { @@ -112,15 +119,24 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( +#if EDM4EIC_VERSION_MAJOR >= 8 + "EcalEndcapNClustersWithoutPID", +#else "EcalEndcapNClusters", +#endif {"EcalEndcapNIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 "EcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection #endif +#if EDM4EIC_VERSION_MAJOR >= 8 + {"EcalEndcapNClustersWithoutPID", // edm4eic::Cluster + "EcalEndcapNClusterAssociationsWithoutPID"}, // edm4eic::MCRecoClusterParticleAssociation +#else {"EcalEndcapNClusters", // edm4eic::Cluster "EcalEndcapNClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation +#endif { .energyWeight = "log", .sampFrac = 1.0, @@ -150,6 +166,49 @@ extern "C" { ) ); +#if EDM4EIC_VERSION_MAJOR >= 8 + app->Add(new JOmniFactoryGeneratorT( + "EcalEndcapNParticleIDPreML", + { + "EcalEndcapNClustersWithoutPID", + "EcalEndcapNClusterAssociationsWithoutPID", + }, + { + "EcalEndcapNParticleIDInput_features", + "EcalEndcapNParticleIDTarget", + }, + app + )); + app->Add(new JOmniFactoryGeneratorT( + "EcalEndcapNParticleIDInference", + { + "EcalEndcapNParticleIDInput_features", + }, + { + "EcalEndcapNParticleIDOutput_label", + "EcalEndcapNParticleIDOutput_probability_tensor", + }, + { + .modelPath = "calibrations/onnx/EcalEndcapN_pi_rejection.onnx", + }, + app + )); + app->Add(new JOmniFactoryGeneratorT( + "EcalEndcapNParticleIDPostML", + { + "EcalEndcapNClustersWithoutPID", + "EcalEndcapNClusterAssociationsWithoutPID", + "EcalEndcapNParticleIDOutput_probability_tensor", + }, + { + "EcalEndcapNClusters", + "EcalEndcapNClusterAssociations", + "EcalEndcapNClusterParticleIDs", + }, + app + )); +#endif + app->Add( new JOmniFactoryGeneratorT( "EcalEndcapNSplitMergeClusters", diff --git a/src/factories/calorimetry/CalorimeterParticleIDPostML_factory.h b/src/factories/calorimetry/CalorimeterParticleIDPostML_factory.h new file mode 100644 index 0000000000..51769c13c0 --- /dev/null +++ b/src/factories/calorimetry/CalorimeterParticleIDPostML_factory.h @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024, Dmitry Kalinkin + +#pragma once + +#include "algorithms/onnx/CalorimeterParticleIDPostML.h" +#include "services/algorithms_init/AlgorithmsInit_service.h" +#include "extensions/jana/JOmniFactory.h" + + +namespace eicrecon { + +class CalorimeterParticleIDPostML_factory : public JOmniFactory { + +public: + using AlgoT = eicrecon::CalorimeterParticleIDPostML; +private: + std::unique_ptr m_algo; + + PodioInput m_cluster_input {this}; + PodioInput m_cluster_assoc_input {this}; + PodioInput m_prediction_tensor_input {this}; + + PodioOutput m_cluster_output {this}; + PodioOutput m_cluster_assoc_output {this}; + PodioOutput m_particle_id_output {this}; + +public: + void Configure() { + m_algo = std::make_unique(GetPrefix()); + m_algo->level(static_cast(logger()->level())); + m_algo->applyConfig(config()); + m_algo->init(); + } + + void ChangeRun(int64_t run_number) { + } + + void Process(int64_t run_number, uint64_t event_number) { + m_algo->process({m_cluster_input(), m_cluster_assoc_input(), m_prediction_tensor_input()}, + {m_cluster_output().get(), m_cluster_assoc_output().get(), m_particle_id_output().get()}); + } +}; + +} // eicrecon diff --git a/src/factories/calorimetry/CalorimeterParticleIDPreML_factory.h b/src/factories/calorimetry/CalorimeterParticleIDPreML_factory.h new file mode 100644 index 0000000000..253abf1f69 --- /dev/null +++ b/src/factories/calorimetry/CalorimeterParticleIDPreML_factory.h @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024, Dmitry Kalinkin + +#pragma once + +#include "algorithms/onnx/CalorimeterParticleIDPreML.h" +#include "services/algorithms_init/AlgorithmsInit_service.h" +#include "extensions/jana/JOmniFactory.h" + + +namespace eicrecon { + +class CalorimeterParticleIDPreML_factory : public JOmniFactory { + +public: + using AlgoT = eicrecon::CalorimeterParticleIDPreML; +private: + std::unique_ptr m_algo; + + PodioInput m_cluster_input {this}; + PodioInput m_cluster_assoc_input {this}; + + PodioOutput m_feature_tensor_output {this}; + PodioOutput m_target_tensor_output {this}; + +public: + void Configure() { + m_algo = std::make_unique(GetPrefix()); + m_algo->level(static_cast(logger()->level())); + m_algo->applyConfig(config()); + m_algo->init(); + } + + void ChangeRun(int64_t run_number) { + } + + void Process(int64_t run_number, uint64_t event_number) { + m_algo->process({m_cluster_input(), m_cluster_assoc_input()}, + {m_feature_tensor_output().get(), m_target_tensor_output().get()}); + } +}; + +} // eicrecon diff --git a/src/factories/meta/ONNXInference_factory.h b/src/factories/meta/ONNXInference_factory.h new file mode 100644 index 0000000000..6837783518 --- /dev/null +++ b/src/factories/meta/ONNXInference_factory.h @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2023 - 2024, Wouter Deconinck, Simon Gardener, Dmitry Kalinkin + +#pragma once + +#include "algorithms/onnx/ONNXInference.h" +#include "services/algorithms_init/AlgorithmsInit_service.h" +#include "extensions/jana/JOmniFactory.h" + + +namespace eicrecon { + +class ONNXInference_factory : public JOmniFactory { + +public: + using AlgoT = eicrecon::ONNXInference; +private: + std::unique_ptr m_algo; + + VariadicPodioInput m_input_tensors {this}; + + VariadicPodioOutput m_output_tensors {this}; + + ParameterRef m_modelPath {this, "modelPath", config().modelPath}; + + Service m_algorithmsInit {this}; + +public: + void Configure() { + m_algo = std::make_unique(GetPrefix()); + m_algo->level(static_cast(logger()->level())); + m_algo->applyConfig(config()); + m_algo->init(); + } + + void ChangeRun(int64_t run_number) { + } + + void Process(int64_t run_number, uint64_t event_number) { + std::vector> in_collections; + for (const auto& in_collection : m_input_tensors()) { + in_collections.push_back(gsl::not_null{in_collection}); + } + + std::vector> out_collections; + for (const auto& out_collection : m_output_tensors()) { + out_collections.push_back(gsl::not_null{out_collection.get()}); + } + + m_algo->process(in_collections, + out_collections); + } +}; + +} // eicrecon From 3a507b8603ab2ac951ca2c03f276525edd9f9174 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 1 Dec 2024 09:46:40 -0600 Subject: [PATCH 10/15] fix: static_cast(sqrt(...)) to avoid c++-narrowing warning/error (again) (#1682) ### Briefly, what does this PR introduce? #1675 again see there. --- src/algorithms/tracking/TrackPropagation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackPropagation.cc b/src/algorithms/tracking/TrackPropagation.cc index bafe82f42f..6ad4e98138 100644 --- a/src/algorithms/tracking/TrackPropagation.cc +++ b/src/algorithms/tracking/TrackPropagation.cc @@ -295,7 +295,7 @@ void TrackPropagation::propagateToSurfaceList( // time const float time{static_cast(parameter(Acts::eBoundTime))}; - const float timeError{sqrt(static_cast(covariance(Acts::eBoundTime, Acts::eBoundTime)))}; + const float timeError{static_cast(sqrt(covariance(Acts::eBoundTime, Acts::eBoundTime)))}; // Direction const float theta(parameter[Acts::eBoundTheta]); From 11b01f394cb60daad896e9a24be8a7cfe840b8f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:54:35 +0000 Subject: [PATCH 11/15] build(deps): bump nickofthyme/object-remap from 2 to 3 (#1680) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [nickofthyme/object-remap](https://github.com/nickofthyme/object-remap) from 2 to 3.
Release notes

Sourced from nickofthyme/object-remap's releases.

v3

Latest v3 stable version -> v3.0.0

v3.0.0

What's Changed

Full Changelog: https://github.com/nickofthyme/object-remap/compare/v2.0.0...v3.0.0

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nickofthyme/object-remap&package-manager=github_actions&previous-version=2&new-version=3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/linux-eic-shell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 90b70ce7ef..e8ad6536fb 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -1067,7 +1067,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Remap open PRs id: remap - uses: nickofthyme/object-remap@v2 + uses: nickofthyme/object-remap@v3 with: __case: snake include.*.pr: ${{ toJSON(fromJSON(steps.query.outputs.data).*.number) }} From 3dc7ce11df414a987a2ae87c0a61e6d54239e73f Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 2 Dec 2024 14:41:29 -0500 Subject: [PATCH 12/15] UndoAfterBurner: skip particles that are not created by generator (#1683) ### Briefly, what does this PR introduce? This provides a file size reduction: ``` before 3.1M after 2.7M ``` ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] 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 - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? Unlikely. ### Does this PR change default behavior? Yes --- src/algorithms/reco/UndoAfterBurner.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/algorithms/reco/UndoAfterBurner.cc b/src/algorithms/reco/UndoAfterBurner.cc index 69430e97e2..129674f470 100644 --- a/src/algorithms/reco/UndoAfterBurner.cc +++ b/src/algorithms/reco/UndoAfterBurner.cc @@ -115,6 +115,9 @@ void eicrecon::UndoAfterBurner::process( // Now, loop through events and apply operations to the MCparticles for (const auto& p: *mcparts) { + if (p.isCreatedInSimulation()) { + continue; + } ROOT::Math::PxPyPzEVector mc(p.getMomentum().x, p.getMomentum().y, p.getMomentum().z, p.getEnergy()); From 906a443c010701700a543b36d2a2ed603573ac2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:11:54 -0500 Subject: [PATCH 13/15] build(deps): bump dawidd6/action-download-artifact from 6 to 7 (#1684) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 6 to 7.
Release notes

Sourced from dawidd6/action-download-artifact's releases.

v7

What's Changed

New Contributors

Full Changelog: https://github.com/dawidd6/action-download-artifact/compare/v6...v7

Commits
  • 80620a5 node_modules: update
  • b15e003 node_modules: install
  • 1ee9a45 build(deps): Fix cross-spawn >=7.0.0 <= 7.0.5 vulnerability (#317)
  • b2f2706 build(deps): bump @​actions/artifact from 2.1.10 to 2.1.11 (#313)
  • fdbeba0 build(deps): bump @​actions/core from 1.11.0 to 1.11.1 (#312)
  • a74b429 build(deps): bump @​actions/core from 1.10.1 to 1.11.0 (#310)
  • 24e807a build(deps): bump @​actions/artifact from 2.1.9 to 2.1.10 (#311)
  • 9592e3c build(deps): bump path-to-regexp from 6.2.2 to 6.3.0 (#307)
  • 5f966b6 build(deps): bump adm-zip from 0.5.15 to 0.5.16 (#306)
  • db9477a build(deps): bump adm-zip from 0.5.14 to 0.5.15 (#301)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dawidd6/action-download-artifact&package-manager=github_actions&previous-version=6&new-version=7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/linux-eic-shell.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index e8ad6536fb..bc2fce64c0 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -754,7 +754,7 @@ jobs: if-no-files-found: error - name: Download previous artifact id: download_previous_artifact - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 with: branch: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }} path: ref/ @@ -954,7 +954,7 @@ jobs: if-no-files-found: error - name: Download previous artifact id: download_previous_artifact - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 with: branch: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref_name }} path: ref/ @@ -1084,7 +1084,7 @@ jobs: max-parallel: 4 steps: - name: Download docs artifact (other PRs) - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 if: github.event.pull_request.number != matrix.pr with: commit: ${{ matrix.head_sha }} @@ -1101,7 +1101,7 @@ jobs: path: publishing_docs/pr/${{ matrix.pr }}/ - name: Download capybara artifact (other PRs) id: download_capybara - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 if: github.event.pull_request.number != matrix.pr with: commit: ${{ matrix.head_sha }} @@ -1133,7 +1133,7 @@ jobs: # - If we run this on a non-main branch, we download from main with action-download-artifact. # - If we run this on the main branch, we have to download from this pipeline with download-artifact. - name: Download docs artifact (in PR) - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 if: github.ref_name != 'main' with: branch: main @@ -1150,7 +1150,7 @@ jobs: path: publishing_docs/ - name: Download capybara artifact (in PR) id: download_capybara - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 if: github.ref_name != 'main' with: commit: ${{ matrix.head_sha }} From 263d005c6cce7b1374b6728c33ce888813f80c9c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Dec 2024 11:59:37 -0600 Subject: [PATCH 14/15] feat(ci): runs-on: ubuntu-latest -> ubuntu-22.04 (#1687) ### Briefly, what does this PR introduce? This PR updates the target operating system for CI jobs, from ubuntu-latest to a more explicit ubuntu-22.04. This is in part to avoid the automatic update of implicit ubuntu-latest that will break everything (https://github.com/eic/EICrecon/pull/1686), and in part because it makes sense to be explicit about the target operating system. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] New feature (issue https://github.com/actions/runner-images/issues/10636) - [ ] 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. --- .github/workflows/linux-eic-shell.yml | 46 +++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index bc2fce64c0..87761b712c 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -49,7 +49,7 @@ jobs: env: # env cannot be used in matrix, but outputs can # so this job turns env into outputs - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: platform_json: ${{ steps.define.outputs.platform_json }} release_json: ${{ steps.define.outputs.release_json }} @@ -60,7 +60,7 @@ jobs: echo "release_json=[\"${{ env.release }}\"]" >> $GITHUB_OUTPUT build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: env strategy: # include multiple compilers for one release version, @@ -175,7 +175,7 @@ jobs: if-no-files-found: error clang-tidy-iwyu: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build steps: - uses: actions/checkout@v4 @@ -252,7 +252,7 @@ jobs: run: git diff --exit-code llvm-cov: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build permissions: statuses: write @@ -311,7 +311,7 @@ jobs: path: build/codecov_report/ detector-info: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: hash: ${{ steps.detector-info.outputs.hash }} steps: @@ -326,7 +326,7 @@ jobs: echo "hash=${hash%% *}" | tee $GITHUB_OUTPUT npsim-gun: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - detector-info strategy: @@ -356,7 +356,7 @@ jobs: if-no-files-found: error npsim-gun-EcalLumiSpec: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - detector-info strategy: @@ -390,7 +390,7 @@ jobs: if-no-files-found: error npsim-dis: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - detector-info strategy: @@ -426,7 +426,7 @@ jobs: if-no-files-found: error npsim-minbias: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - detector-info strategy: @@ -462,7 +462,7 @@ jobs: if-no-files-found: error eicrecon-two-stage-running: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-gun @@ -526,7 +526,7 @@ jobs: if-no-files-found: error eicrecon-eicmkplugin: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-gun @@ -569,7 +569,7 @@ jobs: $PWD/install/bin/eicrecon $JANA_OPTIONS -Pplugins=MyCustomPlugin -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root eicrecon-test-plugins: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-gun @@ -618,7 +618,7 @@ jobs: if-no-files-found: error eicrecon-benchmarks-plugins: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-gun @@ -671,7 +671,7 @@ jobs: if-no-files-found: error eicrecon-gun: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-gun @@ -785,7 +785,7 @@ jobs: if-no-files-found: error eicrecon-gun-EcalLumiSpec: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-gun-EcalLumiSpec @@ -852,7 +852,7 @@ jobs: if-no-files-found: error eicrecon-dis: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build - npsim-dis @@ -985,7 +985,7 @@ jobs: if-no-files-found: error trigger-container: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: ${{ github.event_name != 'merge_group' && github.event_name != 'schedule' && github.actor != 'dependabot[bot]' }} needs: - eicrecon-gun @@ -1017,7 +1017,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} build-docs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - eicrecon-gun - eicrecon-dis @@ -1055,7 +1055,7 @@ jobs: if-no-files-found: error list-open-prs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: json: ${{ steps.remap.outputs.json }} steps: @@ -1074,7 +1074,7 @@ jobs: include.*.head_sha: ${{ toJSON(fromJSON(steps.query.outputs.data).*.head.sha) }} get-docs-from-open-prs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build-docs - list-open-prs @@ -1125,7 +1125,7 @@ jobs: if-no-files-found: ignore get-docs-from-main: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - build-docs steps: @@ -1182,7 +1182,7 @@ jobs: if-no-files-found: error collect-docs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - get-docs-from-main - get-docs-from-open-prs @@ -1241,7 +1241,7 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Deploy to GitHub Pages id: deployment From 96392f3b33443a0d8c39f24a25a1a02d423ae4e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 01:12:27 -0500 Subject: [PATCH 15/15] build(deps): bump cvmfs-contrib/github-action-cvmfs from 4 to 5 (#1689) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [cvmfs-contrib/github-action-cvmfs](https://github.com/cvmfs-contrib/github-action-cvmfs) from 4 to 5.
Release notes

Sourced from cvmfs-contrib/github-action-cvmfs's releases.

v5.0: macos support

What's Changed

Full Changelog: https://github.com/cvmfs-contrib/github-action-cvmfs/compare/v4...v5.0

Commits
  • 204fd62 move sleep into setup (#32)
  • fb426fe CVMFS mac support now in prod; use homebrew to install (#31)
  • e5c2896 chore(deps): bump actions/checkout from 2 to 4 (#29)
  • cec5c94 Re-enable experimental support for cvmfs on macos runners (#28)
  • 7b55d30 chore(deps): bump actions/checkout from 3 to 4
  • c52c4b0 feat: enable dependabot for github-actions ecosystem
  • See full diff in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cvmfs-contrib/github-action-cvmfs&package-manager=github_actions&previous-version=4&new-version=5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/linux-eic-shell.yml | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 87761b712c..4f4e8bfed2 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -125,7 +125,7 @@ jobs: echo "cache_dir=${{ github.workspace }}/.ccache" > ~/.ccache/ccache.conf echo "max_size=1500MB" >> ~/.ccache/ccache.conf echo "compression=true" >> ~/.ccache/ccache.conf - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Build and install uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -181,7 +181,7 @@ jobs: - uses: actions/checkout@v4 with: filter: "tree:0" - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Download build artifact uses: actions/download-artifact@v4 with: @@ -315,7 +315,7 @@ jobs: outputs: hash: ${{ steps.detector-info.outputs.hash }} steps: - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Get detector info id: detector-info run: | @@ -334,7 +334,7 @@ jobs: particle: [pi, e] detector_config: [craterlake] steps: - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Retrieve simulation files id: retrieve_simulation_files uses: actions/cache@v4 @@ -367,7 +367,7 @@ jobs: - uses: actions/checkout@v4 with: filter: "tree:0" - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Retrieve simulation files id: retrieve_simulation_files uses: actions/cache@v4 @@ -403,7 +403,7 @@ jobs: minq2: 1000 detector_config: craterlake_18x275 steps: - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Retrieve simulation files id: retrieve_simulation_files uses: actions/cache@v4 @@ -439,7 +439,7 @@ jobs: - beam: 18x275 detector_config: craterlake_18x275 steps: - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Retrieve simulation files id: retrieve_simulation_files uses: actions/cache@v4 @@ -491,7 +491,7 @@ jobs: with: name: sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - name: Setup cvmfs - uses: cvmfs-contrib/github-action-cvmfs@v4 + uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Run EICrecon (digitization) uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -553,7 +553,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Run EICrecon uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -600,7 +600,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Run EICrecon uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -653,7 +653,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Run EICrecon uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -698,7 +698,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Check dynamic library loader paths uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -812,7 +812,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: sim_${{ matrix.particle }}_EcalLumiSpec_${{ matrix.detector_config }}.edm4hep.root - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Run EICrecon uses: eic/run-cvmfs-osg-eic-shell@main with: @@ -898,7 +898,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: sim_dis_${{ matrix.beam }}_minQ2=${{ matrix.minq2 }}_${{ matrix.detector_config }}.edm4hep.root - - uses: cvmfs-contrib/github-action-cvmfs@v4 + - uses: cvmfs-contrib/github-action-cvmfs@v5 - name: Run EICrecon uses: eic/run-cvmfs-osg-eic-shell@main with: