-
Notifications
You must be signed in to change notification settings - Fork 252
feat: Traccc sequence example python bindings #5348
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
Draft
paradajzblond
wants to merge
27
commits into
acts-project:main
Choose a base branch
from
paradajzblond:traccc_version_bump
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
47bc5b4
bump dependancy versions, add full chain alg example
paradajzblond c8a284c
switching to traccc tag
paradajzblond 78c1ba5
set traccc tag, adding sequence example
paradajzblond 1390ffa
ensure linking against device code only when cuda available, traccc b…
paradajzblond 3d6798a
fixing wrong conditional statement for cuda includes
paradajzblond 11ad3bb
making IAlg Traccc chain
paradajzblond 2f2b999
format tidy
paradajzblond 38ab425
chore: Version bump of Traccc, Detray and VecMem (#5376)
paradajzblond 5b353cc
add traccc example alg
paradajzblond 972f58a
remove unwanted duplicate detray dir
paradajzblond 6d29668
switching to traccc tag
paradajzblond 8ec4d80
set traccc tag, adding sequence example
paradajzblond b83e07b
ensure linking against device code only when cuda available, traccc b…
paradajzblond 1a8c067
rebasing to main
paradajzblond 73bb2a1
clean up after rebase
paradajzblond 4c12761
removing duplicate steering scripts
paradajzblond 9482c64
format tidy
paradajzblond fd0d087
turn off TBB build
paradajzblond d7d3b15
remove second detray inclusion
paradajzblond 91609be
format tidy
paradajzblond f932626
adding converters
paradajzblond 16e6aab
making backend choice at run time
paradajzblond dcacdb1
set single prec as default
paradajzblond f1e1145
format tidy
paradajzblond 97bae46
adding deprication warning
paradajzblond 54f4065
updating seq alg, make pixel volumes configurable
paradajzblond 977d77b
remove converters from plugins
paradajzblond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe remove this from the diff? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| acts_add_library( | ||
| ExamplesTraccc | ||
| SHARED | ||
| src/TracccChain.cpp | ||
| src/TracccSeqAlg.cpp | ||
| src/ActsMeasToTracccAlg.cpp | ||
| src/ActsSpToTracccAlg.cpp | ||
| ) | ||
|
|
||
| target_include_directories( | ||
| ActsExamplesTraccc | ||
| PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
| $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
| ) | ||
|
|
||
| target_link_libraries( | ||
| ActsExamplesTraccc | ||
| PUBLIC | ||
| Acts::Core | ||
| Acts::ExamplesFramework | ||
| traccc::core | ||
| detray::core | ||
| detray::io | ||
| traccc::io | ||
| vecmem::core | ||
| ) | ||
|
|
||
| if(ACTS_ENABLE_CUDA) | ||
| target_compile_definitions(ActsExamplesTraccc PRIVATE ACTS_ENABLE_CUDA) | ||
| target_link_libraries( | ||
| ActsExamplesTraccc | ||
| PRIVATE traccc::cuda traccc::device_common vecmem::cuda | ||
| ) | ||
| endif() |
71 changes: 71 additions & 0 deletions
71
Examples/Algorithms/Traccc/include/ActsExamples/Traccc/ActsMeasToTracccAlg.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // This file is part of the ACTS project. | ||
| // | ||
| // Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
| // | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| #pragma once | ||
| #include "Acts/Geometry/GeometryIdentifier.hpp" | ||
| #include "Acts/SpacePointFormation2/PixelSpacePointBuilder.hpp" | ||
| #include "Acts/Utilities/Logger.hpp" | ||
| #include "ActsExamples/EventData/Measurement.hpp" | ||
| #include "ActsExamples/Framework/DataHandle.hpp" | ||
| #include "ActsExamples/Framework/IAlgorithm.hpp" | ||
| #include "ActsExamples/Framework/ProcessCode.hpp" | ||
|
|
||
| #include <string> | ||
| #include <unordered_map> | ||
|
|
||
| #include <traccc/edm/measurement_collection.hpp> | ||
| #include <traccc/edm/spacepoint_collection.hpp> | ||
| #include <vecmem/memory/host_memory_resource.hpp> | ||
|
|
||
| #include "traccc/geometry/detector.hpp" | ||
| #include "traccc/geometry/host_detector.hpp" | ||
| #include "traccc/io/read_detector.hpp" | ||
|
|
||
| namespace ActsExamples { | ||
|
|
||
| class ActsMeasToTracccAlg final : public IAlgorithm { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't check what other example algorithms do (😦), but some (Doxygen) documentation would be in order here, right? |
||
| public: | ||
| struct Config { | ||
| std::string detectorFile = ""; | ||
| std::string inputActsMeasurements = "measurements"; | ||
| std::string outputDetrayToActsMap = "detray-to-acts-map"; | ||
| std::string outputTracccMeasurements = "acts-to-traccc-measurements"; | ||
| std::vector<int> pixelVolumes; | ||
| std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry; | ||
| }; | ||
|
|
||
| mutable vecmem::host_memory_resource m_mr; | ||
| traccc::host_detector m_host_det; | ||
| std::unordered_map<Acts::GeometryIdentifier, std::uint64_t> m_actsToDetrayMap; | ||
| std::unordered_map<std::uint64_t, Acts::GeometryIdentifier> m_detrayToActsMap; | ||
|
|
||
| explicit ActsMeasToTracccAlg( | ||
| const Config& cfg, std::unique_ptr<const Acts::Logger> logger = nullptr); | ||
|
|
||
| ProcessCode execute(const AlgorithmContext& ctx) const override; | ||
| void buildSurfaceMap( | ||
| const Acts::TrackingGeometry& trackingGeometry, | ||
| const std::string& detectorFile, | ||
| std::unordered_map<std::uint64_t, Acts::GeometryIdentifier>& | ||
| m_detrayToActsMap, | ||
| std::unordered_map<Acts::GeometryIdentifier, std::uint64_t>& | ||
| m_actsToDetrayMap); | ||
| const Config& config() const { return m_cfg; } | ||
|
|
||
| private: | ||
| Config m_cfg; | ||
|
|
||
| ReadDataHandle<MeasurementContainer> m_inputActsMeasurements{ | ||
| this, "inputActsMeasurements"}; | ||
| WriteDataHandle<std::unordered_map<std::uint64_t, Acts::GeometryIdentifier>> | ||
| m_outputDetrayToActsMap{this, "outputDetrayToActsMap"}; | ||
| WriteDataHandle<traccc::edm::measurement_collection::host> | ||
| m_outputTracccMeasurements{this, "outputTracccMeasurements"}; | ||
| }; | ||
|
|
||
| } // namespace ActsExamples | ||
50 changes: 50 additions & 0 deletions
50
Examples/Algorithms/Traccc/include/ActsExamples/Traccc/ActsSpToTracccAlg.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // This file is part of the ACTS project. | ||
| // | ||
| // Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
| // | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| #pragma once | ||
| #include "Acts/Geometry/GeometryIdentifier.hpp" | ||
| #include "Acts/Utilities/Logger.hpp" | ||
| #include "ActsExamples/EventData/Measurement.hpp" | ||
| #include "ActsExamples/EventData/SpacePoint.hpp" | ||
| #include "ActsExamples/Framework/DataHandle.hpp" | ||
| #include "ActsExamples/Framework/IAlgorithm.hpp" | ||
| #include "ActsExamples/Framework/ProcessCode.hpp" | ||
|
|
||
| #include <string> | ||
| #include <unordered_map> | ||
|
|
||
| #include <traccc/edm/spacepoint_collection.hpp> | ||
| #include <vecmem/memory/host_memory_resource.hpp> | ||
|
|
||
| namespace ActsExamples { | ||
|
|
||
| class ActsSpToTracccAlg final : public IAlgorithm { | ||
| public: | ||
| struct Config { | ||
| std::string inputSpacePoints = "spacepoints"; | ||
| std::string outputTracccSpacepoints = "acts-traccc-spacepoints"; | ||
| }; | ||
|
|
||
| explicit ActsSpToTracccAlg( | ||
| const Config& cfg, std::unique_ptr<const Acts::Logger> logger = nullptr); | ||
|
|
||
| ProcessCode execute(const AlgorithmContext& ctx) const override; | ||
| const Config& config() const { return m_cfg; } | ||
|
|
||
| mutable vecmem::host_memory_resource m_mr; | ||
|
|
||
| private: | ||
| Config m_cfg; | ||
|
|
||
| ReadDataHandle<SpacePointContainer> m_inputSpacePoints{this, | ||
| "inputSpacePoints"}; | ||
| WriteDataHandle<traccc::edm::spacepoint_collection::host> | ||
| m_outputTracccSpacepoints{this, "outputTracccSpacepoints"}; | ||
| }; | ||
|
|
||
| } // namespace ActsExamples |
85 changes: 85 additions & 0 deletions
85
Examples/Algorithms/Traccc/include/ActsExamples/Traccc/TracccChain.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // This file is part of the ACTS project. | ||
| // | ||
| // Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
| // | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Acts/Utilities/Logger.hpp" | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "traccc/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp" | ||
| #include "traccc/clusterization/clustering_config.hpp" | ||
| #include "traccc/clusterization/clusterization_algorithm.hpp" | ||
| #include "traccc/edm/measurement_collection.hpp" | ||
| #include "traccc/edm/spacepoint_collection.hpp" | ||
| #include "traccc/finding/combinatorial_kalman_filter_algorithm.hpp" | ||
| #include "traccc/fitting/kalman_fitting_algorithm.hpp" | ||
| #include "traccc/seeding/detail/seeding_config.hpp" | ||
| #include "traccc/seeding/detail/track_params_estimation_config.hpp" | ||
| #include "traccc/seeding/seeding_algorithm.hpp" | ||
| #include "traccc/seeding/silicon_pixel_spacepoint_formation_algorithm.hpp" | ||
| #include "traccc/seeding/track_params_estimation.hpp" | ||
|
|
||
| namespace ActsExamples::Traccc { | ||
|
|
||
| struct TracccChainConfig { | ||
| enum class Backend { CPU, CUDA }; | ||
| Backend backend = Backend::CPU; | ||
|
|
||
| // Detector files | ||
| std::string detectorFile; | ||
| std::string digitizationFile; | ||
| std::string conditionsFile; | ||
| std::string gridFile; | ||
| std::string materialFile; | ||
|
|
||
| // Magnetic field file | ||
| std::string magneticFieldFile; | ||
| // z-component used by CPU track_params_estimation | ||
| float bFieldInZ = 2.0f; | ||
|
|
||
| // Algorithm configs | ||
| traccc::clustering_config clusteringConfig; | ||
| traccc::seedfinder_config seedfinderConfig; | ||
| traccc::seedfilter_config seedfilterConfig; | ||
| traccc::track_params_estimation_config trackParamsEstConfig; | ||
| traccc::finding_config findingConfig; | ||
| traccc::fitting_config fittingConfig; | ||
| traccc::host::greedy_ambiguity_resolution_algorithm::config_type | ||
| resolutionConfig; | ||
| }; | ||
|
|
||
| struct EventResult { | ||
| std::size_t n_measurements = 0; | ||
| std::size_t n_spacepoints = 0; | ||
| std::size_t n_seeds = 0; | ||
| std::size_t n_track_candidates = 0; | ||
| std::size_t n_fitted_tracks = 0; | ||
| }; | ||
|
|
||
| class TracccChain { | ||
| public: | ||
| struct Impl; | ||
|
|
||
| explicit TracccChain(const TracccChainConfig& cfg, | ||
| Acts::Logging::Level logLevel = Acts::Logging::INFO); | ||
| ~TracccChain(); | ||
|
|
||
| TracccChain(TracccChain&&) noexcept; | ||
| TracccChain& operator=(TracccChain&&) noexcept; | ||
|
|
||
| EventResult operator()( | ||
| traccc::edm::measurement_collection::host& measurements, | ||
| traccc::edm::spacepoint_collection::host& spacepoints) const; | ||
|
|
||
| private: | ||
| std::unique_ptr<Impl> m_impl; | ||
| }; | ||
|
|
||
| } // namespace ActsExamples::Traccc |
49 changes: 49 additions & 0 deletions
49
Examples/Algorithms/Traccc/include/ActsExamples/Traccc/TracccSeqAlg.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // This file is part of the ACTS project. | ||
| // | ||
| // Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
| // | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "ActsExamples/Framework/DataHandle.hpp" | ||
| #include "ActsExamples/Framework/IAlgorithm.hpp" | ||
| #include "ActsExamples/Framework/ProcessCode.hpp" | ||
| #include "ActsExamples/Traccc/TracccChain.hpp" | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "traccc/edm/silicon_cell_collection.hpp" | ||
|
|
||
| namespace ActsExamples::Traccc { | ||
|
|
||
| class TracccSeqAlg final : public IAlgorithm { | ||
| public: | ||
| struct Config { | ||
| /// Full traccc chain configuration (geometry, seeding params, etc.) | ||
| TracccChainConfig chain; | ||
|
|
||
| /// WhiteBoard key for the input collections | ||
| std::string inputMeasurements = ""; | ||
| std::string inputSpacepoints = ""; | ||
| }; | ||
|
|
||
| explicit TracccSeqAlg(const Config& cfg, | ||
| std::unique_ptr<const Acts::Logger> logger = nullptr); | ||
|
|
||
| ProcessCode execute(const AlgorithmContext& ctx) const override; | ||
| const Config& config() const { return m_cfg; } | ||
|
|
||
| private: | ||
| Config m_cfg; | ||
| TracccChain m_chain; | ||
|
|
||
| ReadDataHandle<traccc::edm::measurement_collection::host> m_inputMeasurements{ | ||
| this, "inputMeasurements"}; | ||
| ReadDataHandle<traccc::edm::spacepoint_collection::host> m_inputSpacepoints{ | ||
| this, "inputSpacepoints"}; | ||
| }; | ||
|
|
||
| } // namespace ActsExamples::Traccc |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.