Skip to content

Commit

Permalink
refactor: Move Chi2 example bindings to TrackFitting (#1836)
Browse files Browse the repository at this point in the history
I don't think there's a strong need for a separate cpp file for this purpose.
  • Loading branch information
paulgessinger committed Feb 9, 2023
1 parent a141736 commit 2960c5f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 71 deletions.
1 change: 0 additions & 1 deletion Examples/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pybind11_add_module(ActsPythonBindings
src/Generators.cpp
src/TruthTracking.cpp
src/TrackFitting.cpp
src/TrackFittingChi2.cpp
src/TrackFinding.cpp
src/Vertexing.cpp
)
Expand Down
2 changes: 0 additions & 2 deletions Examples/Python/src/ModuleEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ void addInput(Context& ctx);
void addGenerators(Context& ctx);
void addTruthTracking(Context& ctx);
void addTrackFitting(Context& ctx);
void addTrackFittingChi2(Context& ctx);
void addTrackFinding(Context& ctx);
void addVertexing(Context& ctx);

Expand Down Expand Up @@ -265,7 +264,6 @@ PYBIND11_MODULE(ActsPythonBindings, m) {
addGenerators(ctx);
addTruthTracking(ctx);
addTrackFitting(ctx);
addTrackFittingChi2(ctx);
addTrackFinding(ctx);
addVertexing(ctx);

Expand Down
39 changes: 39 additions & 0 deletions Examples/Python/src/TrackFitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "ActsExamples/TrackFitting/KalmanFitterFunction.hpp"
#include "ActsExamples/TrackFitting/SurfaceSortingAlgorithm.hpp"
#include "ActsExamples/TrackFitting/TrackFittingAlgorithm.hpp"
#include "ActsExamples/TrackFittingChi2/TrackFittingChi2Algorithm.hpp"

#include <memory>

Expand Down Expand Up @@ -106,6 +107,44 @@ void addTrackFitting(Context& ctx) {
py::arg("level"));
}

{
using Alg = ActsExamples::TrackFittingChi2Algorithm;
using Config = Alg::Config;

auto alg =
py::class_<Alg, BareAlgorithm, std::shared_ptr<Alg>>(
mex, "TrackFittingChi2Algorithm")
.def(py::init<const Alg::Config&, Acts::Logging::Level>(),
py::arg("config"), py::arg("level"))
.def_property_readonly("config", &Alg::config)
.def_static("makeTrackFitterChi2Function",
py::overload_cast<
std::shared_ptr<const Acts::TrackingGeometry>,
std::shared_ptr<const Acts::MagneticFieldProvider>>(
&Alg::makeTrackFitterChi2Function));

py::class_<
TrackFittingChi2Algorithm::TrackFitterChi2Function,
std::shared_ptr<TrackFittingChi2Algorithm::TrackFitterChi2Function>>(
alg, "TrackFitterChi2Function");

auto c = py::class_<Config>(alg, "Config").def(py::init<>());

ACTS_PYTHON_STRUCT_BEGIN(c, Config);
ACTS_PYTHON_MEMBER(inputMeasurements);
ACTS_PYTHON_MEMBER(inputSourceLinks);
ACTS_PYTHON_MEMBER(inputProtoTracks);
ACTS_PYTHON_MEMBER(inputInitialTrackParameters);
ACTS_PYTHON_MEMBER(outputTrajectories);
ACTS_PYTHON_MEMBER(nUpdates);
ACTS_PYTHON_MEMBER(fit);
ACTS_PYTHON_MEMBER(trackingGeometry);
ACTS_PYTHON_MEMBER(multipleScattering);
ACTS_PYTHON_MEMBER(energyLoss);
ACTS_PYTHON_MEMBER(pickTrack);
ACTS_PYTHON_STRUCT_END();
}

{
py::class_<FreeToBoundCorrection>(mex, "FreeToBoundCorrection")
.def(py::init<>())
Expand Down
68 changes: 0 additions & 68 deletions Examples/Python/src/TrackFittingChi2.cpp

This file was deleted.

0 comments on commit 2960c5f

Please sign in to comment.