-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Exa.TrkX with torchscript backend (#1473)
This PR is a big update to the Exa.TrkX plugin: * It now provides both a TorchScript-based and a ONNX-based backend (the ONNX one doesn't really work at the moment due to missing operators in Onnx, however, we should'nt throw away the code for this I think) * Partial integration of Acts logging instead of `std::cout` based things * The `TrajectoriesToProtoTracks` algorithm to be able to compare results of the CKF and the Exa.TrkkX track finding * Update python to support all of this * The dependency to FRNN is now managed by CMake's `FetchContent` mechanism * The CI routines are restrucutured * no build in the github workflows anymore * Build and check both backends in the CI bridge Co-authored-by: Andreas Stefl <487211+andiwand@users.noreply.github.com>
- Loading branch information
1 parent
ff772f1
commit b409627
Showing
51 changed files
with
1,613 additions
and
3,653 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
40 changes: 40 additions & 0 deletions
40
...s/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrajectoriesToPrototracks.hpp
This file contains 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,40 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2022 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 http://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/Framework/BareAlgorithm.hpp" | ||
|
||
namespace ActsExamples { | ||
|
||
class TrajectoriesToPrototracks final : public BareAlgorithm { | ||
public: | ||
struct Config { | ||
std::string inputTrajectories = "trajectories"; | ||
std::string outputPrototracks = "tracks-from-trajectories"; | ||
}; | ||
|
||
/// Construct the algorithm. | ||
/// | ||
/// @param cfg is the algorithm configuration | ||
/// @param lvl is the logging level | ||
TrajectoriesToPrototracks(Config cfg, Acts::Logging::Level lvl) | ||
: BareAlgorithm("TrajectoriesToPrototracks", lvl), m_cfg(cfg) {} | ||
|
||
/// Run the algorithm. | ||
/// | ||
/// @param ctx is the algorithm context with event information | ||
/// @return a process code indication success or failure | ||
ProcessCode execute(const AlgorithmContext& ctx) const final override; | ||
|
||
/// Const access to the config | ||
const Config& config() const { return m_cfg; } | ||
|
||
private: | ||
Config m_cfg; | ||
}; | ||
|
||
} // namespace ActsExamples |
49 changes: 49 additions & 0 deletions
49
Examples/Algorithms/TrackFinding/src/TrajectoriesToPrototracks.cpp
This file contains 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) 2022 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 http://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/TrackFinding/TrajectoriesToPrototracks.hpp" | ||
|
||
#include "ActsExamples/EventData/IndexSourceLink.hpp" | ||
#include "ActsExamples/EventData/ProtoTrack.hpp" | ||
#include "ActsExamples/EventData/Trajectories.hpp" | ||
#include "ActsExamples/Framework/WhiteBoard.hpp" | ||
|
||
namespace ActsExamples { | ||
|
||
ProcessCode TrajectoriesToPrototracks::execute( | ||
const AlgorithmContext& ctx) const { | ||
const auto trajectories = | ||
ctx.eventStore.get<TrajectoriesContainer>(m_cfg.inputTrajectories); | ||
|
||
ProtoTrackContainer tracks; | ||
|
||
for (const auto& trajectory : trajectories) { | ||
for (const auto tip : trajectory.tips()) { | ||
ProtoTrack track; | ||
|
||
trajectory.multiTrajectory().visitBackwards(tip, [&](const auto& state) { | ||
if (not state.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag)) { | ||
return true; | ||
} | ||
|
||
const auto& source_link = | ||
static_cast<const IndexSourceLink&>(state.uncalibrated()); | ||
track.push_back(source_link.index()); | ||
|
||
return true; | ||
}); | ||
|
||
tracks.push_back(track); | ||
} | ||
} | ||
|
||
ctx.eventStore.add(m_cfg.outputPrototracks, std::move(tracks)); | ||
|
||
return ProcessCode::SUCCESS; | ||
} | ||
} // namespace ActsExamples |
This file contains 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 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 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
Oops, something went wrong.