From c8b27e457207727dbe1d14bd604acd77c10aafda Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Tue, 21 Nov 2023 04:41:56 +0100 Subject: [PATCH 1/2] fix: undocumented parameters (#2702) This PR fixes the doc build, 2 PRs sneaked parameters in. --- Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp | 2 ++ Core/include/Acts/Vertexing/ImpactPointEstimator.hpp | 1 + .../DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp | 1 + 3 files changed, 4 insertions(+) diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp index 81bcf468628..850b36c4c23 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp @@ -68,6 +68,7 @@ class FullBilloirVertexFitter { /// @brief Constructor used if input_track_t type == BoundTrackParameters /// /// @param cfg Configuration object + /// @param logger Logging instance template < typename T = input_track_t, std::enable_if_t::value, int> = 0> @@ -85,6 +86,7 @@ class FullBilloirVertexFitter { /// @param cfg Configuration object /// @param func Function extracting BoundTrackParameters from input_track_t /// object + /// @param logger Logging instance FullBilloirVertexFitter( const Config& cfg, std::function func, diff --git a/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp b/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp index f4239f052d5..986cd068004 100644 --- a/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp +++ b/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp @@ -87,6 +87,7 @@ class ImpactPointEstimator { /// @brief Constructor /// /// @param cfg Configuration object + /// @param logger Logging instance ImpactPointEstimator(const Config& cfg, std::unique_ptr logger = getDefaultLogger( "ImpactPointEstimator", Logging::INFO)) diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp index 87019d7411e..09090603724 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepBinningHelpers.hpp @@ -57,6 +57,7 @@ inline BinningValue stringToBinningValue(const std::string &binningString) { /// e.g. "r,z" -> {binR, binZ} /// /// @param binningString +/// @param del the delimiter for the splitting /// /// @return a vector of binninng values inline std::vector stringToBinningValues( From 3d1dc4543fa148360aee8317617c6cf88149484b Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:07:07 +0100 Subject: [PATCH 2/2] refactor: GX2F: add additional parameters to python bindings (#2584) Adds more parameters to the python bindings of the Global Chi Square Filter: ``` /// Max number of iterations during the fit (abort condition) size_t nUpdateMax = 5; /// Disables the QoP fit in case of missing B-field bool zeroField = false; /// Check for convergence (abort condition). Set to 0 to skip. double relChi2changeCutOff = 1e-7; ``` blocked by: - https://github.com/acts-project/acts/pull/2574 - https://github.com/acts-project/acts/pull/2586 --- .../Acts/TrackFitting/GlobalChiSquareFitter.hpp | 2 +- .../TrackFitting/TrackFitterFunction.hpp | 5 +++++ .../src/GlobalChiSquareFitterFunction.cpp | 13 ++++++++++--- .../Python/python/acts/examples/reconstruction.py | 7 ++++++- Examples/Python/src/TrackFitting.cpp | 10 +++++----- Examples/Scripts/Python/truth_tracking_gx2f.py | 7 ++++--- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp index 59b12e53f87..967de0f42aa 100644 --- a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp +++ b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp @@ -105,7 +105,7 @@ struct Gx2FitterOptions { /// @param freeToBoundCorrection_ Correction for non-linearity effect during transform from free to bound /// @param nUpdateMax_ Max number of iterations for updating the parameters /// @param zeroField_ Disables the QoP fit in case of missing B-field - /// @param relChi2changeCutOff_ Check for convergence (abort condition) + /// @param relChi2changeCutOff_ Check for convergence (abort condition). Set to 0 to skip. Gx2FitterOptions(const GeometryContext& gctx, const MagneticFieldContext& mctx, std::reference_wrapper cctx, diff --git a/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp b/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp index f272d217772..5850b94198e 100644 --- a/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp +++ b/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp @@ -104,6 +104,9 @@ std::shared_ptr makeGsfFitterFunction( /// @param multipleScattering bool /// @param energyLoss bool /// @param freeToBoundCorrection bool +/// @param nUpdateMax max number of iterations during the fit +/// @param zerofield Disables the QoP fit in case of missing B-field. +/// @param relChi2changeCutOff Check for convergence (abort condition). Set to 0 to skip. /// @param logger a logger instance std::shared_ptr makeGlobalChiSquareFitterFunction( std::shared_ptr trackingGeometry, @@ -111,6 +114,8 @@ std::shared_ptr makeGlobalChiSquareFitterFunction( bool multipleScattering = true, bool energyLoss = true, Acts::FreeToBoundCorrection freeToBoundCorrection = Acts::FreeToBoundCorrection(), + std::size_t nUpdateMax = 5, bool zeroField = false, + double relChi2changeCutOff = 1e-7, const Acts::Logger& logger = *Acts::getDefaultLogger("Gx2f", Acts::Logging::INFO)); diff --git a/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp b/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp index a641f93de0e..e2bc9115db0 100644 --- a/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp +++ b/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp @@ -68,6 +68,9 @@ struct GlobalChiSquareFitterFunctionImpl final : public TrackFitterFunction { bool multipleScattering = false; bool energyLoss = false; Acts::FreeToBoundCorrection freeToBoundCorrection; + std::size_t nUpdateMax = 5; + bool zeroField = false; + double relChi2changeCutOff = 1e-7; IndexSourceLink::SurfaceAccessor m_slSurfaceAccessor; @@ -91,7 +94,8 @@ struct GlobalChiSquareFitterFunctionImpl final : public TrackFitterFunction { const Acts::Experimental::Gx2FitterOptions gx2fOptions( options.geoContext, options.magFieldContext, options.calibrationContext, extensions, options.propOptions, &(*options.referenceSurface), - multipleScattering, energyLoss, freeToBoundCorrection, 5); + multipleScattering, energyLoss, freeToBoundCorrection, nUpdateMax, + zeroField, relChi2changeCutOff); return gx2fOptions; } @@ -127,8 +131,8 @@ ActsExamples::makeGlobalChiSquareFitterFunction( std::shared_ptr trackingGeometry, std::shared_ptr magneticField, bool multipleScattering, bool energyLoss, - Acts::FreeToBoundCorrection freeToBoundCorrection, - const Acts::Logger& logger) { + Acts::FreeToBoundCorrection freeToBoundCorrection, std::size_t nUpdateMax, + bool zeroField, double relChi2changeCutOff, const Acts::Logger& logger) { // Stepper should be copied into the fitters const Stepper stepper(std::move(magneticField)); @@ -157,6 +161,9 @@ ActsExamples::makeGlobalChiSquareFitterFunction( fitterFunction->multipleScattering = multipleScattering; fitterFunction->energyLoss = energyLoss; fitterFunction->freeToBoundCorrection = freeToBoundCorrection; + fitterFunction->nUpdateMax = nUpdateMax; + fitterFunction->zeroField = zeroField; + fitterFunction->relChi2changeCutOff = relChi2changeCutOff; return fitterFunction; } diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index 7ab4c4a072e..cfc8de476ff 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -1113,10 +1113,12 @@ def addGx2fTracks( s: acts.examples.Sequencer, trackingGeometry: acts.TrackingGeometry, field: acts.MagneticFieldProvider, - # directNavigation: bool = False, inputProtoTracks: str = "truth_particle_tracks", multipleScattering: bool = False, energyLoss: bool = False, + nUpdateMax: int = 5, + zeroField: bool = False, + relChi2changeCutOff: float = 1e-7, clusters: str = None, calibrator: acts.examples.MeasurementCalibrator = acts.examples.makePassThroughCalibrator(), logLevel: Optional[acts.logging.Level] = None, @@ -1127,6 +1129,9 @@ def addGx2fTracks( "multipleScattering": multipleScattering, "energyLoss": energyLoss, "freeToBoundCorrection": acts.examples.FreeToBoundCorrection(False), + "nUpdateMax": nUpdateMax, + "zeroField": zeroField, + "relChi2changeCutOff": relChi2changeCutOff, "level": customLogLevel(), } diff --git a/Examples/Python/src/TrackFitting.cpp b/Examples/Python/src/TrackFitting.cpp index 97091012c3d..ae6028c94c3 100644 --- a/Examples/Python/src/TrackFitting.cpp +++ b/Examples/Python/src/TrackFitting.cpp @@ -138,17 +138,17 @@ void addTrackFitting(Context& ctx) { std::shared_ptr magneticField, bool multipleScattering, bool energyLoss, Acts::FreeToBoundCorrection freeToBoundCorrection, + std::size_t nUpdateMax, bool zeroField, double relChi2changeCutOff, Logging::Level level) { return ActsExamples::makeGlobalChiSquareFitterFunction( trackingGeometry, magneticField, multipleScattering, energyLoss, - freeToBoundCorrection, *Acts::getDefaultLogger("Gx2f", level)); + freeToBoundCorrection, nUpdateMax, zeroField, relChi2changeCutOff, + *Acts::getDefaultLogger("Gx2f", level)); }, py::arg("trackingGeometry"), py::arg("magneticField"), py::arg("multipleScattering"), py::arg("energyLoss"), - py::arg("freeToBoundCorrection"), py::arg("level")); - - // TODO add other important parameters like nUpdates - // TODO add also in trackfitterfunction + py::arg("freeToBoundCorrection"), py::arg("nUpdateMax"), + py::arg("zeroField"), py::arg("relChi2changeCutOff"), py::arg("level")); } { diff --git a/Examples/Scripts/Python/truth_tracking_gx2f.py b/Examples/Scripts/Python/truth_tracking_gx2f.py index 2645841c258..4566dac4350 100644 --- a/Examples/Scripts/Python/truth_tracking_gx2f.py +++ b/Examples/Scripts/Python/truth_tracking_gx2f.py @@ -95,12 +95,13 @@ def runTruthTrackingGx2f( s, trackingGeometry, field, - # directNavigation, + nUpdateMax=17, + relChi2changeCutOff=1e-7, ) # Output s.addWriter( - acts.examples.RootTrajectoryStatesWriter( + acts.examples.RootTrackStatesWriter( level=acts.logging.INFO, inputTracks="tracks", inputParticles="truth_seeds_selected", @@ -112,7 +113,7 @@ def runTruthTrackingGx2f( ) s.addWriter( - acts.examples.RootTrajectorySummaryWriter( + acts.examples.RootTrackSummaryWriter( level=acts.logging.INFO, inputTracks="tracks", inputParticles="truth_seeds_selected",